Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate CaptureArbitrumStorageGet/Set into the prestate tracer #352

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
8 changes: 5 additions & 3 deletions eth/tracers/native/prestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ func newPrestateTracer(ctx *tracers.Context, cfg json.RawMessage) (*tracers.Trac
}
return &tracers.Tracer{
Hooks: &tracing.Hooks{
OnTxStart: t.OnTxStart,
OnTxEnd: t.OnTxEnd,
OnOpcode: t.OnOpcode,
OnTxStart: t.OnTxStart,
OnTxEnd: t.OnTxEnd,
OnOpcode: t.OnOpcode,
CaptureArbitrumStorageGet: t.CaptureArbitrumStorageGet,
CaptureArbitrumStorageSet: t.CaptureArbitrumStorageSet,
},
GetResult: t.GetResult,
Stop: t.Stop,
Expand Down
11 changes: 11 additions & 0 deletions eth/tracers/native/tracer_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)

type arbitrumTransfer struct {
Expand Down Expand Up @@ -74,6 +75,16 @@ func (t *flatCallTracer) CaptureArbitrumTransfer(from, to *common.Address, value
}
}

func (t *prestateTracer) CaptureArbitrumStorageGet(key common.Hash, depth int, before bool) {
t.lookupAccount(types.ArbosStateAddress)
t.lookupStorage(types.ArbosStateAddress, key)
}

func (t *prestateTracer) CaptureArbitrumStorageSet(key, value common.Hash, depth int, before bool) {
t.lookupAccount(types.ArbosStateAddress)
t.lookupStorage(types.ArbosStateAddress, key)
}

func bigToHex(n *big.Int) string {
if n == nil {
return ""
Expand Down
Loading