mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
eth/traces/native: adapt prestate for live tracing
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
c48a2988e2
commit
186d6d8d69
1 changed files with 12 additions and 0 deletions
|
|
@ -147,7 +147,15 @@ func (t *prestateTracer) OnOpcode(pc uint64, opcode byte, gas, cost uint64, scop
|
|||
}
|
||||
|
||||
func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction, from common.Address) {
|
||||
// Reset for each tx
|
||||
t.pre = stateMap{}
|
||||
t.post = stateMap{}
|
||||
t.env = env
|
||||
t.interrupt.Store(false)
|
||||
t.reason = nil
|
||||
t.created = make(map[common.Address]bool)
|
||||
t.deleted = make(map[common.Address]bool)
|
||||
|
||||
if tx.To() == nil {
|
||||
t.to = crypto.CreateAddress(from, env.StateDB.GetNonce(from))
|
||||
t.created[t.to] = true
|
||||
|
|
@ -276,6 +284,10 @@ func (t *prestateTracer) lookupAccount(addr common.Address) {
|
|||
// it to the prestate of the given contract. It assumes `lookupAccount`
|
||||
// has been performed on the contract before.
|
||||
func (t *prestateTracer) lookupStorage(addr common.Address, key common.Hash) {
|
||||
// For the system calls, such as core.ProcessBeaconBlockRoot doesn't need to lookup accounts before storage access, ignore them.
|
||||
if _, ok := t.pre[addr]; !ok {
|
||||
return
|
||||
}
|
||||
if _, ok := t.pre[addr].Storage[key]; ok {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue