diff --git a/.github/workflows/block-build.yml b/.github/workflows/block-build.yml index 83d81229c8..2ccb9a7cf9 100644 --- a/.github/workflows/block-build.yml +++ b/.github/workflows/block-build.yml @@ -1,11 +1,21 @@ name: Block on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + submodule-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/block @@ -15,32 +25,49 @@ defaults: working-directory: packages/block concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-block cancel-in-progress: true jobs: test-block: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] - steps: - - uses: actions/checkout@v4 + steps: + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - name: Use Node.js ${{ matrix.node-version }} + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if called from workflow_dispatch) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: - files: ${{ env.cwd }}/coverage/lcov.info + files: ${{ github.workspace}}/packages/block/coverage/lcov.info flags: block diff --git a/.github/workflows/blockchain-build.yml b/.github/workflows/blockchain-build.yml index d8faae7d70..1a36f4584b 100644 --- a/.github/workflows/blockchain-build.yml +++ b/.github/workflows/blockchain-build.yml @@ -1,11 +1,18 @@ name: Blockchain on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/blockchain @@ -15,28 +22,35 @@ defaults: working-directory: packages/blockchain concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-blockchain cancel-in-progress: true jobs: test-blockchain: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} - - - run: npm run lint + - name: Install Dependencies (if called from workflow_dispatch) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/browser.yml b/.github/workflows/browser.yml index 5465463ef3..3da9ef5bc1 100644 --- a/.github/workflows/browser.yml +++ b/.github/workflows/browser.yml @@ -1,37 +1,68 @@ name: Browser on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + submodule-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}} concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-browser + cancel-in-progress: true jobs: test-all-browser: runs-on: ubuntu-latest strategy: - matrix: - node-version: [20] fail-fast: false steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: - submodules: recursive # necessary for block tests to load ethereum/tests - - - name: Use Node.js ${{ matrix.node-version }} + submodules: recursive + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci + - name: Install Dependencies (if called from workflow_dispatch) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Restore ethereum-tests from cache if available + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key }} + - run: npm run install-browser-deps - run: npm run test:browser --workspaces --if-present diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..ee25fac806 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,197 @@ +name: Build +on: + pull_request: + types: [opened, reopened, synchronize] + workflow_dispatch: + +env: + cwd: ${{github.workspace}} + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-build + cancel-in-progress: true + +jobs: + checkout-submodules: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - id: create-cache-key + run: echo "submodule-cache-key=$(git submodule)" >> $GITHUB_OUTPUT + shell: bash + + - uses: actions/cache/restore@v4 + id: submodules-cache-restore + with: + key: submodule-${{ steps.create-cache-key.outputs.submodule-cache-key }} + path: ${{github.workspace}}/packages/ethereum-tests + + - if: steps.submodules-cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + id: submodule-cache-save + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: submodule-${{ steps.create-cache-key.outputs.submodule-cache-key}} + + outputs: + submodule-cache-key: submodule-${{ steps.create-cache-key.outputs.submodule-cache-key}} + + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}}/node_modules + key: npm-${{ hashFiles('package-lock.json') }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - run: npm ci + working-directory: ${{github.workspace}} + + - name: Cache dependencies + uses: actions/cache/save@v4 + with: + path: ${{github.workspace}} + key: npm-${{ hashFiles('package-lock.json') }} + + - name: Cache build + uses: actions/cache/save@v4 + with: + path: ${{github.workspace}} + key: npm-${{ hashFiles('package-lock.json') }}-${{ github.run_id }} + + outputs: + dep-cache-key: ${{ steps.dep-cache.outputs.cache-primary-key }}-${{ github.run_id }} + + block: + needs: [build, checkout-submodules] + uses: ./.github/workflows/block-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }} + + blockchain: + needs: build + uses: ./.github/workflows/blockchain-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + browser: + needs: [build, checkout-submodules] + uses: ./.github/workflows/browser.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }} + + client: + needs: build + uses: ./.github/workflows/client-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + common: + needs: build + uses: ./.github/workflows/common-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + devp2p: + needs: build + uses: ./.github/workflows/devp2p-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + ethash: + needs: build + uses: ./.github/workflows/ethash-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + evm: + needs: [build, checkout-submodules] + uses: ./.github/workflows/evm-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }} + + examples: + needs: build + uses: ./.github/workflows/examples.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + genesis: + needs: build + uses: ./.github/workflows/genesis-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + rlp: + needs: build + uses: ./.github/workflows/rlp-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + statemanager: + needs: build + uses: ./.github/workflows/statemanager-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + trie: + needs: build + uses: ./.github/workflows/trie-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + tx: + needs: [build, checkout-submodules] + uses: ./.github/workflows/tx-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }} + + util: + needs: build + uses: ./.github/workflows/util-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + verkle: + needs: build + uses: ./.github/workflows/verkle-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + vm-pr: + needs: [build, checkout-submodules] + uses: ./.github/workflows/vm-pr.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }} + + wallet: + needs: build + uses: ./.github/workflows/wallet-build.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + + lint: + needs: build + uses: ./.github/workflows/lint.yml + with: + dep-cache-key: ${{ needs.build.outputs.dep-cache-key }} + \ No newline at end of file diff --git a/.github/workflows/client-build.yml b/.github/workflows/client-build.yml index 065e7185e3..f818f15ac4 100644 --- a/.github/workflows/client-build.yml +++ b/.github/workflows/client-build.yml @@ -1,11 +1,19 @@ name: Client on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' + env: cwd: ${{github.workspace}}/packages/client @@ -15,40 +23,48 @@ defaults: working-directory: packages/client concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-client cancel-in-progress: true + jobs: test-client: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run coverage - uses: codecov/codecov-action@v3 with: files: ${{ env.cwd }}/coverage/lcov.info flags: client + - uses: nick-fields/retry@v2 with: timeout_minutes: 10 max_attempts: 3 command: cd ${{github.workspace}}/packages/client && npm run test:integration - - run: npm run lint - test-client-dockerfile: name: test client docker file runs-on: ubuntu-latest @@ -73,14 +89,26 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v4 + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - node-version: 18 + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: cd ${{github.workspace}}/packages/client && npx vitest run test/cli/cli diff --git a/.github/workflows/common-build.yml b/.github/workflows/common-build.yml index ec2a134ad2..6685e3e657 100644 --- a/.github/workflows/common-build.yml +++ b/.github/workflows/common-build.yml @@ -1,11 +1,18 @@ name: Common on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/common @@ -15,28 +22,37 @@ defaults: working-directory: packages/common concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-common cancel-in-progress: true jobs: test-common: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/devp2p-build.yml b/.github/workflows/devp2p-build.yml index 9da55bc3b7..856a80dcc5 100644 --- a/.github/workflows/devp2p-build.yml +++ b/.github/workflows/devp2p-build.yml @@ -1,46 +1,57 @@ name: Devp2p on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: - -env: - cwd: ${{github.workspace}}/packages/devp2p - -defaults: - run: - working-directory: packages/devp2p + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-devp2p cancel-in-progress: true jobs: test-devp2p: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + - run: npm run coverage - + working-directory: ${{ github.workspace }}/packages/devp2p - uses: codecov/codecov-action@v3 with: - files: ${{ env.cwd }}/coverage/lcov.info + files: ${{ github.workspace }}/packages/devp2p/coverage/lcov.info flags: devp2p - - run: npm run lint + diff --git a/.github/workflows/ethash-build.yml b/.github/workflows/ethash-build.yml index e9a90041c6..c8333513aa 100644 --- a/.github/workflows/ethash-build.yml +++ b/.github/workflows/ethash-build.yml @@ -1,11 +1,19 @@ name: Ethash on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' + env: cwd: ${{github.workspace}}/packages/ethash @@ -15,28 +23,39 @@ defaults: working-directory: packages/ethash concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-ethash cancel-in-progress: true jobs: test-ethash: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/evm-build.yml b/.github/workflows/evm-build.yml index d1fbe170de..9f641536f8 100644 --- a/.github/workflows/evm-build.yml +++ b/.github/workflows/evm-build.yml @@ -1,11 +1,21 @@ name: EVM on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + submodule-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/evm @@ -15,30 +25,47 @@ defaults: working-directory: packages/evm concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-evm cancel-in-progress: true jobs: test-evm: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - name: Use Node.js ${{ matrix.node-version }} + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key }} + fail-on-cache-miss: true - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 65ed2467f0..2149e38d38 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -1,26 +1,49 @@ name: Packages examples on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-examples cancel-in-progress: true jobs: test-examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + with: + submodules: recursive - - uses: actions/setup-node@v4 + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - - run: npm run examples + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + diff --git a/.github/workflows/genesis-build.yml b/.github/workflows/genesis-build.yml index 5eb151352f..8b0568a0a3 100644 --- a/.github/workflows/genesis-build.yml +++ b/.github/workflows/genesis-build.yml @@ -1,11 +1,18 @@ name: genesis on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: false + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/genesis @@ -15,30 +22,36 @@ defaults: working-directory: packages/genesis concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-genesis cancel-in-progress: true jobs: test-genesis: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - submodules: recursive + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} - - - run: npm run lint + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run coverage - uses: codecov/codecov-action@v3 @@ -46,4 +59,4 @@ jobs: files: ${{ env.cwd }}/coverage/lcov.info flags: genesis - - run: npm run test:node # Only run node tests for now until vitest browser test issues are sorted out \ No newline at end of file + - run: npm run test:node \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..22e4c624a8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,50 @@ +name: Lint +on: + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-lint + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + + - run: npm run lint --workspaces --if-present + working-directory: ${{ github.workspace }} diff --git a/.github/workflows/lockfile.yml.old b/.github/workflows/lockfile.yml.old new file mode 100644 index 0000000000..54578c34ed --- /dev/null +++ b/.github/workflows/lockfile.yml.old @@ -0,0 +1,23 @@ +name: lockfile-lint + +on: + pull_request: + types: [opened, reopened, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + root: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + src: + - 'package-lock.json' + - if: steps.changes.outputs.src == 'true' + run: npx lockfile-lint --path="package-lock.json" --allowed-hosts=npm --allowed-schemes "file:" "https:" "npm:" diff --git a/.github/workflows/node-versions.yml b/.github/workflows/node-versions.yml index 96a499a91c..12f02e89f8 100644 --- a/.github/workflows/node-versions.yml +++ b/.github/workflows/node-versions.yml @@ -16,10 +16,10 @@ jobs: with: submodules: recursive - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - run: npm ci diff --git a/.github/workflows/rlp-build.yml b/.github/workflows/rlp-build.yml index d7de54212e..4a9510be3c 100644 --- a/.github/workflows/rlp-build.yml +++ b/.github/workflows/rlp-build.yml @@ -1,11 +1,17 @@ name: RLP on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false env: cwd: ${{github.workspace}}/packages/rlp @@ -15,28 +21,36 @@ defaults: working-directory: packages/rlp concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-rlp cancel-in-progress: true jobs: test-rlp: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} - - - run: npm run lint + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run coverage - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/statemanager-build.yml b/.github/workflows/statemanager-build.yml index e3477e5c0e..1d5835447f 100644 --- a/.github/workflows/statemanager-build.yml +++ b/.github/workflows/statemanager-build.yml @@ -1,11 +1,18 @@ name: StateManager on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/statemanager @@ -15,28 +22,39 @@ defaults: working-directory: packages/statemanager concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-statemanager cancel-in-progress: true jobs: test-statemanager: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/trie-build.yml b/.github/workflows/trie-build.yml index 37d92c3986..051e96effd 100644 --- a/.github/workflows/trie-build.yml +++ b/.github/workflows/trie-build.yml @@ -1,11 +1,18 @@ name: Trie on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/trie @@ -15,28 +22,37 @@ defaults: working-directory: packages/trie concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-trie cancel-in-progress: true jobs: test-trie: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} - - - run: npm run lint + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/tx-build.yml b/.github/workflows/tx-build.yml index 01bcb0f3f9..7ddc98bc98 100644 --- a/.github/workflows/tx-build.yml +++ b/.github/workflows/tx-build.yml @@ -1,11 +1,21 @@ name: Tx on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + submodule-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/tx @@ -15,30 +25,49 @@ defaults: working-directory: packages/tx concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-tx cancel-in-progress: true jobs: test-tx: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - name: Use Node.js ${{ matrix.node-version }} + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true + - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/util-build.yml b/.github/workflows/util-build.yml index 194edee319..6395446361 100644 --- a/.github/workflows/util-build.yml +++ b/.github/workflows/util-build.yml @@ -1,11 +1,17 @@ name: Util on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false env: cwd: ${{github.workspace}}/packages/util @@ -15,26 +21,36 @@ defaults: working-directory: packages/util concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-util cancel-in-progress: true jobs: test-util: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run coverage - uses: codecov/codecov-action@v3 @@ -42,4 +58,4 @@ jobs: files: ${{ env.cwd }}/coverage/lcov.info flags: util - - run: npm run lint + diff --git a/.github/workflows/verkle-build.yml b/.github/workflows/verkle-build.yml index b680510274..a3477548ee 100644 --- a/.github/workflows/verkle-build.yml +++ b/.github/workflows/verkle-build.yml @@ -1,11 +1,18 @@ name: Verkle on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: false + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/verkle @@ -15,28 +22,35 @@ defaults: working-directory: packages/verkle concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-verkle cancel-in-progress: true jobs: test-verkle: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - submodules: recursive + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} - - - run: npm run lint - - run: npm run test:node # Only run node tests for now until vitest browser test issues are sorted out + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - run: npm run test diff --git a/.github/workflows/vm-build.yml b/.github/workflows/vm-build.yml index 2bec0c73ec..48b065dd84 100644 --- a/.github/workflows/vm-build.yml +++ b/.github/workflows/vm-build.yml @@ -1,12 +1,9 @@ name: VM on: push: - branches: [master, develop] + branches: [master] tags: ['*'] -env: - cwd: ${{github.workspace}}/packages/vm - defaults: run: working-directory: packages/vm @@ -16,44 +13,29 @@ concurrency: cancel-in-progress: true jobs: - test-vm-api: + test-vm-state: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'npm' - - - run: npm ci - working-directory: ${{github.workspace}} - - - run: npm run lint - - run: npm run coverage - # - run: npm run test:API:browser - - - uses: codecov/codecov-action@v3 - with: - files: ${{ env.cwd }}/coverage/lcov.info - flags: vm - - test-vm-state: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + - uses: actions/cache/restore@v4 + id: dep-cache with: - submodules: recursive + path: ${{github.workspace}} + key: npm-${{ hashFiles('package-lock.json') }} - - uses: actions/setup-node@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run test:state:selectedForks @@ -64,56 +46,21 @@ jobs: with: submodules: recursive - - uses: actions/setup-node@v4 + - uses: actions/cache/restore@v4 + id: dep-cache with: - node-version: 18 - cache: 'npm' - - - run: npm ci - working-directory: ${{github.workspace}} - - - run: npm run test:blockchain + path: ${{github.workspace}} + key: npm-${{ hashFiles('package-lock.json') }} - vm-benchmarks: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} - - - run: npm run build:benchmarks - working-directory: ${{ env.cwd }} - - - run: npm run benchmarks -- mainnetBlocks:10 | tee output.txt - working-directory: ${{ env.cwd }} - - # Run git stash in case github-action-benchmark has trouble switching to gh-pages branch due to differing package-locks - - run: git stash - - - name: Compare benchmarks - uses: rhysd/github-action-benchmark@v1 - if: github.ref == 'refs/heads/master' - with: - tool: 'benchmarkjs' - # Where the output from the benchmark tool is stored - output-file-path: ${{ env.cwd }}/output.txt - # Location of data in gh-pages branch - benchmark-data-dir-path: dev/bench/vm - # Enable alert commit comment (default alert threshold: 200%) - comment-on-alert: true - # GitHub API token to make a commit comment - github-token: ${{ secrets.GITHUB_TOKEN }} - # Push and deploy to GitHub pages branch automatically (if on master) - auto-push: 'true' - # Only keep and display the last 30 commits worth of benchmark data - max-items-in-chart: 30 + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - # Re-apply git stash to prepare for saving back to cache. - # Avoids exit code 1 by checking if there are changes to be stashed first - - run: STASH_LIST=`git stash list` && [ ! -z $STASH_LIST ] && git stash apply || echo "No files to stash-apply. Skipping…" + - run: npm run test:blockchain \ No newline at end of file diff --git a/.github/workflows/vm-pr.yml b/.github/workflows/vm-pr.yml index 15cd31d8c1..46f39124b1 100644 --- a/.github/workflows/vm-pr.yml +++ b/.github/workflows/vm-pr.yml @@ -1,8 +1,21 @@ name: VM on: - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: true + type: string + submodule-cache-key: + required: true + type: string workflow_dispatch: + inputs: + dep-cache-key: + required: false + default: 'none' + submodule-cache-key: + required: false + default: 'none' env: cwd: ${{github.workspace}}/packages/vm @@ -12,28 +25,48 @@ defaults: working-directory: packages/vm concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-vm-pr cancel-in-progress: true jobs: vm-api: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - node-version: 18 + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true - - run: npm run lint - run: npm run coverage - # - run: npm run test:API:browser -- disabled until we fix browser tests for vitest - uses: codecov/codecov-action@v3 with: @@ -47,18 +80,40 @@ jobs: fork: ['Berlin', 'London', 'Paris', 'Shanghai', 'Cancun'] fail-fast: false steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - node-version: 18 + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true + - run: npm run test:state -- --fork=${{ matrix.fork }} --verify-test-amount-alltests vm-state-extended: @@ -85,16 +140,41 @@ jobs: ] fail-fast: false steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true + - run: npm run test:state -- --fork=${{ matrix.fork }} --verify-test-amount-alltests @@ -116,17 +196,39 @@ jobs: ] fail-fast: false steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true - run: npm run test:blockchain -- ${{ matrix.args }} @@ -161,31 +263,67 @@ jobs: ] fail-fast: false steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache with: - node-version: 18 + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - if: inputs.submodule-cache-key != 'none' + uses: actions/cache/restore@v4 + name: Initialize ethereum-tests + id: submodules-cache + with: + path: ${{github.workspace}}/packages/ethereum-tests + key: ${{ inputs.submodule-cache-key}} + fail-on-cache-miss: true - run: npm run test:blockchain -- ${{ matrix.args }} vm-benchmarks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + # We clone the repo and submodules if triggered from work-flow dispatch + - if: inputs.submodule-cache-key == 'none' + uses: actions/checkout@v4 + + # We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key) + - if: inputs.dep-cache-key != 'none' + uses: actions/cache/restore@v4 + id: dep-cache + with: + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - uses: actions/setup-node@v4 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - - run: npm ci - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} - run: npm run build:benchmarks working-directory: ${{ env.cwd }} diff --git a/.github/workflows/wallet-build.yml b/.github/workflows/wallet-build.yml index 9a9ecb8022..d7973bf0cf 100644 --- a/.github/workflows/wallet-build.yml +++ b/.github/workflows/wallet-build.yml @@ -1,12 +1,15 @@ name: Wallet on: - push: - branches: [master, develop] - tags: ['*'] - pull_request: - types: [opened, reopened, synchronize] + workflow_call: + inputs: + dep-cache-key: + required: false + type: string workflow_dispatch: - + inputs: + dep-cache-key: + required: false + type: string env: cwd: ${{github.workspace}}/packages/wallet @@ -15,30 +18,35 @@ defaults: working-directory: packages/wallet concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-wallet cancel-in-progress: true jobs: test-wallet: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18] + steps: - uses: actions/checkout@v4 + + - uses: actions/cache/restore@v4 + id: dep-cache with: - submodules: recursive + path: ${{github.workspace}} + key: ${{ inputs.dep-cache-key }} - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'npm' - - run: npm ci --omit=peer - working-directory: ${{github.workspace}} + - name: Install Dependencies (if not restored from cache) + if: steps.dep-cache.outputs.cache-hit != 'true' + run: npm ci + working-directory: ${{ github.workspace }} + + - - run: npm run lint - run: npm run coverage - uses: codecov/codecov-action@v3 diff --git a/package-lock.json b/package-lock.json index 0f04434371..3164f5e900 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,9 @@ "node": ">=18", "npm": ">=7" }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "*" + }, "peerDependencies": { "@vitest/browser": "^v2.0.0-beta.12", "webdriverio": "^8.39.0" @@ -618,66 +621,6 @@ "kuler": "^2.0.0" } }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/darwin-arm64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", @@ -693,276 +636,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -1949,71 +1622,6 @@ "darwin" ] }, - "node_modules/@lmdb/lmdb-darwin-x64": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-2.9.4.tgz", - "integrity": "sha512-JkPrV8rEu88FzMcuouZeU2b/NuVC3KwQxKo5vKhNycBtsCn7KCWHalxL4sdTiHQ4xtgMca3mmeDAdxgqQqnDig==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-2.9.4.tgz", - "integrity": "sha512-b3JZL5pLuvcGEbcsThUQPFlQdBFaBxImrlNbFUeJmzLwpdgGRi0RSQdZZ2PuIoZvpRj0tfNlhXQwXiYMz+9iTw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm64": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-2.9.4.tgz", - "integrity": "sha512-aIzmw0g4Wdd/w2rDppGfo1JEl4xWpg6HPbf5ZeuWXCjFms8oc8cazm6oBEAimiZEgYYBFPDPdM644xJcwuJbxQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-x64": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-2.9.4.tgz", - "integrity": "sha512-Yj6Nb+/j+ZZ65oH/UCE0UfUu/6TO5wWLIeE2izGCpsCxcozZVbzwhzrCs0FUXf6lXv46DJteONosWH9o1XjzqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-win32-x64": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.9.4.tgz", - "integrity": "sha512-0L6Tyun47/kQb+FzTDIumrfZgU6oEos0RgekKa/3YC7nsUY+ZASZHikzGgEZpMQHSz5YeR+DDUtOMSwqodWHDg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz", @@ -2027,71 +1635,6 @@ "darwin" ] }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz", - "integrity": "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz", - "integrity": "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz", - "integrity": "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz", - "integrity": "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz", - "integrity": "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@mswjs/cookies": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.1.1.tgz", @@ -2786,9 +2329,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", - "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.2.tgz", + "integrity": "sha512-B90tYAUoLhU22olrafY3JQCFLnT3NglazdwkHyxNDYF/zAxJt5fJUB/yBoWFoIQ7SQj+KLe3iL4BhOMa9fzgpw==", "cpu": [ "x64" ], @@ -2951,150 +2494,6 @@ "node": ">=10" } }, - "node_modules/@swc/core-darwin-x64": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.6.6.tgz", - "integrity": "sha512-2nbh/RHpweNRsJiYDFk1KcX7UtaKgzzTNUjwtvK5cp0wWrpbXmPvdlWOx3yzwoiSASDFx78242JHHXCIOlEdsw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.6.6.tgz", - "integrity": "sha512-YgytuyUfR7b0z0SRHKV+ylr83HmgnROgeT7xryEkth6JGpAEHooCspQ4RrWTU8+WKJ7aXiZlGXPgybQ4TiS+TA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.6.6.tgz", - "integrity": "sha512-yGwx9fddzEE0iURqRVwKBQ4IwRHE6hNhl15WliHpi/PcYhzmYkUIpcbRXjr0dssubXAVPVnx6+jZVDSbutvnfg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.6.6.tgz", - "integrity": "sha512-a6fMbqzSAsS5KCxFJyg1mD5kwN3ZFO8qQLyJ75R/htZP/eCt05jrhmOI7h2n+1HjiG332jLnZ9S8lkVE5O8Nqw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.6.6.tgz", - "integrity": "sha512-hRGsUKNzzZle28YF0dYIpN0bt9PceR9LaVBq7x8+l9TAaDLFbgksSxcnU/ubTtsy+WsYSYGn+A83w3xWC0O8CQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-musl": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.6.6.tgz", - "integrity": "sha512-NokIUtFxJDVv3LzGeEtYMTV3j2dnGKLac59luTeq36DQLZdJQawQIdTbzzWl2jE7lxxTZme+dhsVOH9LxE3ceg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.6.6.tgz", - "integrity": "sha512-lzYdI4qb4k1dFG26yv+9Jaq/bUMAhgs/2JsrLncGjLof86+uj74wKYCQnbzKAsq2hDtS5DqnHnl+//J+miZfGA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.6.6.tgz", - "integrity": "sha512-bvl7FMaXIJQ76WZU0ER4+RyfKIMGb6S2MgRkBhJOOp0i7VFx4WLOnrmMzaeoPJaJSkityVKAftfNh7NBzTIydQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.6.6.tgz", - "integrity": "sha512-WAP0JoCTfgeYKgOeYJoJV4ZS0sQUmU3OwvXa2dYYtMLF7zsNqOiW4niU7QlThBHgUv/qNZm2p6ITEgh3w1cltw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, "node_modules/@swc/counter": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", @@ -13769,6 +13168,18 @@ "node": ">=12" } }, + "node_modules/rollup/node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -16663,7 +16074,7 @@ "@ethereumjs/common": "4.4.0", "@ethereumjs/devp2p": "6.1.3", "@ethereumjs/ethash": "3.0.4", - "@ethereumjs/evm": "3.1.0", + "@ethereumjs/evm": "3.1.1", "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", "@ethereumjs/statemanager": "2.4.0", @@ -16671,7 +16082,7 @@ "@ethereumjs/tx": "5.4.0", "@ethereumjs/util": "9.1.0", "@ethereumjs/verkle": "^0.1.0", - "@ethereumjs/vm": "8.1.0", + "@ethereumjs/vm": "8.1.1", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", "@polkadot/wasm-crypto": "^7.3.2", @@ -16841,7 +16252,7 @@ }, "packages/evm": { "name": "@ethereumjs/evm", - "version": "3.1.0", + "version": "3.1.1", "license": "MPL-2.0", "dependencies": { "@ethereumjs/common": "^4.4.0", @@ -17009,13 +16420,13 @@ }, "packages/vm": { "name": "@ethereumjs/vm", - "version": "8.1.0", + "version": "8.1.1", "license": "MPL-2.0", "dependencies": { "@ethereumjs/block": "^5.3.0", "@ethereumjs/blockchain": "^7.3.0", "@ethereumjs/common": "^4.4.0", - "@ethereumjs/evm": "^3.1.0", + "@ethereumjs/evm": "^3.1.1", "@ethereumjs/rlp": "^5.0.2", "@ethereumjs/statemanager": "^2.4.0", "@ethereumjs/trie": "^6.2.1", diff --git a/package.json b/package.json index 3ce2829e1f..8082088bfd 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,9 @@ "vite-plugin-wasm": "^3.3.0", "vitest": "^v2.0.0-beta.12" }, + "optionalDependencies": { + "@rollup/rollup-linux-x64-gnu": "*" + }, "peerDependencies": { "@vitest/browser": "^v2.0.0-beta.12", "webdriverio": "^8.39.0" diff --git a/packages/client/package.json b/packages/client/package.json index 9741cae28b..e7e885bd3a 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -60,7 +60,7 @@ "@ethereumjs/common": "4.4.0", "@ethereumjs/devp2p": "6.1.3", "@ethereumjs/ethash": "3.0.4", - "@ethereumjs/evm": "3.1.0", + "@ethereumjs/evm": "3.1.1", "@ethereumjs/genesis": "0.2.3", "@ethereumjs/rlp": "5.0.2", "@ethereumjs/statemanager": "2.4.0", @@ -68,7 +68,7 @@ "@ethereumjs/tx": "5.4.0", "@ethereumjs/util": "9.1.0", "@ethereumjs/verkle": "^0.1.0", - "@ethereumjs/vm": "8.1.0", + "@ethereumjs/vm": "8.1.1", "@multiformats/multiaddr": "^12.2.1", "@polkadot/util": "^12.6.2", "@polkadot/wasm-crypto": "^7.3.2", diff --git a/packages/evm/CHANGELOG.md b/packages/evm/CHANGELOG.md index 97b05b7e15..d2801de086 100644 --- a/packages/evm/CHANGELOG.md +++ b/packages/evm/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 3.1.1 - 2024-09-09 + +- Fixes a Transient Storage EIP-1153 bug related to not clearing Transient Storage after creating a contract at tx-level (thanks to @yann300 ❤️), PR [#3643](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3643) + ## 3.1.0 - 2024-08-15 ### EIP-2537 BLS Precompiles (Prague) diff --git a/packages/evm/package.json b/packages/evm/package.json index 943e301b7b..1c4e8b4e64 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/evm", - "version": "3.1.0", + "version": "3.1.1", "description": "JavaScript Ethereum Virtual Machine (EVM) implementation", "keywords": [ "ethereum", diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index a9266197e9..272be71e88 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -733,6 +733,10 @@ export class EVM implements EVMInterface { } } + if (message.depth === 0) { + this.postMessageCleanup() + } + return { createdAddress: message.to, execResult: result, diff --git a/packages/evm/test/transientStorage.spec.ts b/packages/evm/test/transientStorage.spec.ts index 095b4b66b3..826751034d 100644 --- a/packages/evm/test/transientStorage.spec.ts +++ b/packages/evm/test/transientStorage.spec.ts @@ -1,6 +1,7 @@ -import { Address } from '@ethereumjs/util' +import { Address, equalsBytes, hexToBytes, setLengthLeft, unpadBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' +import { EVM } from '../src/index.js' import { TransientStorage } from '../src/transientStorage.js' describe('Transient Storage', () => { @@ -176,4 +177,38 @@ describe('Transient Storage', () => { transientStorage.revert() assert.deepEqual(transientStorage.get(address, key), value1) }) + + it('should cleanup after a message create', async () => { + const evm = await EVM.create() + // PUSH 1 PUSH 1 TSTORE + const code = hexToBytes('0x600160015D') + const keyBuf = setLengthLeft(new Uint8Array([1]), 32) + const result = await evm.runCall({ + data: code, + gasLimit: BigInt(100_000), + }) + const created = result.createdAddress! + const stored = evm.transientStorage.get(created, keyBuf) + assert.ok( + equalsBytes(unpadBytes(stored), new Uint8Array()), + 'Transient storage has been cleared' + ) + }) + + it('should cleanup after a message call', async () => { + const evm = await EVM.create() + const contractAddress = Address.zero() + // PUSH 1 PUSH 1 TSTORE + const code = hexToBytes('0x600160015D') + await evm.stateManager.putContractCode(contractAddress, code) + const keyBuf = setLengthLeft(new Uint8Array([1]), 32) + await evm.runCall({ + gasLimit: BigInt(100_000), + }) + const stored = evm.transientStorage.get(contractAddress, keyBuf) + assert.ok( + equalsBytes(unpadBytes(stored), new Uint8Array()), + 'Transient storage has been cleared' + ) + }) }) diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index be99d94f81..ca5bf0bda1 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 8.1.1 - 2024-09-09 + +- Fixes a Transient Storage EIP-1153 bug in the underlying EVM related to not clearing Transient Storage after creating a contract at tx-level (thanks @yann300 ❤️), PR [#3643](https://github.com/ethereumjs/ethereumjs-monorepo/pull/3643) + ## 8.1.0 - 2024-08-15 ### EIP-7685 Requests: EIP-6110 (Deposits) / EIP-7002 (Withdrawals) / EIP-7251 (Consolidations) diff --git a/packages/vm/package.json b/packages/vm/package.json index 3ee73c8984..ff9ae194a3 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "8.1.0", + "version": "8.1.1", "description": "An Ethereum VM implementation", "keywords": [ "ethereum", @@ -66,7 +66,7 @@ "@ethereumjs/block": "^5.3.0", "@ethereumjs/blockchain": "^7.3.0", "@ethereumjs/common": "^4.4.0", - "@ethereumjs/evm": "^3.1.0", + "@ethereumjs/evm": "^3.1.1", "@ethereumjs/rlp": "^5.0.2", "@ethereumjs/statemanager": "^2.4.0", "@ethereumjs/trie": "^6.2.1",