Skip to content

Commit

Permalink
Rename requester implementation of BlocksProvider to OverridableBlock…
Browse files Browse the repository at this point in the history
…sProvider
  • Loading branch information
m-Peter committed Jan 10, 2025
1 parent da79cd3 commit 6566fba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion api/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (d *DebugAPI) TraceCall(
return nil, err
}

blocksProvider := requester.NewBlocksProvider(
blocksProvider := requester.NewOverridableBlocksProvider(
d.blocks,
d.config.FlowNetworkID,
).WithTracer(tracer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type blockSnapshot struct {
*BlocksProvider
*OverridableBlocksProvider
block models.Block
}

Expand Down Expand Up @@ -65,50 +65,50 @@ func (bs *blockSnapshot) BlockContext() (evmTypes.BlockContext, error) {
return blockContext, nil
}

// This BlocksProvider implementation is only used for the `eth_call` &
// This OverridableBlocksProvider implementation is only used for the `eth_call` &
// `debug_traceCall` JSON-RPC endpoints. It accepts optional `Tracer` &
// `BlockOverrides` objects, which are used when constructing the
// `BlockContext` object.
type BlocksProvider struct {
type OverridableBlocksProvider struct {
blocks storage.BlockIndexer
chainID flowGo.ChainID
tracer *tracers.Tracer
blockOverrides *ethTypes.BlockOverrides
}

var _ evmTypes.BlockSnapshotProvider = (*BlocksProvider)(nil)
var _ evmTypes.BlockSnapshotProvider = (*OverridableBlocksProvider)(nil)

func NewBlocksProvider(
func NewOverridableBlocksProvider(
blocks storage.BlockIndexer,
chainID flowGo.ChainID,
) *BlocksProvider {
return &BlocksProvider{
) *OverridableBlocksProvider {
return &OverridableBlocksProvider{
blocks: blocks,
chainID: chainID,
}
}

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

func (bp *BlocksProvider) WithBlockOverrides(
func (bp *OverridableBlocksProvider) WithBlockOverrides(
blockOverrides *ethTypes.BlockOverrides,
) *BlocksProvider {
return &BlocksProvider{
) *OverridableBlocksProvider {
return &OverridableBlocksProvider{
blocks: bp.blocks,
chainID: bp.chainID,
tracer: bp.tracer,
blockOverrides: blockOverrides,
}
}

func (bp *BlocksProvider) GetSnapshotAt(height uint64) (
func (bp *OverridableBlocksProvider) GetSnapshotAt(height uint64) (
evmTypes.BlockSnapshot,
error,
) {
Expand All @@ -118,7 +118,7 @@ func (bp *BlocksProvider) GetSnapshotAt(height uint64) (
}

return &blockSnapshot{
BlocksProvider: bp,
block: *block,
OverridableBlocksProvider: bp,
block: *block,
}, nil
}
2 changes: 1 addition & 1 deletion services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func (e *EVM) getBlockView(
height uint64,
blockOverrides *ethTypes.BlockOverrides,
) (*query.View, error) {
blocksProvider := NewBlocksProvider(e.blocks, e.config.FlowNetworkID)
blocksProvider := NewOverridableBlocksProvider(e.blocks, e.config.FlowNetworkID)

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

0 comments on commit 6566fba

Please sign in to comment.