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: adding RPC: get_transaction_and_witness_proof & verify_transaction_and_witness_proof #3724

Merged
merged 7 commits into from
Nov 28, 2022

Conversation

code-monad
Copy link

@code-monad code-monad commented Nov 23, 2022

What problem does this PR solve?

Issue Number: close #3628

Problem Summary:

What is changed and how it works?

What's Changed:

  • Introduced two new RPC method called get_transaction_and_witness_proof & verify_transaction_and_witness_proof

get_transaction_and_witne_proof

This methods accepts the same params as get_transaction_proof, and returns a similar structure TransactionAndWitnessProof

struct TransactionAndWitnessProof {
    /// Block hash
    pub block_hash: H256,
    /// Merkle proof of all transactions' hash
    pub transactions_proof: MerkleProof,
    /// Merkle proof of transactions' witnesses
    pub witnesses_proof: MerkleProof,
}

verify_transaction_and_witness_proof

When we called with same valid param of get_transaction_and_witness_proof & get_transaction_proof, use their result as param of verify_transaction_and_witness_proof & verify_transaction_proof, the final result should be the same(the hash of the transaction this proof pointed to)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Release note

Note: Add a note under the PR title in the release note.

@code-monad code-monad requested a review from a team as a code owner November 23, 2022 13:37
@code-monad code-monad requested review from zhangsoledad, quake and doitian and removed request for a team November 23, 2022 13:37
rpc/README.md Outdated Show resolved Hide resolved
@code-monad code-monad changed the title feat: adding RPC:get_witnesses_proof & verify_witnesses_proof feat: adding RPC: get_transaction_and_witnesses_proof & verify_transaction_and_witnesses_proof Nov 24, 2022
@code-monad code-monad changed the title feat: adding RPC: get_transaction_and_witnesses_proof & verify_transaction_and_witnesses_proof feat: adding RPC: get_transaction_and_witness_proof & verify_transaction_and_witness_proof Nov 24, 2022
rpc/src/module/chain.rs Outdated Show resolved Hide resolved
rpc/src/module/chain.rs Outdated Show resolved Hide resolved
@quake
Copy link
Member

quake commented Nov 28, 2022

bors r=quake

@bors
Copy link
Contributor

bors bot commented Nov 28, 2022

@bors bors bot merged commit dc48d92 into nervosnetwork:develop Nov 28, 2022
@doitian doitian mentioned this pull request Jan 12, 2023
4 tasks
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.

Add get_witnesses_proof RPC
2 participants