Skip to content

Commit cf56ccc

Browse files
Merge pull request #352 from OffchainLabs/integrate-capturearbitrumstoragegetset-prestatetracer
Integrate CaptureArbitrumStorageGet/Set into the prestate tracer
2 parents 9ac8ceb + 38d49e4 commit cf56ccc

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

eth/tracers/native/prestate.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ func newPrestateTracer(ctx *tracers.Context, cfg json.RawMessage, chainConfig *p
9191
}
9292
return &tracers.Tracer{
9393
Hooks: &tracing.Hooks{
94-
OnTxStart: t.OnTxStart,
95-
OnTxEnd: t.OnTxEnd,
96-
OnOpcode: t.OnOpcode,
94+
OnTxStart: t.OnTxStart,
95+
OnTxEnd: t.OnTxEnd,
96+
OnOpcode: t.OnOpcode,
97+
CaptureArbitrumStorageGet: t.CaptureArbitrumStorageGet,
98+
CaptureArbitrumStorageSet: t.CaptureArbitrumStorageSet,
9799
},
98100
GetResult: t.GetResult,
99101
Stop: t.Stop,

eth/tracers/native/tracer_arbitrum.go

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
"github.com/ethereum/go-ethereum/common"
2323
"github.com/ethereum/go-ethereum/core/tracing"
24+
"github.com/ethereum/go-ethereum/core/types"
2425
)
2526

2627
type arbitrumTransfer struct {
@@ -73,6 +74,16 @@ func (t *flatCallTracer) CaptureArbitrumTransfer(from, to *common.Address, value
7374
}
7475
}
7576

77+
func (t *prestateTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {
78+
t.lookupAccount(types.ArbosStateAddress)
79+
t.lookupStorage(types.ArbosStateAddress, key)
80+
}
81+
82+
func (t *prestateTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {
83+
t.lookupAccount(types.ArbosStateAddress)
84+
t.lookupStorage(types.ArbosStateAddress, key)
85+
}
86+
7687
func bigToHex(n *big.Int) string {
7788
if n == nil {
7889
return ""

0 commit comments

Comments
 (0)