-
Notifications
You must be signed in to change notification settings - Fork 151
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
Significant dyn-abi fixes :) #168
Conversation
|
||
self.decode_sequence_populate(&mut child)?; | ||
|
||
if !dynamic { |
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.
bug: missed offset propagation resulted in bad decoding
@@ -470,16 +470,23 @@ impl DynSolValue { | |||
} | |||
|
|||
if let Some(vals) = self.as_fixed_seq() { | |||
return self.is_dynamic() as usize * vals.len() | |||
return self.is_dynamic() as usize * vals.iter().map(Self::total_words).sum::<usize>() |
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.
bug: incorrect tail words for fixed seqs
} | ||
|
||
if let Some(vals) = self.as_array() { | ||
return 1 + vals.iter().map(Self::tail_words).sum::<usize>() | ||
// 1 for the length. Then all words for all elements. | ||
return 1 + vals.iter().map(Self::total_words).sum::<usize>() |
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.
bug: incorrect tail words for dyn seqs
@@ -202,7 +203,11 @@ impl<'a> TryFrom<&'a str> for TupleSpecifier<'a> { | |||
_ => {} | |||
} | |||
} | |||
types.push(value[start..].try_into()?); | |||
// handle termina commas in tuples | |||
let candidate = value[start..].trim(); |
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.
this was a bug. for (T,)
it would include the blank string, which would fail parsing into a typespecifier
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.
Can you add a test case for parsing nested tuples? rest LGTM
closes #167
Motivation
Branch was initially to add tests to dyn-abi. Uncovered a few bugs
Solution
DynToken::FixedSeq
decodingDynSolValue::tail_words
impl for fixed and dyn sequencesDecoder
DynSolValue::total_words
(bool,)
single-element tuples in dyn sol type parserPR Checklist