From abb1a9a6a21c3dbce6dff5cdcea03173119a5f46 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 16 Jul 2024 13:11:37 -0400 Subject: [PATCH] Remove `block.Status` (#3158) Co-authored-by: Aaron Buchwald --- go.mod | 2 +- go.sum | 4 +- proto/pb/vm/vm.pb.go | 1078 ++++++++--------- proto/vm/vm.proto | 9 - snow/consensus/snowman/block.go | 4 +- snow/consensus/snowman/consensus_test.go | 101 +- snow/consensus/snowman/metrics.go | 5 +- snow/consensus/snowman/network_test.go | 19 +- snow/consensus/snowman/snowmantest/block.go | 18 +- snow/consensus/snowman/snowmantest/engine.go | 53 + .../snowman/snowmantest/mock_block.go | 15 - snow/consensus/snowman/snowmantest/require.go | 18 + snow/decidable.go | 33 + .../snowman/bootstrap/bootstrapper_test.go | 60 +- snow/engine/snowman/bootstrap/storage_test.go | 6 +- snow/engine/snowman/getter/getter.go | 27 +- snow/engine/snowman/getter/getter_test.go | 27 +- snow/engine/snowman/transitive_test.go | 171 ++- snow/snowtest/{snowtest.go => context.go} | 0 snow/snowtest/decidable.go | 58 + snow/snowtest/status.go | 30 + vms/avm/block/executor/block.go | 51 +- vms/avm/block/executor/block_test.go | 107 -- vms/components/chain/state.go | 93 +- vms/components/chain/state_test.go | 264 ++-- vms/example/xsvm/chain/block.go | 55 +- vms/example/xsvm/chain/chain.go | 20 +- vms/platformvm/block/executor/block.go | 37 - vms/platformvm/block/executor/block_test.go | 106 -- vms/platformvm/vm_regression_test.go | 25 - vms/platformvm/vm_test.go | 4 +- vms/proposervm/batched_vm.go | 15 +- vms/proposervm/batched_vm_test.go | 6 +- vms/proposervm/block.go | 4 - vms/proposervm/mock_post_fork_block.go | 27 - vms/proposervm/post_fork_block.go | 15 - vms/proposervm/post_fork_block_test.go | 37 +- vms/proposervm/post_fork_option.go | 18 +- vms/proposervm/post_fork_option_test.go | 51 +- vms/proposervm/pre_fork_block.go | 25 - vms/proposervm/pre_fork_block_test.go | 26 +- vms/proposervm/state/block_state.go | 26 +- vms/proposervm/state/block_state_test.go | 13 +- vms/proposervm/state/mock_state.go | 16 +- vms/proposervm/state_syncable_vm_test.go | 12 +- vms/proposervm/tree/tree_test.go | 14 +- vms/proposervm/vm.go | 39 +- vms/proposervm/vm_byzantine_test.go | 30 +- vms/proposervm/vm_test.go | 291 ++--- vms/rpcchainvm/batched_vm_test.go | 6 - vms/rpcchainvm/state_syncable_vm_test.go | 13 +- vms/rpcchainvm/vm_client.go | 29 - vms/rpcchainvm/vm_server.go | 2 - 53 files changed, 1262 insertions(+), 1953 deletions(-) create mode 100644 snow/consensus/snowman/snowmantest/engine.go create mode 100644 snow/consensus/snowman/snowmantest/require.go create mode 100644 snow/decidable.go rename snow/snowtest/{snowtest.go => context.go} (100%) create mode 100644 snow/snowtest/decidable.go create mode 100644 snow/snowtest/status.go diff --git a/go.mod b/go.mod index 4eef73478aa4..52c55810d0f9 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/DataDog/zstd v1.5.2 github.com/NYTimes/gziphandler v1.1.1 github.com/antithesishq/antithesis-sdk-go v0.3.8 - github.com/ava-labs/coreth v0.13.6-rc.1.0.20240702201359-ba2ce5367874 + github.com/ava-labs/coreth v0.13.7-remove-status github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 diff --git a/go.sum b/go.sum index 0642e3c0e5fa..f265b48e620b 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/antithesishq/antithesis-sdk-go v0.3.8 h1:OvGoHxIcOXFJLyn9IJQ5DzByZ3YVAWNBc394ObzDRb8= github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/coreth v0.13.6-rc.1.0.20240702201359-ba2ce5367874 h1:aTDg0jvO07EvUvBYebmLO25bffe1DAaZZPPL0ooGhIA= -github.com/ava-labs/coreth v0.13.6-rc.1.0.20240702201359-ba2ce5367874/go.mod h1:VhNDxZBsqZQQaUTmIkzdyY8UicIsoTDXlRmPaPL9lkA= +github.com/ava-labs/coreth v0.13.7-remove-status h1:NVHOcHcHpgiVbGYQ1TcnnAbf16tONluvVnYt/Gi+bOA= +github.com/ava-labs/coreth v0.13.7-remove-status/go.mod h1:lTa5PYte0AXBtUK866iQrURSuJLprubKjztbDrTWSrQ= github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95 h1:dOVbtdnZL++pENdTCNZ1nu41eYDQkTML4sWebDnnq8c= github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95/go.mod h1:pJxaT9bUgeRNVmNRgtCHb7sFDIRKy7CzTQVi8gGNT6g= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= diff --git a/proto/pb/vm/vm.pb.go b/proto/pb/vm/vm.pb.go index 356f34d061ac..60d5f15d44fc 100644 --- a/proto/pb/vm/vm.pb.go +++ b/proto/pb/vm/vm.pb.go @@ -75,58 +75,6 @@ func (State) EnumDescriptor() ([]byte, []int) { return file_vm_vm_proto_rawDescGZIP(), []int{0} } -type Status int32 - -const ( - Status_STATUS_UNSPECIFIED Status = 0 - Status_STATUS_PROCESSING Status = 1 - Status_STATUS_REJECTED Status = 2 - Status_STATUS_ACCEPTED Status = 3 -) - -// Enum value maps for Status. -var ( - Status_name = map[int32]string{ - 0: "STATUS_UNSPECIFIED", - 1: "STATUS_PROCESSING", - 2: "STATUS_REJECTED", - 3: "STATUS_ACCEPTED", - } - Status_value = map[string]int32{ - "STATUS_UNSPECIFIED": 0, - "STATUS_PROCESSING": 1, - "STATUS_REJECTED": 2, - "STATUS_ACCEPTED": 3, - } -) - -func (x Status) Enum() *Status { - p := new(Status) - *p = x - return p -} - -func (x Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Status) Descriptor() protoreflect.EnumDescriptor { - return file_vm_vm_proto_enumTypes[1].Descriptor() -} - -func (Status) Type() protoreflect.EnumType { - return &file_vm_vm_proto_enumTypes[1] -} - -func (x Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Status.Descriptor instead. -func (Status) EnumDescriptor() ([]byte, []int) { - return file_vm_vm_proto_rawDescGZIP(), []int{1} -} - type Error int32 const ( @@ -164,11 +112,11 @@ func (x Error) String() string { } func (Error) Descriptor() protoreflect.EnumDescriptor { - return file_vm_vm_proto_enumTypes[2].Descriptor() + return file_vm_vm_proto_enumTypes[1].Descriptor() } func (Error) Type() protoreflect.EnumType { - return &file_vm_vm_proto_enumTypes[2] + return &file_vm_vm_proto_enumTypes[1] } func (x Error) Number() protoreflect.EnumNumber { @@ -177,7 +125,7 @@ func (x Error) Number() protoreflect.EnumNumber { // Deprecated: Use Error.Descriptor instead. func (Error) EnumDescriptor() ([]byte, []int) { - return file_vm_vm_proto_rawDescGZIP(), []int{2} + return file_vm_vm_proto_rawDescGZIP(), []int{1} } type StateSummaryAcceptResponse_Mode int32 @@ -216,11 +164,11 @@ func (x StateSummaryAcceptResponse_Mode) String() string { } func (StateSummaryAcceptResponse_Mode) Descriptor() protoreflect.EnumDescriptor { - return file_vm_vm_proto_enumTypes[3].Descriptor() + return file_vm_vm_proto_enumTypes[2].Descriptor() } func (StateSummaryAcceptResponse_Mode) Type() protoreflect.EnumType { - return &file_vm_vm_proto_enumTypes[3] + return &file_vm_vm_proto_enumTypes[2] } func (x StateSummaryAcceptResponse_Mode) Number() protoreflect.EnumNumber { @@ -886,7 +834,6 @@ type ParseBlockResponse struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ParentId []byte `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=vm.Status" json:"status,omitempty"` Height uint64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` VerifyWithContext bool `protobuf:"varint,6,opt,name=verify_with_context,json=verifyWithContext,proto3" json:"verify_with_context,omitempty"` @@ -938,13 +885,6 @@ func (x *ParseBlockResponse) GetParentId() []byte { return nil } -func (x *ParseBlockResponse) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_STATUS_UNSPECIFIED -} - func (x *ParseBlockResponse) GetHeight() uint64 { if x != nil { return x.Height @@ -1020,7 +960,6 @@ type GetBlockResponse struct { ParentId []byte `protobuf:"bytes,1,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=vm.Status" json:"status,omitempty"` Height uint64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // used to propagate database.ErrNotFound through RPC @@ -1074,13 +1013,6 @@ func (x *GetBlockResponse) GetBytes() []byte { return nil } -func (x *GetBlockResponse) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_STATUS_UNSPECIFIED -} - func (x *GetBlockResponse) GetHeight() uint64 { if x != nil { return x.Height @@ -3046,385 +2978,374 @@ var file_vm_vm_proto_rawDesc = []byte{ 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x29, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0xe7, 0x01, 0x0a, 0x12, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, + 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0xc3, 0x01, 0x0a, 0x12, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x76, 0x6d, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x2e, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x76, 0x65, - 0x72, 0x69, 0x66, 0x79, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, - 0x21, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, - 0x69, 0x64, 0x22, 0x88, 0x02, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x76, 0x6d, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, - 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, - 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, - 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x12, 0x2e, 0x0a, - 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x76, 0x65, 0x72, 0x69, - 0x66, 0x79, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x26, 0x0a, - 0x14, 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x68, 0x0a, 0x12, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, - 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, - 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x12, 0x29, 0x0a, 0x0e, 0x70, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x88, 0x01, 0x01, 0x42, 0x11, 0x0a, 0x0f, - 0x5f, 0x70, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, - 0x4f, 0x0a, 0x13, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x22, 0x24, 0x0a, 0x12, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x24, 0x0a, 0x12, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, - 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x0e, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x2b, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x99, 0x01, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, - 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, - 0x36, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2e, 0x0a, 0x13, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x21, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0xe4, + 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x38, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x64, - 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x64, 0x0a, 0x0e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, - 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x39, 0x0a, 0x0c, 0x41, - 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x4d, 0x73, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, - 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, - 0x64, 0x65, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, - 0x73, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, - 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x08, - 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, - 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x9d, - 0x01, 0x0a, 0x1d, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, - 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x09, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x70, - 0x0a, 0x18, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x03, 0x65, 0x72, 0x72, 0x12, 0x2e, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, + 0x77, 0x69, 0x74, 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x11, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x26, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x68, 0x0a, + 0x12, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x0e, 0x70, 0x5f, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x70, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x4f, 0x0a, 0x13, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x24, 0x0a, 0x12, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x22, 0x24, + 0x0a, 0x12, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x02, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x0e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, + 0x22, 0x2b, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x99, 0x01, + 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12, + 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, + 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x41, 0x70, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, + 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x09, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x64, 0x0a, + 0x0e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x12, + 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x39, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, + 0x4d, 0x73, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0xa5, + 0x01, 0x0a, 0x17, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x81, 0x01, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, - 0x61, 0x74, 0x63, 0x68, 0x22, 0x2e, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, - 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, - 0x64, 0x65, 0x49, 0x64, 0x22, 0xb3, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, - 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, - 0x62, 0x6c, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, - 0x6b, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, - 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x53, 0x69, 0x7a, - 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, - 0x72, 0x65, 0x74, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x15, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x52, 0x65, - 0x74, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x14, 0x47, 0x65, - 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6c, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x22, 0x34, 0x0a, 0x18, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4f, 0x0a, 0x19, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x50, 0x0a, - 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x62, - 0x6c, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6b, - 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, - 0x5d, 0x0a, 0x0e, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x4b, 0x0a, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x66, 0x61, 0x6d, 0x69, - 0x6c, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x69, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x52, 0x0e, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x69, 0x65, 0x73, 0x22, 0x51, - 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, - 0x72, 0x22, 0x7f, 0x0a, 0x22, 0x47, 0x65, 0x74, 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, - 0x79, 0x6e, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, - 0x72, 0x72, 0x22, 0x78, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, - 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, - 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x30, 0x0a, 0x18, - 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x60, - 0x0a, 0x19, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, - 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x22, 0x5c, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, - 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, - 0x22, 0x31, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x22, 0xc5, 0x01, 0x0a, 0x1a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, - 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x23, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x65, - 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x51, 0x0a, 0x04, 0x4d, 0x6f, 0x64, 0x65, - 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, - 0x4b, 0x49, 0x50, 0x50, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x4f, 0x44, 0x45, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x49, 0x43, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x4f, 0x44, - 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43, 0x10, 0x03, 0x2a, 0x65, 0x0a, 0x05, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x53, - 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x49, - 0x4e, 0x47, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x42, 0x4f, - 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, - 0x0f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5f, 0x4f, 0x50, - 0x10, 0x03, 0x2a, 0x61, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, - 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, - 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, - 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, - 0x54, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x6b, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x15, - 0x0a, 0x11, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, - 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, - 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x59, 0x4e, 0x43, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4d, 0x50, 0x4c, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x45, 0x44, - 0x10, 0x03, 0x32, 0x86, 0x11, 0x0a, 0x02, 0x56, 0x4d, 0x12, 0x3b, 0x0a, 0x0a, 0x49, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x15, 0x2e, 0x76, 0x6d, 0x2e, 0x49, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x76, 0x6d, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x12, 0x13, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, - 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a, 0x0e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, - 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x39, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x14, 0x2e, 0x76, - 0x6d, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x0c, 0x44, 0x69, - 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x76, 0x6d, 0x2e, + 0x73, 0x74, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x1d, 0x43, 0x72, 0x6f, 0x73, 0x73, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x70, 0x0a, 0x18, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, + 0x73, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, + 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x10, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, + 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, + 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, + 0x6a, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, + 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x2e, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x0a, 0x42, - 0x75, 0x69, 0x6c, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x15, 0x2e, 0x76, 0x6d, 0x2e, 0x42, - 0x75, 0x69, 0x6c, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x73, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x15, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x13, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0d, - 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x2e, - 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0xb3, 0x01, 0x0a, + 0x13, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x6c, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6b, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x6d, + 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x4e, 0x75, + 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6d, 0x61, 0x78, + 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x69, 0x76, 0x61, 0x6c, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x6d, 0x61, 0x78, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x74, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x54, 0x69, + 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, + 0x6b, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, + 0x62, 0x6c, 0x6b, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x34, 0x0a, 0x18, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x4f, 0x0a, 0x19, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x33, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, + 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x50, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x6c, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6b, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x5d, 0x0a, 0x0e, 0x47, 0x61, 0x74, 0x68, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0f, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, + 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x52, 0x0e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46, 0x61, + 0x6d, 0x69, 0x6c, 0x69, 0x65, 0x73, 0x22, 0x51, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x79, 0x6e, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x03, + 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x7f, 0x0a, 0x22, 0x47, 0x65, 0x74, + 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, + 0x03, 0x65, 0x72, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x78, 0x0a, 0x1b, 0x47, 0x65, + 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, + 0x03, 0x65, 0x72, 0x72, 0x22, 0x30, 0x0a, 0x18, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x60, 0x0a, 0x19, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x65, + 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x30, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x5c, 0x0a, 0x17, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x03, 0x65, + 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0x31, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0xc5, 0x01, 0x0a, 0x1a, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, + 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, + 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x09, 0x2e, 0x76, 0x6d, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x03, 0x65, 0x72, 0x72, + 0x22, 0x51, 0x0a, 0x04, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x4f, 0x44, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, + 0x0a, 0x0c, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x4b, 0x49, 0x50, 0x50, 0x45, 0x44, 0x10, 0x01, + 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x49, 0x43, 0x10, + 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, + 0x43, 0x10, 0x03, 0x2a, 0x65, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, 0x11, + 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, + 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x50, + 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x4e, + 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5f, 0x4f, 0x50, 0x10, 0x03, 0x2a, 0x6b, 0x0a, 0x05, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x02, 0x12, 0x24, 0x0a, 0x20, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, + 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4d, 0x50, 0x4c, 0x45, 0x4d, + 0x45, 0x4e, 0x54, 0x45, 0x44, 0x10, 0x03, 0x32, 0x86, 0x11, 0x0a, 0x02, 0x56, 0x4d, 0x12, 0x3b, + 0x0a, 0x0a, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x15, 0x2e, 0x76, + 0x6d, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, + 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x53, + 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x76, + 0x6d, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, + 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x12, 0x14, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x34, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x12, 0x2e, 0x76, 0x6d, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x76, 0x6d, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, - 0x0a, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x76, 0x6d, - 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x1a, 0x16, + 0x3f, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, + 0x17, 0x2e, 0x76, 0x6d, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x3b, 0x0a, 0x0a, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x15, + 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, + 0x0a, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x15, 0x2e, 0x76, 0x6d, + 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x13, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x76, 0x6d, + 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x41, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x18, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x10, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x17, 0x2e, 0x76, 0x6d, 0x2e, - 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x76, 0x6d, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, + 0x76, 0x6d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x11, 0x2e, 0x76, 0x6d, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x0b, 0x41, - 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x2e, 0x76, 0x6d, 0x2e, - 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x41, 0x70, 0x70, 0x47, 0x6f, 0x73, - 0x73, 0x69, 0x70, 0x12, 0x10, 0x2e, 0x76, 0x6d, 0x2e, 0x41, 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, - 0x69, 0x70, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x34, 0x0a, - 0x06, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x12, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x14, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x76, 0x6d, - 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x10, 0x41, + 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, + 0x17, 0x2e, 0x76, 0x6d, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x57, 0x0a, 0x1a, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x21, - 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x4d, 0x73, - 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d, 0x0a, 0x15, 0x43, 0x72, 0x6f, - 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, - 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x17, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, - 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x18, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, - 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x12, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, - 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x12, 0x1d, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x48, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x45, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, - 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x45, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x1a, - 0x47, 0x65, 0x74, 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x12, 0x39, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x12, 0x2e, 0x76, 0x6d, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x41, + 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x10, 0x2e, 0x76, 0x6d, 0x2e, 0x41, 0x70, + 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x6e, 0x67, 0x6f, 0x69, - 0x6e, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x13, 0x47, 0x65, - 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, - 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1f, 0x2e, 0x76, 0x6d, 0x2e, 0x47, - 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x50, 0x61, - 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, - 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, - 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, - 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, - 0x1a, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, - 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x76, 0x6d, - 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x17, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x74, 0x79, 0x12, 0x34, 0x0a, 0x06, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x14, 0x43, 0x72, 0x6f, 0x73, + 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1b, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x57, 0x0a, 0x1a, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x12, 0x21, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d, + 0x0a, 0x15, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x43, 0x72, 0x6f, + 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x4d, 0x73, 0x67, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, + 0x0c, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x17, 0x2e, + 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x41, + 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x50, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x65, 0x64, 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, + 0x50, 0x61, 0x72, 0x73, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, + 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1d, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x44, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x53, 0x79, 0x6e, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x79, + 0x6e, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x5c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, + 0x79, 0x6e, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3d, 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, 0x12, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x1d, 0x2e, 0x76, - 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, - 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x76, 0x6d, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, - 0x65, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2d, 0x5a, 0x2b, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x76, 0x61, 0x2d, 0x6c, 0x61, - 0x62, 0x73, 0x2f, 0x61, 0x76, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x67, 0x6f, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x76, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4e, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1f, + 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x50, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x12, 0x1c, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x76, 0x6d, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1b, 0x2e, 0x76, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, + 0x0b, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x16, 0x2e, 0x76, + 0x6d, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x76, 0x6d, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, + 0x0b, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x16, 0x2e, 0x76, + 0x6d, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3d, 0x0a, 0x0b, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x76, 0x6d, + 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, 0x12, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, + 0x74, 0x12, 0x1d, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, + 0x61, 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1e, 0x2e, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, + 0x76, 0x61, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x61, 0x76, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x68, + 0x65, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x76, 0x6d, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3439,154 +3360,151 @@ func file_vm_vm_proto_rawDescGZIP() []byte { return file_vm_vm_proto_rawDescData } -var file_vm_vm_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_vm_vm_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_vm_vm_proto_msgTypes = make([]protoimpl.MessageInfo, 44) var file_vm_vm_proto_goTypes = []interface{}{ (State)(0), // 0: vm.State - (Status)(0), // 1: vm.Status - (Error)(0), // 2: vm.Error - (StateSummaryAcceptResponse_Mode)(0), // 3: vm.StateSummaryAcceptResponse.Mode - (*InitializeRequest)(nil), // 4: vm.InitializeRequest - (*InitializeResponse)(nil), // 5: vm.InitializeResponse - (*SetStateRequest)(nil), // 6: vm.SetStateRequest - (*SetStateResponse)(nil), // 7: vm.SetStateResponse - (*CreateHandlersResponse)(nil), // 8: vm.CreateHandlersResponse - (*Handler)(nil), // 9: vm.Handler - (*BuildBlockRequest)(nil), // 10: vm.BuildBlockRequest - (*BuildBlockResponse)(nil), // 11: vm.BuildBlockResponse - (*ParseBlockRequest)(nil), // 12: vm.ParseBlockRequest - (*ParseBlockResponse)(nil), // 13: vm.ParseBlockResponse - (*GetBlockRequest)(nil), // 14: vm.GetBlockRequest - (*GetBlockResponse)(nil), // 15: vm.GetBlockResponse - (*SetPreferenceRequest)(nil), // 16: vm.SetPreferenceRequest - (*BlockVerifyRequest)(nil), // 17: vm.BlockVerifyRequest - (*BlockVerifyResponse)(nil), // 18: vm.BlockVerifyResponse - (*BlockAcceptRequest)(nil), // 19: vm.BlockAcceptRequest - (*BlockRejectRequest)(nil), // 20: vm.BlockRejectRequest - (*HealthResponse)(nil), // 21: vm.HealthResponse - (*VersionResponse)(nil), // 22: vm.VersionResponse - (*AppRequestMsg)(nil), // 23: vm.AppRequestMsg - (*AppRequestFailedMsg)(nil), // 24: vm.AppRequestFailedMsg - (*AppResponseMsg)(nil), // 25: vm.AppResponseMsg - (*AppGossipMsg)(nil), // 26: vm.AppGossipMsg - (*CrossChainAppRequestMsg)(nil), // 27: vm.CrossChainAppRequestMsg - (*CrossChainAppRequestFailedMsg)(nil), // 28: vm.CrossChainAppRequestFailedMsg - (*CrossChainAppResponseMsg)(nil), // 29: vm.CrossChainAppResponseMsg - (*ConnectedRequest)(nil), // 30: vm.ConnectedRequest - (*DisconnectedRequest)(nil), // 31: vm.DisconnectedRequest - (*GetAncestorsRequest)(nil), // 32: vm.GetAncestorsRequest - (*GetAncestorsResponse)(nil), // 33: vm.GetAncestorsResponse - (*BatchedParseBlockRequest)(nil), // 34: vm.BatchedParseBlockRequest - (*BatchedParseBlockResponse)(nil), // 35: vm.BatchedParseBlockResponse - (*GetBlockIDAtHeightRequest)(nil), // 36: vm.GetBlockIDAtHeightRequest - (*GetBlockIDAtHeightResponse)(nil), // 37: vm.GetBlockIDAtHeightResponse - (*GatherResponse)(nil), // 38: vm.GatherResponse - (*StateSyncEnabledResponse)(nil), // 39: vm.StateSyncEnabledResponse - (*GetOngoingSyncStateSummaryResponse)(nil), // 40: vm.GetOngoingSyncStateSummaryResponse - (*GetLastStateSummaryResponse)(nil), // 41: vm.GetLastStateSummaryResponse - (*ParseStateSummaryRequest)(nil), // 42: vm.ParseStateSummaryRequest - (*ParseStateSummaryResponse)(nil), // 43: vm.ParseStateSummaryResponse - (*GetStateSummaryRequest)(nil), // 44: vm.GetStateSummaryRequest - (*GetStateSummaryResponse)(nil), // 45: vm.GetStateSummaryResponse - (*StateSummaryAcceptRequest)(nil), // 46: vm.StateSummaryAcceptRequest - (*StateSummaryAcceptResponse)(nil), // 47: vm.StateSummaryAcceptResponse - (*timestamppb.Timestamp)(nil), // 48: google.protobuf.Timestamp - (*_go.MetricFamily)(nil), // 49: io.prometheus.client.MetricFamily - (*emptypb.Empty)(nil), // 50: google.protobuf.Empty + (Error)(0), // 1: vm.Error + (StateSummaryAcceptResponse_Mode)(0), // 2: vm.StateSummaryAcceptResponse.Mode + (*InitializeRequest)(nil), // 3: vm.InitializeRequest + (*InitializeResponse)(nil), // 4: vm.InitializeResponse + (*SetStateRequest)(nil), // 5: vm.SetStateRequest + (*SetStateResponse)(nil), // 6: vm.SetStateResponse + (*CreateHandlersResponse)(nil), // 7: vm.CreateHandlersResponse + (*Handler)(nil), // 8: vm.Handler + (*BuildBlockRequest)(nil), // 9: vm.BuildBlockRequest + (*BuildBlockResponse)(nil), // 10: vm.BuildBlockResponse + (*ParseBlockRequest)(nil), // 11: vm.ParseBlockRequest + (*ParseBlockResponse)(nil), // 12: vm.ParseBlockResponse + (*GetBlockRequest)(nil), // 13: vm.GetBlockRequest + (*GetBlockResponse)(nil), // 14: vm.GetBlockResponse + (*SetPreferenceRequest)(nil), // 15: vm.SetPreferenceRequest + (*BlockVerifyRequest)(nil), // 16: vm.BlockVerifyRequest + (*BlockVerifyResponse)(nil), // 17: vm.BlockVerifyResponse + (*BlockAcceptRequest)(nil), // 18: vm.BlockAcceptRequest + (*BlockRejectRequest)(nil), // 19: vm.BlockRejectRequest + (*HealthResponse)(nil), // 20: vm.HealthResponse + (*VersionResponse)(nil), // 21: vm.VersionResponse + (*AppRequestMsg)(nil), // 22: vm.AppRequestMsg + (*AppRequestFailedMsg)(nil), // 23: vm.AppRequestFailedMsg + (*AppResponseMsg)(nil), // 24: vm.AppResponseMsg + (*AppGossipMsg)(nil), // 25: vm.AppGossipMsg + (*CrossChainAppRequestMsg)(nil), // 26: vm.CrossChainAppRequestMsg + (*CrossChainAppRequestFailedMsg)(nil), // 27: vm.CrossChainAppRequestFailedMsg + (*CrossChainAppResponseMsg)(nil), // 28: vm.CrossChainAppResponseMsg + (*ConnectedRequest)(nil), // 29: vm.ConnectedRequest + (*DisconnectedRequest)(nil), // 30: vm.DisconnectedRequest + (*GetAncestorsRequest)(nil), // 31: vm.GetAncestorsRequest + (*GetAncestorsResponse)(nil), // 32: vm.GetAncestorsResponse + (*BatchedParseBlockRequest)(nil), // 33: vm.BatchedParseBlockRequest + (*BatchedParseBlockResponse)(nil), // 34: vm.BatchedParseBlockResponse + (*GetBlockIDAtHeightRequest)(nil), // 35: vm.GetBlockIDAtHeightRequest + (*GetBlockIDAtHeightResponse)(nil), // 36: vm.GetBlockIDAtHeightResponse + (*GatherResponse)(nil), // 37: vm.GatherResponse + (*StateSyncEnabledResponse)(nil), // 38: vm.StateSyncEnabledResponse + (*GetOngoingSyncStateSummaryResponse)(nil), // 39: vm.GetOngoingSyncStateSummaryResponse + (*GetLastStateSummaryResponse)(nil), // 40: vm.GetLastStateSummaryResponse + (*ParseStateSummaryRequest)(nil), // 41: vm.ParseStateSummaryRequest + (*ParseStateSummaryResponse)(nil), // 42: vm.ParseStateSummaryResponse + (*GetStateSummaryRequest)(nil), // 43: vm.GetStateSummaryRequest + (*GetStateSummaryResponse)(nil), // 44: vm.GetStateSummaryResponse + (*StateSummaryAcceptRequest)(nil), // 45: vm.StateSummaryAcceptRequest + (*StateSummaryAcceptResponse)(nil), // 46: vm.StateSummaryAcceptResponse + (*timestamppb.Timestamp)(nil), // 47: google.protobuf.Timestamp + (*_go.MetricFamily)(nil), // 48: io.prometheus.client.MetricFamily + (*emptypb.Empty)(nil), // 49: google.protobuf.Empty } var file_vm_vm_proto_depIdxs = []int32{ - 48, // 0: vm.InitializeResponse.timestamp:type_name -> google.protobuf.Timestamp + 47, // 0: vm.InitializeResponse.timestamp:type_name -> google.protobuf.Timestamp 0, // 1: vm.SetStateRequest.state:type_name -> vm.State - 48, // 2: vm.SetStateResponse.timestamp:type_name -> google.protobuf.Timestamp - 9, // 3: vm.CreateHandlersResponse.handlers:type_name -> vm.Handler - 48, // 4: vm.BuildBlockResponse.timestamp:type_name -> google.protobuf.Timestamp - 1, // 5: vm.ParseBlockResponse.status:type_name -> vm.Status - 48, // 6: vm.ParseBlockResponse.timestamp:type_name -> google.protobuf.Timestamp - 1, // 7: vm.GetBlockResponse.status:type_name -> vm.Status - 48, // 8: vm.GetBlockResponse.timestamp:type_name -> google.protobuf.Timestamp - 2, // 9: vm.GetBlockResponse.err:type_name -> vm.Error - 48, // 10: vm.BlockVerifyResponse.timestamp:type_name -> google.protobuf.Timestamp - 48, // 11: vm.AppRequestMsg.deadline:type_name -> google.protobuf.Timestamp - 48, // 12: vm.CrossChainAppRequestMsg.deadline:type_name -> google.protobuf.Timestamp - 13, // 13: vm.BatchedParseBlockResponse.response:type_name -> vm.ParseBlockResponse - 2, // 14: vm.GetBlockIDAtHeightResponse.err:type_name -> vm.Error - 49, // 15: vm.GatherResponse.metric_families:type_name -> io.prometheus.client.MetricFamily - 2, // 16: vm.StateSyncEnabledResponse.err:type_name -> vm.Error - 2, // 17: vm.GetOngoingSyncStateSummaryResponse.err:type_name -> vm.Error - 2, // 18: vm.GetLastStateSummaryResponse.err:type_name -> vm.Error - 2, // 19: vm.ParseStateSummaryResponse.err:type_name -> vm.Error - 2, // 20: vm.GetStateSummaryResponse.err:type_name -> vm.Error - 3, // 21: vm.StateSummaryAcceptResponse.mode:type_name -> vm.StateSummaryAcceptResponse.Mode - 2, // 22: vm.StateSummaryAcceptResponse.err:type_name -> vm.Error - 4, // 23: vm.VM.Initialize:input_type -> vm.InitializeRequest - 6, // 24: vm.VM.SetState:input_type -> vm.SetStateRequest - 50, // 25: vm.VM.Shutdown:input_type -> google.protobuf.Empty - 50, // 26: vm.VM.CreateHandlers:input_type -> google.protobuf.Empty - 30, // 27: vm.VM.Connected:input_type -> vm.ConnectedRequest - 31, // 28: vm.VM.Disconnected:input_type -> vm.DisconnectedRequest - 10, // 29: vm.VM.BuildBlock:input_type -> vm.BuildBlockRequest - 12, // 30: vm.VM.ParseBlock:input_type -> vm.ParseBlockRequest - 14, // 31: vm.VM.GetBlock:input_type -> vm.GetBlockRequest - 16, // 32: vm.VM.SetPreference:input_type -> vm.SetPreferenceRequest - 50, // 33: vm.VM.Health:input_type -> google.protobuf.Empty - 50, // 34: vm.VM.Version:input_type -> google.protobuf.Empty - 23, // 35: vm.VM.AppRequest:input_type -> vm.AppRequestMsg - 24, // 36: vm.VM.AppRequestFailed:input_type -> vm.AppRequestFailedMsg - 25, // 37: vm.VM.AppResponse:input_type -> vm.AppResponseMsg - 26, // 38: vm.VM.AppGossip:input_type -> vm.AppGossipMsg - 50, // 39: vm.VM.Gather:input_type -> google.protobuf.Empty - 27, // 40: vm.VM.CrossChainAppRequest:input_type -> vm.CrossChainAppRequestMsg - 28, // 41: vm.VM.CrossChainAppRequestFailed:input_type -> vm.CrossChainAppRequestFailedMsg - 29, // 42: vm.VM.CrossChainAppResponse:input_type -> vm.CrossChainAppResponseMsg - 32, // 43: vm.VM.GetAncestors:input_type -> vm.GetAncestorsRequest - 34, // 44: vm.VM.BatchedParseBlock:input_type -> vm.BatchedParseBlockRequest - 36, // 45: vm.VM.GetBlockIDAtHeight:input_type -> vm.GetBlockIDAtHeightRequest - 50, // 46: vm.VM.StateSyncEnabled:input_type -> google.protobuf.Empty - 50, // 47: vm.VM.GetOngoingSyncStateSummary:input_type -> google.protobuf.Empty - 50, // 48: vm.VM.GetLastStateSummary:input_type -> google.protobuf.Empty - 42, // 49: vm.VM.ParseStateSummary:input_type -> vm.ParseStateSummaryRequest - 44, // 50: vm.VM.GetStateSummary:input_type -> vm.GetStateSummaryRequest - 17, // 51: vm.VM.BlockVerify:input_type -> vm.BlockVerifyRequest - 19, // 52: vm.VM.BlockAccept:input_type -> vm.BlockAcceptRequest - 20, // 53: vm.VM.BlockReject:input_type -> vm.BlockRejectRequest - 46, // 54: vm.VM.StateSummaryAccept:input_type -> vm.StateSummaryAcceptRequest - 5, // 55: vm.VM.Initialize:output_type -> vm.InitializeResponse - 7, // 56: vm.VM.SetState:output_type -> vm.SetStateResponse - 50, // 57: vm.VM.Shutdown:output_type -> google.protobuf.Empty - 8, // 58: vm.VM.CreateHandlers:output_type -> vm.CreateHandlersResponse - 50, // 59: vm.VM.Connected:output_type -> google.protobuf.Empty - 50, // 60: vm.VM.Disconnected:output_type -> google.protobuf.Empty - 11, // 61: vm.VM.BuildBlock:output_type -> vm.BuildBlockResponse - 13, // 62: vm.VM.ParseBlock:output_type -> vm.ParseBlockResponse - 15, // 63: vm.VM.GetBlock:output_type -> vm.GetBlockResponse - 50, // 64: vm.VM.SetPreference:output_type -> google.protobuf.Empty - 21, // 65: vm.VM.Health:output_type -> vm.HealthResponse - 22, // 66: vm.VM.Version:output_type -> vm.VersionResponse - 50, // 67: vm.VM.AppRequest:output_type -> google.protobuf.Empty - 50, // 68: vm.VM.AppRequestFailed:output_type -> google.protobuf.Empty - 50, // 69: vm.VM.AppResponse:output_type -> google.protobuf.Empty - 50, // 70: vm.VM.AppGossip:output_type -> google.protobuf.Empty - 38, // 71: vm.VM.Gather:output_type -> vm.GatherResponse - 50, // 72: vm.VM.CrossChainAppRequest:output_type -> google.protobuf.Empty - 50, // 73: vm.VM.CrossChainAppRequestFailed:output_type -> google.protobuf.Empty - 50, // 74: vm.VM.CrossChainAppResponse:output_type -> google.protobuf.Empty - 33, // 75: vm.VM.GetAncestors:output_type -> vm.GetAncestorsResponse - 35, // 76: vm.VM.BatchedParseBlock:output_type -> vm.BatchedParseBlockResponse - 37, // 77: vm.VM.GetBlockIDAtHeight:output_type -> vm.GetBlockIDAtHeightResponse - 39, // 78: vm.VM.StateSyncEnabled:output_type -> vm.StateSyncEnabledResponse - 40, // 79: vm.VM.GetOngoingSyncStateSummary:output_type -> vm.GetOngoingSyncStateSummaryResponse - 41, // 80: vm.VM.GetLastStateSummary:output_type -> vm.GetLastStateSummaryResponse - 43, // 81: vm.VM.ParseStateSummary:output_type -> vm.ParseStateSummaryResponse - 45, // 82: vm.VM.GetStateSummary:output_type -> vm.GetStateSummaryResponse - 18, // 83: vm.VM.BlockVerify:output_type -> vm.BlockVerifyResponse - 50, // 84: vm.VM.BlockAccept:output_type -> google.protobuf.Empty - 50, // 85: vm.VM.BlockReject:output_type -> google.protobuf.Empty - 47, // 86: vm.VM.StateSummaryAccept:output_type -> vm.StateSummaryAcceptResponse - 55, // [55:87] is the sub-list for method output_type - 23, // [23:55] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 47, // 2: vm.SetStateResponse.timestamp:type_name -> google.protobuf.Timestamp + 8, // 3: vm.CreateHandlersResponse.handlers:type_name -> vm.Handler + 47, // 4: vm.BuildBlockResponse.timestamp:type_name -> google.protobuf.Timestamp + 47, // 5: vm.ParseBlockResponse.timestamp:type_name -> google.protobuf.Timestamp + 47, // 6: vm.GetBlockResponse.timestamp:type_name -> google.protobuf.Timestamp + 1, // 7: vm.GetBlockResponse.err:type_name -> vm.Error + 47, // 8: vm.BlockVerifyResponse.timestamp:type_name -> google.protobuf.Timestamp + 47, // 9: vm.AppRequestMsg.deadline:type_name -> google.protobuf.Timestamp + 47, // 10: vm.CrossChainAppRequestMsg.deadline:type_name -> google.protobuf.Timestamp + 12, // 11: vm.BatchedParseBlockResponse.response:type_name -> vm.ParseBlockResponse + 1, // 12: vm.GetBlockIDAtHeightResponse.err:type_name -> vm.Error + 48, // 13: vm.GatherResponse.metric_families:type_name -> io.prometheus.client.MetricFamily + 1, // 14: vm.StateSyncEnabledResponse.err:type_name -> vm.Error + 1, // 15: vm.GetOngoingSyncStateSummaryResponse.err:type_name -> vm.Error + 1, // 16: vm.GetLastStateSummaryResponse.err:type_name -> vm.Error + 1, // 17: vm.ParseStateSummaryResponse.err:type_name -> vm.Error + 1, // 18: vm.GetStateSummaryResponse.err:type_name -> vm.Error + 2, // 19: vm.StateSummaryAcceptResponse.mode:type_name -> vm.StateSummaryAcceptResponse.Mode + 1, // 20: vm.StateSummaryAcceptResponse.err:type_name -> vm.Error + 3, // 21: vm.VM.Initialize:input_type -> vm.InitializeRequest + 5, // 22: vm.VM.SetState:input_type -> vm.SetStateRequest + 49, // 23: vm.VM.Shutdown:input_type -> google.protobuf.Empty + 49, // 24: vm.VM.CreateHandlers:input_type -> google.protobuf.Empty + 29, // 25: vm.VM.Connected:input_type -> vm.ConnectedRequest + 30, // 26: vm.VM.Disconnected:input_type -> vm.DisconnectedRequest + 9, // 27: vm.VM.BuildBlock:input_type -> vm.BuildBlockRequest + 11, // 28: vm.VM.ParseBlock:input_type -> vm.ParseBlockRequest + 13, // 29: vm.VM.GetBlock:input_type -> vm.GetBlockRequest + 15, // 30: vm.VM.SetPreference:input_type -> vm.SetPreferenceRequest + 49, // 31: vm.VM.Health:input_type -> google.protobuf.Empty + 49, // 32: vm.VM.Version:input_type -> google.protobuf.Empty + 22, // 33: vm.VM.AppRequest:input_type -> vm.AppRequestMsg + 23, // 34: vm.VM.AppRequestFailed:input_type -> vm.AppRequestFailedMsg + 24, // 35: vm.VM.AppResponse:input_type -> vm.AppResponseMsg + 25, // 36: vm.VM.AppGossip:input_type -> vm.AppGossipMsg + 49, // 37: vm.VM.Gather:input_type -> google.protobuf.Empty + 26, // 38: vm.VM.CrossChainAppRequest:input_type -> vm.CrossChainAppRequestMsg + 27, // 39: vm.VM.CrossChainAppRequestFailed:input_type -> vm.CrossChainAppRequestFailedMsg + 28, // 40: vm.VM.CrossChainAppResponse:input_type -> vm.CrossChainAppResponseMsg + 31, // 41: vm.VM.GetAncestors:input_type -> vm.GetAncestorsRequest + 33, // 42: vm.VM.BatchedParseBlock:input_type -> vm.BatchedParseBlockRequest + 35, // 43: vm.VM.GetBlockIDAtHeight:input_type -> vm.GetBlockIDAtHeightRequest + 49, // 44: vm.VM.StateSyncEnabled:input_type -> google.protobuf.Empty + 49, // 45: vm.VM.GetOngoingSyncStateSummary:input_type -> google.protobuf.Empty + 49, // 46: vm.VM.GetLastStateSummary:input_type -> google.protobuf.Empty + 41, // 47: vm.VM.ParseStateSummary:input_type -> vm.ParseStateSummaryRequest + 43, // 48: vm.VM.GetStateSummary:input_type -> vm.GetStateSummaryRequest + 16, // 49: vm.VM.BlockVerify:input_type -> vm.BlockVerifyRequest + 18, // 50: vm.VM.BlockAccept:input_type -> vm.BlockAcceptRequest + 19, // 51: vm.VM.BlockReject:input_type -> vm.BlockRejectRequest + 45, // 52: vm.VM.StateSummaryAccept:input_type -> vm.StateSummaryAcceptRequest + 4, // 53: vm.VM.Initialize:output_type -> vm.InitializeResponse + 6, // 54: vm.VM.SetState:output_type -> vm.SetStateResponse + 49, // 55: vm.VM.Shutdown:output_type -> google.protobuf.Empty + 7, // 56: vm.VM.CreateHandlers:output_type -> vm.CreateHandlersResponse + 49, // 57: vm.VM.Connected:output_type -> google.protobuf.Empty + 49, // 58: vm.VM.Disconnected:output_type -> google.protobuf.Empty + 10, // 59: vm.VM.BuildBlock:output_type -> vm.BuildBlockResponse + 12, // 60: vm.VM.ParseBlock:output_type -> vm.ParseBlockResponse + 14, // 61: vm.VM.GetBlock:output_type -> vm.GetBlockResponse + 49, // 62: vm.VM.SetPreference:output_type -> google.protobuf.Empty + 20, // 63: vm.VM.Health:output_type -> vm.HealthResponse + 21, // 64: vm.VM.Version:output_type -> vm.VersionResponse + 49, // 65: vm.VM.AppRequest:output_type -> google.protobuf.Empty + 49, // 66: vm.VM.AppRequestFailed:output_type -> google.protobuf.Empty + 49, // 67: vm.VM.AppResponse:output_type -> google.protobuf.Empty + 49, // 68: vm.VM.AppGossip:output_type -> google.protobuf.Empty + 37, // 69: vm.VM.Gather:output_type -> vm.GatherResponse + 49, // 70: vm.VM.CrossChainAppRequest:output_type -> google.protobuf.Empty + 49, // 71: vm.VM.CrossChainAppRequestFailed:output_type -> google.protobuf.Empty + 49, // 72: vm.VM.CrossChainAppResponse:output_type -> google.protobuf.Empty + 32, // 73: vm.VM.GetAncestors:output_type -> vm.GetAncestorsResponse + 34, // 74: vm.VM.BatchedParseBlock:output_type -> vm.BatchedParseBlockResponse + 36, // 75: vm.VM.GetBlockIDAtHeight:output_type -> vm.GetBlockIDAtHeightResponse + 38, // 76: vm.VM.StateSyncEnabled:output_type -> vm.StateSyncEnabledResponse + 39, // 77: vm.VM.GetOngoingSyncStateSummary:output_type -> vm.GetOngoingSyncStateSummaryResponse + 40, // 78: vm.VM.GetLastStateSummary:output_type -> vm.GetLastStateSummaryResponse + 42, // 79: vm.VM.ParseStateSummary:output_type -> vm.ParseStateSummaryResponse + 44, // 80: vm.VM.GetStateSummary:output_type -> vm.GetStateSummaryResponse + 17, // 81: vm.VM.BlockVerify:output_type -> vm.BlockVerifyResponse + 49, // 82: vm.VM.BlockAccept:output_type -> google.protobuf.Empty + 49, // 83: vm.VM.BlockReject:output_type -> google.protobuf.Empty + 46, // 84: vm.VM.StateSummaryAccept:output_type -> vm.StateSummaryAcceptResponse + 53, // [53:85] is the sub-list for method output_type + 21, // [21:53] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_vm_vm_proto_init() } @@ -4131,7 +4049,7 @@ func file_vm_vm_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_vm_vm_proto_rawDesc, - NumEnums: 4, + NumEnums: 3, NumMessages: 44, NumExtensions: 0, NumServices: 1, diff --git a/proto/vm/vm.proto b/proto/vm/vm.proto index 038744d4e2d5..11dd0429c8d6 100644 --- a/proto/vm/vm.proto +++ b/proto/vm/vm.proto @@ -88,13 +88,6 @@ enum State { STATE_NORMAL_OP = 3; } -enum Status { - STATUS_UNSPECIFIED = 0; - STATUS_PROCESSING = 1; - STATUS_REJECTED = 2; - STATUS_ACCEPTED = 3; -} - enum Error { // ERROR_UNSPECIFIED is used to indicate that no error occurred. ERROR_UNSPECIFIED = 0; @@ -177,7 +170,6 @@ message ParseBlockRequest { message ParseBlockResponse { bytes id = 1; bytes parent_id = 2; - Status status = 3; uint64 height = 4; google.protobuf.Timestamp timestamp = 5; bool verify_with_context = 6; @@ -190,7 +182,6 @@ message GetBlockRequest { message GetBlockResponse { bytes parent_id = 1; bytes bytes = 2; - Status status = 3; uint64 height = 4; google.protobuf.Timestamp timestamp = 5; // used to propagate database.ErrNotFound through RPC diff --git a/snow/consensus/snowman/block.go b/snow/consensus/snowman/block.go index c950ac3c29ee..4f2c851717cd 100644 --- a/snow/consensus/snowman/block.go +++ b/snow/consensus/snowman/block.go @@ -8,7 +8,7 @@ import ( "time" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" + "github.com/ava-labs/avalanchego/snow" ) // Block is a possible decision that dictates the next canonical block. @@ -22,7 +22,7 @@ import ( // If the status of the block is Accepted or Rejected; Parent, Verify, Accept, // and Reject will never be called. type Block interface { - choices.Decidable + snow.Decidable // Parent returns the ID of this block's parent. Parent() ids.ID diff --git a/snow/consensus/snowman/consensus_test.go b/snow/consensus/snowman/consensus_test.go index 1de19a0b2df4..bbeda976698b 100644 --- a/snow/consensus/snowman/consensus_test.go +++ b/snow/consensus/snowman/consensus_test.go @@ -17,7 +17,6 @@ import ( "gonum.org/v1/gonum/mathext/prng" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowball" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/snowtest" @@ -251,9 +250,9 @@ func AddOnUnknownParentTest(t *testing.T, factory Factory) { )) block := &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.GenerateTestID(), - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.GenerateTestID(), + Status: snowtest.Undecided, }, ParentV: ids.GenerateTestID(), HeightV: snowmantest.GenesisHeight + 2, @@ -289,7 +288,7 @@ func StatusOrProcessingPreviouslyAcceptedTest(t *testing.T, factory Factory) { snowmantest.GenesisTimestamp, )) - require.Equal(choices.Accepted, snowmantest.Genesis.Status()) + require.Equal(snowtest.Accepted, snowmantest.Genesis.Status) require.False(sm.Processing(snowmantest.Genesis.ID())) require.True(sm.IsPreferred(snowmantest.Genesis.ID())) @@ -326,7 +325,7 @@ func StatusOrProcessingPreviouslyRejectedTest(t *testing.T, factory Factory) { block := snowmantest.BuildChild(snowmantest.Genesis) require.NoError(block.Reject(context.Background())) - require.Equal(choices.Rejected, block.Status()) + require.Equal(snowtest.Rejected, block.Status) require.False(sm.Processing(block.ID())) require.False(sm.IsPreferred(block.ID())) @@ -361,7 +360,7 @@ func StatusOrProcessingUnissuedTest(t *testing.T, factory Factory) { block := snowmantest.BuildChild(snowmantest.Genesis) - require.Equal(choices.Processing, block.Status()) + require.Equal(snowtest.Undecided, block.Status) require.False(sm.Processing(block.ID())) require.False(sm.IsPreferred(block.ID())) @@ -397,7 +396,7 @@ func StatusOrProcessingIssuedTest(t *testing.T, factory Factory) { block := snowmantest.BuildChild(snowmantest.Genesis) require.NoError(sm.Add(block)) - require.Equal(choices.Processing, block.Status()) + require.Equal(snowtest.Undecided, block.Status) require.True(sm.Processing(block.ID())) require.True(sm.IsPreferred(block.ID())) @@ -439,12 +438,12 @@ func RecordPollAcceptSingleBlockTest(t *testing.T, factory Factory) { require.NoError(sm.RecordPoll(context.Background(), votes)) require.Equal(block.ID(), sm.Preference()) require.Equal(1, sm.NumProcessing()) - require.Equal(choices.Processing, block.Status()) + require.Equal(snowtest.Undecided, block.Status) require.NoError(sm.RecordPoll(context.Background(), votes)) require.Equal(block.ID(), sm.Preference()) require.Zero(sm.NumProcessing()) - require.Equal(choices.Accepted, block.Status()) + require.Equal(snowtest.Accepted, block.Status) } func RecordPollAcceptAndRejectTest(t *testing.T, factory Factory) { @@ -483,14 +482,14 @@ func RecordPollAcceptAndRejectTest(t *testing.T, factory Factory) { require.NoError(sm.RecordPoll(context.Background(), votes)) require.Equal(firstBlock.ID(), sm.Preference()) require.Equal(2, sm.NumProcessing()) - require.Equal(choices.Processing, firstBlock.Status()) - require.Equal(choices.Processing, secondBlock.Status()) + require.Equal(snowtest.Undecided, firstBlock.Status) + require.Equal(snowtest.Undecided, secondBlock.Status) require.NoError(sm.RecordPoll(context.Background(), votes)) require.Equal(firstBlock.ID(), sm.Preference()) require.Zero(sm.NumProcessing()) - require.Equal(choices.Accepted, firstBlock.Status()) - require.Equal(choices.Rejected, secondBlock.Status()) + require.Equal(snowtest.Accepted, firstBlock.Status) + require.Equal(snowtest.Rejected, secondBlock.Status) } func RecordPollSplitVoteNoChangeTest(t *testing.T, factory Factory) { @@ -628,9 +627,9 @@ func RecordPollRejectTransitivelyTest(t *testing.T, factory Factory) { require.Zero(sm.NumProcessing()) require.Equal(block0.ID(), sm.Preference()) - require.Equal(choices.Accepted, block0.Status()) - require.Equal(choices.Rejected, block1.Status()) - require.Equal(choices.Rejected, block2.Status()) + require.Equal(snowtest.Accepted, block0.Status) + require.Equal(snowtest.Rejected, block1.Status) + require.Equal(snowtest.Rejected, block2.Status) } func RecordPollTransitivelyResetConfidenceTest(t *testing.T, factory Factory) { @@ -697,10 +696,10 @@ func RecordPollTransitivelyResetConfidenceTest(t *testing.T, factory Factory) { require.NoError(sm.RecordPoll(context.Background(), votesFor3)) require.Zero(sm.NumProcessing()) require.Equal(block3.ID(), sm.Preference()) - require.Equal(choices.Rejected, block0.Status()) - require.Equal(choices.Accepted, block1.Status()) - require.Equal(choices.Rejected, block2.Status()) - require.Equal(choices.Accepted, block3.Status()) + require.Equal(snowtest.Rejected, block0.Status) + require.Equal(snowtest.Accepted, block1.Status) + require.Equal(snowtest.Rejected, block2.Status) + require.Equal(snowtest.Accepted, block3.Status) } func RecordPollInvalidVoteTest(t *testing.T, factory Factory) { @@ -803,11 +802,11 @@ func RecordPollTransitiveVotingTest(t *testing.T, factory Factory) { require.Equal(4, sm.NumProcessing()) require.Equal(block2.ID(), sm.Preference()) - require.Equal(choices.Accepted, block0.Status()) - require.Equal(choices.Processing, block1.Status()) - require.Equal(choices.Processing, block2.Status()) - require.Equal(choices.Processing, block3.Status()) - require.Equal(choices.Processing, block4.Status()) + require.Equal(snowtest.Accepted, block0.Status) + require.Equal(snowtest.Undecided, block1.Status) + require.Equal(snowtest.Undecided, block2.Status) + require.Equal(snowtest.Undecided, block3.Status) + require.Equal(snowtest.Undecided, block4.Status) dep2_2_2 := bag.Of(block2.ID(), block2.ID(), block2.ID()) require.NoError(sm.RecordPoll(context.Background(), dep2_2_2)) @@ -818,11 +817,11 @@ func RecordPollTransitiveVotingTest(t *testing.T, factory Factory) { require.Zero(sm.NumProcessing()) require.Equal(block2.ID(), sm.Preference()) - require.Equal(choices.Accepted, block0.Status()) - require.Equal(choices.Accepted, block1.Status()) - require.Equal(choices.Accepted, block2.Status()) - require.Equal(choices.Rejected, block3.Status()) - require.Equal(choices.Rejected, block4.Status()) + require.Equal(snowtest.Accepted, block0.Status) + require.Equal(snowtest.Accepted, block1.Status) + require.Equal(snowtest.Accepted, block2.Status) + require.Equal(snowtest.Rejected, block3.Status) + require.Equal(snowtest.Rejected, block4.Status) } func RecordPollDivergedVotingWithNoConflictingBitTest(t *testing.T, factory Factory) { @@ -850,25 +849,25 @@ func RecordPollDivergedVotingWithNoConflictingBitTest(t *testing.T, factory Fact )) block0 := &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.ID{0x06}, // 0110 - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.ID{0x06}, // 0110 + Status: snowtest.Undecided, }, ParentV: snowmantest.GenesisID, HeightV: snowmantest.GenesisHeight + 1, } block1 := &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.ID{0x08}, // 0001 - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.ID{0x08}, // 0001 + Status: snowtest.Undecided, }, ParentV: snowmantest.GenesisID, HeightV: snowmantest.GenesisHeight + 1, } block2 := &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.ID{0x01}, // 1000 - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.ID{0x01}, // 1000 + Status: snowtest.Undecided, }, ParentV: snowmantest.GenesisID, HeightV: snowmantest.GenesisHeight + 1, @@ -896,10 +895,10 @@ func RecordPollDivergedVotingWithNoConflictingBitTest(t *testing.T, factory Fact require.NoError(sm.Add(block3)) require.Equal(block0.ID(), sm.Preference()) - require.Equal(choices.Processing, block0.Status(), "should not be decided yet") - require.Equal(choices.Processing, block1.Status(), "should not be decided yet") - require.Equal(choices.Processing, block2.Status(), "should not be decided yet") - require.Equal(choices.Processing, block3.Status(), "should not be decided yet") + require.Equal(snowtest.Undecided, block0.Status, "should not be decided yet") + require.Equal(snowtest.Undecided, block1.Status, "should not be decided yet") + require.Equal(snowtest.Undecided, block2.Status, "should not be decided yet") + require.Equal(snowtest.Undecided, block3.Status, "should not be decided yet") // Current graph structure: // G @@ -921,10 +920,10 @@ func RecordPollDivergedVotingWithNoConflictingBitTest(t *testing.T, factory Fact require.NoError(sm.RecordPoll(context.Background(), votes3)) require.Equal(4, sm.NumProcessing()) - require.Equal(choices.Processing, block0.Status()) - require.Equal(choices.Processing, block1.Status()) - require.Equal(choices.Processing, block2.Status()) - require.Equal(choices.Processing, block3.Status()) + require.Equal(snowtest.Undecided, block0.Status) + require.Equal(snowtest.Undecided, block1.Status) + require.Equal(snowtest.Undecided, block2.Status) + require.Equal(snowtest.Undecided, block3.Status) } func RecordPollChangePreferredChainTest(t *testing.T, factory Factory) { @@ -1462,7 +1461,7 @@ func RecordPollRegressionCalculateInDegreeIndegreeCalculation(t *testing.T, fact votes.AddCount(blk2.ID(), 1) votes.AddCount(blk3.ID(), 2) require.NoError(sm.RecordPoll(context.Background(), votes)) - require.Equal(choices.Accepted, blk1.Status()) - require.Equal(choices.Accepted, blk2.Status()) - require.Equal(choices.Accepted, blk3.Status()) + require.Equal(snowtest.Accepted, blk1.Status) + require.Equal(snowtest.Accepted, blk2.Status) + require.Equal(snowtest.Accepted, blk3.Status) } diff --git a/snow/consensus/snowman/metrics.go b/snow/consensus/snowman/metrics.go index bab57e5c371d..72409063f044 100644 --- a/snow/consensus/snowman/metrics.go +++ b/snow/consensus/snowman/metrics.go @@ -10,7 +10,6 @@ import ( "go.uber.org/zap" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/utils/linked" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/metric" @@ -184,7 +183,7 @@ func (m *metrics) Accepted( if !ok { m.log.Error("unable to measure latency", zap.Stringer("blkID", blkID), - zap.Stringer("status", choices.Accepted), + zap.String("status", "accepted"), ) return } @@ -210,7 +209,7 @@ func (m *metrics) Rejected(blkID ids.ID, pollNumber uint64, blockSize int) { if !ok { m.log.Error("unable to measure latency", zap.Stringer("blkID", blkID), - zap.Stringer("status", choices.Rejected), + zap.String("status", "rejected"), ) return } diff --git a/snow/consensus/snowman/network_test.go b/snow/consensus/snowman/network_test.go index 8c302ed5c7c6..27c9f411ae96 100644 --- a/snow/consensus/snowman/network_test.go +++ b/snow/consensus/snowman/network_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowball" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/snowtest" @@ -28,9 +27,9 @@ func NewNetwork(params snowball.Parameters, numColors int, rngSource sampler.Sou n := &Network{ params: params, colors: []*snowmantest.Block{{ - TestDecidable: choices.TestDecidable{ - IDV: ids.Empty.Prefix(rngSource.Uint64()), - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.Empty.Prefix(rngSource.Uint64()), + Status: snowtest.Undecided, }, ParentV: snowmantest.GenesisID, HeightV: snowmantest.GenesisHeight + 1, @@ -44,9 +43,9 @@ func NewNetwork(params snowball.Parameters, numColors int, rngSource sampler.Sou dependencyInd, _ := s.Next() dependency := n.colors[dependencyInd] n.colors = append(n.colors, &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.Empty.Prefix(rngSource.Uint64()), - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: ids.Empty.Prefix(rngSource.Uint64()), + Status: snowtest.Undecided, }, ParentV: dependency.IDV, HeightV: dependency.HeightV + 1, @@ -82,9 +81,9 @@ func (n *Network) AddNode(t testing.TB, sm Consensus) error { myDep = blk.Parent() } myBlock := &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: blk.ID(), - StatusV: blk.Status(), + Decidable: snowtest.Decidable{ + IDV: blk.ID(), + Status: blk.Status, }, ParentV: myDep, HeightV: blk.Height(), diff --git a/snow/consensus/snowman/snowmantest/block.go b/snow/consensus/snowman/snowmantest/block.go index d77ee9759136..19348532e54f 100644 --- a/snow/consensus/snowman/snowmantest/block.go +++ b/snow/consensus/snowman/snowmantest/block.go @@ -1,6 +1,8 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. +//go:build test + package snowmantest import ( @@ -9,7 +11,7 @@ import ( "time" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/utils" ) @@ -30,9 +32,9 @@ var ( func BuildChild(parent *Block) *Block { blkID := ids.GenerateTestID() return &Block{ - TestDecidable: choices.TestDecidable{ - IDV: blkID, - StatusV: choices.Processing, + Decidable: snowtest.Decidable{ + IDV: blkID, + Status: snowtest.Undecided, }, ParentV: parent.ID(), HeightV: parent.Height() + 1, @@ -47,9 +49,9 @@ func BuildChain(length int) []*Block { } genesis := &Block{ - TestDecidable: choices.TestDecidable{ - IDV: GenesisID, - StatusV: choices.Accepted, + Decidable: snowtest.Decidable{ + IDV: GenesisID, + Status: snowtest.Accepted, }, HeightV: GenesisHeight, TimestampV: GenesisTimestamp, @@ -68,7 +70,7 @@ func BuildDescendants(parent *Block, length int) []*Block { } type Block struct { - choices.TestDecidable + snowtest.Decidable ParentV ids.ID HeightV uint64 diff --git a/snow/consensus/snowman/snowmantest/engine.go b/snow/consensus/snowman/snowmantest/engine.go new file mode 100644 index 000000000000..954b6bbe7075 --- /dev/null +++ b/snow/consensus/snowman/snowmantest/engine.go @@ -0,0 +1,53 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build test + +package snowmantest + +import ( + "context" + + "github.com/ava-labs/avalanchego/database" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow/snowtest" +) + +func MakeLastAcceptedBlockF(blks ...[]*Block) func(context.Context) (ids.ID, error) { + return func(context.Context) (ids.ID, error) { + var ( + highestHeight uint64 + highestID ids.ID + ) + for _, blkSlice := range blks { + for _, blk := range blkSlice { + if blk.Status != snowtest.Accepted { + continue + } + + if height := blk.Height(); height >= highestHeight { + highestHeight = height + highestID = blk.ID() + } + } + } + return highestID, nil + } +} + +func MakeGetBlockIDAtHeightF(blks ...[]*Block) func(context.Context, uint64) (ids.ID, error) { + return func(_ context.Context, height uint64) (ids.ID, error) { + for _, blkSlice := range blks { + for _, blk := range blkSlice { + if blk.Status != snowtest.Accepted { + continue + } + + if height == blk.Height() { + return blk.ID(), nil + } + } + } + return ids.Empty, database.ErrNotFound + } +} diff --git a/snow/consensus/snowman/snowmantest/mock_block.go b/snow/consensus/snowman/snowmantest/mock_block.go index 4c1a4ae7beec..233e979e3a86 100644 --- a/snow/consensus/snowman/snowmantest/mock_block.go +++ b/snow/consensus/snowman/snowmantest/mock_block.go @@ -15,7 +15,6 @@ import ( time "time" ids "github.com/ava-labs/avalanchego/ids" - choices "github.com/ava-labs/avalanchego/snow/choices" gomock "go.uber.org/mock/gomock" ) @@ -126,20 +125,6 @@ func (mr *MockBlockMockRecorder) Reject(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reject", reflect.TypeOf((*MockBlock)(nil).Reject), arg0) } -// Status mocks base method. -func (m *MockBlock) Status() choices.Status { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Status") - ret0, _ := ret[0].(choices.Status) - return ret0 -} - -// Status indicates an expected call of Status. -func (mr *MockBlockMockRecorder) Status() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockBlock)(nil).Status)) -} - // Timestamp mocks base method. func (m *MockBlock) Timestamp() time.Time { m.ctrl.T.Helper() diff --git a/snow/consensus/snowman/snowmantest/require.go b/snow/consensus/snowman/snowmantest/require.go new file mode 100644 index 000000000000..5a5e5d09bf44 --- /dev/null +++ b/snow/consensus/snowman/snowmantest/require.go @@ -0,0 +1,18 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build test + +package snowmantest + +import ( + "github.com/stretchr/testify/require" + + "github.com/ava-labs/avalanchego/snow/snowtest" +) + +func RequireStatusIs(require *require.Assertions, status snowtest.Status, blks ...*Block) { + for i, blk := range blks { + require.Equal(status, blk.Status, i) + } +} diff --git a/snow/decidable.go b/snow/decidable.go new file mode 100644 index 000000000000..71665b883e5c --- /dev/null +++ b/snow/decidable.go @@ -0,0 +1,33 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snow + +import ( + "context" + + "github.com/ava-labs/avalanchego/ids" +) + +// Decidable represents element that can be decided. +// +// Decidable objects are typically thought of as either transactions, blocks, or +// vertices. +type Decidable interface { + // ID returns a unique ID for this element. + // + // Typically, this is implemented by using a cryptographic hash of a + // binary representation of this element. An element should return the same + // IDs upon repeated calls. + ID() ids.ID + + // Accept this element. + // + // This element will be accepted by every correct node in the network. + Accept(context.Context) error + + // Reject this element. + // + // This element will not be accepted by any correct node in the network. + Reject(context.Context) error +} diff --git a/snow/engine/snowman/bootstrap/bootstrapper_test.go b/snow/engine/snowman/bootstrap/bootstrapper_test.go index 5577f62fa81d..325b7d2221de 100644 --- a/snow/engine/snowman/bootstrap/bootstrapper_test.go +++ b/snow/engine/snowman/bootstrap/bootstrapper_test.go @@ -18,7 +18,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/network/p2p" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/common" @@ -155,9 +154,9 @@ func TestBootstrapperStartsOnlyIfEnoughStakeIsConnected(t *testing.T) { } vm.CantLastAccepted = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, blkID) return snowmantest.Genesis, nil @@ -276,7 +275,7 @@ func TestBootstrapperUnknownByzantineResponse(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, requestID, blocksToBytes(blks[1:2]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.startSyncing(context.Background(), blocksToIDs(blks[1:2]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) @@ -325,7 +324,7 @@ func TestBootstrapperPartialFetch(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, requestID, blocksToBytes(blks[1:2]))) // respond with blk1 require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.startSyncing(context.Background(), blocksToIDs(blks[3:4]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) @@ -377,7 +376,7 @@ func TestBootstrapperEmptyResponse(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), requestedNodeID, requestID, blocksToBytes(blks[1:2]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) } // There are multiple needed blocks and Ancestors returns all at once @@ -420,7 +419,7 @@ func TestBootstrapperAncestors(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, requestID, blocksToBytes(blks))) // respond with all the blocks require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.startSyncing(context.Background(), blocksToIDs(blks[3:4]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) @@ -462,7 +461,7 @@ func TestBootstrapperFinalized(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, reqIDBlk2, blocksToBytes(blks[1:3]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.startSyncing(context.Background(), blocksToIDs(blks[2:3]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) @@ -518,12 +517,12 @@ func TestRestartBootstrapping(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, blk1RequestID, blocksToBytes(blks[1:2]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - require.Equal(choices.Accepted, blks[0].Status()) - requireStatusIs(require, blks[1:], choices.Processing) + require.Equal(snowtest.Accepted, blks[0].Status) + snowmantest.RequireStatusIs(require, snowtest.Undecided, blks[1:]...) require.NoError(bs.Ancestors(context.Background(), peerID, blk4RequestID, blocksToBytes(blks[4:5]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.startSyncing(context.Background(), blocksToIDs(blks[4:5]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) @@ -537,7 +536,7 @@ func TestBootstrapOldBlockAfterStateSync(t *testing.T) { blks := snowmantest.BuildChain(2) initializeVMWithBlockchain(vm, blks) - blks[0].StatusV = choices.Processing + blks[0].Status = snowtest.Undecided require.NoError(blks[1].Accept(context.Background())) bs, err := New( @@ -568,8 +567,8 @@ func TestBootstrapOldBlockAfterStateSync(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, reqID, blocksToBytes(blks[0:1]))) require.Equal(snow.NormalOp, config.Ctx.State.Get().State) - require.Equal(choices.Processing, blks[0].Status()) - require.Equal(choices.Accepted, blks[1].Status()) + require.Equal(snowtest.Undecided, blks[0].Status) + require.Equal(snowtest.Accepted, blks[1].Status) } func TestBootstrapContinueAfterHalt(t *testing.T) { @@ -736,7 +735,7 @@ func TestBootstrapperReceiveStaleAncestorsMessage(t *testing.T) { require.NoError(bs.Ancestors(context.Background(), peerID, reqIDBlk2, blocksToBytes(blks[1:3]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) - requireStatusIs(require, blks, choices.Accepted) + snowmantest.RequireStatusIs(require, snowtest.Accepted, blks...) require.NoError(bs.Ancestors(context.Background(), peerID, reqIDBlk1, blocksToBytes(blks[1:2]))) require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State) @@ -750,7 +749,7 @@ func TestBootstrapperRollbackOnSetState(t *testing.T) { blks := snowmantest.BuildChain(2) initializeVMWithBlockchain(vm, blks) - blks[1].StatusV = choices.Accepted + blks[1].Status = snowtest.Accepted bs, err := New( config, @@ -765,7 +764,7 @@ func TestBootstrapperRollbackOnSetState(t *testing.T) { require.NoError(err) vm.SetStateF = func(context.Context, snow.State) error { - blks[1].StatusV = choices.Processing + blks[1].Status = snowtest.Undecided return nil } @@ -775,23 +774,12 @@ func TestBootstrapperRollbackOnSetState(t *testing.T) { func initializeVMWithBlockchain(vm *block.TestVM, blocks []*snowmantest.Block) { vm.CantSetState = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - var ( - lastAcceptedID ids.ID - lastAcceptedHeight uint64 - ) - for _, blk := range blocks { - height := blk.Height() - if blk.Status() == choices.Accepted && height >= lastAcceptedHeight { - lastAcceptedID = blk.ID() - lastAcceptedHeight = height - } - } - return lastAcceptedID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + blocks, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { for _, blk := range blocks { - if blk.Status() == choices.Accepted && blk.ID() == blkID { + if blk.Status == snowtest.Accepted && blk.ID() == blkID { return blk, nil } } @@ -807,12 +795,6 @@ func initializeVMWithBlockchain(vm *block.TestVM, blocks []*snowmantest.Block) { } } -func requireStatusIs(require *require.Assertions, blocks []*snowmantest.Block, status choices.Status) { - for i, blk := range blocks { - require.Equal(status, blk.Status(), i) - } -} - func blocksToIDs(blocks []*snowmantest.Block) []ids.ID { blkIDs := make([]ids.ID, len(blocks)) for i, blk := range blocks { diff --git a/snow/engine/snowman/bootstrap/storage_test.go b/snow/engine/snowman/bootstrap/storage_test.go index a4373f3bbfdf..44ac1621226d 100644 --- a/snow/engine/snowman/bootstrap/storage_test.go +++ b/snow/engine/snowman/bootstrap/storage_test.go @@ -13,12 +13,12 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/database/memdb" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/snow/engine/snowman/bootstrap/interval" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/set" ) @@ -277,10 +277,10 @@ func TestExecute(t *testing.T) { test.lastAcceptedHeight, )) for _, height := range test.expectedProcessingHeights { - require.Equal(choices.Processing, blocks[height].Status()) + require.Equal(snowtest.Undecided, blocks[height].Status) } for _, height := range test.expectedAcceptedHeights { - require.Equal(choices.Accepted, blocks[height].Status()) + require.Equal(snowtest.Accepted, blocks[height].Status) } if test.haltable.Halted() { diff --git a/snow/engine/snowman/getter/getter.go b/snow/engine/snowman/getter/getter.go index b501aeef2680..7af3d3a2263e 100644 --- a/snow/engine/snowman/getter/getter.go +++ b/snow/engine/snowman/getter/getter.go @@ -11,7 +11,6 @@ import ( "go.uber.org/zap" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/utils/constants" @@ -148,10 +147,34 @@ func (gh *getter) GetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, re } func (gh *getter) GetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs set.Set[ids.ID]) error { + lastAcceptedID, err := gh.vm.LastAccepted(ctx) + if err != nil { + return err + } + lastAccepted, err := gh.vm.GetBlock(ctx, lastAcceptedID) + if err != nil { + return err + } + lastAcceptedHeight := lastAccepted.Height() + acceptedIDs := make([]ids.ID, 0, containerIDs.Len()) for blkID := range containerIDs { blk, err := gh.vm.GetBlock(ctx, blkID) - if err == nil && blk.Status() == choices.Accepted { + if err != nil { + continue + } + + height := blk.Height() + if height > lastAcceptedHeight { + continue + } + + acceptedBlkID, err := gh.vm.GetBlockIDAtHeight(ctx, height) + if err != nil { + continue + } + + if blkID == acceptedBlkID { acceptedIDs = append(acceptedIDs, blkID) } } diff --git a/snow/engine/snowman/getter/getter_test.go b/snow/engine/snowman/getter/getter_test.go index cf58841b9581..6d1324cb2a32 100644 --- a/snow/engine/snowman/getter/getter_test.go +++ b/snow/engine/snowman/getter/getter_test.go @@ -80,20 +80,25 @@ func TestFilterAccepted(t *testing.T) { acceptedBlk := snowmantest.BuildChild(snowmantest.Genesis) require.NoError(acceptedBlk.Accept(context.Background())) - unknownBlkID := ids.GenerateTestID() + var ( + allBlocks = []*snowmantest.Block{ + snowmantest.Genesis, + acceptedBlk, + } + unknownBlkID = ids.GenerateTestID() + ) + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF(allBlocks) + vm.GetBlockIDAtHeightF = snowmantest.MakeGetBlockIDAtHeightF(allBlocks) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { - switch blkID { - case snowmantest.GenesisID: - return snowmantest.Genesis, nil - case acceptedBlk.ID(): - return acceptedBlk, nil - case unknownBlkID: - return nil, errUnknownBlock - default: - require.FailNow(errUnknownBlock.Error()) - return nil, errUnknownBlock + for _, blk := range allBlocks { + if blk.ID() == blkID { + return blk, nil + } } + + require.Equal(unknownBlkID, blkID) + return nil, errUnknownBlock } var accepted []ids.ID diff --git a/snow/engine/snowman/transitive_test.go b/snow/engine/snowman/transitive_test.go index cfbe04c47a32..5badebb2162a 100644 --- a/snow/engine/snowman/transitive_test.go +++ b/snow/engine/snowman/transitive_test.go @@ -18,7 +18,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowball" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" @@ -65,22 +64,6 @@ func MakeParseBlockF(blks ...[]*snowmantest.Block) func(context.Context, []byte) } } -func MakeLastAcceptedBlockF(defaultBlk *snowmantest.Block, blks ...[]*snowmantest.Block) func(context.Context) (ids.ID, error) { - return func(_ context.Context) (ids.ID, error) { - highestHeight := defaultBlk.Height() - highestID := defaultBlk.ID() - for _, blkSet := range blks { - for _, blk := range blkSet { - if blk.Status() == choices.Accepted && blk.Height() > highestHeight { - highestHeight = blk.Height() - highestID = blk.ID() - } - } - } - return highestID, nil - } -} - func setup(t *testing.T, config Config) (ids.NodeID, validators.Manager, *common.SenderTest, *block.TestVM, *Transitive) { require := require.New(t) @@ -112,10 +95,9 @@ func setup(t *testing.T, config Config) (ids.NodeID, validators.Manager, *common vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } - + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: @@ -313,8 +295,8 @@ func TestEngineQuery(t *testing.T) { // apply the votes received during the poll for [parent]. Applying the votes // should cause both [parent] and [child] to be accepted. require.NoError(engine.Put(context.Background(), getRequest.NodeID, getRequest.RequestID, child.Bytes())) - require.Equal(choices.Accepted, parent.Status()) - require.Equal(choices.Accepted, child.Status()) + require.Equal(snowtest.Accepted, parent.Status) + require.Equal(snowtest.Accepted, child.Status) require.Zero(engine.blocked.NumDependencies()) } @@ -356,9 +338,9 @@ func TestEngineMultipleQuery(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, blkID) return snowmantest.Genesis, nil @@ -460,7 +442,7 @@ func TestEngineMultipleQuery(t *testing.T) { // Should be dropped because the query was already filled require.NoError(te.Chits(context.Background(), vdr2, *queryRequestID, blk0.ID(), blk0.ID(), blk0.ID())) - require.Equal(choices.Accepted, blk1.Status()) + require.Equal(snowtest.Accepted, blk1.Status) require.Zero(te.blocked.NumDependencies()) } @@ -680,9 +662,9 @@ func TestVoteCanceling(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, id ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, id) return snowmantest.Genesis, nil @@ -743,9 +725,9 @@ func TestEngineNoQuery(t *testing.T) { vm := &block.TestVM{} vm.T = t - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { if blkID == snowmantest.GenesisID { @@ -783,9 +765,9 @@ func TestEngineNoRepollQuery(t *testing.T) { vm := &block.TestVM{} vm.T = t - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { if blkID == snowmantest.GenesisID { @@ -1135,9 +1117,9 @@ func TestEngineBlockingChitResponse(t *testing.T) { getRequest.RequestID, missingBlk.Bytes(), )) - require.Equal(choices.Accepted, missingBlk.Status()) - require.Equal(choices.Accepted, blockingBlk.Status()) - require.Equal(choices.Rejected, issuedBlk.Status()) + require.Equal(snowtest.Accepted, missingBlk.Status) + require.Equal(snowtest.Accepted, blockingBlk.Status) + require.Equal(snowtest.Rejected, issuedBlk.Status) } func TestEngineRetryFetch(t *testing.T) { @@ -1226,7 +1208,7 @@ func TestEngineUndeclaredDependencyDeadlock(t *testing.T) { )) require.NoError(te.Chits(context.Background(), vdr, *reqID, invalidBlkID, invalidBlkID, invalidBlkID)) - require.Equal(choices.Accepted, validBlk.Status()) + require.Equal(snowtest.Accepted, validBlk.Status) } func TestEngineGossip(t *testing.T) { @@ -1234,9 +1216,9 @@ func TestEngineGossip(t *testing.T) { nodeID, _, sender, vm, te := setup(t, DefaultConfig(t)) - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, blkID) return snowmantest.Genesis, nil @@ -1430,9 +1412,9 @@ func TestEngineAggressivePolling(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, blkID) return snowmantest.Genesis, nil @@ -1518,9 +1500,9 @@ func TestEngineDoubleChit(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, id ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, id) return snowmantest.Genesis, nil @@ -1565,16 +1547,16 @@ func TestEngineDoubleChit(t *testing.T) { return nil, errUnknownBlock } - require.Equal(choices.Processing, blk.Status()) + require.Equal(snowtest.Undecided, blk.Status) require.NoError(te.Chits(context.Background(), vdr0, *queryRequestID, blk.ID(), blk.ID(), blk.ID())) - require.Equal(choices.Processing, blk.Status()) + require.Equal(snowtest.Undecided, blk.Status) require.NoError(te.Chits(context.Background(), vdr0, *queryRequestID, blk.ID(), blk.ID(), blk.ID())) - require.Equal(choices.Processing, blk.Status()) + require.Equal(snowtest.Undecided, blk.Status) require.NoError(te.Chits(context.Background(), vdr1, *queryRequestID, blk.ID(), blk.ID(), blk.ID())) - require.Equal(choices.Accepted, blk.Status()) + require.Equal(snowtest.Accepted, blk.Status) } func TestEngineBuildBlockLimit(t *testing.T) { @@ -1604,9 +1586,9 @@ func TestEngineBuildBlockLimit(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, blkID) return snowmantest.Genesis, nil @@ -1712,7 +1694,7 @@ func TestEngineDropRejectedBlockOnReceipt(t *testing.T) { // Vote for [acceptedBlk] and cause it to be accepted. require.NoError(te.Chits(context.Background(), nodeID, queryRequestIDs[0], acceptedBlk.ID(), acceptedBlk.ID(), acceptedBlk.ID())) require.Len(queryRequestIDs, 1) // Shouldn't have caused another query - require.Equal(choices.Accepted, acceptedBlk.Status()) + require.Equal(snowtest.Accepted, acceptedBlk.Status) // Attempt to issue rejectedChain[1] to the engine. This should be dropped // because the engine knows it has rejected it's parent rejectedChain[0]. @@ -1883,8 +1865,8 @@ func TestEngineBubbleVotesThroughInvalidBlock(t *testing.T) { require.NoError(te.Put(context.Background(), *reqVdr, *sendReqID, blk2.Bytes())) // The vote should be bubbled through [blk2], such that [blk1] gets marked as Accepted. - require.Equal(choices.Accepted, blk1.Status()) - require.Equal(choices.Processing, blk2.Status()) + require.Equal(snowtest.Accepted, blk1.Status) + require.Equal(snowtest.Undecided, blk2.Status) // Now that [blk1] has been marked as Accepted, [blk2] can pass verification. blk2.VerifyV = nil @@ -1917,7 +1899,7 @@ func TestEngineBubbleVotesThroughInvalidBlock(t *testing.T) { // After a single vote for [blk2], it should be marked as accepted. require.NoError(te.Chits(context.Background(), vdr, *queryRequestID, blk2.ID(), blk1.ID(), blk2.ID())) - require.Equal(choices.Accepted, blk2.Status()) + require.Equal(snowtest.Accepted, blk2.Status) } // Test that in the following scenario, if block B fails verification, votes @@ -2040,7 +2022,7 @@ func TestEngineBubbleVotesThroughInvalidChain(t *testing.T) { // The vote should be bubbled through [blk3] and [blk2] such that [blk1] // gets marked as Accepted. - require.Equal(choices.Accepted, blk1.Status()) + require.Equal(snowtest.Accepted, blk1.Status) } func TestEngineBuildBlockWithCachedNonVerifiedParent(t *testing.T) { @@ -2138,8 +2120,8 @@ func TestEngineBuildBlockWithCachedNonVerifiedParent(t *testing.T) { // Assert that the blocks' statuses are correct. // The evicted [parentBlkA] shouldn't be changed. - require.Equal(choices.Processing, parentBlkA.Status()) - require.Equal(choices.Accepted, parentBlkB.Status()) + require.Equal(snowtest.Undecided, parentBlkA.Status) + require.Equal(snowtest.Accepted, parentBlkB.Status) vm.BuildBlockF = func(context.Context) (snowman.Block, error) { return childBlk, nil @@ -2189,9 +2171,9 @@ func TestEngineApplyAcceptedFrontierInQueryFailed(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, id ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, id) return snowmantest.Genesis, nil @@ -2232,7 +2214,7 @@ func TestEngineApplyAcceptedFrontierInQueryFailed(t *testing.T) { return nil, errUnknownBlock } - require.Equal(choices.Processing, blk.Status()) + require.Equal(snowtest.Undecided, blk.Status) sender.SendPullQueryF = func(_ context.Context, inVdrs set.Set[ids.NodeID], requestID uint32, blkID ids.ID, requestedHeight uint64) { *queryRequestID = requestID @@ -2243,11 +2225,11 @@ func TestEngineApplyAcceptedFrontierInQueryFailed(t *testing.T) { require.NoError(te.Chits(context.Background(), vdr, *queryRequestID, blk.ID(), blk.ID(), blk.ID())) - require.Equal(choices.Processing, blk.Status()) + require.Equal(snowtest.Undecided, blk.Status) require.NoError(te.QueryFailed(context.Background(), vdr, *queryRequestID)) - require.Equal(choices.Accepted, blk.Status()) + require.Equal(snowtest.Accepted, blk.Status) } func TestEngineRepollsMisconfiguredSubnet(t *testing.T) { @@ -2283,9 +2265,9 @@ func TestEngineRepollsMisconfiguredSubnet(t *testing.T) { vm.CantSetState = false vm.CantSetPreference = false - vm.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + vm.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) vm.GetBlockF = func(_ context.Context, id ids.ID) (snowman.Block, error) { require.Equal(snowmantest.GenesisID, id) return snowmantest.Genesis, nil @@ -2347,7 +2329,7 @@ func TestEngineRepollsMisconfiguredSubnet(t *testing.T) { // Voting for the block that was issued during the period when the validator // set was misconfigured should result in it being accepted successfully. require.NoError(te.Chits(context.Background(), vdr, queryRequestID, blk.ID(), blk.ID(), blk.ID())) - require.Equal(choices.Accepted, blk.Status()) + require.Equal(snowtest.Accepted, blk.Status) } // Full blockchain structure: @@ -2451,8 +2433,8 @@ func TestEngineVoteStallRegression(t *testing.T) { SetPreferenceF: func(context.Context, ids.ID) error { return nil }, - LastAcceptedF: MakeLastAcceptedBlockF( - snowmantest.Genesis, + LastAcceptedF: snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, acceptedChain, ), } @@ -2595,10 +2577,10 @@ func TestEngineVoteStallRegression(t *testing.T) { getBlock3Request.RequestID, rejectedChain[0].Bytes(), )) - require.Equal(choices.Accepted, acceptedChain[0].Status()) - require.Equal(choices.Accepted, acceptedChain[1].Status()) - require.Equal(choices.Processing, acceptedChain[2].Status()) - require.Equal(choices.Rejected, rejectedChain[0].Status()) + require.Equal(snowtest.Accepted, acceptedChain[0].Status) + require.Equal(snowtest.Accepted, acceptedChain[1].Status) + require.Equal(snowtest.Undecided, acceptedChain[2].Status) + require.Equal(snowtest.Rejected, rejectedChain[0].Status) // Then engine should issue as many queries as needed to confirm block 2. for i := 2; i < len(pollRequestIDs); i++ { @@ -2613,10 +2595,10 @@ func TestEngineVoteStallRegression(t *testing.T) { )) } } - require.Equal(choices.Accepted, acceptedChain[0].Status()) - require.Equal(choices.Accepted, acceptedChain[1].Status()) - require.Equal(choices.Accepted, acceptedChain[2].Status()) - require.Equal(choices.Rejected, rejectedChain[0].Status()) + require.Equal(snowtest.Accepted, acceptedChain[0].Status) + require.Equal(snowtest.Accepted, acceptedChain[1].Status) + require.Equal(snowtest.Accepted, acceptedChain[2].Status) + require.Equal(snowtest.Rejected, rejectedChain[0].Status) } // When a voter is registered with multiple dependencies, the engine must not @@ -2667,8 +2649,8 @@ func TestEngineEarlyTerminateVoterRegression(t *testing.T) { SetPreferenceF: func(context.Context, ids.ID) error { return nil }, - LastAcceptedF: MakeLastAcceptedBlockF( - snowmantest.Genesis, + LastAcceptedF: snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, chain, ), } @@ -2743,11 +2725,10 @@ func TestEngineEarlyTerminateVoterRegression(t *testing.T) { // Because Put added a new preferred block to the chain, a new poll will be // created. require.Len(pollRequestIDs, 2) - require.Equal(choices.Accepted, chain[0].Status()) - require.Equal(choices.Accepted, chain[1].Status()) - // Block 2 still hasn't been issued, so it's status should remain - // Processing. - require.Equal(choices.Processing, chain[2].Status()) + require.Equal(snowtest.Accepted, chain[0].Status) + require.Equal(snowtest.Accepted, chain[1].Status) + // Block 2 still hasn't been issued, so it's status should remain Undecided. + require.Equal(snowtest.Undecided, chain[2].Status) } // Voting for an unissued cached block that fails verification should not @@ -2819,8 +2800,8 @@ func TestEngineRegistersInvalidVoterDependencyRegression(t *testing.T) { SetPreferenceF: func(context.Context, ids.ID) error { return nil }, - LastAcceptedF: MakeLastAcceptedBlockF( - snowmantest.Genesis, + LastAcceptedF: snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, acceptedChain, rejectedChain, ), @@ -2900,8 +2881,8 @@ func TestEngineRegistersInvalidVoterDependencyRegression(t *testing.T) { )) // There are no processing blocks, so no new poll should be created. require.Len(pollRequestIDs, 1) - require.Equal(choices.Accepted, acceptedChain[0].Status()) - require.Equal(choices.Rejected, rejectedChain[0].Status()) + require.Equal(snowtest.Accepted, acceptedChain[0].Status) + require.Equal(snowtest.Rejected, rejectedChain[0].Status) // Issue acceptedChain[1] to consensus. require.NoError(engine.PushQuery( @@ -2943,7 +2924,7 @@ func TestEngineRegistersInvalidVoterDependencyRegression(t *testing.T) { snowmantest.GenesisID, )) require.Len(pollRequestIDs, 3) - require.Equal(choices.Accepted, acceptedChain[1].Status()) + require.Equal(snowtest.Accepted, acceptedChain[1].Status) } func TestGetProcessingAncestor(t *testing.T) { diff --git a/snow/snowtest/snowtest.go b/snow/snowtest/context.go similarity index 100% rename from snow/snowtest/snowtest.go rename to snow/snowtest/context.go diff --git a/snow/snowtest/decidable.go b/snow/snowtest/decidable.go new file mode 100644 index 000000000000..3cbdb2c1c9c2 --- /dev/null +++ b/snow/snowtest/decidable.go @@ -0,0 +1,58 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build test + +package snowtest + +import ( + "context" + "errors" + "fmt" + + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/snow" +) + +var ( + _ snow.Decidable = (*Decidable)(nil) + + ErrInvalidStateTransition = errors.New("invalid state transition") +) + +type Decidable struct { + IDV ids.ID + AcceptV error + RejectV error + Status Status +} + +func (d *Decidable) ID() ids.ID { + return d.IDV +} + +func (d *Decidable) Accept(context.Context) error { + if d.Status == Rejected { + return fmt.Errorf("%w from %s to %s", + ErrInvalidStateTransition, + Rejected, + Accepted, + ) + } + + d.Status = Accepted + return d.AcceptV +} + +func (d *Decidable) Reject(context.Context) error { + if d.Status == Accepted { + return fmt.Errorf("%w from %s to %s", + ErrInvalidStateTransition, + Accepted, + Rejected, + ) + } + + d.Status = Rejected + return d.RejectV +} diff --git a/snow/snowtest/status.go b/snow/snowtest/status.go new file mode 100644 index 000000000000..36c26f83cbde --- /dev/null +++ b/snow/snowtest/status.go @@ -0,0 +1,30 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +//go:build test + +package snowtest + +type Status int + +// [Undecided] means the operation hasn't been decided yet +// [Accepted] means the operation was accepted +// [Rejected] means the operation will never be accepted +const ( + Undecided Status = iota + Accepted + Rejected +) + +func (s Status) String() string { + switch s { + case Undecided: + return "Undecided" + case Accepted: + return "Accepted" + case Rejected: + return "Rejected" + default: + return "Unknown" + } +} diff --git a/vms/avm/block/executor/block.go b/vms/avm/block/executor/block.go index 8663f27ba123..109e6708b0bf 100644 --- a/vms/avm/block/executor/block.go +++ b/vms/avm/block/executor/block.go @@ -12,9 +12,7 @@ import ( "go.uber.org/zap" "github.com/ava-labs/avalanchego/chains/atomic" - "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/vms/avm/block" "github.com/ava-labs/avalanchego/vms/avm/state" @@ -38,8 +36,7 @@ var ( // Exported for testing in avm package. type Block struct { block.Block - manager *manager - rejected bool + manager *manager } func (b *Block) Verify(context.Context) error { @@ -293,51 +290,5 @@ func (b *Block) Reject(context.Context) error { // If we added transactions to the mempool, we should be willing to build a // block. b.manager.mempool.RequestBuildBlock() - - b.rejected = true return nil } - -func (b *Block) Status() choices.Status { - // If this block's reference was rejected, we should report it as rejected. - // - // We don't persist the rejection, but that's fine. The consensus engine - // will hold the same reference to the block until it no longer needs it. - // After the consensus engine has released the reference to the block that - // was verified, it may get a new reference that isn't marked as rejected. - // The consensus engine may then try to issue the block, but will discover - // that it was rejected due to a conflicting block having been accepted. - if b.rejected { - return choices.Rejected - } - - blkID := b.ID() - // If this block is the last accepted block, we don't need to go to disk to - // check the status. - if b.manager.lastAccepted == blkID { - return choices.Accepted - } - // Check if the block is in memory. If so, it's processing. - if _, ok := b.manager.blkIDToState[blkID]; ok { - return choices.Processing - } - // Block isn't in memory. Check in the database. - _, err := b.manager.state.GetBlock(blkID) - switch err { - case nil: - return choices.Accepted - - case database.ErrNotFound: - // choices.Unknown means we don't have the bytes of the block. - // In this case, we do, so we return choices.Processing. - return choices.Processing - - default: - // TODO: correctly report this error to the consensus engine. - b.manager.backend.Ctx.Log.Error( - "dropping unhandled database error", - zap.Error(err), - ) - return choices.Processing - } -} diff --git a/vms/avm/block/executor/block_test.go b/vms/avm/block/executor/block_test.go index 8e72f4c21ebe..3f6c0a81b977 100644 --- a/vms/avm/block/executor/block_test.go +++ b/vms/avm/block/executor/block_test.go @@ -13,10 +13,8 @@ import ( "go.uber.org/mock/gomock" "github.com/ava-labs/avalanchego/chains/atomic" - "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/utils" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/set" @@ -927,117 +925,12 @@ func TestBlockReject(t *testing.T) { b := tt.blockFunc(ctrl) require.NoError(b.Reject(context.Background())) - require.True(b.rejected) _, ok := b.manager.blkIDToState[b.ID()] require.False(ok) }) } } -func TestBlockStatus(t *testing.T) { - type test struct { - name string - blockFunc func(ctrl *gomock.Controller) *Block - expected choices.Status - } - tests := []test{ - { - name: "block is rejected", - blockFunc: func(*gomock.Controller) *Block { - return &Block{ - rejected: true, - } - }, - expected: choices.Rejected, - }, - { - name: "block is last accepted", - blockFunc: func(ctrl *gomock.Controller) *Block { - blockID := ids.GenerateTestID() - mockBlock := block.NewMockBlock(ctrl) - mockBlock.EXPECT().ID().Return(blockID).AnyTimes() - return &Block{ - Block: mockBlock, - manager: &manager{ - backend: defaultTestBackend(false, nil), - lastAccepted: blockID, - }, - } - }, - expected: choices.Accepted, - }, - { - name: "block is processing", - blockFunc: func(ctrl *gomock.Controller) *Block { - blockID := ids.GenerateTestID() - mockBlock := block.NewMockBlock(ctrl) - mockBlock.EXPECT().ID().Return(blockID).AnyTimes() - return &Block{ - Block: mockBlock, - manager: &manager{ - backend: defaultTestBackend(false, nil), - blkIDToState: map[ids.ID]*blockState{ - blockID: {}, - }, - }, - } - }, - expected: choices.Processing, - }, - { - name: "block is accepted but not last accepted", - blockFunc: func(ctrl *gomock.Controller) *Block { - blockID := ids.GenerateTestID() - mockBlock := block.NewMockBlock(ctrl) - mockBlock.EXPECT().ID().Return(blockID).AnyTimes() - - mockState := state.NewMockState(ctrl) - mockState.EXPECT().GetBlock(blockID).Return(nil, nil) - - return &Block{ - Block: mockBlock, - manager: &manager{ - backend: defaultTestBackend(false, nil), - blkIDToState: map[ids.ID]*blockState{}, - state: mockState, - }, - } - }, - expected: choices.Accepted, - }, - { - name: "block is unknown", - blockFunc: func(ctrl *gomock.Controller) *Block { - blockID := ids.GenerateTestID() - mockBlock := block.NewMockBlock(ctrl) - mockBlock.EXPECT().ID().Return(blockID).AnyTimes() - - mockState := state.NewMockState(ctrl) - mockState.EXPECT().GetBlock(blockID).Return(nil, database.ErrNotFound) - - return &Block{ - Block: mockBlock, - manager: &manager{ - backend: defaultTestBackend(false, nil), - blkIDToState: map[ids.ID]*blockState{}, - state: mockState, - }, - } - }, - expected: choices.Processing, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require := require.New(t) - ctrl := gomock.NewController(t) - - b := tt.blockFunc(ctrl) - require.Equal(tt.expected, b.Status()) - }) - } -} - func defaultTestBackend(bootstrapped bool, sharedMemory atomic.SharedMemory) *executor.Backend { return &executor.Backend{ Bootstrapped: bootstrapped, diff --git a/vms/components/chain/state.go b/vms/components/chain/state.go index 6ada30e73eee..0a01f0d3779a 100644 --- a/vms/components/chain/state.go +++ b/vms/components/chain/state.go @@ -14,7 +14,6 @@ import ( "github.com/ava-labs/avalanchego/cache/metercacher" "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/utils/constants" @@ -46,9 +45,6 @@ type State struct { // If nil, [BuildBlockWithContext] returns [BuildBlock]. buildBlockWithContext func(context.Context, *block.Context) (snowman.Block, error) - // getStatus returns the status of the block - getStatus func(context.Context, snowman.Block) (choices.Status, error) - // verifiedBlocks is a map of blocks that have been verified and are // therefore currently in consensus. verifiedBlocks map[ids.ID]*BlockWrapper @@ -75,53 +71,6 @@ type Config struct { BatchedUnmarshalBlock func(context.Context, [][]byte) ([]snowman.Block, error) BuildBlock func(context.Context) (snowman.Block, error) BuildBlockWithContext func(context.Context, *block.Context) (snowman.Block, error) - GetBlockIDAtHeight func(context.Context, uint64) (ids.ID, error) -} - -// Block is an interface wrapping the normal snowman.Block interface to be used in -// association with passing in a non-nil function to GetBlockIDAtHeight -type Block interface { - snowman.Block - - SetStatus(choices.Status) -} - -// produceGetStatus creates a getStatus function that infers the status of a block by using a function -// passed in from the VM that gets the block ID at a specific height. It is assumed that for any height -// less than or equal to the last accepted block, getBlockIDAtHeight returns the accepted blockID at -// the requested height. -func produceGetStatus(s *State, getBlockIDAtHeight func(context.Context, uint64) (ids.ID, error)) func(context.Context, snowman.Block) (choices.Status, error) { - return func(ctx context.Context, blk snowman.Block) (choices.Status, error) { - internalBlk, ok := blk.(Block) - if !ok { - return choices.Unknown, fmt.Errorf("expected block to match chain Block interface but found block of type %T", blk) - } - lastAcceptedHeight := s.lastAcceptedBlock.Height() - blkHeight := internalBlk.Height() - if blkHeight > lastAcceptedHeight { - internalBlk.SetStatus(choices.Processing) - return choices.Processing, nil - } - - acceptedID, err := getBlockIDAtHeight(ctx, blkHeight) - switch err { - case nil: - if acceptedID == blk.ID() { - internalBlk.SetStatus(choices.Accepted) - return choices.Accepted, nil - } - internalBlk.SetStatus(choices.Rejected) - return choices.Rejected, nil - case database.ErrNotFound: - // Not found can happen if chain history is missing. In this case, - // the block may have been accepted or rejected, it isn't possible - // to know here. - internalBlk.SetStatus(choices.Processing) - return choices.Processing, nil - default: - return choices.Unknown, fmt.Errorf("%w: failed to get accepted blkID at height %d", err, blkHeight) - } - } } func (s *State) initialize(config *Config) { @@ -131,13 +80,6 @@ func (s *State) initialize(config *Config) { s.buildBlockWithContext = config.BuildBlockWithContext s.unmarshalBlock = config.UnmarshalBlock s.batchedUnmarshalBlock = config.BatchedUnmarshalBlock - if config.GetBlockIDAtHeight == nil { - s.getStatus = func(_ context.Context, blk snowman.Block) (choices.Status, error) { - return blk.Status(), nil - } - } else { - s.getStatus = produceGetStatus(s, config.GetBlockIDAtHeight) - } s.lastAcceptedBlock = &BlockWrapper{ Block: config.LastAcceptedBlock, state: s, @@ -282,7 +224,7 @@ func (s *State) GetBlock(ctx context.Context, blkID ids.ID) (snowman.Block, erro // Since this block is not in consensus, addBlockOutsideConsensus // is called to add [blk] to the correct cache. - return s.addBlockOutsideConsensus(ctx, blk) + return s.addBlockOutsideConsensus(blk), nil } // getCachedBlock checks the caches for [blkID] by priority. Returning @@ -348,7 +290,7 @@ func (s *State) ParseBlock(ctx context.Context, b []byte) (snowman.Block, error) // Since this block is not in consensus, addBlockOutsideConsensus // is called to add [blk] to the correct cache. - return s.addBlockOutsideConsensus(ctx, blk) + return s.addBlockOutsideConsensus(blk), nil } // BatchedParseBlock implements part of the block.BatchedChainVM interface. In @@ -423,11 +365,7 @@ func (s *State) BatchedParseBlock(ctx context.Context, blksBytes [][]byte) ([]sn } s.missingBlocks.Evict(blkID) - wrappedBlk, err := s.addBlockOutsideConsensus(ctx, blk) - if err != nil { - return nil, err - } - blks[i] = wrappedBlk + blks[i] = s.addBlockOutsideConsensus(blk) } return blks, nil } @@ -445,7 +383,7 @@ func (s *State) BuildBlockWithContext(ctx context.Context, blockCtx *block.Conte return nil, err } - return s.deduplicate(ctx, blk) + return s.deduplicate(blk), nil } // BuildBlock attempts to build a new internal Block, wraps it, and adds it @@ -456,22 +394,22 @@ func (s *State) BuildBlock(ctx context.Context) (snowman.Block, error) { return nil, err } - return s.deduplicate(ctx, blk) + return s.deduplicate(blk), nil } -func (s *State) deduplicate(ctx context.Context, blk snowman.Block) (snowman.Block, error) { +func (s *State) deduplicate(blk snowman.Block) snowman.Block { blkID := blk.ID() // Defensive: buildBlock should not return a block that has already been verified. // If it does, make sure to return the existing reference to the block. if existingBlk, ok := s.getCachedBlock(blkID); ok { - return existingBlk, nil + return existingBlk } // Evict the produced block from missing blocks in case it was previously // marked as missing. s.missingBlocks.Evict(blkID) // wrap the returned block and add it to the correct cache - return s.addBlockOutsideConsensus(ctx, blk) + return s.addBlockOutsideConsensus(blk) } // addBlockOutsideConsensus adds [blk] to the correct cache and returns @@ -479,27 +417,20 @@ func (s *State) deduplicate(ctx context.Context, blk snowman.Block) (snowman.Blo // assumes [blk] is a known, non-wrapped block that is not currently // in consensus. [blk] could be either decided or a block that has not yet // been verified and added to consensus. -func (s *State) addBlockOutsideConsensus(ctx context.Context, blk snowman.Block) (snowman.Block, error) { +func (s *State) addBlockOutsideConsensus(blk snowman.Block) snowman.Block { wrappedBlk := &BlockWrapper{ Block: blk, state: s, } blkID := blk.ID() - status, err := s.getStatus(ctx, blk) - if err != nil { - return nil, fmt.Errorf("could not get block status for %s due to %w", blkID, err) - } - switch status { - case choices.Accepted, choices.Rejected: + if blk.Height() <= s.lastAcceptedBlock.Height() { s.decidedBlocks.Put(blkID, wrappedBlk) - case choices.Processing: + } else { s.unverifiedBlocks.Put(blkID, wrappedBlk) - default: - return nil, fmt.Errorf("found unexpected status for blk %s: %s", blkID, status) } - return wrappedBlk, nil + return wrappedBlk } func (s *State) LastAccepted(context.Context) (ids.ID, error) { diff --git a/vms/components/chain/state_test.go b/vms/components/chain/state_test.go index 69fe825cb048..223b861d27dc 100644 --- a/vms/components/chain/state_test.go +++ b/vms/components/chain/state_test.go @@ -14,12 +14,18 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/utils/hashing" ) +const ( + Unknown snowtest.Status = -1 + + defaultBlockCacheSize = 256 +) + var ( errCantBuildBlock = errors.New("can't build new block") errVerify = errors.New("verify failed") @@ -34,9 +40,9 @@ func NewTestBlock(i uint64, parentID ids.ID) *snowmantest.Block { b := []byte{byte(i)} id := hashing.ComputeHash256Array(b) return &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: id, - StatusV: choices.Unknown, + Decidable: snowtest.Decidable{ + IDV: id, + Status: Unknown, }, HeightV: i, ParentV: parentID, @@ -60,7 +66,6 @@ func NewTestBlocks(numBlocks uint64) []*snowmantest.Block { func createInternalBlockFuncs(blks []*snowmantest.Block) ( func(ctx context.Context, blkID ids.ID) (snowman.Block, error), func(ctx context.Context, b []byte) (snowman.Block, error), - func(ctx context.Context, height uint64) (ids.ID, error), ) { blkMap := make(map[ids.ID]*snowmantest.Block) blkBytesMap := make(map[string]*snowmantest.Block) @@ -72,7 +77,7 @@ func createInternalBlockFuncs(blks []*snowmantest.Block) ( getBlock := func(_ context.Context, id ids.ID) (snowman.Block, error) { blk, ok := blkMap[id] - if !ok || !blk.Status().Fetched() { + if !ok || blk.Status == Unknown { return nil, database.ErrNotFound } @@ -84,28 +89,15 @@ func createInternalBlockFuncs(blks []*snowmantest.Block) ( if !ok { return nil, fmt.Errorf("%w: %x", errUnexpectedBlockBytes, b) } - if blk.Status() == choices.Unknown { - blk.SetStatus(choices.Processing) + if blk.Status == Unknown { + blk.Status = snowtest.Undecided } blkMap[blk.ID()] = blk return blk, nil } - getAcceptedBlockIDAtHeight := func(_ context.Context, height uint64) (ids.ID, error) { - for _, blk := range blks { - if blk.Height() != height { - continue - } - - if blk.Status() == choices.Accepted { - return blk.ID(), nil - } - } - - return ids.Empty, database.ErrNotFound - } - return getBlock, parseBlk, getAcceptedBlockIDAtHeight + return getBlock, parseBlk } func cantBuildBlock(context.Context) (snowman.Block, error) { @@ -123,7 +115,6 @@ func checkProcessingBlock(t *testing.T, s *State, blk snowman.Block) { require.NoError(err) require.Equal(blk.ID(), parsedBlk.ID()) require.Equal(blk.Bytes(), parsedBlk.Bytes()) - require.Equal(choices.Processing, parsedBlk.Status()) require.Equal(blk, parsedBlk) getBlk, err := s.GetBlock(context.Background(), blk.ID()) @@ -133,16 +124,24 @@ func checkProcessingBlock(t *testing.T, s *State, blk snowman.Block) { // checkDecidedBlock asserts that [blk] is returned with the correct status by ParseBlock // and GetBlock. -func checkDecidedBlock(t *testing.T, s *State, blk snowman.Block, expectedStatus choices.Status, cached bool) { +// expectedStatus should be either Accepted or Rejected. +func checkDecidedBlock(t *testing.T, s *State, blk snowman.Block, cached bool) { require := require.New(t) require.IsType(&BlockWrapper{}, blk) + if cached { + _, ok := s.decidedBlocks.Get(blk.ID()) + require.True(ok) + } + parsedBlk, err := s.ParseBlock(context.Background(), blk.Bytes()) require.NoError(err) require.Equal(blk.ID(), parsedBlk.ID()) require.Equal(blk.Bytes(), parsedBlk.Bytes()) - require.Equal(expectedStatus, parsedBlk.Status()) + + _, ok := s.decidedBlocks.Get(blk.ID()) + require.True(ok) // If the block should be in the cache, assert that the returned block is identical to [blk] if cached { @@ -153,27 +152,18 @@ func checkDecidedBlock(t *testing.T, s *State, blk snowman.Block, expectedStatus require.NoError(err) require.Equal(blk.ID(), getBlk.ID()) require.Equal(blk.Bytes(), getBlk.Bytes()) - require.Equal(expectedStatus, getBlk.Status()) // Since ParseBlock should have triggered a cache hit, assert that the block is identical // to the parsed block. require.Equal(parsedBlk, getBlk) } -func checkAcceptedBlock(t *testing.T, s *State, blk snowman.Block, cached bool) { - checkDecidedBlock(t, s, blk, choices.Accepted, cached) -} - -func checkRejectedBlock(t *testing.T, s *State, blk snowman.Block, cached bool) { - checkDecidedBlock(t, s, blk, choices.Rejected, cached) -} - func TestState(t *testing.T) { require := require.New(t) testBlks := NewTestBlocks(3) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] blk2 := testBlks[2] // Need to create a block with a different bytes and hash here @@ -181,17 +171,16 @@ func TestState(t *testing.T) { blk3 := snowmantest.BuildChild(blk1) testBlks = append(testBlks, blk3) - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) lastAccepted, err := chainState.LastAccepted(context.Background()) @@ -246,10 +235,10 @@ func TestState(t *testing.T) { // Flush the caches to ensure decided blocks are handled correctly on cache misses. chainState.Flush() - checkAcceptedBlock(t, chainState, wrappedGenesisBlk, false) - checkAcceptedBlock(t, chainState, parsedBlk1, false) - checkAcceptedBlock(t, chainState, parsedBlk2, false) - checkRejectedBlock(t, chainState, parsedBlk3, false) + checkDecidedBlock(t, chainState, wrappedGenesisBlk, false) + checkDecidedBlock(t, chainState, parsedBlk1, false) + checkDecidedBlock(t, chainState, parsedBlk2, false) + checkDecidedBlock(t, chainState, parsedBlk3, false) } func TestBuildBlock(t *testing.T) { @@ -257,26 +246,25 @@ func TestBuildBlock(t *testing.T) { testBlks := NewTestBlocks(2) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) buildBlock := func(context.Context) (snowman.Block, error) { // Once the block is built, mark it as processing - blk1.SetStatus(choices.Processing) + blk1.Status = snowtest.Undecided return blk1, nil } chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: buildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) builtBlk, err := chainState.BuildBlock(context.Background()) @@ -290,7 +278,7 @@ func TestBuildBlock(t *testing.T) { require.NoError(builtBlk.Accept(context.Background())) - checkAcceptedBlock(t, chainState, builtBlk, true) + checkDecidedBlock(t, chainState, builtBlk, true) } func TestStateDecideBlock(t *testing.T) { @@ -298,24 +286,23 @@ func TestStateDecideBlock(t *testing.T) { testBlks := NewTestBlocks(4) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted badAcceptBlk := testBlks[1] badAcceptBlk.AcceptV = errAccept badVerifyBlk := testBlks[2] badVerifyBlk.VerifyV = errVerify badRejectBlk := testBlks[3] badRejectBlk.RejectV = errReject - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) // Parse badVerifyBlk (which should fail verification) @@ -354,21 +341,20 @@ func TestStateParent(t *testing.T) { testBlks := NewTestBlocks(3) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] blk2 := testBlks[2] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) parsedBlk2, err := chainState.ParseBlock(context.Background(), blk2.Bytes()) @@ -385,7 +371,7 @@ func TestStateParent(t *testing.T) { genesisBlkParentID := parsedBlk1.Parent() genesisBlkParent, err := chainState.GetBlock(context.Background(), genesisBlkParentID) require.NoError(err) - checkAcceptedBlock(t, chainState, genesisBlkParent, true) + checkDecidedBlock(t, chainState, genesisBlkParent, true) parentBlk1ID := parsedBlk2.Parent() parentBlk1, err := chainState.GetBlock(context.Background(), parentBlk1ID) @@ -397,19 +383,18 @@ func TestGetBlockInternal(t *testing.T) { require := require.New(t) testBlks := NewTestBlocks(1) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) genesisBlockInternal := chainState.LastAcceptedBlockInternal() @@ -428,10 +413,10 @@ func TestGetBlockError(t *testing.T) { testBlks := NewTestBlocks(2) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) wrappedGetBlock := func(ctx context.Context, id ids.ID) (snowman.Block, error) { blk, err := getBlock(ctx, id) if err != nil { @@ -440,23 +425,22 @@ func TestGetBlockError(t *testing.T) { return blk, nil } chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: wrappedGetBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) _, err := chainState.GetBlock(context.Background(), blk1.ID()) require.ErrorIs(err, database.ErrNotFound) - // Update the status to Processing, so that it will be returned by the internal get block - // function. - blk1.SetStatus(choices.Processing) + // Update the status to Undecided, so that it will be returned by the + // internal get block function. + blk1.Status = snowtest.Undecided blk, err := chainState.GetBlock(context.Background(), blk1.ID()) require.NoError(err) require.Equal(blk1.ID(), blk.ID()) @@ -466,19 +450,18 @@ func TestGetBlockError(t *testing.T) { func TestParseBlockError(t *testing.T) { testBlks := NewTestBlocks(1) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) _, err := chainState.ParseBlock(context.Background(), []byte{255}) @@ -488,19 +471,18 @@ func TestParseBlockError(t *testing.T) { func TestBuildBlockError(t *testing.T) { testBlks := NewTestBlocks(1) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) _, err := chainState.BuildBlock(context.Background()) @@ -514,19 +496,18 @@ func TestMeteredCache(t *testing.T) { testBlks := NewTestBlocks(1) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) config := &Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, } _, err := NewMeteredState(registry, config) require.NoError(err) @@ -540,11 +521,11 @@ func TestStateBytesToIDCache(t *testing.T) { testBlks := NewTestBlocks(3) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] blk2 := testBlks[2] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) buildBlock := func(context.Context) (snowman.Block, error) { require.FailNow("shouldn't have been called") return nil, nil @@ -559,7 +540,6 @@ func TestStateBytesToIDCache(t *testing.T) { GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: buildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) // Shouldn't have blk1 ID to start with @@ -594,7 +574,7 @@ func TestSetLastAcceptedBlock(t *testing.T) { testBlks := NewTestBlocks(1) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted postSetBlk1ParentID := hashing.ComputeHash256Array([]byte{byte(199)}) postSetBlk1 := NewTestBlock(200, postSetBlk1ParentID) @@ -603,13 +583,16 @@ func TestSetLastAcceptedBlock(t *testing.T) { // note we do not need to parse postSetBlk1 so it is omitted here testBlks = append(testBlks, postSetBlk2) - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - LastAcceptedBlock: genesisBlock, - GetBlock: getBlock, - UnmarshalBlock: parseBlock, - BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, + LastAcceptedBlock: genesisBlock, + GetBlock: getBlock, + UnmarshalBlock: parseBlock, + BuildBlock: cantBuildBlock, }) lastAcceptedID, err := chainState.LastAccepted(context.Background()) require.NoError(err) @@ -632,7 +615,7 @@ func TestSetLastAcceptedBlock(t *testing.T) { require.Equal(postSetBlk2.ID(), lastAcceptedID) require.Equal(postSetBlk2.ID(), chainState.LastAcceptedBlock().ID()) - checkAcceptedBlock(t, chainState, parsedpostSetBlk2, false) + checkDecidedBlock(t, chainState, parsedpostSetBlk2, false) } func TestSetLastAcceptedBlockWithProcessingBlocksErrors(t *testing.T) { @@ -640,27 +623,26 @@ func TestSetLastAcceptedBlockWithProcessingBlocksErrors(t *testing.T) { testBlks := NewTestBlocks(5) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] resetBlk := testBlks[4] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) buildBlock := func(context.Context) (snowman.Block, error) { - // Once the block is built, mark it as processing - blk1.SetStatus(choices.Processing) + // Once the block is built, mark it as undecided + genesisBlock.Status = snowtest.Undecided return blk1, nil } chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: buildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) builtBlk, err := chainState.BuildBlock(context.Background()) @@ -681,22 +663,21 @@ func TestStateParseTransitivelyAcceptedBlock(t *testing.T) { testBlks := NewTestBlocks(3) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] blk2 := testBlks[2] - blk2.SetStatus(choices.Accepted) + blk2.Status = snowtest.Accepted - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: blk2, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) parsedBlk1, err := chainState.ParseBlock(context.Background(), blk1.Bytes()) @@ -709,20 +690,19 @@ func TestIsProcessing(t *testing.T) { testBlks := NewTestBlocks(2) genesisBlock := testBlks[0] - genesisBlock.SetStatus(choices.Accepted) + genesisBlock.Status = snowtest.Accepted blk1 := testBlks[1] - getBlock, parseBlock, getCanonicalBlockID := createInternalBlockFuncs(testBlks) + getBlock, parseBlock := createInternalBlockFuncs(testBlks) chainState := NewState(&Config{ - DecidedCacheSize: 2, - MissingCacheSize: 2, - UnverifiedCacheSize: 2, - BytesToIDCacheSize: 2, + DecidedCacheSize: defaultBlockCacheSize, + MissingCacheSize: defaultBlockCacheSize, + UnverifiedCacheSize: defaultBlockCacheSize, + BytesToIDCacheSize: defaultBlockCacheSize, LastAcceptedBlock: genesisBlock, GetBlock: getBlock, UnmarshalBlock: parseBlock, BuildBlock: cantBuildBlock, - GetBlockIDAtHeight: getCanonicalBlockID, }) // Parse blk1 diff --git a/vms/example/xsvm/chain/block.go b/vms/example/xsvm/chain/block.go index 8ab761d515f8..6703788fb082 100644 --- a/vms/example/xsvm/chain/block.go +++ b/vms/example/xsvm/chain/block.go @@ -12,11 +12,9 @@ import ( "github.com/ava-labs/avalanchego/database/versiondb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/utils/set" "github.com/ava-labs/avalanchego/vms/example/xsvm/execute" - "github.com/ava-labs/avalanchego/vms/example/xsvm/state" smblock "github.com/ava-labs/avalanchego/snow/engine/snowman/block" xsblock "github.com/ava-labs/avalanchego/vms/example/xsvm/block" @@ -30,7 +28,6 @@ var ( errMissingParent = errors.New("missing parent block") errMissingChild = errors.New("missing child block") errParentNotVerified = errors.New("parent block has not been verified") - errMissingState = errors.New("missing state") errFutureTimestamp = errors.New("future timestamp") errTimestampBeforeParent = errors.New("timestamp before parent") errWrongHeight = errors.New("wrong height") @@ -52,9 +49,8 @@ type block struct { chain *chain - id ids.ID - status choices.Status - bytes []byte + id ids.ID + bytes []byte state *versiondb.Database verifiedChildrenIDs set.Set[ids.ID] @@ -64,13 +60,6 @@ func (b *block) ID() ids.ID { return b.id } -func (b *block) Status() choices.Status { - if !b.status.Decided() { - b.status = b.calculateStatus() - } - return b.status -} - func (b *block) Parent() ids.ID { return b.ParentID } @@ -108,15 +97,16 @@ func (b *block) Accept(context.Context) error { } } - b.status = choices.Accepted - b.chain.lastAccepted = b.id + b.chain.lastAcceptedID = b.id + b.chain.lastAcceptedHeight = b.Height() delete(b.chain.verifiedBlocks, b.ParentID) + b.state = nil return nil } func (b *block) Reject(context.Context) error { - b.status = choices.Rejected delete(b.chain.verifiedBlocks, b.id) + b.state = nil // TODO: push transactions back into the mempool return nil @@ -178,42 +168,15 @@ func (b *block) VerifyWithContext(ctx context.Context, blockContext *smblock.Con } func (b *block) State() (database.Database, error) { - if b.id == b.chain.lastAccepted { + if b.id == b.chain.lastAcceptedID { return b.chain.acceptedState, nil } - // States of accepted blocks other than the lastAccepted are undefined. - if b.Status() == choices.Accepted { - return nil, errMissingState - } - - // We should not be calling State on an unverified block. + // If this block isn't processing, then the child should never have had + // verify called on it. if b.state == nil { return nil, errParentNotVerified } return b.state, nil } - -func (b *block) calculateStatus() choices.Status { - if b.chain.lastAccepted == b.id { - return choices.Accepted - } - if _, ok := b.chain.verifiedBlocks[b.id]; ok { - return choices.Processing - } - - _, err := state.GetBlock(b.chain.acceptedState, b.id) - switch { - case err == nil: - return choices.Accepted - - case errors.Is(err, database.ErrNotFound): - // This block hasn't been verified yet. - return choices.Processing - - default: - // TODO: correctly report this error to the consensus engine. - return choices.Processing - } -} diff --git a/vms/example/xsvm/chain/chain.go b/vms/example/xsvm/chain/chain.go index 7fc60261d159..c2d8055b2eab 100644 --- a/vms/example/xsvm/chain/chain.go +++ b/vms/example/xsvm/chain/chain.go @@ -7,7 +7,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/vms/example/xsvm/state" xsblock "github.com/ava-labs/avalanchego/vms/example/xsvm/block" @@ -32,8 +31,9 @@ type chain struct { // chain state as driven by the consensus engine chainState snow.State - lastAccepted ids.ID - verifiedBlocks map[ids.ID]*block + lastAcceptedID ids.ID + lastAcceptedHeight uint64 + verifiedBlocks map[ids.ID]*block } func New(ctx *snow.Context, db database.Database) (Chain, error) { @@ -46,12 +46,17 @@ func New(ctx *snow.Context, db database.Database) (Chain, error) { } c := &chain{ - chainContext: ctx, - acceptedState: db, - lastAccepted: lastAcceptedID, + chainContext: ctx, + acceptedState: db, + lastAcceptedID: lastAcceptedID, } lastAccepted, err := c.getBlock(lastAcceptedID) + if err != nil { + return nil, err + } + + c.lastAcceptedHeight = lastAccepted.Height() c.verifiedBlocks = map[ids.ID]*block{ lastAcceptedID: lastAccepted, } @@ -59,7 +64,7 @@ func New(ctx *snow.Context, db database.Database) (Chain, error) { } func (c *chain) LastAccepted() ids.ID { - return c.lastAccepted + return c.lastAcceptedID } func (c *chain) SetChainState(state snow.State) { @@ -111,7 +116,6 @@ func (c *chain) getBlock(blkID ids.ID) (*block, error) { Stateless: stateless, chain: c, id: blkID, - status: choices.Accepted, bytes: blkBytes, }, nil } diff --git a/vms/platformvm/block/executor/block.go b/vms/platformvm/block/executor/block.go index 5cd5a02f709c..5248ab7e778f 100644 --- a/vms/platformvm/block/executor/block.go +++ b/vms/platformvm/block/executor/block.go @@ -7,10 +7,6 @@ import ( "context" "time" - "go.uber.org/zap" - - "github.com/ava-labs/avalanchego/database" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/vms/platformvm/block" ) @@ -44,39 +40,6 @@ func (b *Block) Reject(context.Context) error { return b.Visit(b.manager.rejector) } -func (b *Block) Status() choices.Status { - blkID := b.ID() - // If this block is an accepted Proposal block with no accepted children, it - // will be in [blkIDToState], but we should return accepted, not processing, - // so we do this check. - if b.manager.lastAccepted == blkID { - return choices.Accepted - } - // Check if the block is in memory. If so, it's processing. - if _, ok := b.manager.blkIDToState[blkID]; ok { - return choices.Processing - } - // Block isn't in memory. Check in the database. - _, err := b.manager.state.GetStatelessBlock(blkID) - switch err { - case nil: - return choices.Accepted - - case database.ErrNotFound: - // choices.Unknown means we don't have the bytes of the block. - // In this case, we do, so we return choices.Processing. - return choices.Processing - - default: - // TODO: correctly report this error to the consensus engine. - b.manager.ctx.Log.Error( - "dropping unhandled database error", - zap.Error(err), - ) - return choices.Processing - } -} - func (b *Block) Timestamp() time.Time { return b.manager.getTimestamp(b.ID()) } diff --git a/vms/platformvm/block/executor/block_test.go b/vms/platformvm/block/executor/block_test.go index 1215f9628e92..dfccc413e29b 100644 --- a/vms/platformvm/block/executor/block_test.go +++ b/vms/platformvm/block/executor/block_test.go @@ -13,7 +13,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/snow/uptime" "github.com/ava-labs/avalanchego/utils/constants" @@ -26,111 +25,6 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/txs/executor" ) -func TestStatus(t *testing.T) { - type test struct { - name string - blockF func(*gomock.Controller) *Block - expectedStatus choices.Status - } - - tests := []test{ - { - name: "last accepted", - blockF: func(ctrl *gomock.Controller) *Block { - blkID := ids.GenerateTestID() - statelessBlk := block.NewMockBlock(ctrl) - statelessBlk.EXPECT().ID().Return(blkID) - - manager := &manager{ - backend: &backend{ - lastAccepted: blkID, - }, - } - - return &Block{ - Block: statelessBlk, - manager: manager, - } - }, - expectedStatus: choices.Accepted, - }, - { - name: "processing", - blockF: func(ctrl *gomock.Controller) *Block { - blkID := ids.GenerateTestID() - statelessBlk := block.NewMockBlock(ctrl) - statelessBlk.EXPECT().ID().Return(blkID) - - manager := &manager{ - backend: &backend{ - blkIDToState: map[ids.ID]*blockState{ - blkID: {}, - }, - }, - } - return &Block{ - Block: statelessBlk, - manager: manager, - } - }, - expectedStatus: choices.Processing, - }, - { - name: "in database", - blockF: func(ctrl *gomock.Controller) *Block { - blkID := ids.GenerateTestID() - statelessBlk := block.NewMockBlock(ctrl) - statelessBlk.EXPECT().ID().Return(blkID) - - state := state.NewMockState(ctrl) - state.EXPECT().GetStatelessBlock(blkID).Return(statelessBlk, nil) - - manager := &manager{ - backend: &backend{ - state: state, - }, - } - return &Block{ - Block: statelessBlk, - manager: manager, - } - }, - expectedStatus: choices.Accepted, - }, - { - name: "not in map or database", - blockF: func(ctrl *gomock.Controller) *Block { - blkID := ids.GenerateTestID() - statelessBlk := block.NewMockBlock(ctrl) - statelessBlk.EXPECT().ID().Return(blkID) - - state := state.NewMockState(ctrl) - state.EXPECT().GetStatelessBlock(blkID).Return(nil, database.ErrNotFound) - - manager := &manager{ - backend: &backend{ - state: state, - }, - } - return &Block{ - Block: statelessBlk, - manager: manager, - } - }, - expectedStatus: choices.Processing, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - ctrl := gomock.NewController(t) - - blk := tt.blockF(ctrl) - require.Equal(t, tt.expectedStatus, blk.Status()) - }) - } -} - func TestBlockOptions(t *testing.T) { type test struct { name string diff --git a/vms/platformvm/vm_regression_test.go b/vms/platformvm/vm_regression_test.go index 629be17fe1ba..c505f9b1a9e1 100644 --- a/vms/platformvm/vm_regression_test.go +++ b/vms/platformvm/vm_regression_test.go @@ -22,7 +22,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/network/p2p" "github.com/ava-labs/avalanchego/network/p2p/gossip" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/snowtest" @@ -713,11 +712,6 @@ func TestRejectedStateRegressionInvalidValidatorTimestamp(t *testing.T) { err = importBlk.Verify(context.Background()) require.ErrorIs(err, database.ErrNotFound) - // Because we no longer ever reject a block in verification, the status - // should remain as processing. - importBlkStatus := importBlk.Status() - require.Equal(choices.Processing, importBlkStatus) - // Populate the shared memory UTXO. m := atomic.NewMemory(prefixdb.New([]byte{5}, baseDB)) @@ -745,10 +739,6 @@ func TestRejectedStateRegressionInvalidValidatorTimestamp(t *testing.T) { // pass verification. require.NoError(importBlk.Verify(context.Background())) - // The status shouldn't have been changed during a successful verification. - importBlkStatus = importBlk.Status() - require.Equal(choices.Processing, importBlkStatus) - // Move chain time ahead to bring the new validator from the pending // validator set into the current validator set. vm.clock.Set(newValidatorStartTime) @@ -777,9 +767,6 @@ func TestRejectedStateRegressionInvalidValidatorTimestamp(t *testing.T) { } for _, blk := range allBlocks { require.NoError(blk.Accept(context.Background())) - - status := blk.Status() - require.Equal(choices.Accepted, status) } // Force a reload of the state from the database. @@ -961,11 +948,6 @@ func TestRejectedStateRegressionInvalidValidatorReward(t *testing.T) { err = importBlk.Verify(context.Background()) require.ErrorIs(err, database.ErrNotFound) - // Because we no longer ever reject a block in verification, the status - // should remain as processing. - importBlkStatus := importBlk.Status() - require.Equal(choices.Processing, importBlkStatus) - // Populate the shared memory UTXO. m := atomic.NewMemory(prefixdb.New([]byte{5}, baseDB)) @@ -993,10 +975,6 @@ func TestRejectedStateRegressionInvalidValidatorReward(t *testing.T) { // pass verification. require.NoError(importBlk.Verify(context.Background())) - // The status shouldn't have been changed during a successful verification. - importBlkStatus = importBlk.Status() - require.Equal(choices.Processing, importBlkStatus) - newValidatorStartTime1 := newValidatorStartTime0.Add(executor.SyncBound).Add(1 * time.Second) newValidatorEndTime1 := newValidatorStartTime1.Add(defaultMaxStakingDuration) @@ -1092,9 +1070,6 @@ func TestRejectedStateRegressionInvalidValidatorReward(t *testing.T) { } for _, blk := range allBlocks { require.NoError(blk.Accept(context.Background())) - - status := blk.Status() - require.Equal(choices.Accepted, status) } // Force a reload of the state from the database. diff --git a/vms/platformvm/vm_test.go b/vms/platformvm/vm_test.go index 9153ee6548bf..277eed268013 100644 --- a/vms/platformvm/vm_test.go +++ b/vms/platformvm/vm_test.go @@ -21,7 +21,6 @@ import ( "github.com/ava-labs/avalanchego/message" "github.com/ava-labs/avalanchego/network/p2p" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowball" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/common/tracker" @@ -371,9 +370,10 @@ func TestGenesis(t *testing.T) { genesisBlockID, err := vm.LastAccepted(context.Background()) // lastAccepted should be ID of genesis block require.NoError(err) + // Ensure the genesis block can be retrieved genesisBlock, err := vm.manager.GetBlock(genesisBlockID) require.NoError(err) - require.Equal(choices.Accepted, genesisBlock.Status()) + require.NotNil(genesisBlock) genesisState, _ := defaultGenesis(t, vm.ctx.AVAXAssetID) // Ensure all the genesis UTXOs are there diff --git a/vms/proposervm/batched_vm.go b/vms/proposervm/batched_vm.go index 853c858e6bba..86672bdc19ea 100644 --- a/vms/proposervm/batched_vm.go +++ b/vms/proposervm/batched_vm.go @@ -7,9 +7,7 @@ import ( "context" "time" - "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/utils/wrappers" @@ -129,14 +127,6 @@ func (vm *VM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]snowman.B for ; innerBlocksIndex < len(statelessBlockDescs); innerBlocksIndex++ { statelessBlockDesc := statelessBlockDescs[innerBlocksIndex] statelessBlk := statelessBlockDesc.block - blkID := statelessBlk.ID() - - _, status, err := vm.State.GetBlock(blkID) - if err == database.ErrNotFound { - status = choices.Processing - } else if err != nil { - return nil, err - } if statelessSignedBlock, ok := statelessBlk.(statelessblock.SignedBlock); ok { blocks[statelessBlockDesc.index] = &postForkBlock{ @@ -144,7 +134,6 @@ func (vm *VM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]snowman.B postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlks[innerBlocksIndex], - status: status, }, } } else { @@ -153,7 +142,6 @@ func (vm *VM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]snowman.B postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlks[innerBlocksIndex], - status: status, }, } } @@ -171,6 +159,5 @@ func (vm *VM) getStatelessBlk(blkID ids.ID) (statelessblock.Block, error) { if currentBlk, exists := vm.verifiedBlocks[blkID]; exists { return currentBlk.getStatelessBlk(), nil } - statelessBlock, _, err := vm.State.GetBlock(blkID) - return statelessBlock, err + return vm.State.GetBlock(blkID) } diff --git a/vms/proposervm/batched_vm_test.go b/vms/proposervm/batched_vm_test.go index be134823c894..458aad628f1c 100644 --- a/vms/proposervm/batched_vm_test.go +++ b/vms/proposervm/batched_vm_test.go @@ -839,9 +839,9 @@ func initTestRemoteProposerVM( ) error { return nil } - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: diff --git a/vms/proposervm/block.go b/vms/proposervm/block.go index d320a80543bc..6c0c2c7e14e7 100644 --- a/vms/proposervm/block.go +++ b/vms/proposervm/block.go @@ -13,7 +13,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/vms/proposervm/block" "github.com/ava-labs/avalanchego/vms/proposervm/proposer" @@ -65,7 +64,6 @@ type Block interface { type PostForkBlock interface { Block - setStatus(choices.Status) getStatelessBlk() block.Block setInnerBlk(snowman.Block) } @@ -74,7 +72,6 @@ type PostForkBlock interface { type postForkCommonComponents struct { vm *VM innerBlk snowman.Block - status choices.Status } // Return the inner block's height @@ -268,7 +265,6 @@ func (p *postForkCommonComponents) buildChild( postForkCommonComponents: postForkCommonComponents{ vm: p.vm, innerBlk: innerBlock, - status: choices.Processing, }, } diff --git a/vms/proposervm/mock_post_fork_block.go b/vms/proposervm/mock_post_fork_block.go index ab449b6363bf..7957a91b457d 100644 --- a/vms/proposervm/mock_post_fork_block.go +++ b/vms/proposervm/mock_post_fork_block.go @@ -15,7 +15,6 @@ import ( time "time" ids "github.com/ava-labs/avalanchego/ids" - choices "github.com/ava-labs/avalanchego/snow/choices" snowman "github.com/ava-labs/avalanchego/snow/consensus/snowman" block "github.com/ava-labs/avalanchego/vms/proposervm/block" gomock "go.uber.org/mock/gomock" @@ -128,20 +127,6 @@ func (mr *MockPostForkBlockMockRecorder) Reject(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reject", reflect.TypeOf((*MockPostForkBlock)(nil).Reject), arg0) } -// Status mocks base method. -func (m *MockPostForkBlock) Status() choices.Status { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Status") - ret0, _ := ret[0].(choices.Status) - return ret0 -} - -// Status indicates an expected call of Status. -func (mr *MockPostForkBlockMockRecorder) Status() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockPostForkBlock)(nil).Status)) -} - // Timestamp mocks base method. func (m *MockPostForkBlock) Timestamp() time.Time { m.ctrl.T.Helper() @@ -268,18 +253,6 @@ func (mr *MockPostForkBlockMockRecorder) setInnerBlk(arg0 any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "setInnerBlk", reflect.TypeOf((*MockPostForkBlock)(nil).setInnerBlk), arg0) } -// setStatus mocks base method. -func (m *MockPostForkBlock) setStatus(arg0 choices.Status) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "setStatus", arg0) -} - -// setStatus indicates an expected call of setStatus. -func (mr *MockPostForkBlockMockRecorder) setStatus(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "setStatus", reflect.TypeOf((*MockPostForkBlock)(nil).setStatus), arg0) -} - // verifyPostForkChild mocks base method. func (m *MockPostForkBlock) verifyPostForkChild(arg0 context.Context, arg1 *postForkBlock) error { m.ctrl.T.Helper() diff --git a/vms/proposervm/post_fork_block.go b/vms/proposervm/post_fork_block.go index 2c875807eb79..c815144fd306 100644 --- a/vms/proposervm/post_fork_block.go +++ b/vms/proposervm/post_fork_block.go @@ -7,7 +7,6 @@ import ( "context" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -43,7 +42,6 @@ func (b *postForkBlock) Accept(ctx context.Context) error { func (b *postForkBlock) acceptOuterBlk() error { // Update in-memory references - b.status = choices.Accepted b.vm.lastAcceptedTime = b.Timestamp() return b.vm.acceptPostForkBlock(b) @@ -58,17 +56,9 @@ func (b *postForkBlock) acceptInnerBlk(ctx context.Context) error { func (b *postForkBlock) Reject(context.Context) error { // We do not reject the inner block here because it may be accepted later delete(b.vm.verifiedBlocks, b.ID()) - b.status = choices.Rejected return nil } -func (b *postForkBlock) Status() choices.Status { - if b.status == choices.Accepted && b.Height() > b.vm.lastAcceptedHeight { - return choices.Processing - } - return b.status -} - // Return this block's parent, or a *missing.Block if // we don't have the parent. func (b *postForkBlock) Parent() ids.ID { @@ -116,7 +106,6 @@ func (b *postForkBlock) Options(ctx context.Context) ([2]snowman.Block, error) { postForkCommonComponents: postForkCommonComponents{ vm: b.vm, innerBlk: innerOption, - status: innerOption.Status(), }, } } @@ -168,10 +157,6 @@ func (b *postForkBlock) pChainHeight(context.Context) (uint64, error) { return b.PChainHeight(), nil } -func (b *postForkBlock) setStatus(status choices.Status) { - b.status = status -} - func (b *postForkBlock) getStatelessBlk() block.Block { return b.SignedBlock } diff --git a/vms/proposervm/post_fork_block_test.go b/vms/proposervm/post_fork_block_test.go index 416fc087b101..be61e0fb75a6 100644 --- a/vms/proposervm/post_fork_block_test.go +++ b/vms/proposervm/post_fork_block_test.go @@ -14,16 +14,19 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/timer/mockable" "github.com/ava-labs/avalanchego/vms/proposervm/block" "github.com/ava-labs/avalanchego/vms/proposervm/proposer" ) -var errDuplicateVerify = errors.New("duplicate verify") +var ( + errDuplicateVerify = errors.New("duplicate verify") + errUnexpectedBlockRejection = errors.New("unexpected block rejection") +) // ProposerBlock Option interface tests section func TestOracle_PostForkBlock_ImplementsInterface(t *testing.T) { @@ -53,7 +56,7 @@ func TestOracle_PostForkBlock_ImplementsInterface(t *testing.T) { innerTestBlock := snowmantest.BuildChild(snowmantest.Genesis) innerOracleBlk := &TestOptionsBlock{ Block: *innerTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(innerTestBlock), snowmantest.BuildChild(innerTestBlock), }, @@ -74,7 +77,6 @@ func TestOracle_PostForkBlock_ImplementsInterface(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: innerOracleBlk, - status: choices.Processing, }, } @@ -139,7 +141,6 @@ func TestBlockVerify_PostForkBlock_PreDurango_ParentChecks(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: childCoreBlk, - status: choices.Processing, }, } @@ -229,7 +230,6 @@ func TestBlockVerify_PostForkBlock_PostDurango_ParentChecks(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: childCoreBlk, - status: choices.Processing, }, } @@ -351,7 +351,6 @@ func TestBlockVerify_PostForkBlock_TimestampChecks(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: childCoreBlk, - status: choices.Processing, }, } @@ -540,7 +539,6 @@ func TestBlockVerify_PostForkBlock_PChainHeightChecks(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: childCoreBlk, - status: choices.Processing, }, } @@ -659,7 +657,7 @@ func TestBlockVerify_PostForkBlockBuiltOnOption_PChainHeightChecks(t *testing.T) Block: *innerTestBlock, } preferredOracleBlkChild := snowmantest.BuildChild(innerTestBlock) - oracleCoreBlk.opts = [2]snowman.Block{ + oracleCoreBlk.opts = [2]*snowmantest.Block{ preferredOracleBlkChild, snowmantest.BuildChild(innerTestBlock), } @@ -724,7 +722,6 @@ func TestBlockVerify_PostForkBlockBuiltOnOption_PChainHeightChecks(t *testing.T) postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: childCoreBlk, - status: choices.Processing, }, } @@ -910,12 +907,12 @@ func TestBlockAccept_PostForkBlock_SetsLastAcceptedBlock(t *testing.T) { // test require.NoError(builtBlk.Accept(context.Background())) - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - if coreBlk.Status() == choices.Accepted { - return coreBlk.ID(), nil - } - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{ + snowmantest.Genesis, + coreBlk, + }, + ) acceptedID, err := proVM.LastAccepted(context.Background()) require.NoError(err) require.Equal(builtBlk.ID(), acceptedID) @@ -956,7 +953,7 @@ func TestBlockAccept_PostForkBlock_TwoProBlocksWithSameCoreBlock_OneIsAccepted(t // set proBlk1 as preferred require.NoError(proBlk1.Accept(context.Background())) - require.Equal(choices.Accepted, coreBlk.Status()) + require.Equal(snowtest.Accepted, coreBlk.Status) acceptedID, err := proVM.LastAccepted(context.Background()) require.NoError(err) @@ -977,6 +974,7 @@ func TestBlockReject_PostForkBlock_InnerBlockIsNotRejected(t *testing.T) { }() coreBlk := snowmantest.BuildChild(snowmantest.Genesis) + coreBlk.RejectV = errUnexpectedBlockRejection coreVM.BuildBlockF = func(context.Context) (snowman.Block, error) { return coreBlk, nil } @@ -987,9 +985,6 @@ func TestBlockReject_PostForkBlock_InnerBlockIsNotRejected(t *testing.T) { proBlk := sb.(*postForkBlock) require.NoError(proBlk.Reject(context.Background())) - - require.Equal(choices.Rejected, proBlk.Status()) - require.NotEqual(choices.Rejected, proBlk.innerBlk.Status()) } func TestBlockVerify_PostForkBlock_ShouldBePostForkOption(t *testing.T) { @@ -1008,7 +1003,7 @@ func TestBlockVerify_PostForkBlock_ShouldBePostForkOption(t *testing.T) { coreTestBlk := snowmantest.BuildChild(snowmantest.Genesis) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, diff --git a/vms/proposervm/post_fork_option.go b/vms/proposervm/post_fork_option.go index 93cfd2550ca6..8be839049f93 100644 --- a/vms/proposervm/post_fork_option.go +++ b/vms/proposervm/post_fork_option.go @@ -10,7 +10,6 @@ import ( "go.uber.org/zap" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -25,7 +24,7 @@ type postForkOption struct { } func (b *postForkOption) Timestamp() time.Time { - if b.Status() == choices.Accepted { + if b.Height() <= b.vm.lastAcceptedHeight { return b.vm.lastAcceptedTime } return b.timestamp @@ -39,9 +38,6 @@ func (b *postForkOption) Accept(ctx context.Context) error { } func (b *postForkOption) acceptOuterBlk() error { - // Update in-memory references - b.status = choices.Accepted - return b.vm.acceptPostForkBlock(b) } @@ -56,17 +52,9 @@ func (b *postForkOption) Reject(context.Context) error { // in the proposer block that causing this block to be rejected. delete(b.vm.verifiedBlocks, b.ID()) - b.status = choices.Rejected return nil } -func (b *postForkOption) Status() choices.Status { - if b.status == choices.Accepted && b.Height() > b.vm.lastAcceptedHeight { - return choices.Processing - } - return b.status -} - func (b *postForkOption) Parent() ids.ID { return b.ParentID() } @@ -134,10 +122,6 @@ func (b *postForkOption) pChainHeight(ctx context.Context) (uint64, error) { return parent.pChainHeight(ctx) } -func (b *postForkOption) setStatus(status choices.Status) { - b.status = status -} - func (b *postForkOption) getStatelessBlk() block.Block { return b.Block } diff --git a/vms/proposervm/post_fork_option_test.go b/vms/proposervm/post_fork_option_test.go index 43b7d5f5b90f..0055fa3f50e2 100644 --- a/vms/proposervm/post_fork_option_test.go +++ b/vms/proposervm/post_fork_option_test.go @@ -15,10 +15,10 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/common" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -26,12 +26,12 @@ var _ snowman.OracleBlock = (*TestOptionsBlock)(nil) type TestOptionsBlock struct { snowmantest.Block - opts [2]snowman.Block + opts [2]*snowmantest.Block optsErr error } func (tob TestOptionsBlock) Options(context.Context) ([2]snowman.Block, error) { - return tob.opts, tob.optsErr + return [2]snowman.Block{tob.opts[0], tob.opts[1]}, tob.optsErr } // ProposerBlock.Verify tests section @@ -52,7 +52,7 @@ func TestBlockVerify_PostForkOption_ParentChecks(t *testing.T) { preferredBlk := snowmantest.BuildChild(coreTestBlk) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ preferredBlk, snowmantest.BuildChild(coreTestBlk), }, @@ -142,7 +142,7 @@ func TestBlockVerify_PostForkOption_CoreBlockVerifyIsCalledOnce(t *testing.T) { coreOpt1 := snowmantest.BuildChild(coreTestBlk) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ coreOpt0, coreOpt1, }, @@ -222,7 +222,7 @@ func TestBlockAccept_PostForkOption_SetsLastAcceptedBlock(t *testing.T) { coreTestBlk := snowmantest.BuildChild(snowmantest.Genesis) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, @@ -266,12 +266,13 @@ func TestBlockAccept_PostForkOption_SetsLastAcceptedBlock(t *testing.T) { // accept oracle block require.NoError(parentBlk.Accept(context.Background())) - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - if oracleCoreBlk.Status() == choices.Accepted { - return oracleCoreBlk.ID(), nil - } - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{ + snowmantest.Genesis, + &oracleCoreBlk.Block, + }, + oracleCoreBlk.opts[:], + ) acceptedID, err := proVM.LastAccepted(context.Background()) require.NoError(err) require.Equal(parentBlk.ID(), acceptedID) @@ -284,12 +285,6 @@ func TestBlockAccept_PostForkOption_SetsLastAcceptedBlock(t *testing.T) { require.NoError(opts[0].Accept(context.Background())) - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - if oracleCoreBlk.opts[0].Status() == choices.Accepted { - return oracleCoreBlk.opts[0].ID(), nil - } - return oracleCoreBlk.ID(), nil - } acceptedID, err = proVM.LastAccepted(context.Background()) require.NoError(err) require.Equal(opts[0].ID(), acceptedID) @@ -312,7 +307,7 @@ func TestBlockReject_InnerBlockIsNotRejected(t *testing.T) { coreTestBlk := snowmantest.BuildChild(snowmantest.Genesis) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, @@ -355,12 +350,7 @@ func TestBlockReject_InnerBlockIsNotRejected(t *testing.T) { // reject oracle block require.NoError(builtBlk.Reject(context.Background())) - require.IsType(&postForkBlock{}, builtBlk) - proBlk := builtBlk.(*postForkBlock) - - require.Equal(choices.Rejected, proBlk.Status()) - - require.NotEqual(choices.Rejected, proBlk.innerBlk.Status()) + require.NotEqual(snowtest.Rejected, oracleCoreBlk.Status) // reject an option require.IsType(&postForkBlock{}, builtBlk) @@ -369,12 +359,7 @@ func TestBlockReject_InnerBlockIsNotRejected(t *testing.T) { require.NoError(err) require.NoError(opts[0].Reject(context.Background())) - require.IsType(&postForkOption{}, opts[0]) - proOpt := opts[0].(*postForkOption) - - require.Equal(choices.Rejected, proOpt.Status()) - - require.NotEqual(choices.Rejected, proOpt.innerBlk.Status()) + require.NotEqual(snowtest.Rejected, oracleCoreBlk.opts[0].Status) } func TestBlockVerify_PostForkOption_ParentIsNotOracleWithError(t *testing.T) { @@ -463,7 +448,7 @@ func TestOptionTimestampValidity(t *testing.T) { coreTestBlk := snowmantest.BuildChild(snowmantest.Genesis) coreOracleBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, @@ -617,7 +602,7 @@ func TestOptionTimestampValidity(t *testing.T) { statefulOptionBlock, err := proVM.ParseBlock(context.Background(), option.Bytes()) require.NoError(err) - require.Equal(choices.Accepted, statefulOptionBlock.Status()) + require.LessOrEqual(statefulOptionBlock.Height(), proVM.lastAcceptedHeight) coreVM.GetBlockF = func(context.Context, ids.ID) (snowman.Block, error) { require.FailNow("called GetBlock when unable to handle the error") diff --git a/vms/proposervm/pre_fork_block.go b/vms/proposervm/pre_fork_block.go index 737659cacc05..6610a9f4d823 100644 --- a/vms/proposervm/pre_fork_block.go +++ b/vms/proposervm/pre_fork_block.go @@ -11,9 +11,7 @@ import ( "go.uber.org/zap" - "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -44,28 +42,6 @@ func (b *preForkBlock) acceptInnerBlk(ctx context.Context) error { return b.Block.Accept(ctx) } -func (b *preForkBlock) Status() choices.Status { - forkHeight, err := b.vm.GetForkHeight() - if err == database.ErrNotFound { - return b.Block.Status() - } - if err != nil { - // TODO: Once `Status()` can return an error, we should return the error - // here. - b.vm.ctx.Log.Error("unexpected error looking up fork height", - zap.Error(err), - ) - return b.Block.Status() - } - - // The fork has occurred earlier than this block, so preForkBlocks are all - // invalid. - if b.Height() >= forkHeight { - return choices.Rejected - } - return b.Block.Status() -} - func (b *preForkBlock) Verify(ctx context.Context) error { parent, err := b.vm.getPreForkBlock(ctx, b.Block.Parent()) if err != nil { @@ -246,7 +222,6 @@ func (b *preForkBlock) buildChild(ctx context.Context) (Block, error) { postForkCommonComponents: postForkCommonComponents{ vm: b.vm, innerBlk: innerBlock, - status: choices.Processing, }, } diff --git a/vms/proposervm/pre_fork_block_test.go b/vms/proposervm/pre_fork_block_test.go index 892209781e8c..2153a62f9e3b 100644 --- a/vms/proposervm/pre_fork_block_test.go +++ b/vms/proposervm/pre_fork_block_test.go @@ -15,10 +15,10 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" + "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/timer/mockable" @@ -65,7 +65,7 @@ func TestOracle_PreForkBlkCanBuiltOnPreForkOption(t *testing.T) { preferredTestBlk := snowmantest.BuildChild(coreTestBlk) oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ preferredTestBlk, snowmantest.BuildChild(coreTestBlk), }, @@ -139,7 +139,7 @@ func TestOracle_PostForkBlkCanBuiltOnPreForkOption(t *testing.T) { oracleCoreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ preferredBlk, unpreferredBlk, }, @@ -294,7 +294,6 @@ func TestBlockVerify_BlocksBuiltOnPreForkGenesis(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: coreBlk, - status: choices.Processing, }, } @@ -439,12 +438,12 @@ func TestBlockAccept_PreFork_SetsLastAcceptedBlock(t *testing.T) { // test require.NoError(builtBlk.Accept(context.Background())) - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - if coreBlk.Status() == choices.Accepted { - return coreBlk.ID(), nil - } - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{ + snowmantest.Genesis, + coreBlk, + }, + ) acceptedID, err := proVM.LastAccepted(context.Background()) require.NoError(err) require.Equal(builtBlk.ID(), acceptedID) @@ -474,8 +473,7 @@ func TestBlockReject_PreForkBlock_InnerBlockIsRejected(t *testing.T) { proBlk := sb.(*preForkBlock) require.NoError(proBlk.Reject(context.Background())) - require.Equal(choices.Rejected, proBlk.Status()) - require.Equal(choices.Rejected, proBlk.Block.Status()) + require.Equal(snowtest.Rejected, coreBlk.Status) } func TestBlockVerify_ForkBlockIsOracleBlock(t *testing.T) { @@ -497,7 +495,7 @@ func TestBlockVerify_ForkBlockIsOracleBlock(t *testing.T) { coreTestBlk.TimestampV = postActivationTime coreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, @@ -567,7 +565,7 @@ func TestBlockVerify_ForkBlockIsOracleBlockButChildrenAreSigned(t *testing.T) { coreTestBlk.TimestampV = postActivationTime coreBlk := &TestOptionsBlock{ Block: *coreTestBlk, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(coreTestBlk), snowmantest.BuildChild(coreTestBlk), }, diff --git a/vms/proposervm/state/block_state.go b/vms/proposervm/state/block_state.go index 8e888332e9c2..82f1cf0e5a9e 100644 --- a/vms/proposervm/state/block_state.go +++ b/vms/proposervm/state/block_state.go @@ -29,8 +29,8 @@ var ( ) type BlockState interface { - GetBlock(blkID ids.ID) (block.Block, choices.Status, error) - PutBlock(blk block.Block, status choices.Status) error + GetBlock(blkID ids.ID) (block.Block, error) + PutBlock(blk block.Block) error DeleteBlock(blkID ids.ID) error } @@ -82,47 +82,47 @@ func NewMeteredBlockState(db database.Database, namespace string, metrics promet }, err } -func (s *blockState) GetBlock(blkID ids.ID) (block.Block, choices.Status, error) { +func (s *blockState) GetBlock(blkID ids.ID) (block.Block, error) { if blk, found := s.blkCache.Get(blkID); found { if blk == nil { - return nil, choices.Unknown, database.ErrNotFound + return nil, database.ErrNotFound } - return blk.block, blk.Status, nil + return blk.block, nil } blkWrapperBytes, err := s.db.Get(blkID[:]) if err == database.ErrNotFound { s.blkCache.Put(blkID, nil) - return nil, choices.Unknown, database.ErrNotFound + return nil, database.ErrNotFound } if err != nil { - return nil, choices.Unknown, err + return nil, err } blkWrapper := blockWrapper{} parsedVersion, err := Codec.Unmarshal(blkWrapperBytes, &blkWrapper) if err != nil { - return nil, choices.Unknown, err + return nil, err } if parsedVersion != CodecVersion { - return nil, choices.Unknown, errBlockWrongVersion + return nil, errBlockWrongVersion } // The key was in the database blk, err := block.ParseWithoutVerification(blkWrapper.Block) if err != nil { - return nil, choices.Unknown, err + return nil, err } blkWrapper.block = blk s.blkCache.Put(blkID, &blkWrapper) - return blk, blkWrapper.Status, nil + return blk, nil } -func (s *blockState) PutBlock(blk block.Block, status choices.Status) error { +func (s *blockState) PutBlock(blk block.Block) error { blkWrapper := blockWrapper{ Block: blk.Bytes(), - Status: status, + Status: choices.Accepted, block: blk, } diff --git a/vms/proposervm/state/block_state_test.go b/vms/proposervm/state/block_state_test.go index 33a43c5febae..a04d2ca553e8 100644 --- a/vms/proposervm/state/block_state_test.go +++ b/vms/proposervm/state/block_state_test.go @@ -14,7 +14,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/database/memdb" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/staking" "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -44,22 +43,20 @@ func testBlockState(require *require.Assertions, bs BlockState) { ) require.NoError(err) - _, _, err = bs.GetBlock(b.ID()) + _, err = bs.GetBlock(b.ID()) require.Equal(database.ErrNotFound, err) - _, _, err = bs.GetBlock(b.ID()) + _, err = bs.GetBlock(b.ID()) require.Equal(database.ErrNotFound, err) - require.NoError(bs.PutBlock(b, choices.Accepted)) + require.NoError(bs.PutBlock(b)) - fetchedBlock, fetchedStatus, err := bs.GetBlock(b.ID()) + fetchedBlock, err := bs.GetBlock(b.ID()) require.NoError(err) - require.Equal(choices.Accepted, fetchedStatus) require.Equal(b.Bytes(), fetchedBlock.Bytes()) - fetchedBlock, fetchedStatus, err = bs.GetBlock(b.ID()) + fetchedBlock, err = bs.GetBlock(b.ID()) require.NoError(err) - require.Equal(choices.Accepted, fetchedStatus) require.Equal(b.Bytes(), fetchedBlock.Bytes()) } diff --git a/vms/proposervm/state/mock_state.go b/vms/proposervm/state/mock_state.go index ce28025a93e9..e01ab01d93aa 100644 --- a/vms/proposervm/state/mock_state.go +++ b/vms/proposervm/state/mock_state.go @@ -13,7 +13,6 @@ import ( reflect "reflect" ids "github.com/ava-labs/avalanchego/ids" - choices "github.com/ava-labs/avalanchego/snow/choices" block "github.com/ava-labs/avalanchego/vms/proposervm/block" gomock "go.uber.org/mock/gomock" ) @@ -84,13 +83,12 @@ func (mr *MockStateMockRecorder) DeleteLastAccepted() *gomock.Call { } // GetBlock mocks base method. -func (m *MockState) GetBlock(arg0 ids.ID) (block.Block, choices.Status, error) { +func (m *MockState) GetBlock(arg0 ids.ID) (block.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlock", arg0) ret0, _ := ret[0].(block.Block) - ret1, _ := ret[1].(choices.Status) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 + ret1, _ := ret[1].(error) + return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. @@ -160,17 +158,17 @@ func (mr *MockStateMockRecorder) GetMinimumHeight() *gomock.Call { } // PutBlock mocks base method. -func (m *MockState) PutBlock(arg0 block.Block, arg1 choices.Status) error { +func (m *MockState) PutBlock(arg0 block.Block) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PutBlock", arg0, arg1) + ret := m.ctrl.Call(m, "PutBlock", arg0) ret0, _ := ret[0].(error) return ret0 } // PutBlock indicates an expected call of PutBlock. -func (mr *MockStateMockRecorder) PutBlock(arg0, arg1 any) *gomock.Call { +func (mr *MockStateMockRecorder) PutBlock(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutBlock", reflect.TypeOf((*MockState)(nil).PutBlock), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutBlock", reflect.TypeOf((*MockState)(nil).PutBlock), arg0) } // SetBlockIDAtHeight mocks base method. diff --git a/vms/proposervm/state_syncable_vm_test.go b/vms/proposervm/state_syncable_vm_test.go index 479c311b5fed..2327384fc04f 100644 --- a/vms/proposervm/state_syncable_vm_test.go +++ b/vms/proposervm/state_syncable_vm_test.go @@ -16,7 +16,6 @@ import ( "github.com/ava-labs/avalanchego/database/prefixdb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/common" @@ -48,9 +47,9 @@ func helperBuildStateSyncTestObjects(t *testing.T) (*fullVM, *VM) { ) error { return nil } - innerVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + innerVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) innerVM.GetBlockF = func(context.Context, ids.ID) (snowman.Block, error) { return snowmantest.Genesis, nil } @@ -187,7 +186,6 @@ func TestStateSyncGetOngoingSyncStateSummary(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Accepted, }, } require.NoError(vm.acceptPostForkBlock(proBlk)) @@ -271,7 +269,6 @@ func TestStateSyncGetLastStateSummary(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Accepted, }, } require.NoError(vm.acceptPostForkBlock(proBlk)) @@ -358,7 +355,6 @@ func TestStateSyncGetStateSummary(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Accepted, }, } require.NoError(vm.acceptPostForkBlock(proBlk)) @@ -430,7 +426,6 @@ func TestParseStateSummary(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Accepted, }, } require.NoError(vm.acceptPostForkBlock(proBlk)) @@ -563,7 +558,6 @@ func TestStateSummaryAcceptOlderBlock(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Accepted, }, } require.NoError(vm.acceptPostForkBlock(proBlk)) diff --git a/vms/proposervm/tree/tree_test.go b/vms/proposervm/tree/tree_test.go index 48095a40f638..08cae64145e3 100644 --- a/vms/proposervm/tree/tree_test.go +++ b/vms/proposervm/tree/tree_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" + "github.com/ava-labs/avalanchego/snow/snowtest" ) func TestAcceptSingleBlock(t *testing.T) { @@ -28,7 +28,7 @@ func TestAcceptSingleBlock(t *testing.T) { require.True(contains) require.NoError(tr.Accept(context.Background(), block)) - require.Equal(choices.Accepted, block.Status()) + require.Equal(snowtest.Accepted, block.Status) _, contains = tr.Get(block) require.False(contains) @@ -55,11 +55,11 @@ func TestAcceptBlockConflict(t *testing.T) { require.NoError(tr.Accept(context.Background(), blockToAccept)) // check their statuses and that they are removed from the tree - require.Equal(choices.Accepted, blockToAccept.Status()) + require.Equal(snowtest.Accepted, blockToAccept.Status) _, contains = tr.Get(blockToAccept) require.False(contains) - require.Equal(choices.Rejected, blockToReject.Status()) + require.Equal(snowtest.Rejected, blockToReject.Status) _, contains = tr.Get(blockToReject) require.False(contains) } @@ -90,15 +90,15 @@ func TestAcceptChainConflict(t *testing.T) { require.NoError(tr.Accept(context.Background(), blockToAccept)) // check their statuses and whether they are removed from tree - require.Equal(choices.Accepted, blockToAccept.Status()) + require.Equal(snowtest.Accepted, blockToAccept.Status) _, contains = tr.Get(blockToAccept) require.False(contains) - require.Equal(choices.Rejected, blockToReject.Status()) + require.Equal(snowtest.Rejected, blockToReject.Status) _, contains = tr.Get(blockToReject) require.False(contains) - require.Equal(choices.Rejected, blockToRejectChild.Status()) + require.Equal(snowtest.Rejected, blockToRejectChild.Status) _, contains = tr.Get(blockToRejectChild) require.False(contains) } diff --git a/vms/proposervm/vm.go b/vms/proposervm/vm.go index 2baf8064e4e3..1c44cab6fbf8 100644 --- a/vms/proposervm/vm.go +++ b/vms/proposervm/vm.go @@ -19,7 +19,6 @@ import ( "github.com/ava-labs/avalanchego/database/versiondb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" @@ -531,16 +530,7 @@ func (vm *VM) parsePostForkBlock(ctx context.Context, b []byte) (PostForkBlock, return nil, err } - // if the block already exists, then make sure the status is set correctly blkID := statelessBlock.ID() - blk, err := vm.getPostForkBlock(ctx, blkID) - if err == nil { - return blk, nil - } - if err != database.ErrNotFound { - return nil, err - } - innerBlkBytes := statelessBlock.Block() innerBlk, err := vm.parseInnerBlock(ctx, blkID, innerBlkBytes) if err != nil { @@ -548,25 +538,22 @@ func (vm *VM) parsePostForkBlock(ctx context.Context, b []byte) (PostForkBlock, } if statelessSignedBlock, ok := statelessBlock.(statelessblock.SignedBlock); ok { - blk = &postForkBlock{ + return &postForkBlock{ SignedBlock: statelessSignedBlock, postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: choices.Processing, - }, - } - } else { - blk = &postForkOption{ - Block: statelessBlock, - postForkCommonComponents: postForkCommonComponents{ - vm: vm, - innerBlk: innerBlk, - status: choices.Processing, }, - } + }, nil } - return blk, nil + + return &postForkOption{ + Block: statelessBlock, + postForkCommonComponents: postForkCommonComponents{ + vm: vm, + innerBlk: innerBlk, + }, + }, nil } func (vm *VM) parsePreForkBlock(ctx context.Context, b []byte) (*preForkBlock, error) { @@ -590,7 +577,7 @@ func (vm *VM) getPostForkBlock(ctx context.Context, blkID ids.ID) (PostForkBlock return block, nil } - statelessBlock, status, err := vm.State.GetBlock(blkID) + statelessBlock, err := vm.State.GetBlock(blkID) if err != nil { return nil, err } @@ -607,7 +594,6 @@ func (vm *VM) getPostForkBlock(ctx context.Context, blkID ids.ID) (PostForkBlock postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: status, }, }, nil } @@ -616,7 +602,6 @@ func (vm *VM) getPostForkBlock(ctx context.Context, blkID ids.ID) (PostForkBlock postForkCommonComponents: postForkCommonComponents{ vm: vm, innerBlk: innerBlk, - status: status, }, }, nil } @@ -640,7 +625,7 @@ func (vm *VM) acceptPostForkBlock(blk PostForkBlock) error { if err := vm.State.SetLastAccepted(blkID); err != nil { return err } - if err := vm.State.PutBlock(blk.getStatelessBlk(), choices.Accepted); err != nil { + if err := vm.State.PutBlock(blk.getStatelessBlk()); err != nil { return err } if err := vm.updateHeightIndex(height, blkID); err != nil { diff --git a/vms/proposervm/vm_byzantine_test.go b/vms/proposervm/vm_byzantine_test.go index d4997781cdd4..ca38084a4125 100644 --- a/vms/proposervm/vm_byzantine_test.go +++ b/vms/proposervm/vm_byzantine_test.go @@ -14,7 +14,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/validators" @@ -99,7 +98,7 @@ func TestInvalidByzantineProposerOracleParent(t *testing.T) { xTestBlock := snowmantest.BuildChild(snowmantest.Genesis) xBlock := &TestOptionsBlock{ Block: *xTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(xTestBlock), snowmantest.BuildChild(xTestBlock), }, @@ -152,14 +151,10 @@ func TestInvalidByzantineProposerOracleParent(t *testing.T) { wrappedXBlock, err := proVM.ParseBlock(context.Background(), xBlock.Bytes()) require.NoError(err) + // This should never be invoked by the consensus engine. However, it is + // enforced to fail verification as a failsafe. err = wrappedXBlock.Verify(context.Background()) require.ErrorIs(err, errUnexpectedBlockType) - - require.NoError(aBlock.Accept(context.Background())) - - // Because the wrappedXBlock never passed verification and is now rejected, - // the consensus engine will never verify any of its children. - require.Equal(choices.Rejected, wrappedXBlock.Status()) } // Ensure that a byzantine node issuing an invalid PostForkBlock (B) when the @@ -223,15 +218,10 @@ func TestInvalidByzantineProposerPreForkParent(t *testing.T) { wrappedXBlock, err := proVM.ParseBlock(context.Background(), xBlock.Bytes()) require.NoError(err) - // If there wasn't an error parsing - verify must return an error + // This should never be invoked by the consensus engine. However, it is + // enforced to fail verification as a failsafe. err = wrappedXBlock.Verify(context.Background()) require.ErrorIs(err, errUnexpectedBlockType) - - require.NoError(aBlock.Accept(context.Background())) - - // Because the wrappedXBlock never passed verification and is now rejected, - // the consensus engine will never verify any of its children. - require.Equal(choices.Rejected, wrappedXBlock.Status()) } // Ensure that a byzantine node issuing an invalid OptionBlock (B) which @@ -258,7 +248,7 @@ func TestBlockVerify_PostForkOption_FaultyParent(t *testing.T) { xBlock := &TestOptionsBlock{ Block: *snowmantest.BuildChild(snowmantest.Genesis), - opts: [2]snowman.Block{ // valid blocks should reference xBlock + opts: [2]*snowmantest.Block{ // valid blocks should reference xBlock snowmantest.BuildChild(snowmantest.Genesis), snowmantest.BuildChild(snowmantest.Genesis), }, @@ -339,7 +329,7 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { xTestBlock := snowmantest.BuildChild(snowmantest.Genesis) xBlock := &TestOptionsBlock{ Block: *xTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(xTestBlock), snowmantest.BuildChild(xTestBlock), }, @@ -365,7 +355,6 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: yBlock, - status: choices.Processing, }, } @@ -383,7 +372,6 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: xInnerOption, - status: xInnerOption.Status(), }, } @@ -410,7 +398,6 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: xInnerOption, - status: xInnerOption.Status(), }, } @@ -421,7 +408,7 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { zTestBlock := snowmantest.BuildChild(snowmantest.Genesis) zBlock := &TestOptionsBlock{ Block: *zTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(zTestBlock), snowmantest.BuildChild(zTestBlock), }, @@ -447,7 +434,6 @@ func TestBlockVerify_InvalidPostForkOption(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: xInnerOption, - status: xInnerOption.Status(), }, } diff --git a/vms/proposervm/vm_test.go b/vms/proposervm/vm_test.go index 5e76b22cd6e2..5ad10d3dfd4f 100644 --- a/vms/proposervm/vm_test.go +++ b/vms/proposervm/vm_test.go @@ -21,7 +21,6 @@ import ( "github.com/ava-labs/avalanchego/database/prefixdb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/common" @@ -32,7 +31,6 @@ import ( "github.com/ava-labs/avalanchego/utils" "github.com/ava-labs/avalanchego/utils/timer/mockable" "github.com/ava-labs/avalanchego/vms/proposervm/proposer" - "github.com/ava-labs/avalanchego/vms/proposervm/state" statelessblock "github.com/ava-labs/avalanchego/vms/proposervm/block" ) @@ -103,9 +101,9 @@ func initTestProposerVM( ) error { return nil } - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: @@ -496,7 +494,6 @@ func TestCoreBlockFailureCauseProposerBlockParseFailure(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: innerBlk, - status: choices.Processing, }, } @@ -541,7 +538,6 @@ func TestTwoProBlocksWrappingSameCoreBlockCanBeParsed(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: innerBlk, - status: choices.Processing, }, } @@ -560,7 +556,6 @@ func TestTwoProBlocksWrappingSameCoreBlockCanBeParsed(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: innerBlk, - status: choices.Processing, }, } @@ -630,7 +625,6 @@ func TestTwoProBlocksWithSameParentCanBothVerify(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: netcoreBlk, - status: choices.Processing, }, } @@ -784,9 +778,9 @@ func TestExpiredBuildBlock(t *testing.T) { coreVM := &block.TestVM{} coreVM.T = t - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: @@ -1064,61 +1058,62 @@ func TestInnerVMRollback(t *testing.T) { valState := &validators.TestState{ T: t, - } - valState.GetCurrentHeightF = func(context.Context) (uint64, error) { - return defaultPChainHeight, nil - } - valState.GetValidatorSetF = func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) { - nodeID := ids.BuildTestNodeID([]byte{1}) - return map[ids.NodeID]*validators.GetValidatorOutput{ - nodeID: { - NodeID: nodeID, - Weight: 100, - }, - }, nil + GetCurrentHeightF: func(context.Context) (uint64, error) { + return defaultPChainHeight, nil + }, + GetValidatorSetF: func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) { + nodeID := ids.BuildTestNodeID([]byte{1}) + return map[ids.NodeID]*validators.GetValidatorOutput{ + nodeID: { + NodeID: nodeID, + Weight: 100, + }, + }, nil + }, } - coreVM := &block.TestVM{} - coreVM.T = t - - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } - coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { - switch blkID { - case snowmantest.GenesisID: - return snowmantest.Genesis, nil - default: - return nil, errUnknownBlock - } - } - coreVM.ParseBlockF = func(_ context.Context, b []byte) (snowman.Block, error) { - switch { - case bytes.Equal(b, snowmantest.GenesisBytes): - return snowmantest.Genesis, nil - default: - return nil, errUnknownBlock - } + coreVM := &block.TestVM{ + TestVM: common.TestVM{ + T: t, + InitializeF: func( + context.Context, + *snow.Context, + database.Database, + []byte, + []byte, + []byte, + chan<- common.Message, + []*common.Fx, + common.AppSender, + ) error { + return nil + }, + }, + ParseBlockF: func(_ context.Context, b []byte) (snowman.Block, error) { + switch { + case bytes.Equal(b, snowmantest.GenesisBytes): + return snowmantest.Genesis, nil + default: + return nil, errUnknownBlock + } + }, + GetBlockF: func(_ context.Context, blkID ids.ID) (snowman.Block, error) { + switch blkID { + case snowmantest.GenesisID: + return snowmantest.Genesis, nil + default: + return nil, errUnknownBlock + } + }, + LastAcceptedF: snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ), } ctx := snowtest.Context(t, snowtest.CChainID) ctx.NodeID = ids.NodeIDFromCert(pTestCert) ctx.ValidatorState = valState - coreVM.InitializeF = func( - context.Context, - *snow.Context, - database.Database, - []byte, - []byte, - []byte, - chan<- common.Message, - []*common.Fx, - common.AppSender, - ) error { - return nil - } - db := memdb.New() proVM := New( @@ -1182,23 +1177,24 @@ func TestInnerVMRollback(t *testing.T) { proVM.Clock.Set(statelessBlock.Timestamp()) - parsedBlock, err := proVM.ParseBlock(context.Background(), statelessBlock.Bytes()) + lastAcceptedID, err := proVM.LastAccepted(context.Background()) require.NoError(err) + require.Equal(snowmantest.GenesisID, lastAcceptedID) - require.Equal(choices.Processing, parsedBlock.Status()) + parsedBlock, err := proVM.ParseBlock(context.Background(), statelessBlock.Bytes()) + require.NoError(err) require.NoError(parsedBlock.Verify(context.Background())) require.NoError(proVM.SetPreference(context.Background(), parsedBlock.ID())) require.NoError(parsedBlock.Accept(context.Background())) - fetchedBlock, err := proVM.GetBlock(context.Background(), parsedBlock.ID()) + lastAcceptedID, err = proVM.LastAccepted(context.Background()) require.NoError(err) - - require.Equal(choices.Accepted, fetchedBlock.Status()) + require.Equal(parsedBlock.ID(), lastAcceptedID) // Restart the node and have the inner VM rollback state. require.NoError(proVM.Shutdown(context.Background())) - coreBlk.StatusV = choices.Processing + coreBlk.Status = snowtest.Undecided proVM = New( coreVM, @@ -1229,15 +1225,9 @@ func TestInnerVMRollback(t *testing.T) { require.NoError(proVM.Shutdown(context.Background())) }() - lastAcceptedID, err := proVM.LastAccepted(context.Background()) + lastAcceptedID, err = proVM.LastAccepted(context.Background()) require.NoError(err) - require.Equal(snowmantest.GenesisID, lastAcceptedID) - - parsedBlock, err = proVM.ParseBlock(context.Background(), statelessBlock.Bytes()) - require.NoError(err) - - require.Equal(choices.Processing, parsedBlock.Status()) } func TestBuildBlockDuringWindow(t *testing.T) { @@ -1368,7 +1358,6 @@ func TestTwoForks_OneIsAccepted(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: yBlock, - status: choices.Processing, }, } @@ -1392,14 +1381,14 @@ func TestTwoForks_OneIsAccepted(t *testing.T) { require.Equal(yBlock.ID(), zBlock.Parent()) require.Equal(bBlock.ID(), cBlock.Parent()) - require.NotEqual(choices.Rejected, yBlock.Status()) + require.NotEqual(snowtest.Rejected, yBlock.Status) // accept A require.NoError(aBlock.Accept(context.Background())) - require.Equal(choices.Accepted, xBlock.Status()) - require.Equal(choices.Rejected, yBlock.Status()) - require.Equal(choices.Rejected, zBlock.Status()) + require.Equal(snowtest.Accepted, xBlock.Status) + require.Equal(snowtest.Rejected, yBlock.Status) + require.Equal(snowtest.Rejected, zBlock.Status) } func TestTooFarAdvanced(t *testing.T) { @@ -1437,7 +1426,6 @@ func TestTooFarAdvanced(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: yBlock, - status: choices.Processing, }, } @@ -1458,7 +1446,6 @@ func TestTooFarAdvanced(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: yBlock, - status: choices.Processing, }, } @@ -1469,14 +1456,14 @@ func TestTooFarAdvanced(t *testing.T) { // Ensure that Accepting a PostForkOption (B) causes both the other option and // the core block in the other option to be rejected. // -// G -// | -// A(X) -// /====\ -// B(...) C(...) +// G +// | +// A(X) +// / \ +// B(Y) C(Z) // -// B(...) is B(X.opts[0]) -// B(...) is C(X.opts[1]) +// Y is X.opts[0] +// Z is X.opts[1] func TestTwoOptions_OneIsAccepted(t *testing.T) { require := require.New(t) @@ -1492,7 +1479,7 @@ func TestTwoOptions_OneIsAccepted(t *testing.T) { xTestBlock := snowmantest.BuildChild(snowmantest.Genesis) xBlock := &TestOptionsBlock{ Block: *xTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(xTestBlock), snowmantest.BuildChild(xTestBlock), }, @@ -1503,30 +1490,24 @@ func TestTwoOptions_OneIsAccepted(t *testing.T) { } aBlockIntf, err := proVM.BuildBlock(context.Background()) require.NoError(err) - require.IsType(&postForkBlock{}, aBlockIntf) aBlock := aBlockIntf.(*postForkBlock) opts, err := aBlock.Options(context.Background()) require.NoError(err) - require.NoError(aBlock.Verify(context.Background())) bBlock := opts[0] - require.NoError(bBlock.Verify(context.Background())) cBlock := opts[1] + + require.NoError(aBlock.Verify(context.Background())) + require.NoError(bBlock.Verify(context.Background())) require.NoError(cBlock.Verify(context.Background())) require.NoError(aBlock.Accept(context.Background())) - require.NoError(bBlock.Accept(context.Background())) // the other pre-fork option should be rejected - require.Equal(choices.Rejected, xBlock.opts[1].Status()) - - // the other post-fork option should also be rejected - require.NoError(cBlock.Reject(context.Background())) - - require.Equal(choices.Rejected, cBlock.Status()) + require.Equal(snowtest.Rejected, xBlock.opts[1].Status) } // Ensure that given the chance, built blocks will reference a lagged P-chain @@ -1583,9 +1564,9 @@ func TestRejectedHeightNotIndexed(t *testing.T) { ) error { return nil } - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: @@ -1707,7 +1688,6 @@ func TestRejectedHeightNotIndexed(t *testing.T) { postForkCommonComponents: postForkCommonComponents{ vm: proVM, innerBlk: yBlock, - status: choices.Processing, }, } @@ -1755,9 +1735,9 @@ func TestRejectedOptionHeightNotIndexed(t *testing.T) { ) error { return nil } - coreVM.LastAcceptedF = func(context.Context) (ids.ID, error) { - return snowmantest.GenesisID, nil - } + coreVM.LastAcceptedF = snowmantest.MakeLastAcceptedBlockF( + []*snowmantest.Block{snowmantest.Genesis}, + ) coreVM.GetBlockF = func(_ context.Context, blkID ids.ID) (snowman.Block, error) { switch blkID { case snowmantest.GenesisID: @@ -1854,7 +1834,7 @@ func TestRejectedOptionHeightNotIndexed(t *testing.T) { xTestBlock := snowmantest.BuildChild(snowmantest.Genesis) xBlock := &TestOptionsBlock{ Block: *xTestBlock, - opts: [2]snowman.Block{ + opts: [2]*snowmantest.Block{ snowmantest.BuildChild(xTestBlock), snowmantest.BuildChild(xTestBlock), }, @@ -1962,9 +1942,6 @@ func TestVMInnerBlkCache(t *testing.T) { require.NoError(vm.Shutdown(context.Background())) }() - state := state.NewMockState(ctrl) // mock state - vm.State = state - // Create a block near the tip (0). blkNearTipInnerBytes := []byte{1} blkNearTip, err := statelessblock.Build( @@ -1978,9 +1955,6 @@ func TestVMInnerBlkCache(t *testing.T) { ) require.NoError(err) - // Parse a block. - // Not in the VM's state so need to parse it. - state.EXPECT().GetBlock(blkNearTip.ID()).Return(blkNearTip, choices.Accepted, nil).Times(2) // We will ask the inner VM to parse. mockInnerBlkNearTip := snowmantest.NewMockBlock(ctrl) mockInnerBlkNearTip.EXPECT().Height().Return(uint64(1)).Times(2) @@ -2012,101 +1986,6 @@ func TestVMInnerBlkCache(t *testing.T) { require.False(ok) } -func TestVMInnerBlkCacheDeduplicationRegression(t *testing.T) { - require := require.New(t) - var ( - activationTime = time.Unix(0, 0) - durangoTime = activationTime - ) - coreVM, _, proVM, _ := initTestProposerVM(t, activationTime, durangoTime, 0) - defer func() { - require.NoError(proVM.Shutdown(context.Background())) - }() - - // create pre-fork block X and post-fork block A - xBlock := snowmantest.BuildChild(snowmantest.Genesis) - - coreVM.BuildBlockF = func(context.Context) (snowman.Block, error) { - return xBlock, nil - } - aBlock, err := proVM.BuildBlock(context.Background()) - require.NoError(err) - coreVM.BuildBlockF = nil - - bStatelessBlock, err := statelessblock.BuildUnsigned( - snowmantest.GenesisID, - snowmantest.GenesisTimestamp, - defaultPChainHeight, - xBlock.Bytes(), - ) - require.NoError(err) - - xBlockCopy := *xBlock - coreVM.ParseBlockF = func(context.Context, []byte) (snowman.Block, error) { - return &xBlockCopy, nil - } - - bBlockBytes := bStatelessBlock.Bytes() - bBlock, err := proVM.ParseBlock(context.Background(), bBlockBytes) - require.NoError(err) - - require.NoError(aBlock.Verify(context.Background())) - require.NoError(bBlock.Verify(context.Background())) - require.NoError(aBlock.Accept(context.Background())) - require.NoError(bBlock.Reject(context.Background())) - - require.Equal( - choices.Accepted, - aBlock.(*postForkBlock).innerBlk.Status(), - ) - - require.Equal( - choices.Accepted, - bBlock.(*postForkBlock).innerBlk.Status(), - ) - - cachedXBlock, ok := proVM.innerBlkCache.Get(bBlock.ID()) - require.True(ok) - require.Equal( - choices.Accepted, - cachedXBlock.Status(), - ) -} - -func TestVMInnerBlkMarkedAcceptedRegression(t *testing.T) { - require := require.New(t) - var ( - activationTime = time.Unix(0, 0) - durangoTime = activationTime - ) - coreVM, _, proVM, _ := initTestProposerVM(t, activationTime, durangoTime, 0) - defer func() { - require.NoError(proVM.Shutdown(context.Background())) - }() - - // create an inner block and wrap it in an postForkBlock. - innerBlock := snowmantest.BuildChild(snowmantest.Genesis) - - coreVM.BuildBlockF = func(context.Context) (snowman.Block, error) { - return innerBlock, nil - } - outerBlock, err := proVM.BuildBlock(context.Background()) - require.NoError(err) - coreVM.BuildBlockF = nil - - require.NoError(outerBlock.Verify(context.Background())) - require.NoError(outerBlock.Accept(context.Background())) - - coreVM.GetBlockF = func(_ context.Context, id ids.ID) (snowman.Block, error) { - require.Equal(innerBlock.ID(), id) - return innerBlock, nil - } - - wrappedInnerBlock, err := proVM.GetBlock(context.Background(), innerBlock.ID()) - require.NoError(err) - require.Equal(choices.Rejected, wrappedInnerBlock.Status()) -} - type blockWithVerifyContext struct { *snowmantest.MockBlock *block.MockWithVerifyContext diff --git a/vms/rpcchainvm/batched_vm_test.go b/vms/rpcchainvm/batched_vm_test.go index 9d6a602283a3..e476222f0493 100644 --- a/vms/rpcchainvm/batched_vm_test.go +++ b/vms/rpcchainvm/batched_vm_test.go @@ -13,7 +13,6 @@ import ( "github.com/ava-labs/avalanchego/database/memdb" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/snow/snowtest" @@ -28,9 +27,6 @@ var ( blkID1 = ids.ID{1} blkID2 = ids.ID{2} - status1 = choices.Accepted - status2 = choices.Processing - time1 = time.Unix(1, 0) time2 = time.Unix(2, 0) ) @@ -59,7 +55,6 @@ func batchedParseBlockCachingTestPlugin(t *testing.T, loadExpectations bool) blo vm.EXPECT().ParseBlock(gomock.Any(), blkBytes1).Return(blk1, nil).Times(1), blk1.EXPECT().ID().Return(blkID1).Times(1), blk1.EXPECT().Parent().Return(blkID0).Times(1), - blk1.EXPECT().Status().Return(status1).Times(1), blk1.EXPECT().Height().Return(uint64(1)).Times(1), blk1.EXPECT().Timestamp().Return(time1).Times(1), @@ -67,7 +62,6 @@ func batchedParseBlockCachingTestPlugin(t *testing.T, loadExpectations bool) blo vm.EXPECT().ParseBlock(gomock.Any(), blkBytes2).Return(blk2, nil).Times(1), blk2.EXPECT().ID().Return(blkID2).Times(1), blk2.EXPECT().Parent().Return(blkID1).Times(1), - blk2.EXPECT().Status().Return(status2).Times(1), blk2.EXPECT().Height().Return(uint64(2)).Times(1), blk2.EXPECT().Timestamp().Return(time2).Times(1), ) diff --git a/vms/rpcchainvm/state_syncable_vm_test.go b/vms/rpcchainvm/state_syncable_vm_test.go index 9e77daa3799a..da0c9fe3c89f 100644 --- a/vms/rpcchainvm/state_syncable_vm_test.go +++ b/vms/rpcchainvm/state_syncable_vm_test.go @@ -17,7 +17,6 @@ import ( "github.com/ava-labs/avalanchego/database/prefixdb" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman/snowmantest" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/snow/snowtest" @@ -43,18 +42,18 @@ var ( // last accepted blocks data before and after summary is accepted preSummaryBlk = &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.ID{'f', 'i', 'r', 's', 't', 'B', 'l', 'K'}, - StatusV: choices.Accepted, + Decidable: snowtest.Decidable{ + IDV: ids.ID{'f', 'i', 'r', 's', 't', 'B', 'l', 'K'}, + Status: snowtest.Accepted, }, HeightV: preSummaryHeight, ParentV: ids.ID{'p', 'a', 'r', 'e', 'n', 't', 'B', 'l', 'k'}, } summaryBlk = &snowmantest.Block{ - TestDecidable: choices.TestDecidable{ - IDV: ids.ID{'s', 'u', 'm', 'm', 'a', 'r', 'y', 'B', 'l', 'K'}, - StatusV: choices.Accepted, + Decidable: snowtest.Decidable{ + IDV: ids.ID{'s', 'u', 'm', 'm', 'a', 'r', 'y', 'B', 'l', 'K'}, + Status: snowtest.Accepted, }, HeightV: SummaryHeight, ParentV: ids.ID{'p', 'a', 'r', 'e', 'n', 't', 'B', 'l', 'k'}, diff --git a/vms/rpcchainvm/vm_client.go b/vms/rpcchainvm/vm_client.go index d5e115ca0233..c820f63ce4b9 100644 --- a/vms/rpcchainvm/vm_client.go +++ b/vms/rpcchainvm/vm_client.go @@ -25,7 +25,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/ids/galiasreader" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/choices" "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/common/appsender" @@ -232,7 +231,6 @@ func (vm *VMClient) Initialize( vm: vm, id: id, parentID: parentID, - status: choices.Accepted, bytes: resp.Bytes, height: resp.Height, time: time, @@ -335,7 +333,6 @@ func (vm *VMClient) SetState(ctx context.Context, state snow.State) error { vm: vm, id: id, parentID: parentID, - status: choices.Accepted, bytes: resp.Bytes, height: resp.Height, time: time, @@ -433,11 +430,6 @@ func (vm *VMClient) parseBlock(ctx context.Context, bytes []byte) (snowman.Block return nil, err } - status := choices.Status(resp.Status) - if err := status.Valid(); err != nil { - return nil, err - } - time, err := grpcutils.TimestampAsTime(resp.Timestamp) if err != nil { return nil, err @@ -446,7 +438,6 @@ func (vm *VMClient) parseBlock(ctx context.Context, bytes []byte) (snowman.Block vm: vm, id: id, parentID: parentID, - status: status, bytes: bytes, height: resp.Height, time: time, @@ -470,17 +461,11 @@ func (vm *VMClient) getBlock(ctx context.Context, blkID ids.ID) (snowman.Block, return nil, err } - status := choices.Status(resp.Status) - if err := status.Valid(); err != nil { - return nil, err - } - time, err := grpcutils.TimestampAsTime(resp.Timestamp) return &blockClient{ vm: vm, id: blkID, parentID: parentID, - status: status, bytes: resp.Bytes, height: resp.Height, time: time, @@ -649,11 +634,6 @@ func (vm *VMClient) batchedParseBlock(ctx context.Context, blksBytes [][]byte) ( return nil, err } - status := choices.Status(blkResp.Status) - if err := status.Valid(); err != nil { - return nil, err - } - time, err := grpcutils.TimestampAsTime(blkResp.Timestamp) if err != nil { return nil, err @@ -663,7 +643,6 @@ func (vm *VMClient) batchedParseBlock(ctx context.Context, blksBytes [][]byte) ( vm: vm, id: id, parentID: parentID, - status: status, bytes: blksBytes[idx], height: blkResp.Height, time: time, @@ -798,7 +777,6 @@ func (vm *VMClient) newBlockFromBuildBlock(resp *vmpb.BuildBlockResponse) (*bloc vm: vm, id: id, parentID: parentID, - status: choices.Processing, bytes: resp.Bytes, height: resp.Height, time: time, @@ -811,7 +789,6 @@ type blockClient struct { id ids.ID parentID ids.ID - status choices.Status bytes []byte height uint64 time time.Time @@ -823,7 +800,6 @@ func (b *blockClient) ID() ids.ID { } func (b *blockClient) Accept(ctx context.Context) error { - b.status = choices.Accepted _, err := b.vm.client.BlockAccept(ctx, &vmpb.BlockAcceptRequest{ Id: b.id[:], }) @@ -831,17 +807,12 @@ func (b *blockClient) Accept(ctx context.Context) error { } func (b *blockClient) Reject(ctx context.Context) error { - b.status = choices.Rejected _, err := b.vm.client.BlockReject(ctx, &vmpb.BlockRejectRequest{ Id: b.id[:], }) return err } -func (b *blockClient) Status() choices.Status { - return b.status -} - func (b *blockClient) Parent() ids.ID { return b.parentID } diff --git a/vms/rpcchainvm/vm_server.go b/vms/rpcchainvm/vm_server.go index b33fd3e5b5fe..577aa95b9d08 100644 --- a/vms/rpcchainvm/vm_server.go +++ b/vms/rpcchainvm/vm_server.go @@ -438,7 +438,6 @@ func (vm *VMServer) ParseBlock(ctx context.Context, req *vmpb.ParseBlockRequest) return &vmpb.ParseBlockResponse{ Id: blkID[:], ParentId: parentID[:], - Status: vmpb.Status(blk.Status()), Height: blk.Height(), Timestamp: grpcutils.TimestampFromTime(blk.Timestamp()), VerifyWithContext: verifyWithCtx, @@ -469,7 +468,6 @@ func (vm *VMServer) GetBlock(ctx context.Context, req *vmpb.GetBlockRequest) (*v return &vmpb.GetBlockResponse{ ParentId: parentID[:], Bytes: blk.Bytes(), - Status: vmpb.Status(blk.Status()), Height: blk.Height(), Timestamp: grpcutils.TimestampFromTime(blk.Timestamp()), VerifyWithContext: verifyWithCtx,