Skip to content

Commit

Permalink
Fix mmr zombienet test (paritytech#5417)
Browse files Browse the repository at this point in the history
Fixes paritytech#4309

If a new block is generated between these 2 lines:

```
  const proof = await apis[nodeName].rpc.mmr.generateProof([1, 9, 20]);

  const root = await apis[nodeName].rpc.mmr.root()
```

we will try to verify a proof for the previous block with the mmr root
at the current block. Which will fail.

So we generate the proof and get the mmr root at block 21 for
consistency.
  • Loading branch information
serban300 committed Aug 20, 2024
1 parent f239aba commit 73e2316
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const common = require('./0003-common.js');
async function run(nodeName, networkInfo, nodeNames) {
const apis = await common.getApis(networkInfo, nodeNames);

const proof = await apis[nodeName].rpc.mmr.generateProof([1, 9, 20]);

const root = await apis[nodeName].rpc.mmr.root()
let at = await apis[nodeName].rpc.chain.getBlockHash(21);
const root = await apis[nodeName].rpc.mmr.root(at);
const proof = await apis[nodeName].rpc.mmr.generateProof([1, 9, 20], 21, at);

const proofVerifications = await Promise.all(
Object.values(apis).map(async (api) => {
Expand Down

0 comments on commit 73e2316

Please sign in to comment.