Skip to content
Snippets Groups Projects
Unverified Commit 73e2316a authored by Serban Iorga's avatar Serban Iorga Committed by GitHub
Browse files

Fix mmr zombienet test (#5417)

Fixes https://github.com/paritytech/polkadot-sdk/issues/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.
parent f239abac
No related merge requests found
Pipeline #491584 waiting for manual action with stages
in 1 hour, 17 minutes, and 35 seconds
......@@ -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) => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment