rpc: preserve ordinary constructor replay context in overlay_callConstructor

Open
#26,394 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@lupin012 is already working on this.

Since Nov 16, 2026.

Assessment

This issue has not been assessed yet.

Description

RPC

Follow-up to #25602, limited to the ordinary creation transaction executed by overlay_callConstructor.

The method replaces the ordinary transaction's gas allowance with the RPC cap and enables internal gas bailout, so its sender pays no gas fees. For a top-level deployment it also replaces the message's initcode before intrinsic gas is calculated. The replacement constructor can therefore observe balances and gas conditions that differ from the original creation context. Frame transactions already retain their signed budgets and normal fee accounting.

A focused reproduction uses a sender with 1,000,000 wei, an ordinary creation transaction with gas limit 100,000 and gas price 2 wei, and replacement initcode returning the sender's balance. With an RPC cap of 1,000,000, both top-level and factory creation return 1,000,000 wei. Replaying the original fee charge would return 800,000 wei. This reproduces with the constructor changes deferred from #25602.

Proposed work:

  • Replay the original ordinary transaction, including its fees, intrinsic gas and earlier execution, until the target CREATE or CREATE2.
  • Use the existing creation tracer to run the replacement constructor with a separate RPC allowance, without charging that allowance as the original transaction's fee budget.
  • Define whether the original transaction must also fit within the RPC cap, and report a cap error directly if that policy is adopted. Preserve cap-zero handling.
  • Cover top-level and factory creation, fee-sensitive replacement code, intrinsic gas, and finite/unlimited caps. Document the change in observable overlay behaviour.

The shared block replay and frame-transaction fixes remain in #25602. This issue does not restore the public gasBailOut tracing argument.

Dominant language
Go
Stars
3.6k
Forks
1.6k
Avg merge
1d 17h
Merged PRs (30d)
820

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from erigontech/erigon

All issues in erigontech/erigon

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.