Skip to content

Commit

Permalink
Accept optional tracer in NewOverridableBlocksProvider constructor me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
m-Peter committed Jan 14, 2025
1 parent c34aecc commit a3f62ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 3 additions & 1 deletion api/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func (d *DebugAPI) TraceCall(
blocksProvider := requester.NewOverridableBlocksProvider(
d.blocks,
d.config.FlowNetworkID,
).WithTracer(tracer)
tracer,
)

if config.BlockOverrides != nil {
blocksProvider = blocksProvider.WithBlockOverrides(&ethTypes.BlockOverrides{
Number: config.BlockOverrides.Number,
Expand Down
11 changes: 2 additions & 9 deletions services/requester/overridable_blocks_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,12 @@ var _ evmTypes.BlockSnapshotProvider = (*OverridableBlocksProvider)(nil)
func NewOverridableBlocksProvider(
blocks storage.BlockIndexer,
chainID flowGo.ChainID,
tracer *tracers.Tracer,
) *OverridableBlocksProvider {
return &OverridableBlocksProvider{
blocks: blocks,
chainID: chainID,
}
}

func (bp *OverridableBlocksProvider) WithTracer(tracer *tracers.Tracer) *OverridableBlocksProvider {
return &OverridableBlocksProvider{
blocks: bp.blocks,
chainID: bp.chainID,
tracer: tracer,
blockOverrides: bp.blockOverrides,
tracer: tracer,
}
}

Expand Down
6 changes: 5 additions & 1 deletion services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ func (e *EVM) getBlockView(
height uint64,
blockOverrides *ethTypes.BlockOverrides,
) (*query.View, error) {
blocksProvider := NewOverridableBlocksProvider(e.blocks, e.config.FlowNetworkID)
blocksProvider := NewOverridableBlocksProvider(
e.blocks,
e.config.FlowNetworkID,
nil,
)

if blockOverrides != nil {
blocksProvider = blocksProvider.WithBlockOverrides(blockOverrides)
Expand Down

0 comments on commit a3f62ee

Please sign in to comment.