Skip to content
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: solidity verifier usage example #16

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

merklefruit
Copy link
Contributor

This PR adds a simple example of using the library to prove the inclusion of a transaction in an Ethereum transaction trie. The example takes in a txHash, generates a proof by interacting with the CLI binary via FFI, parses it and feeds it to a MerkleTrie verifier after RLP-encoding it correctly.

Note: the test has to be run with forge test --ffi to enable FFI usage.

@rkdud007
Copy link
Member

rkdud007 commented Sep 17, 2024

thanks for neat example, here is 2 comments i have:

  • currently default rpc is public node as this example tx hash potentially be deprecated via public node rpc. would be nice to accept rpc url as .env param on test
  • can we mention on readme : to run this example forge test --ffi

return MerkleTrie.get(_key, _proof, _root);
}

function verifyInclusionProof(bytes memory _key, bytes memory _value, bytes memory _proof, bytes32 _root)
Copy link
Member

@rkdud007 rkdud007 Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems this function is not used, can we call this function on the example? or can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, removed, it's doing the same thing under the hood

@merklefruit
Copy link
Contributor Author

@rkdud007 added docs and a custom settable RPC endpoint which falls back to a good default.

@rkdud007
Copy link
Member

lgtm, thanks for example @merklefruit :)

@rkdud007 rkdud007 merged commit 39c8d41 into HerodotusDev:main Sep 17, 2024
1 check passed
@merklefruit merklefruit deleted the nico/feat/sol-example branch September 17, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants