Skip to content

feat: expose gas overrides for intelligent contract transactions - #111

Open
MuncleUscles wants to merge 1 commit into
v0.19-devfrom
feat/unified-transaction-gas
Open

feat: expose gas overrides for intelligent contract transactions#111
MuncleUscles wants to merge 1 commit into
v0.19-devfrom
feat/unified-transaction-gas

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Delivery context

No direct cross-repository dependency. This is the Python SDK parity implementation of the same public transaction-level gas convention.

Problem and outcome

Large intelligent-contract deploy/write calldata can exceed a guessed outer EVM gas limit. The Python SDK previously offered no transaction-level override, so callers could not bypass an unreliable eth_estimateGas result.

This PR:

  • adds optional top-level gas to write_contract and deploy_contract;
  • passes an explicit positive integer unchanged and skips eth_estimateGas;
  • applies 2× safety headroom when estimation succeeds and no override is supplied;
  • stops before signing or broadcast when estimation fails, preserving known revert selectors in the error;
  • documents that gas controls the outer EVM ConsensusMain.addTransaction call and is separate from GenLayer fees budgets.

There is no protocol, consensus, or fee-accounting change.

Implementation and validation

Validation:

  • .venv/bin/pytest tests/unit/contracts/test_contract_actions.py -q — 45 passed.
  • .venv/bin/pytest tests/unit --ignore=tests/unit/smoke -q — 124 passed.
  • .venv/bin/python -m compileall -q genlayer_py — passed.

The excluded tests/unit/smoke directory performs live Bradbury/Asimov RPC calls; its sandbox run failed only on blocked DNS/network access. No live transaction was broadcast for this change.

Coverage includes:

  • explicit write/deploy gas propagation;
  • estimation bypass;
  • positive-integer validation;
  • 2× estimated-gas headroom;
  • no signing or broadcast on estimation failure;
  • decoded BudgetTooLow error context.

Decisions, risks, and rollback

  • Public spelling is gas, matching standard EVM transaction APIs and genlayer-js.
  • gas is deliberately outside the fees object because it belongs to the outer EVM envelope, not GenLayer execution/consensus budgets.
  • Default Python behavior now includes the same 2× estimation margin used by genlayer-js. This raises only the limit; normal EVM charging remains based on gas used.
  • Reverting this commit restores exact-estimate behavior and removes the override.

Add the outer EVM gas option to write_contract and deploy_contract, align default estimation headroom with genlayer-js, and stop before broadcast when estimation fails.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 15705909-8b56-414d-93df-84a49b00312f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MuncleUscles MuncleUscles self-assigned this Aug 31, 2026
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