diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 000000000..e7dc0a386 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,12 @@ +# Workflows + +- [Circuits profiling](./circuits_profile.yml) + - Runs `nargo info` and stores the results into an artefact +- [Circuits tests](./circuits_test.yml) + - Runs `nargo test` +- [Circuits E2E tests](./circuits_e2e.yml) + - Runs `nargo prove` & `nargo verify` +- [Solidity tests](./contract_test.yml) + - Runs `forge test` +- [TypeScript E2E tests using solidity verifiers](./e2e_test.yml) + - Runs `yarn test:e2e` diff --git a/.github/workflows/circuits_e2e.yaml b/.github/workflows/circuits_e2e.yaml new file mode 100644 index 000000000..9e08deb3d --- /dev/null +++ b/.github/workflows/circuits_e2e.yaml @@ -0,0 +1,57 @@ +name: Circuits E2E Tests + +on: [push] + +jobs: + test: + name: Circuits E2E Tests + runs-on: 32-core-ubuntu-runner + environment: CI + env: + ETHEREUM_JSON_RPC_API_URL: ${{ secrets.ETHEREUM_JSON_RPC_API_URL }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: Enable Corepack and Install Yarn 4 + run: | + corepack enable + yarn set version latest + + - name: Install Dependencies + run: yarn install + + - name: Install Nargo + uses: noir-lang/noirup@v0.1.3 + with: + toolchain: 0.23.0 + + - name: Compile Circuit + run: nargo compile --workspace + + - name: Start Oracle Server + working-directory: ethereum_history_api/oracles + run: | + yarn oracle-server & + ORACLE_SERVER_PID=$! + echo "ORACLE_SERVER_PID=$ORACLE_SERVER_PID" >> $GITHUB_ENV + + - name: Generate Proof + run: | + nargo prove --package get_header --oracle-resolver=http://localhost:5555 + nargo prove --package get_account --oracle-resolver=http://localhost:5555 + + - name: Veirfy Proof + run: | + nargo verify --package get_header + nargo verify --package get_account + + - name: Stop Oracle Server + if: always() + run: kill $ORACLE_SERVER_PID diff --git a/.github/workflows/e2e_test.yaml b/.github/workflows/e2e_test.yaml index ae568bc04..bffe87e4d 100644 --- a/.github/workflows/e2e_test.yaml +++ b/.github/workflows/e2e_test.yaml @@ -47,9 +47,6 @@ jobs: nargo prove --package get_header --oracle-resolver=http://localhost:5555 nargo prove --package get_account --oracle-resolver=http://localhost:5555 - - name: Veirfy Proof - run: nargo verify --package get_account - - name: Run nargo codegen-verifier run: | nargo codegen-verifier --package get_header diff --git a/README.md b/README.md index 03785f62b..2ebec3d5f 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ # noir-ethereum-history-api -_noir-ethereum-history-api_ is a [Noir](https://noir-lang.org) library for proving and verifying account balances and smart contracts storage slots on the Ethereum blockchain and other EVMs. +_noir-ethereum-history-api_ is a [Noir](https://noir-lang.org) library for proving and verifying account balances and smart contracts storage slots on the Ethereum blockchain and other EVMs. As for now, it allows for proving and verifying last 256 blocks. It is currently in a development stage. ### Repository structure + This monorepo consists of four sub-projects: -* [Circuits](ethereum_history_api/circuits/lib/) - Noir circuits to generate account and storage proofs for historical blocks data -* [Contracts](ethereum_history_api/contracts/) - related Solidity contracts with tests -* [Oracles](ethereum_history_api/oracles/) - TypeScript oracle server that provides data for circuits -* [Tests](ethereum_history_api/tests/) - e2e tests in TypeScript -## Prerequisites +- [Circuits](ethereum_history_api/circuits/lib/) - Noir circuits to generate account and storage proofs for historical blocks data +- [Contracts](ethereum_history_api/contracts/) - related Solidity contracts with tests +- [Oracles](ethereum_history_api/oracles/) - TypeScript oracle server that provides data for circuits +- [Tests](ethereum_history_api/tests/) - e2e tests in TypeScript -_nargo_ and _foundry_ must be installed in order to compile and test code in this repository. +## Prerequisites -* [nargo installation](https://noir-lang.org/docs/getting_started/installation/) -* [foundry installation](https://book.getfoundry.sh/getting-started/installation) -* [yarn](https://yarnpkg.com) >= 4.1.0 +_nargo_ and _foundry_ must be installed in order to compile and test code in this repository. +- [nargo installation](https://noir-lang.org/docs/getting_started/installation/) +- [foundry installation](https://book.getfoundry.sh/getting-started/installation) +- [yarn](https://yarnpkg.com) >= 4.1.0 ## Getting started @@ -31,6 +32,7 @@ Run `yarn` to install dependencies. ### Running checks To run all static checks (eslint, prettier, typecheck) type: + ```sh yarn check ``` @@ -43,13 +45,15 @@ To run checks individually use: `yarn typecheck:all` - to run `typescript` checks on the whole repo - ### Compilation & testing Compilation and testing instructions for individual projects: -* [Circuits](ethereum_history_api/circuits/lib/README.md#compilation) -* [Contracts](ethereum_history_api/contracts/README.md#build) -* [Oracles](ethereum_history_api/oracles/README.md) -* [Tests](ethereum_history_api/tests/README.md) +- [Circuits](ethereum_history_api/circuits/lib/README.md#compilation) +- [Contracts](ethereum_history_api/contracts/README.md#build) +- [Oracles](ethereum_history_api/oracles/README.md) +- [Tests](ethereum_history_api/tests/README.md) + +### CI workflows +We use Github actions to run tests on CI. For a detailed description of what does each workflow do consult [Workflow Docs](./.github/workflows/README.md)