diff --git a/.changeset/foundry-deploy-skip-simulation.md b/.changeset/foundry-deploy-skip-simulation.md new file mode 100644 index 0000000000..85b64036ff --- /dev/null +++ b/.changeset/foundry-deploy-skip-simulation.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +Add `--skip-simulation` to non-localhost Foundry deploys so gas limits come from the node's `eth_estimateGas`. Forge simulates Ethereum chains with the `evm_version` from `foundry.toml` rather than the target chain's active fork, so deploys to Amsterdam chains (EIP-8037, e.g. Sepolia) ran out of gas. Note: skipping simulation makes the broadcast sequential and drops the pre-broadcast cost summary. diff --git a/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs b/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs index 5f070ccc88..bfcf460ebf 100644 --- a/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs +++ b/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs @@ -22,6 +22,10 @@ fork: setup-anvil-wallet anvil --fork-url \${FORK_URL} --chain-id 31337 # Deploy the contracts +# Non-localhost deploys use --skip-simulation: forge simulates with evm_version from +# foundry.toml, not the target chain's fork, so it under-estimates gas on Amsterdam +# chains (EIP-8037). Remove once forge resolves the Ethereum hardfork from the RPC +# or once Amsterdam is active on every network in foundry.toml. deploy: @if [ ! -f "$(DEPLOY_SCRIPT)" ]; then \ echo "Error: Deploy script '$(DEPLOY_SCRIPT)' not found"; \ @@ -34,7 +38,7 @@ deploy: forge script $(DEPLOY_SCRIPT) --rpc-url localhost --broadcast --ffi; \ fi \ else \ - forge script $(DEPLOY_SCRIPT) --rpc-url $(RPC_URL) --broadcast --ffi; \ + forge script $(DEPLOY_SCRIPT) --rpc-url $(RPC_URL) --broadcast --ffi --skip-simulation; \ fi # Deploy and generate ABIs