Skip to content

Pin or lockfile hardhat in example-ethereum-basic-event-handlers container #2127

@lutter

Description

@lutter

Background

The hardhat node used by examples/ethereum-basic-event-handlers/hardhat/ is built from a Dockerfile that runs pnpm install against a package.json with "hardhat": "^2.22.1" and no lockfile. Each CI build therefore picks up whatever matching version is latest on npm at that moment.

That bit us in CI run Ethereum Basic Event Handlers on the ci branch when the in-container hardhat resolved to 2.28.6. Hardhat ≥ 2.26 defaults to the Prague hardfork, which enforces EIP-7825's per-transaction gas cap of 2^24 = 16_777_216. The test contract deploy needs ~30M gas and gets rejected with:

ProviderError: Transaction gas limit is 30000000 and exceeds transaction gas cap of 16777216

Temporary workaround already in place

Commit e906ab36 pins the in-container hardhat network's hardfork to cancun, which is the last hardfork before EIP-7825 took effect:

// examples/ethereum-basic-event-handlers/hardhat/hardhat.config.js
networks: {
  hardhat: { hardfork: 'cancun' },
},

This unblocks CI but is the wrong long-term fix: it freezes the example to pre-Prague EVM semantics, and the contract size / gas limit assumptions in the test fixtures will continue to drift from real Ethereum.

Proper fix (pick one)

  1. Pin hardhat exactly in examples/ethereum-basic-event-handlers/hardhat/package.json ("hardhat": "2.28.6" or whichever known-good version) and add a lockfile committed to the repo so the Docker build is deterministic. Drop the hardfork: 'cancun' override.
  2. Lower the test contracts' deploy gas under the EIP-7825 cap (split deployments, slim down constructors, or use library linking) and let the example track the current hardfork. This is more invasive but keeps the example representative of mainnet.
  3. Bump the example to a hardhat 3.x baseline (3.4.5 is current) and audit the test for any breaking changes; same goal as option 2.

Option 1 is the smallest change and is probably what we want unless someone wants to use this example to demonstrate post-Prague behavior.

Acceptance criteria

  • In-container hardhat version is deterministic (lockfile committed or version pinned exact).
  • The hardfork: 'cancun' override in examples/ethereum-basic-event-handlers/hardhat/hardhat.config.js is removed.
  • The Ethereum Basic Event Handlers CI job passes on a fresh CI runner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions