Skip to content

Commit 6a3661b

Browse files
Remove verify height index (#2634)
Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
1 parent a18c4a3 commit 6a3661b

30 files changed

+370
-1726
lines changed

proto/pb/vm/vm.pb.go

Lines changed: 367 additions & 443 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/pb/vm/vm_grpc.pb.go

Lines changed: 0 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/vm/vm.proto

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ service VM {
5656
rpc BatchedParseBlock(BatchedParseBlockRequest) returns (BatchedParseBlockResponse);
5757

5858
// HeightIndexedChainVM
59-
rpc VerifyHeightIndex(google.protobuf.Empty) returns (VerifyHeightIndexResponse);
6059
rpc GetBlockIDAtHeight(GetBlockIDAtHeightRequest) returns (GetBlockIDAtHeightResponse);
6160

6261
// StateSyncableVM
@@ -101,8 +100,7 @@ enum Error {
101100
ERROR_UNSPECIFIED = 0;
102101
ERROR_CLOSED = 1;
103102
ERROR_NOT_FOUND = 2;
104-
ERROR_HEIGHT_INDEX_INCOMPLETE = 3;
105-
ERROR_STATE_SYNC_NOT_IMPLEMENTED = 4;
103+
ERROR_STATE_SYNC_NOT_IMPLEMENTED = 3;
106104
}
107105

108106
message InitializeRequest {
@@ -334,10 +332,6 @@ message BatchedParseBlockResponse {
334332
repeated ParseBlockResponse response = 1;
335333
}
336334

337-
message VerifyHeightIndexResponse {
338-
Error err = 1;
339-
}
340-
341335
message GetBlockIDAtHeightRequest {
342336
uint64 height = 1;
343337
}

snow/engine/avalanche/vertex/mock_vm.go

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snow/engine/snowman/block/mock_chain_vm.go

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snow/engine/snowman/block/test_vm.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ var (
1919
errParseBlock = errors.New("unexpectedly called ParseBlock")
2020
errGetBlock = errors.New("unexpectedly called GetBlock")
2121
errLastAccepted = errors.New("unexpectedly called LastAccepted")
22-
errVerifyHeightIndex = errors.New("unexpectedly called VerifyHeightIndex")
2322
errGetBlockIDAtHeight = errors.New("unexpectedly called GetBlockIDAtHeight")
2423

2524
_ ChainVM = (*TestVM)(nil)
@@ -34,15 +33,13 @@ type TestVM struct {
3433
CantGetBlock,
3534
CantSetPreference,
3635
CantLastAccepted,
37-
CantVerifyHeightIndex,
3836
CantGetBlockIDAtHeight bool
3937

4038
BuildBlockF func(context.Context) (snowman.Block, error)
4139
ParseBlockF func(context.Context, []byte) (snowman.Block, error)
4240
GetBlockF func(context.Context, ids.ID) (snowman.Block, error)
4341
SetPreferenceF func(context.Context, ids.ID) error
4442
LastAcceptedF func(context.Context) (ids.ID, error)
45-
VerifyHeightIndexF func(context.Context) error
4643
GetBlockIDAtHeightF func(ctx context.Context, height uint64) (ids.ID, error)
4744
}
4845

@@ -106,16 +103,6 @@ func (vm *TestVM) LastAccepted(ctx context.Context) (ids.ID, error) {
106103
return ids.ID{}, errLastAccepted
107104
}
108105

109-
func (vm *TestVM) VerifyHeightIndex(ctx context.Context) error {
110-
if vm.VerifyHeightIndexF != nil {
111-
return vm.VerifyHeightIndexF(ctx)
112-
}
113-
if vm.CantVerifyHeightIndex && vm.T != nil {
114-
require.FailNow(vm.T, errVerifyHeightIndex.Error())
115-
}
116-
return errVerifyHeightIndex
117-
}
118-
119106
func (vm *TestVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) {
120107
if vm.GetBlockIDAtHeightF != nil {
121108
return vm.GetBlockIDAtHeightF(ctx, height)

snow/engine/snowman/block/vm.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@ package block
55

66
import (
77
"context"
8-
"errors"
98

109
"github.com/ava-labs/avalanchego/ids"
1110
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
1211
"github.com/ava-labs/avalanchego/snow/engine/common"
1312
)
1413

15-
// ErrIndexIncomplete is used to indicate that the VM is currently repairing its
16-
// index.
17-
//
18-
// TODO: Remove after v1.11.x activates.
19-
var ErrIndexIncomplete = errors.New("query failed because height index is incomplete")
20-
2114
// ChainVM defines the required functionality of a Snowman VM.
2215
//
2316
// A Snowman VM is responsible for defining the representation of state,
@@ -56,15 +49,6 @@ type ChainVM interface {
5649
// returned.
5750
LastAccepted(context.Context) (ids.ID, error)
5851

59-
// VerifyHeightIndex should return:
60-
// - nil if the height index is available.
61-
// - ErrIndexIncomplete if the height index is not currently available.
62-
// - Any other non-standard error that may have occurred when verifying the
63-
// index.
64-
//
65-
// TODO: Remove after v1.11.x activates.
66-
VerifyHeightIndex(context.Context) error
67-
6852
// GetBlockIDAtHeight returns:
6953
// - The ID of the block that was accepted with [height].
7054
// - database.ErrNotFound if the [height] index is unknown.

vms/avm/vm.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, erro
390390
return vm.state.GetBlockIDAtHeight(height)
391391
}
392392

393-
func (*VM) VerifyHeightIndex(context.Context) error {
394-
return nil
395-
}
396-
397393
/*
398394
******************************************************************************
399395
*********************************** DAG VM ***********************************

vms/example/xsvm/vm.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@ func (vm *VM) BuildBlockWithContext(ctx context.Context, blockContext *smblock.C
168168
return vm.builder.BuildBlock(ctx, blockContext)
169169
}
170170

171-
func (*VM) VerifyHeightIndex(context.Context) error {
172-
return nil
173-
}
174-
175171
func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error) {
176172
return state.GetBlockIDByHeight(vm.db, height)
177173
}

vms/metervm/block_metrics.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ type blockMetrics struct {
2424
accept,
2525
reject,
2626
// Height metrics
27-
verifyHeightIndex,
2827
getBlockIDAtHeight,
2928
// Block verification with context metrics
3029
shouldVerifyWithContext,
@@ -69,7 +68,6 @@ func (m *blockMetrics) Initialize(
6968
m.shouldVerifyWithContext = newAverager(namespace, "should_verify_with_context", reg, &errs)
7069
m.verifyWithContext = newAverager(namespace, "verify_with_context", reg, &errs)
7170
m.verifyWithContextErr = newAverager(namespace, "verify_with_context_err", reg, &errs)
72-
m.verifyHeightIndex = newAverager(namespace, "verify_height_index", reg, &errs)
7371
m.getBlockIDAtHeight = newAverager(namespace, "get_block_id_at_height", reg, &errs)
7472

7573
if supportsBlockBuildingWithContext {

0 commit comments

Comments
 (0)