Skip to content

Limit estimate gas to the current blockLimit#192

Merged
Chengxuan merged 1 commit into
mainfrom
block-max-estimate
May 1, 2026
Merged

Limit estimate gas to the current blockLimit#192
Chengxuan merged 1 commit into
mainfrom
block-max-estimate

Conversation

@peterbroadhurst
Copy link
Copy Markdown
Contributor

It is possible to get into a problematic situation where a transaction is accepted into the EVMConnect transaction queue, with a gas estimation that is higher than the current block limit.

This is because the eth_estimateGas configuration on the node-side does not use the current gasLimit as the limit on the call. For example in the default Besu configuration, the --rpc-gas-cap option can be unlimited (0) or 100M. Whereas the block gasLimit is only 4M by default.

This PR proposes a best-effort protection on this, when the block tracking mode is full and EVMConnect is monitoring the highest blocks from the blockchain. It tracks the current gasLimit from the head of the chain, and if a transaction gas estimate (after scaling) breaches this limit then an error is thrown.

Because the gas estimate occurs before the transaction is accepted, this rejects the transaction with a suitable error early and prevents allocation of a nonce.

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst requested a review from a team as a code owner May 1, 2026 01:20
Copy link
Copy Markdown
Contributor

@Chengxuan Chengxuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Chengxuan Chengxuan merged commit b323e33 into main May 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants