Skip to content

giga: report EIP-1559 effective gas price on receipt (CON-256)#3384

Merged
wen-coding merged 3 commits intomainfrom
wen/fix_gas_in_receipt
May 5, 2026
Merged

giga: report EIP-1559 effective gas price on receipt (CON-256)#3384
wen-coding merged 3 commits intomainfrom
wen/fix_gas_in_receipt

Conversation

@wen-coding
Copy link
Copy Markdown
Contributor

@wen-coding wen-coding commented May 5, 2026

GIGA's executeEVMTxWithGigaExecutor was passing ethTx.GasPrice() into the core.Message used to construct the receipt. For dynamic-fee (EIP-1559) txs Transaction.GasPrice() returns GasFeeCap, so the receipt wrongly reported maxFee for any tx that actually paid baseFee + tip < maxFee.

This breaks EIP-1559 RPC semantics for clients (ethers, hardhat-ethers, etc.) that read receipt.effectiveGasPrice to compute spend / display per-tx cost.

What's actually wrong

V2's x/evm/keeper/msg_server.go constructs the message via server.GetEVMMessage(ctx, tx, sender), which has the EIP-1559 adjustment built in:

baseFee := k.GetBaseFee(ctx)
if baseFee != nil {
    msg.GasPrice = msg.GasPrice.Add(msg.GasTipCap, baseFee)
    if msg.GasPrice.Cmp(msg.GasFeeCap) > 0 {
        msg.GasPrice = msg.GasFeeCap
    }
}

GIGA's path hand-rolls a core.Message literal in executeEVMTxWithGigaExecutor and missed this step.

The fix

Use the already-computed effectiveGasPrice (line 1866 of app/app.go, which already does min(baseFee + tipCap, feeCap) and is what the chain actually charges via stateDB.SubBalance at line 1871) when constructing the receipt's core.Message.

The chain's actual fee charge has always been correct — only the value reported on the receipt was wrong.

Things done

  • Single-line code change in app/app.go executeEVMTxWithGigaExecutor: GasPrice: ethTx.GasPrice()GasPrice: effectiveGasPrice
  • Unit test in giga/deps/xevm/keeper/receipt_test.go documents the WriteReceipt contract: receipt.EffectiveGasPrice == msg.GasPrice (caller is responsible for passing the EIP-1559 effective price)
  • gofmt -s clean

🤖 Generated with Claude Code

executeEVMTxWithGigaExecutor was passing ethTx.GasPrice() into the
core.Message used to construct the receipt. For dynamic-fee txs that
returns GasFeeCap, so receipts wrongly reported maxFee even when the
chain actually charged baseFee+tip < maxFee.

Use the already-computed effectiveGasPrice (line 1866) instead. The
chain's actual fee charge (line 1871's stateDB.SubBalance) was already
correct — only the receipt was wrong.

Non-apphash-breaking: receipt.EffectiveGasPrice is stored in the
ledger receipt store (off-consensus). ExecTxResult.{Code,Data,
GasWanted,GasUsed} which feed LastResultsHash are unchanged.

Test added: documents the WriteReceipt contract that
receipt.EffectiveGasPrice == msg.GasPrice, so the caller must pass
the EIP-1559 effective price.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
wen-coding added a commit that referenced this pull request May 5, 2026
Mirror the success-branch evmMsg construction (PR #3384): use
effectiveGasPrice (computed at line 1866) for receipt's
EffectiveGasPrice field instead of ethTx.GasPrice() which returns
GasFeeCap for dynamic-fee txs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 5, 2026, 2:32 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.07%. Comparing base (52d368f) to head (ad55ad6).

Files with missing lines Patch % Lines
app/app.go 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3384      +/-   ##
==========================================
- Coverage   59.08%   59.07%   -0.01%     
==========================================
  Files        2100     2099       -1     
  Lines      173008   172972      -36     
==========================================
- Hits       102219   102188      -31     
+ Misses      61926    61921       -5     
  Partials     8863     8863              
Flag Coverage Δ
sei-chain-pr 52.46% <0.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/app.go 69.78% <0.00%> (-0.07%) ⬇️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wen-coding wen-coding changed the title giga: report EIP-1559 effective gas price on receipt giga: report EIP-1559 effective gas price on receipt (CON-256) May 5, 2026
Copy link
Copy Markdown
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

Thanks!

@wen-coding wen-coding enabled auto-merge May 5, 2026 13:18
@wen-coding wen-coding added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 7004ef1 May 5, 2026
40 checks passed
@wen-coding wen-coding deleted the wen/fix_gas_in_receipt branch May 5, 2026 13:33
@seidroid
Copy link
Copy Markdown

seidroid Bot commented May 5, 2026

Successfully created backport PR for release/v6.5:

masih added a commit that referenced this pull request May 5, 2026
… receipt (CON-256) (#3387)

Backport of #3384 to `release/v6.5`.

Co-authored-by: Wen <113942165+wen-coding@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Masih H. Derkani <m@derkani.org>
@arajasek
Copy link
Copy Markdown
Contributor

arajasek commented May 5, 2026

/backport

@seidroid
Copy link
Copy Markdown

seidroid Bot commented May 5, 2026

Successfully created backport PR for release/v6.4:

masih added a commit that referenced this pull request May 5, 2026
… receipt (CON-256) (#3390)

Backport of #3384 to `release/v6.4`.

Co-authored-by: Wen <113942165+wen-coding@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Masih H. Derkani <m@derkani.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants