check base fee in test block results

This commit is contained in:
Sina Mahmoodi 2024-06-06 19:15:17 +02:00
parent 399812ad37
commit 1c154e996e

View file

@ -1111,7 +1111,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit string
GasUsed string
Miner string
BaseFee string
BaseFeePerGas string
Calls []callRes
}
var testSuite = []struct {
@ -1150,6 +1150,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xf618",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x5208",
@ -1203,6 +1204,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xa410",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x5208",
@ -1219,6 +1221,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x5208",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x5208",
@ -1257,6 +1260,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x47e7c4",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
Error: callErr{Message: "stack underflow (0 <=> 2)", Code: errCodeVMError},
@ -1302,6 +1306,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xe891",
Miner: strings.ToLower(cac.String()),
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000b",
GasUsed: "0xe891",
@ -1313,6 +1318,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xe891",
Miner: strings.ToLower(cac.String()),
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000c",
GasUsed: "0xe891",
@ -1381,6 +1387,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x10683",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0xaacc",
@ -1422,6 +1429,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x5508",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
Logs: []log{{
@ -1490,6 +1498,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x52f6",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
// Caller is in this case the contract that invokes ecrecover.
ReturnValue: strings.ToLower(randomAccounts[2].addr.String()),
@ -1540,6 +1549,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xa58c",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5",
GasUsed: "0x52dc",
@ -1588,6 +1598,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xd984",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0xd984",
@ -1654,6 +1665,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x1b83f",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0xd166",
@ -1670,6 +1682,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xe6d9",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0xe6d9",
@ -1717,6 +1730,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x5208",
Miner: coinbase,
BaseFeePerGas: "0x1",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x5208",
@ -1769,6 +1783,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xc542",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x0000000000000000000000000000000200000000000000000000000000000003",
GasUsed: "0x62a1",
@ -1785,6 +1800,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x62a1",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x0000000000000000000000000000000500000000000000000000000000000000",
GasUsed: "0x62a1",
@ -1842,12 +1858,14 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x0",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{},
}, {
Number: "0xc",
GasLimit: "0x47e7c4",
GasUsed: "0xf864",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x52cc",
@ -1870,24 +1888,28 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x0",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{},
}, {
Number: "0xe",
GasLimit: "0x47e7c4",
GasUsed: "0x0",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{},
}, {
Number: "0xf",
GasLimit: "0x47e7c4",
GasUsed: "0x0",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{},
}, {
Number: "0x10",
GasLimit: "0x47e7c4",
GasUsed: "0xa598",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0x52cc",
@ -1951,6 +1973,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xa44e",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
GasUsed: "0x5227",
@ -1967,6 +1990,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0xa44e",
Miner: coinbase,
BaseFeePerGas: "0x1",
Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
GasUsed: "0x5227",
@ -1983,6 +2007,7 @@ func TestSimulateV1(t *testing.T) {
GasLimit: "0x47e7c4",
GasUsed: "0x5227",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
GasUsed: "0x5227",
@ -1990,6 +2015,36 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1",
}},
}},
}, {
name: "basefee-validation-mode",
tag: latest,
blocks: []simBlock{{
StateOverrides: &StateOverride{
randomAccounts[2].addr: {
Code: hex2Bytes("3a489060005260205260406000f3"),
},
},
Calls: []TransactionArgs{{
From: &accounts[0].addr,
To: &randomAccounts[2].addr,
MaxFeePerGas: newInt(233138868),
MaxPriorityFeePerGas: newInt(1),
}},
}},
validation: &validation,
want: []blockRes{{
Number: "0xb",
GasLimit: "0x47e7c4",
GasUsed: "0x5227",
Miner: coinbase,
BaseFeePerGas: "0xde56ab3",
Calls: []callRes{{
ReturnValue: "0x000000000000000000000000000000000000000000000000000000000de56ab4000000000000000000000000000000000000000000000000000000000de56ab3",
GasUsed: "0x5227",
Logs: []log{},
Status: "0x1",
}},
}},
},
}