Skip to content

Commit acf23b7

Browse files
committed
add comments
1 parent c2d3130 commit acf23b7

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

core/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type Validator interface {
3333
// gas used.
3434
ValidateState(block *types.Block, state *state.StateDB, receipts types.Receipts, usedGas uint64) error
3535

36-
// TODO: add comments
36+
// SetupTracerAndCircuitCapacityChecker sets up ScrollTracerWrapper and CircuitCapacityChecker for validator,
37+
// to get scroll-related traces and to validate the circuit row consumption
3738
SetupTracerAndCircuitCapacityChecker(tracer tracerWrapper)
3839
}
3940

rollup/tracing/mux_tracer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,59 @@ import (
99
_ "github.com/scroll-tech/go-ethereum/eth/tracers/native"
1010
)
1111

12+
// MuxTracer is a tracer mux, to support running multiple tracers together
1213
type MuxTracer struct {
1314
tracers []vm.EVMLogger
1415
}
1516

17+
// NewMuxTracer creates a new MuxTracer with multiple tracers
1618
func NewMuxTracer(tracers ...vm.EVMLogger) *MuxTracer {
1719
return &MuxTracer{tracers}
1820
}
1921

22+
// CaptureStart runs CaptureStart for each tracer in the MuxTracer
2023
func (t *MuxTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
2124
for _, tracer := range t.tracers {
2225
tracer.CaptureStart(env, from, to, create, input, gas, value)
2326
}
2427
}
2528

29+
// CaptureState runs CaptureState for each tracer in the MuxTracer
2630
func (t *MuxTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
2731
for _, tracer := range t.tracers {
2832
tracer.CaptureState(pc, op, gas, cost, scope, rData, depth, err)
2933
}
3034
}
3135

36+
// CaptureStateAfter runs CaptureStateAfter for each tracer in the MuxTracer
3237
func (t *MuxTracer) CaptureStateAfter(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
3338
for _, tracer := range t.tracers {
3439
tracer.CaptureStateAfter(pc, op, gas, cost, scope, rData, depth, err)
3540
}
3641
}
3742

43+
// CaptureEnter runs CaptureEnter for each tracer in the MuxTracer
3844
func (t *MuxTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
3945
for _, tracer := range t.tracers {
4046
tracer.CaptureEnter(typ, from, to, input, gas, value)
4147
}
4248
}
4349

50+
// CaptureExit runs CaptureExit for each tracer in the MuxTracer
4451
func (t *MuxTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
4552
for _, tracer := range t.tracers {
4653
tracer.CaptureExit(output, gasUsed, err)
4754
}
4855
}
4956

57+
// CaptureFault runs CaptureFault for each tracer in the MuxTracer
5058
func (t *MuxTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
5159
for _, tracer := range t.tracers {
5260
tracer.CaptureFault(pc, op, gas, cost, scope, depth, err)
5361
}
5462
}
5563

64+
// CaptureEnd runs CaptureEnd for each tracer in the MuxTracer
5665
func (t *MuxTracer) CaptureEnd(output []byte, gasUsed uint64, d time.Duration, err error) {
5766
for _, tracer := range t.tracers {
5867
tracer.CaptureEnd(output, gasUsed, d, err)

rollup/tracing/tracing.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ import (
2626
"github.com/scroll-tech/go-ethereum/trie/zkproof"
2727
)
2828

29+
// TracerWrapper implements ScrollTracerWrapper interface
2930
type TracerWrapper struct{}
3031

32+
// TracerWrapper creates a new TracerWrapper
3133
func NewTracerWrapper() *TracerWrapper {
3234
return &TracerWrapper{}
3335
}
3436

37+
// CreateTraceEnvAndGetBlockTrace wraps the whole block tracing logic for a block
3538
func (tw *TracerWrapper) CreateTraceEnvAndGetBlockTrace(chainConfig *params.ChainConfig, chainContext core.ChainContext, engine consensus.Engine, chaindb ethdb.Database, statedb *state.StateDB, parent *types.Block, block *types.Block, commitAfterApply bool) (*types.BlockTrace, error) {
3639
traceEnv, err := CreateTraceEnv(chainConfig, chainContext, engine, chaindb, statedb, parent, block, commitAfterApply)
3740
if err != nil {

0 commit comments

Comments
 (0)