fix supply withdrawals

This commit is contained in:
Sina Mahmoodi 2024-09-04 13:07:40 +02:00 committed by Martin Holst Swende
parent 0e4c9e2155
commit 8d95b10bb9
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 10 additions and 7 deletions

View file

@ -197,25 +197,28 @@ func TestSupplyWithdrawals(t *testing.T) {
}) })
} }
out, _, chain, err := testSupplyTracer(t, gspec, withdrawalsBlockGenerationFunc) out, db, chain, err := testSupplyTracer(t, gspec, withdrawalsBlockGenerationFunc)
if err != nil { if err != nil {
t.Fatalf("failed to test supply tracer: %v", err) t.Fatalf("failed to test supply tracer: %v", err)
} }
var ( var (
head = chain.CurrentBlock() head = chain.CurrentBlock()
expected = supplyInfo{ expected = []supplyInfo{{
Number: 0,
Hash: common.HexToHash("0x52f276d96f0afaaf2c3cb358868bdc2779c4b0cb8de3e7e5302e247c0b66a703"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}, {
Issuance: &supplyInfoIssuance{ Issuance: &supplyInfoIssuance{
Withdrawals: big.NewInt(1337000000000), Withdrawals: big.NewInt(1337000000000),
}, },
Number: 1, Number: 1,
Hash: head.Hash(), Hash: head.Hash(),
ParentHash: head.ParentHash, ParentHash: head.ParentHash,
} }}
actual = out[expected.Number]
) )
compareAsJSON(t, expected, out)
compareAsJSON(t, expected, actual) writeArtifact(t, "withdrawals_cancun", db, chain, expected)
} }
// Tests fund retrieval after contract's selfdestruct. // Tests fund retrieval after contract's selfdestruct.

View file

@ -30,7 +30,7 @@ func TestSupplyTracerBlockchain(t *testing.T) {
t.Fatalf("failed to read testcase: %v", err) t.Fatalf("failed to read testcase: %v", err)
} }
if err := json.Unmarshal(blob, &testcases); err != nil { if err := json.Unmarshal(blob, &testcases); err != nil {
t.Fatalf("failed to parse testcase: %v", err) t.Fatalf("failed to parse testcase %s: %v", file.Name(), err)
} }
for testname, test := range testcases { for testname, test := range testcases {
t.Run(fmt.Sprintf("%s/%s", camel(strings.TrimSuffix(file.Name(), ".json")), testname), func(t *testing.T) { t.Run(fmt.Sprintf("%s/%s", camel(strings.TrimSuffix(file.Name(), ".json")), testname), func(t *testing.T) {