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

@ -1108,11 +1108,11 @@ func TestSimulateV1(t *testing.T) {
Number string Number string
//Hash string //Hash string
// Ignore timestamp // Ignore timestamp
GasLimit string GasLimit string
GasUsed string GasUsed string
Miner string Miner string
BaseFee string BaseFeePerGas string
Calls []callRes Calls []callRes
} }
var testSuite = []struct { var testSuite = []struct {
name string name string
@ -1146,10 +1146,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xf618", GasUsed: "0xf618",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x5208", GasUsed: "0x5208",
@ -1199,10 +1200,11 @@ func TestSimulateV1(t *testing.T) {
}, },
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xa410", GasUsed: "0xa410",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x5208", GasUsed: "0x5208",
@ -1215,10 +1217,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x5208", GasUsed: "0x5208",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x5208", GasUsed: "0x5208",
@ -1253,10 +1256,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x47e7c4", GasUsed: "0x47e7c4",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
Error: callErr{Message: "stack underflow (0 <=> 2)", Code: errCodeVMError}, Error: callErr{Message: "stack underflow (0 <=> 2)", Code: errCodeVMError},
@ -1298,10 +1302,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xe891", GasUsed: "0xe891",
Miner: strings.ToLower(cac.String()), Miner: strings.ToLower(cac.String()),
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000b", ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000b",
GasUsed: "0xe891", GasUsed: "0xe891",
@ -1309,10 +1314,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xe891", GasUsed: "0xe891",
Miner: strings.ToLower(cac.String()), Miner: strings.ToLower(cac.String()),
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000c", ReturnValue: "0x000000000000000000000000000000000000000000000000000000000000000c",
GasUsed: "0xe891", GasUsed: "0xe891",
@ -1377,10 +1383,11 @@ func TestSimulateV1(t *testing.T) {
}, },
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x10683", GasUsed: "0x10683",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0xaacc", GasUsed: "0xaacc",
@ -1418,10 +1425,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x5508", GasUsed: "0x5508",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
Logs: []log{{ Logs: []log{{
@ -1486,10 +1494,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x52f6", GasUsed: "0x52f6",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
// Caller is in this case the contract that invokes ecrecover. // Caller is in this case the contract that invokes ecrecover.
ReturnValue: strings.ToLower(randomAccounts[2].addr.String()), ReturnValue: strings.ToLower(randomAccounts[2].addr.String()),
@ -1536,10 +1545,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xa58c", GasUsed: "0xa58c",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5", ReturnValue: "0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5",
GasUsed: "0x52dc", GasUsed: "0x52dc",
@ -1584,10 +1594,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
includeTransfers: &includeTransfers, includeTransfers: &includeTransfers,
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xd984", GasUsed: "0xd984",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0xd984", GasUsed: "0xd984",
@ -1650,10 +1661,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x1b83f", GasUsed: "0x1b83f",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0xd166", GasUsed: "0xd166",
@ -1666,10 +1678,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xe6d9", GasUsed: "0xe6d9",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0xe6d9", GasUsed: "0xe6d9",
@ -1713,10 +1726,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
validation: &validation, validation: &validation,
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x5208", GasUsed: "0x5208",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x1",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x5208", GasUsed: "0x5208",
@ -1765,10 +1779,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xc542", GasUsed: "0xc542",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x0000000000000000000000000000000200000000000000000000000000000003", ReturnValue: "0x0000000000000000000000000000000200000000000000000000000000000003",
GasUsed: "0x62a1", GasUsed: "0x62a1",
@ -1781,10 +1796,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x62a1", GasUsed: "0x62a1",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x0000000000000000000000000000000500000000000000000000000000000000", ReturnValue: "0x0000000000000000000000000000000500000000000000000000000000000000",
GasUsed: "0x62a1", GasUsed: "0x62a1",
@ -1838,16 +1854,18 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x0", GasUsed: "0x0",
Miner: coinbase, Miner: coinbase,
Calls: []callRes{}, BaseFeePerGas: "0x0",
Calls: []callRes{},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xf864", GasUsed: "0xf864",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x52cc", GasUsed: "0x52cc",
@ -1866,28 +1884,32 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xd", Number: "0xd",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x0", GasUsed: "0x0",
Miner: coinbase, Miner: coinbase,
Calls: []callRes{}, BaseFeePerGas: "0x0",
Calls: []callRes{},
}, { }, {
Number: "0xe", Number: "0xe",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x0", GasUsed: "0x0",
Miner: coinbase, Miner: coinbase,
Calls: []callRes{}, BaseFeePerGas: "0x0",
Calls: []callRes{},
}, { }, {
Number: "0xf", Number: "0xf",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x0", GasUsed: "0x0",
Miner: coinbase, Miner: coinbase,
Calls: []callRes{}, BaseFeePerGas: "0x0",
Calls: []callRes{},
}, { }, {
Number: "0x10", Number: "0x10",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xa598", GasUsed: "0xa598",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x", ReturnValue: "0x",
GasUsed: "0x52cc", GasUsed: "0x52cc",
@ -1947,10 +1969,11 @@ func TestSimulateV1(t *testing.T) {
}}, }},
}}, }},
want: []blockRes{{ want: []blockRes{{
Number: "0xb", Number: "0xb",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xa44e", GasUsed: "0xa44e",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
GasUsed: "0x5227", GasUsed: "0x5227",
@ -1963,10 +1986,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xc", Number: "0xc",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0xa44e", GasUsed: "0xa44e",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x1",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
GasUsed: "0x5227", GasUsed: "0x5227",
@ -1979,10 +2003,11 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", Status: "0x1",
}}, }},
}, { }, {
Number: "0xd", Number: "0xd",
GasLimit: "0x47e7c4", GasLimit: "0x47e7c4",
GasUsed: "0x5227", GasUsed: "0x5227",
Miner: coinbase, Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{ Calls: []callRes{{
ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ReturnValue: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
GasUsed: "0x5227", GasUsed: "0x5227",
@ -1990,6 +2015,36 @@ func TestSimulateV1(t *testing.T) {
Status: "0x1", 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",
}},
}},
}, },
} }