Skip to content

fix(models): estimate every call of a batch in to_estimate_gas_request - #104

Open
mehmetkr-31 wants to merge 1 commit into
tempoxyz:mainfrom
mehmetkr-31:fix/estimate-gas-batch-calls
Open

mehmetkr-31 wants to merge 1 commit into
tempoxyz:mainfrom
mehmetkr-31:fix/estimate-gas-batch-calls

Conversation

@mehmetkr-31

Copy link
Copy Markdown

TempoTransaction.to_estimate_gas_request built the request from calls[0] only, so a batch was estimated as a single call. The transactions guide recommends this helper for gas estimation.

On moderato, a three-call batch of pathUSD balanceOf calls, estimated through w3.eth.estimate_gas(tx.to_estimate_gas_request(...)):

request estimate batch at that gas limit
before from, to, data 277,031 intrinsic gas too low
after from, calls 287,699 succeeds

A batch is now sent as calls, with value on every call (the node requires it) and to: null for a create. Single-call requests keep their to/data/value shape. The new single-call test passes against the old code too.

Tested with uv run pytest (283 passed, 37 integration tests skipped), ruff check and ruff format --check. The batch test fails without the change.

🤖 Generated with Claude Code

`to_estimate_gas_request` built the request from `calls[0]` alone, so a
batch was estimated as if it had a single call. On moderato a three-call
batch of pathUSD `balanceOf` calls estimates to 287,699 gas, but the
helper returned 277,031, and the node rejects the batch at that limit
with "intrinsic gas too low".

Send a batch as `calls` so the node estimates all of them. Single-call
requests keep their `to`/`data`/`value` shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant