mirror of
https://github.com/luxfi/cevm.git
synced 2026-10-30 17:00:54 +00:00
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. 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, and declines a tip above the cap, which the device test sends. Co-authored-by: Hanzo Dev <[email protected]>
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
//go:build cgo
|
|
|
|
package cevm
|
|
|
|
import "testing"
|
|
|
|
// The block context reaches the device path and is read there: the transfers
|
|
// a device runs are declined when the block's base fee is above their fee cap,
|
|
// and when the block's gas limit cannot hold their limits. Either would be
|
|
// run as valid transfers 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 := transfers(1)
|
|
r, err := ExecuteBlock(b, txs, WithContext(&ctx))
|
|
ranTransfers(t, r, err, 1)
|
|
|
|
priced := ctx
|
|
priced.BaseFee = txs[0].GasFeeCap + 1
|
|
r, err = ExecuteBlock(b, txs, WithContext(&priced))
|
|
declined(t, r, err)
|
|
|
|
tipped := append([]Transaction(nil), txs...)
|
|
tipped[0].GasTipCap = tipped[0].GasFeeCap + 1
|
|
r, err = ExecuteBlock(b, tipped, WithContext(&ctx))
|
|
declined(t, r, err)
|
|
|
|
full := ctx
|
|
full.GasLimit = txs[0].GasLimit - 1
|
|
r, err = ExecuteBlock(b, txs, WithContext(&full))
|
|
declined(t, r, err)
|
|
})
|
|
}
|
|
}
|
|
|
|
// Without WithContext the block is the zero context, whose gas limit holds no
|
|
// transaction: every lane declines it.
|
|
func TestABlockWithoutAContextIsDeclined(t *testing.T) {
|
|
txs, _ := transfers(1)
|
|
for _, b := range AvailableBackends() {
|
|
t.Run(BackendName(b), func(t *testing.T) {
|
|
r, err := ExecuteBlock(b, txs)
|
|
declined(t, r, err)
|
|
})
|
|
}
|
|
}
|