We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 RPC api to validate if the given root is a known root, this will be used by the relayer to validate leaves before caching.
https://github.com/webb-tools/protocol-substrate/blob/main/pallets/mt/src/lib.rs#L492-#L509
#[method(name = "mt_isKnownRoot")] fn is_known_root( &self, tree_id: u32, target_root: Element, at: Option<BlockHash>, ) -> RpcResult<bool>;
The text was updated successfully, but these errors were encountered:
This Like a two part operation here.
Runtime API: So for you to do this, you need to declare it for the runtime API first like here:
https://github.com/webb-tools/protocol-substrate/blob/f0c637dc00625f65a7df28acd2d5f463c5f833c3/pallets/mt/rpc/runtime-api/src/lib.rs#L5-L10
And then you will need to implement that Runtime API in the */runtime/lib.rs like so: https://github.com/webb-tools/protocol-substrate/blob/f0c637dc00625f65a7df28acd2d5f463c5f833c3/standalone/runtime/src/lib.rs#L1743-L1752
*/runtime/lib.rs
RPC: And here for the RPC https://github.com/webb-tools/protocol-substrate/blob/f0c637dc00625f65a7df28acd2d5f463c5f833c3/pallets/mt/rpc/src/lib.rs#L32-L51
Then you just implement it inside the RPC
This an example implementation of the get_leaves
get_leaves
https://github.com/webb-tools/protocol-substrate/blob/f0c637dc00625f65a7df28acd2d5f463c5f833c3/pallets/mt/rpc/src/lib.rs#L75-L94
And that's it actually.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Summary
Add RPC api to validate if the given root is a known root, this will be used by the relayer to validate leaves before caching.
https://github.com/webb-tools/protocol-substrate/blob/main/pallets/mt/src/lib.rs#L492-#L509
The text was updated successfully, but these errors were encountered: