-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add eth proof generation utilities #928
Conversation
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.
Could you please also provide more details in PR description: where this class will be used (why we need this) and the link to JS version
Also, I think the utilities
better rename into eth_proof_extractor
or something like this.
Depends whether proof generation is the only thing we are going to expose from this crate. If we, say, also want to expose the new ETH client then 'utilities' would work better |
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.
Thank you for your work! I like the code condition. I haven't tested it yet, but I like how it looks. Thank you for specifying in the PR description the origin code and the place of usage, it makes the reviewing process much easier.
I continue to think, that it is better to change the name of utilities
for something more specific.
It would help if you prepared the PR for https://github.com/aurora-is-near/fast-bridge-service to start using this code instead of JS one.
518d2da
to
9faa39c
Compare
Replacement for https://github.com/aurora-is-near/rainbow-bridge/blob/master/eth2near/eth2near-block-relay/eth-proof-extractor.js#L86 written in Rust.
Javascript version is used here https://github.com/aurora-is-near/fast-bridge-service/blob/8ed92f1b9c051d49083726803d112aeaa5e51d52/src/ethereum/proof.rs#L40
Supporting older blocks
I tested this on post merge and post-4844 blocks. Older blocks may not work (for example because of different handling of difficulty field). If needed I'll test and add support for pre-merge.
Tests
I intended to mock RPC requests and add a few tests for the client as well ass more general test cases for proof generation. Would that be the correct approach?
Error handling
As one can see it's Box almost everywhere. I can put some work towards friendlier error types.
Types
I chose not to expose the types I added publicly. They are quite specifically designed for deserialization and support only required fields. In the future they can be improved and exposed to other components if that is deemed useful