BEEFY & MMR zombienet tests (#7068)

* test that successfully verify self-generated proof

* verify proof result on all unpaused nodes

* tighten interface: reuse connection

* generate the proof on arbitrary node

* s/stub-name/validator

seems this doesn't pass some regex

* rename script

* add basic mmr-leaves test

* documentation formatting

* check lower bound on mmr leaves

* test beefy rpc: finalized heads match

* test mmr api: stateless proofs

* set lower bound on number of leaves

* change leaves in proof generation

* remove TODOs

* cleanup: consistently ignore zndsl name arg

* refactor: simplify returns

Co-authored-by: Serban Iorga <serban@parity.io>

* lax finalized head test

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* fixup! refactor: simplify returns

* refactor out getApis

Co-authored-by: Serban Iorga <serban@parity.io>

* split out paused validator from group

* refactor: don't ignore node arg

don't randomize selection of proof generating / finalized head
retrieving node, but use the node arg for this.

* only check min block height, not relative

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* verify finalized heads share same canonical chain

picks the node with the highest finalized head, gets its blockchain
headers since genesis, and verifies that all other nodes' finalized
heads are in said blockchain.

* fixup! split out paused validator from group

Co-authored-by: Serban Iorga <serban@parity.io>

---------

Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Robert Hambrock
2023-05-04 15:36:50 +02:00
committed by GitHub
parent 87159f8a73
commit 71aa0b0931
7 changed files with 113 additions and 31 deletions
@@ -0,0 +1,26 @@
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()
const proofVerifications = await Promise.all(
Object.values(apis).map(async (api) => {
return api.rpc.mmr.verifyProof(proof);
})
);
const proofVerificationsStateless = await Promise.all(
Object.values(apis).map(async (api) => {
return api.rpc.mmr.verifyProofStateless(root, proof);
})
);
// check that all nodes accepted the proof
return proofVerifications.every((proofVerification) => proofVerification) && proofVerificationsStateless.every((proofVerification) => proofVerification)
}
module.exports = { run };