-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix blank transition builder #108
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,9 @@ impl Allocation { | |
pub fn with(index: TokenIndex, fraction: OwnedFraction) -> Allocation { | ||
Allocation(index, fraction) | ||
} | ||
|
||
pub fn token_id(self) -> TokenIndex { self.0 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Id's are usually hashes, thus better to use the type name |
||
pub fn fraction(self) -> OwnedFraction { self.1 } | ||
} | ||
|
||
impl StrictSerialize for Allocation {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,8 +477,9 @@ impl DivisibleAssetSpec { | |
pub fn details(&self) -> Option<&str> { self.naming.details.as_ref().map(|d| d.as_str()) } | ||
} | ||
|
||
#[derive(Clone, Eq, PartialEq, Debug, Default)] | ||
#[derive(StrictType, StrictEncode, StrictDecode)] | ||
#[derive(Wrapper, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, From, Debug)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think having default is better |
||
#[wrapper(Deref, Display)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are adding Wrapper we need to add |
||
#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)] | ||
#[strict_type(lib = LIB_NAME_RGB_CONTRACT)] | ||
#[cfg_attr( | ||
feature = "serde", | ||
|
@@ -498,6 +499,13 @@ impl FromStr for RicardianContract { | |
} | ||
} | ||
|
||
impl RicardianContract { | ||
pub fn from_strict_val_unchecked(value: &StrictVal) -> Self { | ||
let s = value.unwrap_string(); | ||
RicardianContract::from_str(&s).expect("invalid term data") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will open a vulnerability where an attacker can send a malformed consignment and crash end-user wallets and nodes (DoS attack). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't know, as I saw in several code snippets, I imagined that this was the correct implementation. What would be the alternative? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need an unchecked version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a method that extracts some information from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you point specific place in code where you do that call? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why you do not want to use |
||
} | ||
} | ||
|
||
#[derive(Wrapper, WrapperMut, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug, From)] | ||
#[wrapper(Deref, Display, FromStr, MathOps)] | ||
#[wrapper_mut(DerefMut, MathAssign)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add outpoint filter like in
fungible
method above