feat(evm): add gas boost retry option for contract deploys [CLD-2779]#1047
Conversation
🦋 Changeset detectedLatest commit: 52b0949 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
b7836e2 to
db74e59
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in “gas boost” retry option for operations2 EVM contract deploys, allowing deploy retries to progressively increase gas limit and gas price when failures look gas-related, and threads optional gas overrides through the EVM deploy path.
Changes:
- Added
RetryDeployWithGasBoost+GasBoostConfigand supporting helpers for classifying gas-related failures and computing boosted gas values. - Extended
DeployInputwith optionalGasLimit/GasPriceand applied them viadeployTransactOptson the EVM deploy path. - Added unit tests for gas boosting logic and expanded deployment tests to cover gas overrides.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
chain/evm/operations2/contract/gas_boost.go |
Implements gas-boost retry option, retryable error classification, and transact opts override helper. |
chain/evm/operations2/contract/gas_boost_test.go |
Adds tests covering boosted gas calculations, retryable error detection, and transact opts behavior. |
chain/evm/operations2/contract/deploy.go |
Extends deploy input with gas overrides and applies them to EVM deploy transact opts. |
chain/evm/operations2/contract/deployment_test.go |
Adds coverage for deploys when gas overrides are provided. |
.changeset/dry-paws-unite.md |
Declares a minor release for the new deploy gas bumping option. |
go.mod |
Updates dependencies (including several version bumps and indirect dependency changes). |
go.sum |
Syncs checksums with the updated dependency graph. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Enable RetryDeployWithGasBoost to raise gas limit and price on gas-related deploy failures, with optional overrides wired through DeployInput for EVM deployments.
db74e59 to
52b0949
Compare
| var gasRetryableErrorPatterns = []string{ | ||
| "out of gas", | ||
| "gas required exceeds allowance", | ||
| "intrinsic gas too low", | ||
| "underpriced", | ||
| "replacement transaction underpriced", | ||
| "max fee per gas less than block base fee", | ||
| "exceeds block gas limit", | ||
| } |
There was a problem hiding this comment.
nit(noaction): I wonder if we can find better ways to detect retryable errors. I've seen this pattern in gauntlet too, but I've never been happy about it. Wondering if there's better mechanisms nowadays
There was a problem hiding this comment.
yeah i know! I dont like this too, currently i am just using a hybrid approach of hardcoded strings plus sentinel errors that we know exist
Why
In order to take advantage of the contract.NewDeploy method used by the operations-gen cli, we need to add support for gas limit bumping as we currently support for legacy deploy MCMS contract changesets.
Note this already exist in cld-changesets here, moving and refactoring this to CLDF makes more sense to other users can take advantage of this option.
Summary
RetryDeployWithGasBoostandGasBoostConfigfor operations2 EVM contract deploys, increasing gas limit and price on retries after gas-related failures.DeployInputwith optionalGasLimitandGasPricefields and applies them viadeployTransactOptson EVM deploy paths.errors.Is) with a string fallback for RPC-wrapped messages.JIRA: https://smartcontract-it.atlassian.net/browse/CLD-2779