Files
chains/evm/cevm/cevm_blockctx_test.go
zeekayandHanzo Dev 1d08088efd The binding sends a tx's fee cap and tip, as ABI 7's CGpuTx carries them
go_bridge.h's CGpuTx has max_fee_per_gas and max_priority_fee_per_gas in
place of gas_price, 120 bytes on LP64. cevm.Transaction has GasFeeCap and
GasTipCap for them, both the gas price of a legacy or access-list tx, and
buildTxs sets both; the size check reads 120. cevm charges min(cap, base
fee + tip), as the EVM does, where it charged the cap whole, and declines
a tip above the cap.

The executor shapes tx.GasFeeCap() and tx.GasTipCap(), each held to 64
bits. The device test sends a transfer with its tip above its cap, which
the device declines.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-23 13:45:07 -07:00

37 lines
1.2 KiB
Go

//go:build cgo && lux_cevm_native
package cevm
import "testing"
// The block context reaches the device path and is read there: the same
// funded transfer that a device runs is declined when the block's base fee is
// above its fee cap, and when the block's gas limit cannot hold its limit.
// Either would be run as a valid transfer by a path that dropped the context.
// So is the transfer with its tip above its fee cap, which luxfi/geth refuses
// (ErrTipAboveFeeCap): before ABI 7 carried the tip, the device never saw it.
func TestTheBlockContextReachesTheDevice(t *testing.T) {
for _, b := range deviceLanes(t) {
t.Run(BackendName(b), func(t *testing.T) {
txs, ctx, state := transfers(1)
r, err := ExecuteBlock(b, 0, txs, &ctx, state)
ranTransfers(t, r, err, 1)
priced := ctx
priced.BaseFee = txs[0].GasFeeCap + 1
r, err = ExecuteBlock(b, 0, txs, &priced, state)
declined(t, r, err)
tipped := append([]Transaction(nil), txs...)
tipped[0].GasTipCap = tipped[0].GasFeeCap + 1
r, err = ExecuteBlock(b, 0, tipped, &ctx, state)
declined(t, r, err)
full := ctx
full.GasLimit = txs[0].GasLimit - 1
r, err = ExecuteBlock(b, 0, txs, &full, state)
declined(t, r, err)
})
}
}