Add post state to selfdestruct test

This commit is contained in:
Sina Mahmoodi 2024-09-10 18:16:57 +02:00 committed by Martin Holst Swende
parent 709e96d2df
commit a4e0549d3f
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 37 additions and 4 deletions

View file

@ -316,10 +316,15 @@ func TestSupplySelfdestruct(t *testing.T) {
Hash: head.Hash(),
ParentHash: head.ParentHash,
}}
post = &types.GenesisAlloc{
dad: {Balance: eth1},
aa: {Balance: big.NewInt(0), Code: gspec.Alloc[aa].Code},
bb: {Balance: big.NewInt(0)},
}
)
compareAsJSON(t, expected, preCancunOutput)
preCancunTest, err := btFromChain(preCancunDB, preCancunChain, nil)
preCancunTest, err := btFromChain(preCancunDB, preCancunChain, post)
if err != nil {
t.Fatalf("failed to fill tests from chain: %v", err)
}
@ -373,9 +378,14 @@ func TestSupplySelfdestruct(t *testing.T) {
Hash: head.Hash(),
ParentHash: head.ParentHash,
}}
post = &types.GenesisAlloc{
dad: {Balance: eth1},
aa: {Balance: big.NewInt(0), Code: gspec.Alloc[aa].Code},
bb: {Balance: gwei5, Code: gspec.Alloc[bb].Code},
}
compareAsJSON(t, expected, postCancunOutput)
postCancunTest, err := btFromChain(postCancunDB, postCancunChain, nil)
postCancunTest, err := btFromChain(postCancunDB, postCancunChain, post)
if err != nil {
t.Fatalf("failed to fill tests from chain: %v", err)
}

View file

@ -73,7 +73,19 @@
},
"lastblockhash": "d5a0d7e4b5fa687dd355938a24e34229db3c01cd2a999e5023369016371a98ac",
"network": "Cancun",
"postState": {},
"postState": {
"0x0000000000000000000000000000000000000dad": {
"balance": "0xde0b6b3a7640000"
},
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0x12a05f200",
"code": "0x6000357fface000000000000000000000000000000000000000000000000000000000000808203602f57610dad80ff5b5050"
}
},
"pre": {
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
@ -167,7 +179,18 @@
},
"lastblockhash": "f7f68f34d07d7acc5dad5ba9bbde99c82347a74471801e7c0c22e5b2ed6d0bc6",
"network": "GrayGlacier",
"postState": {},
"postState": {
"0x0000000000000000000000000000000000000dad": {
"balance": "0xde0b6b3a7640000"
},
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",
"code": "0x61face60f01b6000527322222222222222222222222222222222222222226000806002600080855af160008103603457600080fd5b60008060008034865af1905060008103604c57600080fd5b5050"
},
"0x2222222222222222222222222222222222222222": {
"balance": "0x0"
}
},
"pre": {
"0x1111111111111111111111111111111111111111": {
"balance": "0x0",