Skip to content

Commit

Permalink
remove block functions
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 24, 2024
1 parent 8ead746 commit 7273300
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 50 deletions.
33 changes: 2 additions & 31 deletions chain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import (
)

var (
_ snowman.Block = &StatelessBlock{}
_ block.WithVerifyContext = &StatelessBlock{}
_ block.StateSummary = &SyncableBlock{}
_ snowman.Block = &StatelessBlock{}
_ block.StateSummary = &SyncableBlock{}
)

type StatefulBlock struct {
Expand Down Expand Up @@ -252,34 +251,6 @@ func (b *StatelessBlock) initializeBuilt(
// implements "snowman.Block.choices.Decidable"
func (b *StatelessBlock) ID() ids.ID { return b.id }

// implements "block.WithVerifyContext"
func (*StatelessBlock) ShouldVerifyWithContext(context.Context) (bool, error) {
return false, nil
}

// implements "block.WithVerifyContext"
func (b *StatelessBlock) VerifyWithContext(ctx context.Context, _ *block.Context) error {
start := time.Now()
defer func() {
b.vm.RecordBlockVerify(time.Since(start))
}()

stateReady := b.vm.StateReady()
ctx, span := b.vm.Tracer().Start(
ctx, "StatelessBlock.VerifyWithContext",
trace.WithAttributes(
attribute.Int("txs", len(b.Txs)),
attribute.Int64("height", int64(b.Hght)),
attribute.Bool("stateReady", stateReady),
attribute.Bool("built", b.Processed()),
),
)
defer span.End()

// Proceed with normal verification
return b.verify(ctx, stateReady)
}

// implements "snowman.Block"
func (b *StatelessBlock) Verify(ctx context.Context) error {
start := time.Now()
Expand Down
11 changes: 5 additions & 6 deletions vm/resolutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ import (
)

var (
_ chain.VM = (*VM)(nil)
_ gossiper.VM = (*VM)(nil)
_ builder.VM = (*VM)(nil)
_ block.ChainVM = (*VM)(nil)
_ block.StateSyncableVM = (*VM)(nil)
_ block.BuildBlockWithContextChainVM = (*VM)(nil)
_ chain.VM = (*VM)(nil)
_ gossiper.VM = (*VM)(nil)
_ builder.VM = (*VM)(nil)
_ block.ChainVM = (*VM)(nil)
_ block.StateSyncableVM = (*VM)(nil)
)

func (vm *VM) ChainID() ids.ID {
Expand Down
13 changes: 0 additions & 13 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,19 +753,6 @@ func (vm *VM) BuildBlock(ctx context.Context) (snowman.Block, error) {
return vm.buildBlock(ctx, nil)
}

// implements "block.BuildBlockWithContextChainVM"
func (vm *VM) BuildBlockWithContext(ctx context.Context, blockContext *block.Context) (snowman.Block, error) {
start := time.Now()
defer func() {
vm.metrics.blockBuild.Observe(float64(time.Since(start)))
}()

ctx, span := vm.tracer.Start(ctx, "VM.BuildBlockWithContext")
defer span.End()

return vm.buildBlock(ctx, blockContext)
}

func (vm *VM) Submit(
ctx context.Context,
verifyAuth bool,
Expand Down

0 comments on commit 7273300

Please sign in to comment.