-
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
feat(dyn-abi): add arbitrary impls and proptests #175
Conversation
865bed6
to
674ed23
Compare
674ed23
to
a014e91
Compare
EIP-712: | ||
|
||
assert_eq!(decoded, my_values); | ||
```rust,ignore | ||
todo!() | ||
``` |
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.
do we have an example for this anywhere? if not can you add one @prestwich
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'm still stewing on the interface, so i haven't wanted to write an example that will churn. the basic thing right now is "just deser the json"
#[inline] | ||
pub fn as_tuple(&self) -> Option<&[Self]> { | ||
match self { | ||
Self::Tuple(t) => Some(t), |
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.
should this use the. as_tuple macro or have similar behavior?
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.
No I think the as_<variant>
should only return the variant
crates/dyn-abi/src/ty.rs
Outdated
} | ||
} | ||
|
||
/// Returns wheter this type is contains a custom struct. |
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.
wheter
should this function only exist if the feature is enabled?
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 want these to be available always, cfg is already annoying as it is with just one variant, especially inside of this crate itself
/// Fallible cast to the contents of a variant. | ||
#[inline] | ||
#[allow(clippy::missing_const_for_fn)] | ||
pub fn as_custom_struct(&self) -> Option<(&str, &[String], &[Self])> { |
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.
should this function only exist if the feature is enabled?
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.
glad i didn't write this code 🖖
Motivation
::arbitrary
andproptest
) for dyn-abi enums and fuzz test them withproptest
.DynSolType::{parse,sol_type_name}
Solution
PR Checklist