-
Notifications
You must be signed in to change notification settings - Fork 89
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: Wrap eth::U256 into a type #2086
Comments
@sunce86 |
@sunce86 @fleupold I've tried several times, in order to implement the suggested solution. From my side, I think it is better way that the team should be more diligent when reviewing the PR which includes |
Thanks for trying, though. |
Hey, I just like to mention that there has been some developments in the Rust ecosystem for EVM-based chains with alloy-rs as the new kid on the block. I also saw that ethcontract-rs hasn’t received many updates over the past year. Have you maybe considered switching to the Alloy type system to potentially improve the issue mentioned above? Potential benefits:
You can find an example here: https://github.com/cakevm/cowprotocol-solvers-dto-alloy (Please be aware it has maybe some rough edges) I also like to mention that Alloy is moving quite fast forward and the API was now stable for the last months, but maybe this will change. If you are interested maybe I can support with a step-by-step transition. |
Hey cakevm 👋 Thank you for sharing these cool insights. We really like your approach! We’d love to explore ways to collaborate further and discuss your ideas in more detail. How about we arrange a quick call? Would it be okay if I email you at [email protected], or is there another contact method you prefer? Looking forward to hearing from you! |
Great to hear, feel free to send me an email. |
Problem
Default serde implementation for
U256
type encodes/decodes in hexadecimal format, while we always want to use decimal format. We need to make sure that every time we useU256
, we add an annotation#[serde_as(as = "serialize::U256")]
to the field.This has been forgotten numerous times, cf #2075, #1958, etc...
Suggested solution
Wrap U256 in its own type that implements default serialization using
HexOrDecimalU256
.Additionally, investigate if there is a way to forbid using raw
U256
in our system (with clippy or something similar) so we don't accidentally continue toU256
instead of our own type.The text was updated successfully, but these errors were encountered: