mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-06 11:25:02 +00:00
eth/tracers: fix prestateTracer for EIP-6780 SELFDESTRUCT (#33050)
fix https://github.com/ethereum/go-ethereum/issues/33049
This commit is contained in:
parent
243407a3aa
commit
e6d34c1fee
2 changed files with 110 additions and 1 deletions
101
eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide_cancun.json
vendored
Normal file
101
eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide_cancun.json
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"context": {
|
||||
"difficulty": "0",
|
||||
"gasLimit": "8000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"number": "1",
|
||||
"timestamp": "1000",
|
||||
"baseFeePerGas": "7"
|
||||
},
|
||||
"genesis": {
|
||||
"alloc": {
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0x10000000000000000",
|
||||
"nonce": "0",
|
||||
"code": "0x",
|
||||
"storage": {}
|
||||
},
|
||||
"0x1111111111111111111111111111111111111111": {
|
||||
"balance": "0x0",
|
||||
"nonce": "0",
|
||||
"code": "0x",
|
||||
"storage": {}
|
||||
},
|
||||
"0x2222222222222222222222222222222222222222": {
|
||||
"balance": "0xde0b6b3a7640000",
|
||||
"nonce": "1",
|
||||
"code": "0x6099600155731111111111111111111111111111111111111111ff",
|
||||
"storage": {
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000000000000000000000000000000000000abcd",
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000001234"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"chainId": 1,
|
||||
"homesteadBlock": 0,
|
||||
"eip150Block": 0,
|
||||
"eip155Block": 0,
|
||||
"eip158Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"mergeNetsplitBlock": 0,
|
||||
"shanghaiTime": 0,
|
||||
"cancunTime": 0,
|
||||
"terminalTotalDifficulty": 0,
|
||||
"terminalTotalDifficultyPassed": true
|
||||
},
|
||||
"difficulty": "0",
|
||||
"extraData": "0x",
|
||||
"gasLimit": "8000000",
|
||||
"hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0",
|
||||
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"timestamp": "0"
|
||||
},
|
||||
"input": "0xf860800a830186a094222222222222222222222222222222222222222280801ba0c4829400221936e8016721406f84b4710ead5608f15c785a3cedc20a7aebaab2a033e8e6e12cc432098b5ce8a409691f977867249073a3fc7804e8676c4d159475",
|
||||
"tracerConfig": {
|
||||
"diffMode": true
|
||||
},
|
||||
"result": {
|
||||
"pre": {
|
||||
"0x2222222222222222222222222222222222222222": {
|
||||
"balance": "0xde0b6b3a7640000",
|
||||
"nonce": 1,
|
||||
"code": "0x6099600155731111111111111111111111111111111111111111ff",
|
||||
"codeHash": "0x701bdb1d43777a9304905a100f758955d130e09c8e86d97e3f6becccdc001048",
|
||||
"storage": {
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000000000000000000000000000000000000000abcd"
|
||||
}
|
||||
},
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0x10000000000000000"
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"0x0000000000000000000000000000000000000000": {
|
||||
"balance": "0x2aed3"
|
||||
},
|
||||
"0x1111111111111111111111111111111111111111": {
|
||||
"balance": "0xde0b6b3a7640000"
|
||||
},
|
||||
"0x2222222222222222222222222222222222222222": {
|
||||
"balance": "0x0",
|
||||
"storage": {
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000099"
|
||||
}
|
||||
},
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0xfffffffffff70e96",
|
||||
"nonce": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,15 @@ func (t *prestateTracer) OnOpcode(pc uint64, opcode byte, gas, cost uint64, scop
|
|||
addr := common.Address(stackData[stackLen-1].Bytes20())
|
||||
t.lookupAccount(addr)
|
||||
if op == vm.SELFDESTRUCT {
|
||||
t.deleted[caller] = true
|
||||
if t.chainConfig.IsCancun(t.env.BlockNumber, t.env.Time) {
|
||||
// EIP-6780: only delete if created in same transaction
|
||||
if t.created[caller] {
|
||||
t.deleted[caller] = true
|
||||
}
|
||||
} else {
|
||||
// Pre-EIP-6780: always delete
|
||||
t.deleted[caller] = true
|
||||
}
|
||||
}
|
||||
case stackLen >= 5 && (op == vm.DELEGATECALL || op == vm.CALL || op == vm.STATICCALL || op == vm.CALLCODE):
|
||||
addr := common.Address(stackData[stackLen-2].Bytes20())
|
||||
|
|
|
|||
Loading…
Reference in a new issue