From 5413b74130c1b38fc10cd77146f0a93ddb69c0c8 Mon Sep 17 00:00:00 2001 From: Kristin Kirkov Date: Tue, 27 Jun 2023 17:31:40 +0300 Subject: [PATCH] test(verifier): Add test for the nim verify function --- .github/workflows/ci.yml | 3 +++ tests/verify_proof/nim.cfg | 7 ++++++ .../verify_proof/verify_given_proof_test.nim | 22 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/verify_proof/nim.cfg create mode 100644 tests/verify_proof/verify_given_proof_test.nim diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43e67335d..1224e0b83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,9 @@ jobs: # - name: Run Verifier in EOS test # run: nix develop -c yarn test './tests/eosLightClient/test-verifier-in-EOS.ts' + - name: Run Verify given proof - test using bncurve and constantine + run: nix develop -c nim c -r 'tests/verify_proof/verify_given_proof_test.nim' + SolidityVerifierTests: needs: Tests runs-on: ubuntu-latest diff --git a/tests/verify_proof/nim.cfg b/tests/verify_proof/nim.cfg new file mode 100644 index 000000000..bf61e7f86 --- /dev/null +++ b/tests/verify_proof/nim.cfg @@ -0,0 +1,7 @@ +path="../../vendor/nim-bncurve" +path="../../vendor/nim-confutils" +path="../../vendor/nim-stew" +path="../../vendor/nim-serialization" +path="../../vendor/nim-faststreams" +path="../../vendor/nimcrypto" +path="../../vendor/constantine" diff --git a/tests/verify_proof/verify_given_proof_test.nim b/tests/verify_proof/verify_given_proof_test.nim new file mode 100644 index 000000000..a4fd419e9 --- /dev/null +++ b/tests/verify_proof/verify_given_proof_test.nim @@ -0,0 +1,22 @@ +import + std/unittest, + # ../../libs/nim/verify-utils/verify_given_proof_constantine, + ../../libs/nim/verify-utils/verify_given_proof + +suite "description for this stuff": + setup: + let pathToKey = "vendor/eth2-light-client-updates/prater/capella-updates-94/vk.json" + let pathToProof = "vendor/eth2-light-client-updates/prater/capella-updates-94/proof_5609044_5609069.json" + let pathToLastUpdate = "vendor/eth2-light-client-updates/prater/capella-updates-94/update_5601823_5609044.json" + let pathToNewUpdate = "vendor/eth2-light-client-updates/prater/capella-updates-94/update_5609044_5609069.json" + let domain = "0x07000000628941ef21d1fe8c7134720add10bb91e3b02c007e0046d2472c6695" + + test "check verifyProof for bncurve": + assert verifyProof(pathToKey, pathToProof, pathToLastUpdate, + pathToNewUpdate, domain) +#Will me added with another PR + # test "check verifyProof for constantine": + # assert verifyProofConstantine(pathToKey, pathToProof, pathToLastUpdate, + # pathToNewUpdate, domain) + +