mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Add blinded beacon block protobufs and wrappers (#10473)
Co-authored-by: rkapka <rkapka@wp.pl>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 6de36f732d72b5c4c0c967bc0edcc752b7afdd337e829486954eb6affda84da8
|
||||
// Hash: 2e923b42b8e4fcc278301da6506b212334a78169cb32c70e0d66a636435b8925
|
||||
package v1
|
||||
|
||||
import (
|
||||
|
||||
2
beacon-chain/state/state-native/v2/generated.ssz.go
Executable file → Normal file
2
beacon-chain/state/state-native/v2/generated.ssz.go
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 6a7886393e8874ccf57ea6c160647da09f5e541234a235ee71f3bf786d56a100
|
||||
// Hash: ec98b14e43fd11e74e0d9e705a7afe74a77706c3e215d7940b11411859873f4b
|
||||
package v2
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: a71c6e70ae416774612961057f4c96b97b5c3323270a80167d30ea672ea2f5cd
|
||||
// Hash: aa2156293aac4326afe2b8c0ba985a0291c83f20c8d8b92d148bc810a7f442e9
|
||||
package v3
|
||||
|
||||
import (
|
||||
|
||||
0
proto/engine/v1/generated.ssz.go
Executable file → Normal file
0
proto/engine/v1/generated.ssz.go
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: dc04c886a976aeec2f44be5d57a2afbc88a4811ff4c318c6786b60e8749e5fd7
|
||||
// Hash: 3436ca36fc169b508a0d11275f4489b2a4bb71bcd2d5b213681cec0910a075a5
|
||||
package v1
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: d911bb3ae3b364fe206f845d41d54a2ddc40db6e74c7c51415238edd1b02ade4
|
||||
// Hash: 762868663887e554d225f15592bd2945117fb213b90d8ebaf37560f813fe953b
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
@@ -104,6 +104,9 @@ ssz_gen_marshal(
|
||||
"SyncCommittee",
|
||||
"SyncAggregatorSelectionData",
|
||||
"PowBlock",
|
||||
"SignedBlindedBeaconBlockBellatrix",
|
||||
"BlindedBeaconBlockBellatrix",
|
||||
"BlindedBeaconBlockBodyBellatrix",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
1403
proto/prysm/v1alpha1/beacon_block.pb.go
generated
1403
proto/prysm/v1alpha1/beacon_block.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,9 @@ message GenericSignedBeaconBlock {
|
||||
|
||||
// Representing a signed, post-Bellatrix fork beacon block.
|
||||
SignedBeaconBlockBellatrix bellatrix = 3;
|
||||
|
||||
// Representing a signed, post-Bellatrix fork blinded beacon block.
|
||||
SignedBlindedBeaconBlockBellatrix blinded_bellatrix = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +52,9 @@ message GenericBeaconBlock {
|
||||
|
||||
// Representing a post-Bellatrix fork beacon block.
|
||||
BeaconBlockBellatrix bellatrix = 3;
|
||||
|
||||
// Representing a post-Bellatrix fork blinded beacon block.
|
||||
BlindedBeaconBlockBellatrix blinded_bellatrix = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,3 +364,78 @@ message BeaconBlockBodyBellatrix {
|
||||
// Execution payload from the execution chain. New in Bellatrix network upgrade.
|
||||
ethereum.engine.v1.ExecutionPayload execution_payload = 10;
|
||||
}
|
||||
|
||||
message SignedBlindedBeaconBlockBellatrix {
|
||||
// The unsigned blinded beacon block itself.
|
||||
BlindedBeaconBlockBellatrix block = 1;
|
||||
|
||||
// 96 byte BLS signature from the validator that produced this blinded block.
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message BlindedBeaconBlockBellatrix {
|
||||
// Beacon chain slot that this blinded block represents.
|
||||
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
|
||||
|
||||
// Validator index of the validator that proposed the block header.
|
||||
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
|
||||
|
||||
// 32 byte root of the parent block.
|
||||
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// 32 byte root of the resulting state after processing this blinded block.
|
||||
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// The blinded beacon block body.
|
||||
BlindedBeaconBlockBodyBellatrix body = 5;
|
||||
}
|
||||
|
||||
message BlindedBeaconBlockBodyBellatrix {
|
||||
// The validators RANDAO reveal 96 byte value.
|
||||
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
|
||||
// A reference to the Ethereum 1.x chain.
|
||||
Eth1Data eth1_data = 2;
|
||||
|
||||
// 32 byte field of arbitrary data. This field may contain any data and
|
||||
// is not used for anything other than a fun message.
|
||||
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// At most MAX_PROPOSER_SLASHINGS.
|
||||
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_ATTESTER_SLASHINGS.
|
||||
repeated AttesterSlashing attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "2"];
|
||||
|
||||
// At most MAX_ATTESTATIONS.
|
||||
repeated Attestation attestations = 6 [(ethereum.eth.ext.ssz_max) = "128"];
|
||||
|
||||
// At most MAX_DEPOSITS.
|
||||
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_VOLUNTARY_EXITS.
|
||||
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// Sync aggregate object for the beacon chain to track sync committee votes. New in Altair network upgrade.
|
||||
SyncAggregate sync_aggregate = 9;
|
||||
|
||||
// Execution payload header from the execution chain. New in Bellatrix network upgrade to accommodate MEV interaction.
|
||||
ExecutionPayloadHeader execution_payload_header = 10;
|
||||
}
|
||||
|
||||
message ExecutionPayloadHeader {
|
||||
bytes parent_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes fee_recipient = 2 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
bytes state_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes receipt_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "256"];
|
||||
bytes prev_randao = 6 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 block_number = 7;
|
||||
uint64 gas_limit = 8;
|
||||
uint64 gas_used = 9;
|
||||
uint64 timestamp = 10;
|
||||
bytes extra_data = 11 [(ethereum.eth.ext.ssz_max) = "32"];
|
||||
bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes transactions_root = 14 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
}
|
||||
|
||||
311
proto/prysm/v1alpha1/beacon_state.pb.go
generated
311
proto/prysm/v1alpha1/beacon_state.pb.go
generated
@@ -1307,157 +1307,6 @@ func (x *BeaconStateBellatrix) GetLatestExecutionPayloadHeader() *ExecutionPaylo
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExecutionPayloadHeader struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ParentHash []byte `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty" ssz-size:"32"`
|
||||
FeeRecipient []byte `protobuf:"bytes,2,opt,name=fee_recipient,json=feeRecipient,proto3" json:"fee_recipient,omitempty" ssz-size:"20"`
|
||||
StateRoot []byte `protobuf:"bytes,3,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty" ssz-size:"32"`
|
||||
ReceiptRoot []byte `protobuf:"bytes,4,opt,name=receipt_root,json=receiptRoot,proto3" json:"receipt_root,omitempty" ssz-size:"32"`
|
||||
LogsBloom []byte `protobuf:"bytes,5,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom,omitempty" ssz-size:"256"`
|
||||
PrevRandao []byte `protobuf:"bytes,6,opt,name=prev_randao,json=prevRandao,proto3" json:"prev_randao,omitempty" ssz-size:"32"`
|
||||
BlockNumber uint64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
|
||||
GasLimit uint64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
|
||||
GasUsed uint64 `protobuf:"varint,9,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
|
||||
Timestamp uint64 `protobuf:"varint,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
ExtraData []byte `protobuf:"bytes,11,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty" ssz-max:"32"`
|
||||
BaseFeePerGas []byte `protobuf:"bytes,12,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"base_fee_per_gas,omitempty" ssz-size:"32"`
|
||||
BlockHash []byte `protobuf:"bytes,13,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty" ssz-size:"32"`
|
||||
TransactionsRoot []byte `protobuf:"bytes,14,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactions_root,omitempty" ssz-size:"32"`
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) Reset() {
|
||||
*x = ExecutionPayloadHeader{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExecutionPayloadHeader) ProtoMessage() {}
|
||||
|
||||
func (x *ExecutionPayloadHeader) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExecutionPayloadHeader.ProtoReflect.Descriptor instead.
|
||||
func (*ExecutionPayloadHeader) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_beacon_state_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetParentHash() []byte {
|
||||
if x != nil {
|
||||
return x.ParentHash
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetFeeRecipient() []byte {
|
||||
if x != nil {
|
||||
return x.FeeRecipient
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetStateRoot() []byte {
|
||||
if x != nil {
|
||||
return x.StateRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetReceiptRoot() []byte {
|
||||
if x != nil {
|
||||
return x.ReceiptRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetLogsBloom() []byte {
|
||||
if x != nil {
|
||||
return x.LogsBloom
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetPrevRandao() []byte {
|
||||
if x != nil {
|
||||
return x.PrevRandao
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetBlockNumber() uint64 {
|
||||
if x != nil {
|
||||
return x.BlockNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetGasLimit() uint64 {
|
||||
if x != nil {
|
||||
return x.GasLimit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetGasUsed() uint64 {
|
||||
if x != nil {
|
||||
return x.GasUsed
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetTimestamp() uint64 {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetExtraData() []byte {
|
||||
if x != nil {
|
||||
return x.ExtraData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetBaseFeePerGas() []byte {
|
||||
if x != nil {
|
||||
return x.BaseFeePerGas
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetBlockHash() []byte {
|
||||
if x != nil {
|
||||
return x.BlockHash
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecutionPayloadHeader) GetTransactionsRoot() []byte {
|
||||
if x != nil {
|
||||
return x.TransactionsRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PowBlock struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1471,7 +1320,7 @@ type PowBlock struct {
|
||||
func (x *PowBlock) Reset() {
|
||||
*x = PowBlock{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[14]
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1484,7 +1333,7 @@ func (x *PowBlock) String() string {
|
||||
func (*PowBlock) ProtoMessage() {}
|
||||
|
||||
func (x *PowBlock) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[14]
|
||||
mi := &file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1497,7 +1346,7 @@ func (x *PowBlock) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PowBlock.ProtoReflect.Descriptor instead.
|
||||
func (*PowBlock) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_beacon_state_proto_rawDescGZIP(), []int{14}
|
||||
return file_proto_prysm_v1alpha1_beacon_state_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *PowBlock) GetBlockHash() []byte {
|
||||
@@ -1953,63 +1802,27 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_rawDesc = []byte{
|
||||
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x52, 0x1c, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0xbe,
|
||||
0x04, 0x0a, 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0b, 0x70, 0x61, 0x72,
|
||||
0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06,
|
||||
0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61,
|
||||
0x73, 0x68, 0x12, 0x2b, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69,
|
||||
0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x32,
|
||||
0x30, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x25, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x29, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70,
|
||||
0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5,
|
||||
0x18, 0x02, 0x33, 0x32, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x52, 0x6f, 0x6f,
|
||||
0x74, 0x12, 0x26, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x5f, 0x62, 0x6c, 0x6f, 0x6f, 0x6d, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07, 0x8a, 0xb5, 0x18, 0x03, 0x32, 0x35, 0x36, 0x52, 0x09,
|
||||
0x6c, 0x6f, 0x67, 0x73, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x12, 0x27, 0x0a, 0x0b, 0x70, 0x72, 0x65,
|
||||
0x76, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x61, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06,
|
||||
0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x76, 0x52, 0x61, 0x6e, 0x64,
|
||||
0x61, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e,
|
||||
0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d,
|
||||
0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d,
|
||||
0x69, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x09,
|
||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04,
|
||||
0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x25, 0x0a, 0x0a, 0x65,
|
||||
0x78, 0x74, 0x72, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x42,
|
||||
0x06, 0x92, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x65, 0x78, 0x74, 0x72, 0x61, 0x44, 0x61,
|
||||
0x74, 0x61, 0x12, 0x2f, 0x0a, 0x10, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70,
|
||||
0x65, 0x72, 0x5f, 0x67, 0x61, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5,
|
||||
0x18, 0x02, 0x33, 0x32, 0x52, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72,
|
||||
0x47, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73,
|
||||
0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52,
|
||||
0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x33, 0x0a, 0x11, 0x74, 0x72,
|
||||
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18,
|
||||
0x0e, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x10, 0x74,
|
||||
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x6f, 0x6f, 0x74, 0x22,
|
||||
0x8d, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x0a,
|
||||
0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48,
|
||||
0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61,
|
||||
0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32,
|
||||
0x52, 0x0a, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x31, 0x0a, 0x10,
|
||||
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f,
|
||||
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42,
|
||||
0x98, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x42,
|
||||
0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
|
||||
0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72,
|
||||
0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68,
|
||||
0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x41, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74,
|
||||
0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x8d,
|
||||
0x01, 0x0a, 0x08, 0x50, 0x6f, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x25, 0x0a, 0x0a, 0x62,
|
||||
0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42,
|
||||
0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61,
|
||||
0x73, 0x68, 0x12, 0x27, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73,
|
||||
0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52,
|
||||
0x0a, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x31, 0x0a, 0x10, 0x74,
|
||||
0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x74,
|
||||
0x6f, 0x74, 0x61, 0x6c, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x98,
|
||||
0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x42, 0x65,
|
||||
0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61,
|
||||
0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x41, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68,
|
||||
0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -2024,7 +1837,7 @@ func file_proto_prysm_v1alpha1_beacon_state_proto_rawDescGZIP() []byte {
|
||||
return file_proto_prysm_v1alpha1_beacon_state_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_proto_prysm_v1alpha1_beacon_state_proto_goTypes = []interface{}{
|
||||
(*BeaconState)(nil), // 0: ethereum.eth.v1alpha1.BeaconState
|
||||
(*BeaconStateAltair)(nil), // 1: ethereum.eth.v1alpha1.BeaconStateAltair
|
||||
@@ -2039,48 +1852,48 @@ var file_proto_prysm_v1alpha1_beacon_state_proto_goTypes = []interface{}{
|
||||
(*SyncCommittee)(nil), // 10: ethereum.eth.v1alpha1.SyncCommittee
|
||||
(*SyncAggregatorSelectionData)(nil), // 11: ethereum.eth.v1alpha1.SyncAggregatorSelectionData
|
||||
(*BeaconStateBellatrix)(nil), // 12: ethereum.eth.v1alpha1.BeaconStateBellatrix
|
||||
(*ExecutionPayloadHeader)(nil), // 13: ethereum.eth.v1alpha1.ExecutionPayloadHeader
|
||||
(*PowBlock)(nil), // 14: ethereum.eth.v1alpha1.PowBlock
|
||||
(*BeaconBlockHeader)(nil), // 15: ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
(*Eth1Data)(nil), // 16: ethereum.eth.v1alpha1.Eth1Data
|
||||
(*Validator)(nil), // 17: ethereum.eth.v1alpha1.Validator
|
||||
(*Checkpoint)(nil), // 18: ethereum.eth.v1alpha1.Checkpoint
|
||||
(*AttestationData)(nil), // 19: ethereum.eth.v1alpha1.AttestationData
|
||||
(*PowBlock)(nil), // 13: ethereum.eth.v1alpha1.PowBlock
|
||||
(*BeaconBlockHeader)(nil), // 14: ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
(*Eth1Data)(nil), // 15: ethereum.eth.v1alpha1.Eth1Data
|
||||
(*Validator)(nil), // 16: ethereum.eth.v1alpha1.Validator
|
||||
(*Checkpoint)(nil), // 17: ethereum.eth.v1alpha1.Checkpoint
|
||||
(*AttestationData)(nil), // 18: ethereum.eth.v1alpha1.AttestationData
|
||||
(*ExecutionPayloadHeader)(nil), // 19: ethereum.eth.v1alpha1.ExecutionPayloadHeader
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_beacon_state_proto_depIdxs = []int32{
|
||||
2, // 0: ethereum.eth.v1alpha1.BeaconState.fork:type_name -> ethereum.eth.v1alpha1.Fork
|
||||
15, // 1: ethereum.eth.v1alpha1.BeaconState.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
16, // 2: ethereum.eth.v1alpha1.BeaconState.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 3: ethereum.eth.v1alpha1.BeaconState.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
17, // 4: ethereum.eth.v1alpha1.BeaconState.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
14, // 1: ethereum.eth.v1alpha1.BeaconState.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
15, // 2: ethereum.eth.v1alpha1.BeaconState.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
15, // 3: ethereum.eth.v1alpha1.BeaconState.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 4: ethereum.eth.v1alpha1.BeaconState.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
3, // 5: ethereum.eth.v1alpha1.BeaconState.previous_epoch_attestations:type_name -> ethereum.eth.v1alpha1.PendingAttestation
|
||||
3, // 6: ethereum.eth.v1alpha1.BeaconState.current_epoch_attestations:type_name -> ethereum.eth.v1alpha1.PendingAttestation
|
||||
18, // 7: ethereum.eth.v1alpha1.BeaconState.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 8: ethereum.eth.v1alpha1.BeaconState.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 9: ethereum.eth.v1alpha1.BeaconState.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 7: ethereum.eth.v1alpha1.BeaconState.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 8: ethereum.eth.v1alpha1.BeaconState.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 9: ethereum.eth.v1alpha1.BeaconState.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
2, // 10: ethereum.eth.v1alpha1.BeaconStateAltair.fork:type_name -> ethereum.eth.v1alpha1.Fork
|
||||
15, // 11: ethereum.eth.v1alpha1.BeaconStateAltair.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
16, // 12: ethereum.eth.v1alpha1.BeaconStateAltair.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 13: ethereum.eth.v1alpha1.BeaconStateAltair.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
17, // 14: ethereum.eth.v1alpha1.BeaconStateAltair.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
18, // 15: ethereum.eth.v1alpha1.BeaconStateAltair.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 16: ethereum.eth.v1alpha1.BeaconStateAltair.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 17: ethereum.eth.v1alpha1.BeaconStateAltair.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
14, // 11: ethereum.eth.v1alpha1.BeaconStateAltair.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
15, // 12: ethereum.eth.v1alpha1.BeaconStateAltair.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
15, // 13: ethereum.eth.v1alpha1.BeaconStateAltair.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 14: ethereum.eth.v1alpha1.BeaconStateAltair.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
17, // 15: ethereum.eth.v1alpha1.BeaconStateAltair.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 16: ethereum.eth.v1alpha1.BeaconStateAltair.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 17: ethereum.eth.v1alpha1.BeaconStateAltair.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
10, // 18: ethereum.eth.v1alpha1.BeaconStateAltair.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
|
||||
10, // 19: ethereum.eth.v1alpha1.BeaconStateAltair.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
|
||||
19, // 20: ethereum.eth.v1alpha1.PendingAttestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
|
||||
18, // 20: ethereum.eth.v1alpha1.PendingAttestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
|
||||
2, // 21: ethereum.eth.v1alpha1.CheckPtInfo.fork:type_name -> ethereum.eth.v1alpha1.Fork
|
||||
2, // 22: ethereum.eth.v1alpha1.BeaconStateBellatrix.fork:type_name -> ethereum.eth.v1alpha1.Fork
|
||||
15, // 23: ethereum.eth.v1alpha1.BeaconStateBellatrix.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
16, // 24: ethereum.eth.v1alpha1.BeaconStateBellatrix.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 25: ethereum.eth.v1alpha1.BeaconStateBellatrix.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
17, // 26: ethereum.eth.v1alpha1.BeaconStateBellatrix.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
18, // 27: ethereum.eth.v1alpha1.BeaconStateBellatrix.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 28: ethereum.eth.v1alpha1.BeaconStateBellatrix.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
18, // 29: ethereum.eth.v1alpha1.BeaconStateBellatrix.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
14, // 23: ethereum.eth.v1alpha1.BeaconStateBellatrix.latest_block_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
|
||||
15, // 24: ethereum.eth.v1alpha1.BeaconStateBellatrix.eth1_data:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
15, // 25: ethereum.eth.v1alpha1.BeaconStateBellatrix.eth1_data_votes:type_name -> ethereum.eth.v1alpha1.Eth1Data
|
||||
16, // 26: ethereum.eth.v1alpha1.BeaconStateBellatrix.validators:type_name -> ethereum.eth.v1alpha1.Validator
|
||||
17, // 27: ethereum.eth.v1alpha1.BeaconStateBellatrix.previous_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 28: ethereum.eth.v1alpha1.BeaconStateBellatrix.current_justified_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
17, // 29: ethereum.eth.v1alpha1.BeaconStateBellatrix.finalized_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
10, // 30: ethereum.eth.v1alpha1.BeaconStateBellatrix.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
|
||||
10, // 31: ethereum.eth.v1alpha1.BeaconStateBellatrix.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
|
||||
13, // 32: ethereum.eth.v1alpha1.BeaconStateBellatrix.latest_execution_payload_header:type_name -> ethereum.eth.v1alpha1.ExecutionPayloadHeader
|
||||
19, // 32: ethereum.eth.v1alpha1.BeaconStateBellatrix.latest_execution_payload_header:type_name -> ethereum.eth.v1alpha1.ExecutionPayloadHeader
|
||||
33, // [33:33] is the sub-list for method output_type
|
||||
33, // [33:33] is the sub-list for method input_type
|
||||
33, // [33:33] is the sub-list for extension type_name
|
||||
@@ -2254,18 +2067,6 @@ func file_proto_prysm_v1alpha1_beacon_state_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ExecutionPayloadHeader); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_beacon_state_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PowBlock); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -2284,7 +2085,7 @@ func file_proto_prysm_v1alpha1_beacon_state_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_prysm_v1alpha1_beacon_state_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 15,
|
||||
NumMessages: 14,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -232,25 +232,9 @@ message BeaconStateBellatrix {
|
||||
SyncCommittee next_sync_committee = 9003; // [New in Altair]
|
||||
|
||||
// Bellatrix fields [10001-11000]
|
||||
ExecutionPayloadHeader latest_execution_payload_header = 10001; // [New in Bellatrix]
|
||||
ethereum.eth.v1alpha1.ExecutionPayloadHeader latest_execution_payload_header = 10001; // [New in Bellatrix]
|
||||
}
|
||||
|
||||
message ExecutionPayloadHeader {
|
||||
bytes parent_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes fee_recipient = 2 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
bytes state_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes receipt_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "256"];
|
||||
bytes prev_randao = 6 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 block_number = 7;
|
||||
uint64 gas_limit = 8;
|
||||
uint64 gas_used = 9;
|
||||
uint64 timestamp = 10;
|
||||
bytes extra_data = 11 [(ethereum.eth.ext.ssz_max) = "32"];
|
||||
bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes transactions_root = 14 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
}
|
||||
|
||||
// PowBlock is a definition from Bellatrix fork choice spec to represent a block with total difficulty in the PoW chain.
|
||||
// Spec:
|
||||
|
||||
@@ -21,6 +21,7 @@ type SignedBeaconBlock interface {
|
||||
PbPhase0Block() (*ethpb.SignedBeaconBlock, error)
|
||||
PbAltairBlock() (*ethpb.SignedBeaconBlockAltair, error)
|
||||
PbBellatrixBlock() (*ethpb.SignedBeaconBlockBellatrix, error)
|
||||
PbBlindedBellatrixBlock() (*ethpb.SignedBlindedBeaconBlockBellatrix, error)
|
||||
ssz.Marshaler
|
||||
ssz.Unmarshaler
|
||||
Version() int
|
||||
@@ -61,4 +62,5 @@ type BeaconBlockBody interface {
|
||||
HashTreeRoot() ([32]byte, error)
|
||||
Proto() proto.Message
|
||||
ExecutionPayload() (*enginev1.ExecutionPayload, error)
|
||||
ExecutionPayloadHeader() (*ethpb.ExecutionPayloadHeader, error)
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ func (SignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatrix, er
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (SignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (SignedBeaconBlock) MarshalSSZTo(_ []byte) ([]byte, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
@@ -195,6 +199,10 @@ func (BeaconBlockBody) ExecutionPayload() (*enginev1.ExecutionPayload, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (BeaconBlockBody) ExecutionPayloadHeader() (*eth.ExecutionPayloadHeader, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
var _ block.SignedBeaconBlock = &SignedBeaconBlock{}
|
||||
var _ block.BeaconBlock = &BeaconBlock{}
|
||||
var _ block.BeaconBlockBody = &BeaconBlockBody{}
|
||||
|
||||
@@ -468,3 +468,47 @@ func CopyExecutionPayloadHeader(payload *ExecutionPayloadHeader) *ExecutionPaylo
|
||||
TransactionsRoot: bytesutil.SafeCopyBytes(payload.TransactionsRoot),
|
||||
}
|
||||
}
|
||||
|
||||
// CopySignedBlindedBeaconBlockBellatrix copies the provided SignedBlindedBeaconBlockBellatrix.
|
||||
func CopySignedBlindedBeaconBlockBellatrix(sigBlock *SignedBlindedBeaconBlockBellatrix) *SignedBlindedBeaconBlockBellatrix {
|
||||
if sigBlock == nil {
|
||||
return nil
|
||||
}
|
||||
return &SignedBlindedBeaconBlockBellatrix{
|
||||
Block: CopyBlindedBeaconBlockBellatrix(sigBlock.Block),
|
||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBlindedBeaconBlockBellatrix copies the provided BlindedBeaconBlockBellatrix.
|
||||
func CopyBlindedBeaconBlockBellatrix(block *BlindedBeaconBlockBellatrix) *BlindedBeaconBlockBellatrix {
|
||||
if block == nil {
|
||||
return nil
|
||||
}
|
||||
return &BlindedBeaconBlockBellatrix{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||
Body: CopyBlindedBeaconBlockBodyBellatrix(block.Body),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBlindedBeaconBlockBodyBellatrix copies the provided BlindedBeaconBlockBodyBellatrix.
|
||||
func CopyBlindedBeaconBlockBodyBellatrix(body *BlindedBeaconBlockBodyBellatrix) *BlindedBeaconBlockBodyBellatrix {
|
||||
if body == nil {
|
||||
return nil
|
||||
}
|
||||
return &BlindedBeaconBlockBodyBellatrix{
|
||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||
Eth1Data: CopyETH1Data(body.Eth1Data),
|
||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||
ProposerSlashings: CopyProposerSlashings(body.ProposerSlashings),
|
||||
AttesterSlashings: CopyAttesterSlashings(body.AttesterSlashings),
|
||||
Attestations: CopyAttestations(body.Attestations),
|
||||
Deposits: CopyDeposits(body.Deposits),
|
||||
VoluntaryExits: CopySignedVoluntaryExits(body.VoluntaryExits),
|
||||
SyncAggregate: CopySyncAggregate(body.SyncAggregate),
|
||||
ExecutionPayloadHeader: CopyExecutionPayloadHeader(body.ExecutionPayloadHeader),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +349,36 @@ func TestCopyBeaconBlockBodyBellatrix(t *testing.T) {
|
||||
assert.NotEmpty(t, bb, "Copied beacon block body Bellatrix has empty fields")
|
||||
}
|
||||
|
||||
func TestCopySignedBlindedBeaconBlockBellatrix(t *testing.T) {
|
||||
sbb := genSignedBeaconBlockBellatrix()
|
||||
|
||||
got := v1alpha1.CopySignedBeaconBlockBellatrix(sbb)
|
||||
if !reflect.DeepEqual(got, sbb) {
|
||||
t.Errorf("CopySignedBeaconBlockBellatrix() = %v, want %v", got, sbb)
|
||||
}
|
||||
assert.NotEmpty(t, sbb, "Copied signed blinded beacon block Bellatrix has empty fields")
|
||||
}
|
||||
|
||||
func TestCopyBlindedBeaconBlockBellatrix(t *testing.T) {
|
||||
b := genBeaconBlockBellatrix()
|
||||
|
||||
got := v1alpha1.CopyBeaconBlockBellatrix(b)
|
||||
if !reflect.DeepEqual(got, b) {
|
||||
t.Errorf("CopyBeaconBlockBellatrix() = %v, want %v", got, b)
|
||||
}
|
||||
assert.NotEmpty(t, b, "Copied blinded beacon block Bellatrix has empty fields")
|
||||
}
|
||||
|
||||
func TestCopyBlindedBeaconBlockBodyBellatrix(t *testing.T) {
|
||||
bb := genBeaconBlockBodyBellatrix()
|
||||
|
||||
got := v1alpha1.CopyBeaconBlockBodyBellatrix(bb)
|
||||
if !reflect.DeepEqual(got, bb) {
|
||||
t.Errorf("CopyBeaconBlockBodyBellatrix() = %v, want %v", got, bb)
|
||||
}
|
||||
assert.NotEmpty(t, bb, "Copied blinded beacon block body Bellatrix has empty fields")
|
||||
}
|
||||
|
||||
func bytes() []byte {
|
||||
b := make([]byte, 32)
|
||||
_, err := rand.Read(b)
|
||||
@@ -637,6 +667,38 @@ func genSignedBeaconBlockBellatrix() *v1alpha1.SignedBeaconBlockBellatrix {
|
||||
}
|
||||
}
|
||||
|
||||
func genBlindedBeaconBlockBodyBellatrix() *v1alpha1.BlindedBeaconBlockBodyBellatrix {
|
||||
return &v1alpha1.BlindedBeaconBlockBodyBellatrix{
|
||||
RandaoReveal: bytes(),
|
||||
Eth1Data: genEth1Data(),
|
||||
Graffiti: bytes(),
|
||||
ProposerSlashings: genProposerSlashings(5),
|
||||
AttesterSlashings: genAttesterSlashings(5),
|
||||
Attestations: genAttestations(10),
|
||||
Deposits: genDeposits(5),
|
||||
VoluntaryExits: genSignedVoluntaryExits(12),
|
||||
SyncAggregate: genSyncAggregate(),
|
||||
ExecutionPayloadHeader: genPayloadHeader(),
|
||||
}
|
||||
}
|
||||
|
||||
func genBlindedBeaconBlockBellatrix() *v1alpha1.BlindedBeaconBlockBellatrix {
|
||||
return &v1alpha1.BlindedBeaconBlockBellatrix{
|
||||
Slot: 123455,
|
||||
ProposerIndex: 55433,
|
||||
ParentRoot: bytes(),
|
||||
StateRoot: bytes(),
|
||||
Body: genBlindedBeaconBlockBodyBellatrix(),
|
||||
}
|
||||
}
|
||||
|
||||
func genSignedBlindedBeaconBlockBellatrix() *v1alpha1.SignedBlindedBeaconBlockBellatrix {
|
||||
return &v1alpha1.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: genBlindedBeaconBlockBellatrix(),
|
||||
Signature: bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
func genSyncCommitteeMessage() *v1alpha1.SyncCommitteeMessage {
|
||||
return &v1alpha1.SyncCommitteeMessage{
|
||||
Slot: 424555,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
146
proto/prysm/v1alpha1/validator-client/keymanager.pb.go
generated
146
proto/prysm/v1alpha1/validator-client/keymanager.pb.go
generated
@@ -149,6 +149,7 @@ type SignRequest struct {
|
||||
// *SignRequest_ContributionAndProof
|
||||
// *SignRequest_SyncMessageBlockRoot
|
||||
// *SignRequest_BlockV3
|
||||
// *SignRequest_BlindedBlockV3
|
||||
Object isSignRequest_Object `protobuf_oneof:"object"`
|
||||
SigningSlot github_com_prysmaticlabs_eth2_types.Slot `protobuf:"varint,6,opt,name=signing_slot,json=signingSlot,proto3" json:"signing_slot,omitempty" cast-type:"github.com/prysmaticlabs/eth2-types.Slot"`
|
||||
}
|
||||
@@ -290,6 +291,13 @@ func (x *SignRequest) GetBlockV3() *v1alpha1.BeaconBlockBellatrix {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignRequest) GetBlindedBlockV3() *v1alpha1.BlindedBeaconBlockBellatrix {
|
||||
if x, ok := x.GetObject().(*SignRequest_BlindedBlockV3); ok {
|
||||
return x.BlindedBlockV3
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignRequest) GetSigningSlot() github_com_prysmaticlabs_eth2_types.Slot {
|
||||
if x != nil {
|
||||
return x.SigningSlot
|
||||
@@ -345,6 +353,10 @@ type SignRequest_BlockV3 struct {
|
||||
BlockV3 *v1alpha1.BeaconBlockBellatrix `protobuf:"bytes,111,opt,name=blockV3,proto3,oneof"`
|
||||
}
|
||||
|
||||
type SignRequest_BlindedBlockV3 struct {
|
||||
BlindedBlockV3 *v1alpha1.BlindedBeaconBlockBellatrix `protobuf:"bytes,112,opt,name=blinded_blockV3,json=blindedBlockV3,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*SignRequest_Block) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_AttestationData) isSignRequest_Object() {}
|
||||
@@ -367,6 +379,8 @@ func (*SignRequest_SyncMessageBlockRoot) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_BlockV3) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_BlindedBlockV3) isSignRequest_Object() {}
|
||||
|
||||
type SignResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -451,7 +465,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte
|
||||
0x34, 0x0a, 0x16, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52,
|
||||
0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x4b, 0x65, 0x79, 0x73, 0x22, 0xdf, 0x08, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65,
|
||||
0x63, 0x4b, 0x65, 0x79, 0x73, 0x22, 0xbe, 0x09, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f,
|
||||
@@ -515,57 +529,62 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte
|
||||
0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
|
||||
0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x65, 0x6c, 0x6c,
|
||||
0x61, 0x74, 0x72, 0x69, 0x78, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x33,
|
||||
0x12, 0x4f, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2c, 0x82, 0xb5, 0x18, 0x28, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63,
|
||||
0x6c, 0x61, 0x62, 0x73, 0x2f, 0x65, 0x74, 0x68, 0x32, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
|
||||
0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f,
|
||||
0x74, 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4a, 0x04, 0x08, 0x04, 0x10,
|
||||
0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xb7, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x12, 0x5d, 0x0a, 0x0f, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x56, 0x33, 0x18, 0x70, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42,
|
||||
0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x65, 0x6c, 0x6c, 0x61, 0x74, 0x72, 0x69, 0x78, 0x48, 0x00, 0x52,
|
||||
0x0e, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x33, 0x12,
|
||||
0x4f, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2c, 0x82, 0xb5, 0x18, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c,
|
||||
0x61, 0x62, 0x73, 0x2f, 0x65, 0x74, 0x68, 0x32, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53,
|
||||
0x6c, 0x6f, 0x74, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74,
|
||||
0x42, 0x08, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05,
|
||||
0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xb7, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07,
|
||||
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x43,
|
||||
0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4e, 0x49,
|
||||
0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03,
|
||||
0x32, 0xa7, 0x02, 0x0a, 0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65,
|
||||
0x72, 0x12, 0x90, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 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, 0x36, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55,
|
||||
0x43, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4e,
|
||||
0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10,
|
||||
0x03, 0x32, 0xa7, 0x02, 0x0a, 0x0c, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x72, 0x12, 0x90, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 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, 0x36, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x75, 0x62,
|
||||
0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||
0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2f, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x83, 0x01, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x2b,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67,
|
||||
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x1a, 0x22, 0x18, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x32, 0x2f,
|
||||
0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x42, 0xcb, 0x01, 0x0a, 0x22,
|
||||
0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c,
|
||||
0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x76, 0x32, 0x42, 0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72,
|
||||
0x65, 0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2f, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x12, 0x83, 0x01, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x2b, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a,
|
||||
0x22, 0x18, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x72,
|
||||
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x42, 0xcb, 0x01, 0x0a, 0x22, 0x6f,
|
||||
0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76,
|
||||
0x32, 0x42, 0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -595,7 +614,8 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_goTypes = []inte
|
||||
(*v1alpha1.SyncAggregatorSelectionData)(nil), // 9: ethereum.eth.v1alpha1.SyncAggregatorSelectionData
|
||||
(*v1alpha1.ContributionAndProof)(nil), // 10: ethereum.eth.v1alpha1.ContributionAndProof
|
||||
(*v1alpha1.BeaconBlockBellatrix)(nil), // 11: ethereum.eth.v1alpha1.BeaconBlockBellatrix
|
||||
(*empty.Empty)(nil), // 12: google.protobuf.Empty
|
||||
(*v1alpha1.BlindedBeaconBlockBellatrix)(nil), // 12: ethereum.eth.v1alpha1.BlindedBeaconBlockBellatrix
|
||||
(*empty.Empty)(nil), // 13: google.protobuf.Empty
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int32{
|
||||
4, // 0: ethereum.validator.accounts.v2.SignRequest.block:type_name -> ethereum.eth.v1alpha1.BeaconBlock
|
||||
@@ -606,16 +626,17 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int3
|
||||
9, // 5: ethereum.validator.accounts.v2.SignRequest.sync_aggregator_selection_data:type_name -> ethereum.eth.v1alpha1.SyncAggregatorSelectionData
|
||||
10, // 6: ethereum.validator.accounts.v2.SignRequest.contribution_and_proof:type_name -> ethereum.eth.v1alpha1.ContributionAndProof
|
||||
11, // 7: ethereum.validator.accounts.v2.SignRequest.blockV3:type_name -> ethereum.eth.v1alpha1.BeaconBlockBellatrix
|
||||
0, // 8: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status
|
||||
12, // 9: ethereum.validator.accounts.v2.RemoteSigner.ListValidatingPublicKeys:input_type -> google.protobuf.Empty
|
||||
2, // 10: ethereum.validator.accounts.v2.RemoteSigner.Sign:input_type -> ethereum.validator.accounts.v2.SignRequest
|
||||
1, // 11: ethereum.validator.accounts.v2.RemoteSigner.ListValidatingPublicKeys:output_type -> ethereum.validator.accounts.v2.ListPublicKeysResponse
|
||||
3, // 12: ethereum.validator.accounts.v2.RemoteSigner.Sign:output_type -> ethereum.validator.accounts.v2.SignResponse
|
||||
11, // [11:13] is the sub-list for method output_type
|
||||
9, // [9:11] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
9, // [9:9] is the sub-list for extension extendee
|
||||
0, // [0:9] is the sub-list for field type_name
|
||||
12, // 8: ethereum.validator.accounts.v2.SignRequest.blinded_blockV3:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockBellatrix
|
||||
0, // 9: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status
|
||||
13, // 10: ethereum.validator.accounts.v2.RemoteSigner.ListValidatingPublicKeys:input_type -> google.protobuf.Empty
|
||||
2, // 11: ethereum.validator.accounts.v2.RemoteSigner.Sign:input_type -> ethereum.validator.accounts.v2.SignRequest
|
||||
1, // 12: ethereum.validator.accounts.v2.RemoteSigner.ListValidatingPublicKeys:output_type -> ethereum.validator.accounts.v2.ListPublicKeysResponse
|
||||
3, // 13: ethereum.validator.accounts.v2.RemoteSigner.Sign:output_type -> ethereum.validator.accounts.v2.SignResponse
|
||||
12, // [12:14] is the sub-list for method output_type
|
||||
10, // [10:12] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() }
|
||||
@@ -673,6 +694,7 @@ func file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() {
|
||||
(*SignRequest_ContributionAndProof)(nil),
|
||||
(*SignRequest_SyncMessageBlockRoot)(nil),
|
||||
(*SignRequest_BlockV3)(nil),
|
||||
(*SignRequest_BlindedBlockV3)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
||||
@@ -77,6 +77,7 @@ message SignRequest {
|
||||
|
||||
// Bellatrix objects.
|
||||
ethereum.eth.v1alpha1.BeaconBlockBellatrix blockV3 = 111;
|
||||
ethereum.eth.v1alpha1.BlindedBeaconBlockBellatrix blinded_blockV3 = 112;
|
||||
}
|
||||
reserved 4, 5; // Reserving old, deleted fields.
|
||||
uint64 signing_slot = 6 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
|
||||
|
||||
@@ -7,6 +7,7 @@ go_library(
|
||||
"beacon_block_altair.go",
|
||||
"beacon_block_bellatrix.go",
|
||||
"beacon_block_phase0.go",
|
||||
"blinded_beacon_block_bellatrix.go",
|
||||
"metadata.go",
|
||||
"mutator.go",
|
||||
],
|
||||
@@ -34,6 +35,7 @@ go_test(
|
||||
"beacon_block_bellatrix_test.go",
|
||||
"beacon_block_phase0_test.go",
|
||||
"beacon_block_test.go",
|
||||
"blinded_beacon_block_bellatrix_test.go",
|
||||
],
|
||||
deps = [
|
||||
":go_default_library",
|
||||
|
||||
@@ -26,6 +26,8 @@ var (
|
||||
// ErrUnsupportedBellatrixBlock is returned when accessing a bellatrix block from a non-bellatrix wrapped
|
||||
// block.
|
||||
ErrUnsupportedBellatrixBlock = errors.New("unsupported bellatrix block")
|
||||
// ErrUnsupportedBlindedBellatrixBlock is returned when accessing a blinded bellatrix block from unsupported method.
|
||||
ErrUnsupportedBlindedBellatrixBlock = errors.New("unsupported blinded bellatrix block")
|
||||
// ErrNilObjectWrapped is returned in a constructor when the underlying object is nil.
|
||||
ErrNilObjectWrapped = errors.New("attempted to wrap nil object")
|
||||
)
|
||||
@@ -46,6 +48,10 @@ func WrappedSignedBeaconBlock(i interface{}) (block.SignedBeaconBlock, error) {
|
||||
return wrappedBellatrixSignedBeaconBlock(b.Bellatrix)
|
||||
case *eth.SignedBeaconBlockBellatrix:
|
||||
return wrappedBellatrixSignedBeaconBlock(b)
|
||||
case *eth.GenericSignedBeaconBlock_BlindedBellatrix:
|
||||
return wrappedBellatrixSignedBlindedBeaconBlock(b.BlindedBellatrix)
|
||||
case *eth.SignedBlindedBeaconBlockBellatrix:
|
||||
return wrappedBellatrixSignedBlindedBeaconBlock(b)
|
||||
case nil:
|
||||
return nil, ErrNilObjectWrapped
|
||||
default:
|
||||
@@ -69,6 +75,10 @@ func WrappedBeaconBlock(i interface{}) (block.BeaconBlock, error) {
|
||||
return WrappedBellatrixBeaconBlock(b.Bellatrix)
|
||||
case *eth.BeaconBlockBellatrix:
|
||||
return WrappedBellatrixBeaconBlock(b)
|
||||
case *eth.GenericBeaconBlock_BlindedBellatrix:
|
||||
return WrappedBellatrixBlindedBeaconBlock(b.BlindedBellatrix)
|
||||
case *eth.BlindedBeaconBlockBellatrix:
|
||||
return WrappedBellatrixBlindedBeaconBlock(b)
|
||||
default:
|
||||
return nil, errors.Wrapf(ErrUnsupportedBeaconBlock, "unable to wrap block of type %T", i)
|
||||
}
|
||||
@@ -97,6 +107,12 @@ func BuildSignedBeaconBlock(blk block.BeaconBlock, signature []byte) (block.Sign
|
||||
return nil, errors.New("unable to access inner bellatrix proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBeaconBlockBellatrix{Block: pb, Signature: signature})
|
||||
case blindedBeaconBlockBellatrix:
|
||||
pb, ok := b.Proto().(*eth.BlindedBeaconBlockBellatrix)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to access inner bellatrix proto")
|
||||
}
|
||||
return WrappedSignedBeaconBlock(ð.SignedBlindedBeaconBlockBellatrix{Block: pb, Signature: signature})
|
||||
default:
|
||||
return nil, errors.Wrapf(ErrUnsupportedBeaconBlock, "unable to wrap block of type %T", b)
|
||||
}
|
||||
@@ -113,6 +129,8 @@ func UnwrapGenericSignedBeaconBlock(gb *eth.GenericSignedBeaconBlock) (block.Sig
|
||||
return WrappedSignedBeaconBlock(bb.Altair)
|
||||
case *eth.GenericSignedBeaconBlock_Bellatrix:
|
||||
return WrappedSignedBeaconBlock(bb.Bellatrix)
|
||||
case *eth.GenericSignedBeaconBlock_BlindedBellatrix:
|
||||
return WrappedSignedBeaconBlock(bb.BlindedBellatrix)
|
||||
default:
|
||||
return nil, errors.Wrapf(ErrUnsupportedSignedBeaconBlock, "unable to wrap block of type %T", gb)
|
||||
}
|
||||
|
||||
@@ -63,18 +63,18 @@ func (w altairSignedBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the signed beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the signed beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w altairSignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized signed block
|
||||
// SizeSSZ returns the size of the serialized signed block
|
||||
func (w altairSignedBeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the signed beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the signed beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w altairSignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -108,6 +108,11 @@ func (altairSignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatr
|
||||
return nil, ErrUnsupportedBellatrixBlock
|
||||
}
|
||||
|
||||
// PbBlindedBellatrixBlock is a stub.
|
||||
func (altairSignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error) {
|
||||
return nil, ErrUnsupportedBlindedBellatrixBlock
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
func (altairSignedBeaconBlock) Version() int {
|
||||
return version.Altair
|
||||
@@ -153,7 +158,7 @@ func (w altairBeaconBlock) Slot() types.Slot {
|
||||
return w.b.Slot
|
||||
}
|
||||
|
||||
// ProposerIndex returns proposer index of the beacon block.
|
||||
// ProposerIndex returns the proposer index of the beacon block.
|
||||
func (w altairBeaconBlock) ProposerIndex() types.ValidatorIndex {
|
||||
return w.b.ProposerIndex
|
||||
}
|
||||
@@ -194,18 +199,18 @@ func (w altairBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w altairBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized block.
|
||||
// SizeSSZ returns the size of the serialized block.
|
||||
func (w altairBeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w altairBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -222,6 +227,7 @@ func (altairBeaconBlock) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w altairBeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
return &validatorpb.SignRequest_BlockV2{
|
||||
BlockV2: w.b,
|
||||
@@ -308,3 +314,8 @@ func (w altairBeaconBlockBody) Proto() proto.Message {
|
||||
func (w altairBeaconBlockBody) ExecutionPayload() (*enginev1.ExecutionPayload, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayload for %T", w)
|
||||
}
|
||||
|
||||
// ExecutionPayloadHeader is a stub.
|
||||
func (w altairBeaconBlockBody) ExecutionPayloadHeader() (*eth.ExecutionPayloadHeader, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayloadHeader for %T", w)
|
||||
}
|
||||
|
||||
@@ -328,3 +328,23 @@ func TestAltairBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV2")
|
||||
assert.Equal(t, abb, got.BlockV2)
|
||||
}
|
||||
|
||||
func TestAltairBeaconBlock_PbBlindedBellatrixBlock(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlockAltair{
|
||||
Block: ðpb.BeaconBlockAltair{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.PbBlindedBellatrixBlock()
|
||||
require.ErrorContains(t, "unsupported blinded bellatrix block", err)
|
||||
}
|
||||
|
||||
func TestAltairBeaconBlock_ExecutionPayloadHeader(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlockAltair{
|
||||
Block: ðpb.BeaconBlockAltair{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.Block().Body().ExecutionPayloadHeader()
|
||||
require.ErrorContains(t, "unsupported field for block type", err)
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ var (
|
||||
_ = block.BeaconBlockBody(&bellatrixBeaconBlockBody{})
|
||||
)
|
||||
|
||||
// bellatrixSignedBeaconBlock is a convenience wrapper around a Bellatrix beacon block
|
||||
// bellatrixSignedBeaconBlock is a convenience wrapper around a Bellatrix blinded beacon block
|
||||
// object. This wrapper allows us to conform to a common interface so that beacon
|
||||
// blocks for future forks can also be applied across prysm without issues.
|
||||
type bellatrixSignedBeaconBlock struct {
|
||||
b *eth.SignedBeaconBlockBellatrix
|
||||
}
|
||||
|
||||
// wrappedBellatrixSignedBeaconBlock is constructor which wraps a protobuf Bellatrix block with the block wrapper.
|
||||
// wrappedBellatrixSignedBeaconBlock is a constructor which wraps a protobuf Bellatrix block with the block wrapper.
|
||||
func wrappedBellatrixSignedBeaconBlock(b *eth.SignedBeaconBlockBellatrix) (block.SignedBeaconBlock, error) {
|
||||
w := bellatrixSignedBeaconBlock{b: b}
|
||||
if w.IsNil() {
|
||||
@@ -59,18 +59,18 @@ func (w bellatrixSignedBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the signed beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the signed beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w bellatrixSignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized signed block
|
||||
// SizeSSZ returns the size of the serialized signed block
|
||||
func (w bellatrixSignedBeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the signed beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the signed beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w bellatrixSignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -93,6 +93,11 @@ func (w bellatrixSignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBe
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbBlindedBellatrixBlock is a stub.
|
||||
func (bellatrixSignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error) {
|
||||
return nil, ErrUnsupportedBlindedBellatrixBlock
|
||||
}
|
||||
|
||||
// PbPhase0Block is a stub.
|
||||
func (bellatrixSignedBeaconBlock) PbPhase0Block() (*eth.SignedBeaconBlock, error) {
|
||||
return nil, ErrUnsupportedPhase0Block
|
||||
@@ -131,7 +136,7 @@ type bellatrixBeaconBlock struct {
|
||||
b *eth.BeaconBlockBellatrix
|
||||
}
|
||||
|
||||
// WrappedBellatrixBeaconBlock is constructor which wraps a protobuf Bellatrix object
|
||||
// WrappedBellatrixBeaconBlock is a constructor which wraps a protobuf Bellatrix object
|
||||
// with the block wrapper.
|
||||
//
|
||||
// Deprecated: Use WrappedBeaconBlock.
|
||||
@@ -148,7 +153,7 @@ func (w bellatrixBeaconBlock) Slot() types.Slot {
|
||||
return w.b.Slot
|
||||
}
|
||||
|
||||
// ProposerIndex returns proposer index of the beacon block.
|
||||
// ProposerIndex returns the proposer index of the beacon block.
|
||||
func (w bellatrixBeaconBlock) ProposerIndex() types.ValidatorIndex {
|
||||
return w.b.ProposerIndex
|
||||
}
|
||||
@@ -189,18 +194,18 @@ func (w bellatrixBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w bellatrixBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized block.
|
||||
// SizeSSZ returns the size of the serialized block.
|
||||
func (w bellatrixBeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w bellatrixBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -217,6 +222,7 @@ func (bellatrixBeaconBlock) Version() int {
|
||||
return version.Bellatrix
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w bellatrixBeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
return &validatorpb.SignRequest_BlockV3{
|
||||
BlockV3: w.b,
|
||||
@@ -228,7 +234,7 @@ type bellatrixBeaconBlockBody struct {
|
||||
b *eth.BeaconBlockBodyBellatrix
|
||||
}
|
||||
|
||||
// WrappedBellatrixBeaconBlockBody is constructor which wraps a protobuf bellatrix object
|
||||
// WrappedBellatrixBeaconBlockBody is a constructor which wraps a protobuf bellatrix object
|
||||
// with the block wrapper.
|
||||
func WrappedBellatrixBeaconBlockBody(b *eth.BeaconBlockBodyBellatrix) (block.BeaconBlockBody, error) {
|
||||
w := bellatrixBeaconBlockBody{b: b}
|
||||
@@ -303,3 +309,8 @@ func (w bellatrixBeaconBlockBody) Proto() proto.Message {
|
||||
func (w bellatrixBeaconBlockBody) ExecutionPayload() (*enginev1.ExecutionPayload, error) {
|
||||
return w.b.ExecutionPayload, nil
|
||||
}
|
||||
|
||||
// ExecutionPayloadHeader is a stub.
|
||||
func (w bellatrixBeaconBlockBody) ExecutionPayloadHeader() (*eth.ExecutionPayloadHeader, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayloadHeader for %T", w)
|
||||
}
|
||||
|
||||
@@ -373,3 +373,23 @@ func TestBellatrixBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV3")
|
||||
assert.Equal(t, abb, got.BlockV3)
|
||||
}
|
||||
|
||||
func TestBellatrixBeaconBlock_PbBlindedBellatrixBlock(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlockBellatrix{
|
||||
Block: ðpb.BeaconBlockBellatrix{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.PbBlindedBellatrixBlock()
|
||||
require.ErrorContains(t, "unsupported blinded bellatrix block", err)
|
||||
}
|
||||
|
||||
func TestBellatrixBeaconBlock_ExecutionPayloadHeader(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlockBellatrix{
|
||||
Block: ðpb.BeaconBlockBellatrix{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.Block().Body().ExecutionPayloadHeader()
|
||||
require.ErrorContains(t, "unsupported field for block type", err)
|
||||
}
|
||||
|
||||
@@ -59,18 +59,18 @@ func (w Phase0SignedBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the signed beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the signed beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w Phase0SignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized signed block
|
||||
// SizeSSZ returns the size of the serialized signed block
|
||||
func (w Phase0SignedBeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the signed beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the signed beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w Phase0SignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -104,6 +104,11 @@ func (Phase0SignedBeaconBlock) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatr
|
||||
return nil, ErrUnsupportedBellatrixBlock
|
||||
}
|
||||
|
||||
// PbBlindedBellatrixBlock is a stub.
|
||||
func (Phase0SignedBeaconBlock) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error) {
|
||||
return nil, ErrUnsupportedBlindedBellatrixBlock
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
func (Phase0SignedBeaconBlock) Version() int {
|
||||
return version.Phase0
|
||||
@@ -145,7 +150,7 @@ func (w Phase0BeaconBlock) Slot() types.Slot {
|
||||
return w.b.Slot
|
||||
}
|
||||
|
||||
// ProposerIndex returns proposer index of the beacon block.
|
||||
// ProposerIndex returns the proposer index of the beacon block.
|
||||
func (w Phase0BeaconBlock) ProposerIndex() types.ValidatorIndex {
|
||||
return w.b.ProposerIndex
|
||||
}
|
||||
@@ -186,18 +191,18 @@ func (w Phase0BeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the beacon block to its relevant ssz
|
||||
// MarshalSSZTo marshals the beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w Phase0BeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of serialized block.
|
||||
// SizeSSZ returns the size of the serialized block.
|
||||
func (w Phase0BeaconBlock) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshalls the beacon block from its relevant ssz
|
||||
// UnmarshalSSZ unmarshals the beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w Phase0BeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
@@ -214,6 +219,7 @@ func (Phase0BeaconBlock) Version() int {
|
||||
return version.Phase0
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w Phase0BeaconBlock) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
return &validatorpb.SignRequest_Block{
|
||||
Block: w.b,
|
||||
@@ -296,3 +302,8 @@ func (w Phase0BeaconBlockBody) Proto() proto.Message {
|
||||
func (w Phase0BeaconBlockBody) ExecutionPayload() (*enginev1.ExecutionPayload, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayload for %T", w)
|
||||
}
|
||||
|
||||
// ExecutionPayloadHeader is a stub.
|
||||
func (w Phase0BeaconBlockBody) ExecutionPayloadHeader() (*eth.ExecutionPayloadHeader, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayloadHeader for %T", w)
|
||||
}
|
||||
|
||||
@@ -64,3 +64,23 @@ func TestBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
require.Equal(t, true, ok, "Not a SignRequest_Block")
|
||||
assert.Equal(t, abb, got.Block)
|
||||
}
|
||||
|
||||
func TestPhase0BeaconBlock_PbBlindedBellatrixBlock(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlock{
|
||||
Block: ðpb.BeaconBlock{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.PbBlindedBellatrixBlock()
|
||||
require.ErrorContains(t, "unsupported blinded bellatrix block", err)
|
||||
}
|
||||
|
||||
func TestPhase0BeaconBlock_ExecutionPayloadHeader(t *testing.T) {
|
||||
sb := ðpb.SignedBeaconBlock{
|
||||
Block: ðpb.BeaconBlock{Slot: 66},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
_, err = wsb.Block().Body().ExecutionPayloadHeader()
|
||||
require.ErrorContains(t, "unsupported field for block type", err)
|
||||
}
|
||||
|
||||
317
proto/prysm/v1alpha1/wrapper/blinded_beacon_block_bellatrix.go
Normal file
317
proto/prysm/v1alpha1/wrapper/blinded_beacon_block_bellatrix.go
Normal file
@@ -0,0 +1,317 @@
|
||||
package wrapper
|
||||
|
||||
import (
|
||||
ssz "github.com/ferranbt/fastssz"
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/proto/engine/v1"
|
||||
eth "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
_ = block.SignedBeaconBlock(&signedBlindedBeaconBlockBellatrix{})
|
||||
_ = block.BeaconBlock(&blindedBeaconBlockBellatrix{})
|
||||
_ = block.BeaconBlockBody(&blindedBeaconBlockBodyBellatrix{})
|
||||
)
|
||||
|
||||
// signedBlindedBeaconBlockBellatrix is a convenience wrapper around a Bellatrix blinded beacon block
|
||||
// object. This wrapper allows us to conform to a common interface so that beacon
|
||||
// blocks for future forks can also be applied across prysm without issues.
|
||||
type signedBlindedBeaconBlockBellatrix struct {
|
||||
b *eth.SignedBlindedBeaconBlockBellatrix
|
||||
}
|
||||
|
||||
// wrappedBellatrixSignedBlindedBeaconBlock is a constructor which wraps a protobuf Bellatrix blinded block with the block wrapper.
|
||||
func wrappedBellatrixSignedBlindedBeaconBlock(b *eth.SignedBlindedBeaconBlockBellatrix) (block.SignedBeaconBlock, error) {
|
||||
w := signedBlindedBeaconBlockBellatrix{b: b}
|
||||
if w.IsNil() {
|
||||
return nil, ErrNilObjectWrapped
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// Signature returns the respective block signature.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Signature() []byte {
|
||||
return w.b.Signature
|
||||
}
|
||||
|
||||
// Block returns the underlying beacon block object.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Block() block.BeaconBlock {
|
||||
return blindedBeaconBlockBellatrix{b: w.b.Block}
|
||||
}
|
||||
|
||||
// IsNil checks if the underlying beacon block is nil.
|
||||
func (w signedBlindedBeaconBlockBellatrix) IsNil() bool {
|
||||
return w.b == nil || w.b.Block == nil
|
||||
}
|
||||
|
||||
// Copy performs a deep copy of the signed beacon block object.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Copy() block.SignedBeaconBlock {
|
||||
return signedBlindedBeaconBlockBellatrix{b: eth.CopySignedBlindedBeaconBlockBellatrix(w.b)}
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the signed beacon block to its relevant ssz form.
|
||||
func (w signedBlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the signed beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w signedBlindedBeaconBlockBellatrix) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of the serialized signed block
|
||||
func (w signedBlindedBeaconBlockBellatrix) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshals the signed beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w signedBlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
}
|
||||
|
||||
// Proto returns the block in its underlying protobuf interface.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
}
|
||||
|
||||
// PbGenericBlock returns a generic signed beacon block.
|
||||
func (w signedBlindedBeaconBlockBellatrix) PbGenericBlock() (*eth.GenericSignedBeaconBlock, error) {
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_BlindedBellatrix{BlindedBellatrix: w.b},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// PbBellatrixBlock returns the underlying protobuf object.
|
||||
func (signedBlindedBeaconBlockBellatrix) PbBellatrixBlock() (*eth.SignedBeaconBlockBellatrix, error) {
|
||||
return nil, ErrUnsupportedBellatrixBlock
|
||||
}
|
||||
|
||||
// PbBlindedBellatrixBlock returns the underlying protobuf object.
|
||||
func (w signedBlindedBeaconBlockBellatrix) PbBlindedBellatrixBlock() (*eth.SignedBlindedBeaconBlockBellatrix, error) {
|
||||
return w.b, nil
|
||||
}
|
||||
|
||||
// PbPhase0Block returns the underlying protobuf object.
|
||||
func (signedBlindedBeaconBlockBellatrix) PbPhase0Block() (*eth.SignedBeaconBlock, error) {
|
||||
return nil, ErrUnsupportedPhase0Block
|
||||
}
|
||||
|
||||
// PbAltairBlock returns the underlying protobuf object.
|
||||
func (signedBlindedBeaconBlockBellatrix) PbAltairBlock() (*eth.SignedBeaconBlockAltair, error) {
|
||||
return nil, ErrUnsupportedAltairBlock
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
func (signedBlindedBeaconBlockBellatrix) Version() int {
|
||||
return version.Bellatrix
|
||||
}
|
||||
|
||||
// Header converts the underlying protobuf object from blinded block to header format.
|
||||
func (w signedBlindedBeaconBlockBellatrix) Header() (*eth.SignedBeaconBlockHeader, error) {
|
||||
root, err := w.b.Block.Body.HashTreeRoot()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not hash block")
|
||||
}
|
||||
|
||||
return ð.SignedBeaconBlockHeader{
|
||||
Header: ð.BeaconBlockHeader{
|
||||
Slot: w.b.Block.Slot,
|
||||
ProposerIndex: w.b.Block.ProposerIndex,
|
||||
ParentRoot: w.b.Block.ParentRoot,
|
||||
StateRoot: w.b.Block.StateRoot,
|
||||
BodyRoot: root[:],
|
||||
},
|
||||
Signature: w.Signature(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// blindedBeaconBlockBellatrix is the wrapper for the actual block.
|
||||
type blindedBeaconBlockBellatrix struct {
|
||||
b *eth.BlindedBeaconBlockBellatrix
|
||||
}
|
||||
|
||||
// WrappedBellatrixBlindedBeaconBlock is a constructor which wraps a protobuf Bellatrix object
|
||||
// with the block wrapper.
|
||||
//
|
||||
// Deprecated: Use WrappedBeaconBlock.
|
||||
func WrappedBellatrixBlindedBeaconBlock(b *eth.BlindedBeaconBlockBellatrix) (block.BeaconBlock, error) {
|
||||
w := blindedBeaconBlockBellatrix{b: b}
|
||||
if w.IsNil() {
|
||||
return nil, ErrNilObjectWrapped
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// Slot returns the respective slot of the block.
|
||||
func (w blindedBeaconBlockBellatrix) Slot() types.Slot {
|
||||
return w.b.Slot
|
||||
}
|
||||
|
||||
// ProposerIndex returns the proposer index of the beacon block.
|
||||
func (w blindedBeaconBlockBellatrix) ProposerIndex() types.ValidatorIndex {
|
||||
return w.b.ProposerIndex
|
||||
}
|
||||
|
||||
// ParentRoot returns the parent root of beacon block.
|
||||
func (w blindedBeaconBlockBellatrix) ParentRoot() []byte {
|
||||
return w.b.ParentRoot
|
||||
}
|
||||
|
||||
// StateRoot returns the state root of the beacon block.
|
||||
func (w blindedBeaconBlockBellatrix) StateRoot() []byte {
|
||||
return w.b.StateRoot
|
||||
}
|
||||
|
||||
// Body returns the underlying block body.
|
||||
func (w blindedBeaconBlockBellatrix) Body() block.BeaconBlockBody {
|
||||
return blindedBeaconBlockBodyBellatrix{b: w.b.Body}
|
||||
}
|
||||
|
||||
// IsNil checks if the beacon block is nil.
|
||||
func (w blindedBeaconBlockBellatrix) IsNil() bool {
|
||||
return w.b == nil
|
||||
}
|
||||
|
||||
// HashTreeRoot returns the ssz root of the block.
|
||||
func (w blindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) {
|
||||
return w.b.HashTreeRoot()
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the BeaconBlock object with a hasher.
|
||||
func (w blindedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) error {
|
||||
return w.b.HashTreeRootWith(hh)
|
||||
}
|
||||
|
||||
// MarshalSSZ marshals the block into its respective
|
||||
// ssz form.
|
||||
func (w blindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) {
|
||||
return w.b.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo marshals the beacon block's ssz
|
||||
// form to the provided byte buffer.
|
||||
func (w blindedBeaconBlockBellatrix) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return w.b.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ returns the size of the serialized block.
|
||||
func (w blindedBeaconBlockBellatrix) SizeSSZ() int {
|
||||
return w.b.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ unmarshals the beacon block from its relevant ssz
|
||||
// form.
|
||||
func (w blindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error {
|
||||
return w.b.UnmarshalSSZ(buf)
|
||||
}
|
||||
|
||||
// Proto returns the underlying block object in its
|
||||
// proto form.
|
||||
func (w blindedBeaconBlockBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
}
|
||||
|
||||
// Version of the underlying protobuf object.
|
||||
func (blindedBeaconBlockBellatrix) Version() int {
|
||||
return version.Bellatrix
|
||||
}
|
||||
|
||||
// AsSignRequestObject returns the underlying sign request object.
|
||||
func (w blindedBeaconBlockBellatrix) AsSignRequestObject() validatorpb.SignRequestObject {
|
||||
return &validatorpb.SignRequest_BlindedBlockV3{
|
||||
BlindedBlockV3: w.b,
|
||||
}
|
||||
}
|
||||
|
||||
// blindedBeaconBlockBodyBellatrix is a wrapper of a beacon block body.
|
||||
type blindedBeaconBlockBodyBellatrix struct {
|
||||
b *eth.BlindedBeaconBlockBodyBellatrix
|
||||
}
|
||||
|
||||
// WrappedBellatrixBlindedBeaconBlockBody is a constructor which wraps a protobuf bellatrix object
|
||||
// with the block wrapper.
|
||||
func WrappedBellatrixBlindedBeaconBlockBody(b *eth.BlindedBeaconBlockBodyBellatrix) (block.BeaconBlockBody, error) {
|
||||
w := blindedBeaconBlockBodyBellatrix{b: b}
|
||||
if w.IsNil() {
|
||||
return nil, ErrNilObjectWrapped
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// RandaoReveal returns the randao reveal from the block body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) RandaoReveal() []byte {
|
||||
return w.b.RandaoReveal
|
||||
}
|
||||
|
||||
// Eth1Data returns the eth1 data in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Eth1Data() *eth.Eth1Data {
|
||||
return w.b.Eth1Data
|
||||
}
|
||||
|
||||
// Graffiti returns the graffiti in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Graffiti() []byte {
|
||||
return w.b.Graffiti
|
||||
}
|
||||
|
||||
// ProposerSlashings returns the proposer slashings in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) ProposerSlashings() []*eth.ProposerSlashing {
|
||||
return w.b.ProposerSlashings
|
||||
}
|
||||
|
||||
// AttesterSlashings returns the attester slashings in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) AttesterSlashings() []*eth.AttesterSlashing {
|
||||
return w.b.AttesterSlashings
|
||||
}
|
||||
|
||||
// Attestations returns the stored attestations in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Attestations() []*eth.Attestation {
|
||||
return w.b.Attestations
|
||||
}
|
||||
|
||||
// Deposits returns the stored deposits in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Deposits() []*eth.Deposit {
|
||||
return w.b.Deposits
|
||||
}
|
||||
|
||||
// VoluntaryExits returns the voluntary exits in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) VoluntaryExits() []*eth.SignedVoluntaryExit {
|
||||
return w.b.VoluntaryExits
|
||||
}
|
||||
|
||||
// SyncAggregate returns the sync aggregate in the block.
|
||||
func (w blindedBeaconBlockBodyBellatrix) SyncAggregate() (*eth.SyncAggregate, error) {
|
||||
return w.b.SyncAggregate, nil
|
||||
}
|
||||
|
||||
// IsNil checks if the block body is nil.
|
||||
func (w blindedBeaconBlockBodyBellatrix) IsNil() bool {
|
||||
return w.b == nil
|
||||
}
|
||||
|
||||
// HashTreeRoot returns the ssz root of the block body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) {
|
||||
return w.b.HashTreeRoot()
|
||||
}
|
||||
|
||||
// Proto returns the underlying proto form of the block
|
||||
// body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) Proto() proto.Message {
|
||||
return w.b
|
||||
}
|
||||
|
||||
// ExecutionPayload returns the execution payload of the block body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) ExecutionPayload() (*enginev1.ExecutionPayload, error) {
|
||||
return nil, errors.Wrapf(ErrUnsupportedField, "ExecutionPayload for %T", w)
|
||||
}
|
||||
|
||||
// ExecutionPayloadHeader returns the execution payload header of the block body.
|
||||
func (w blindedBeaconBlockBodyBellatrix) ExecutionPayloadHeader() (*eth.ExecutionPayloadHeader, error) {
|
||||
return w.b.ExecutionPayloadHeader, nil
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
package wrapper_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
||||
"github.com/prysmaticlabs/prysm/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/testing/assert"
|
||||
"github.com/prysmaticlabs/prysm/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/testing/util"
|
||||
)
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Header(t *testing.T) {
|
||||
root := bytesutil.PadTo([]byte("root"), 32)
|
||||
signature := bytesutil.PadTo([]byte("sig"), 96)
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{}
|
||||
body = util.HydrateBlindedBeaconBlockBodyBellatrix(body)
|
||||
bodyRoot, err := body.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
block := ðpb.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: ðpb.BlindedBeaconBlockBellatrix{
|
||||
Slot: 1,
|
||||
ProposerIndex: 1,
|
||||
ParentRoot: root,
|
||||
StateRoot: root,
|
||||
Body: body,
|
||||
},
|
||||
Signature: signature,
|
||||
}
|
||||
wrapped, err := wrapper.WrappedSignedBeaconBlock(block)
|
||||
require.NoError(t, err)
|
||||
|
||||
header, err := wrapped.Header()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, types.ValidatorIndex(1), header.Header.ProposerIndex)
|
||||
assert.Equal(t, types.Slot(1), header.Header.Slot)
|
||||
assert.DeepEqual(t, bodyRoot[:], header.Header.BodyRoot)
|
||||
assert.DeepEqual(t, root, header.Header.StateRoot)
|
||||
assert.DeepEqual(t, root, header.Header.ParentRoot)
|
||||
assert.DeepEqual(t, signature, header.Signature)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Signature(t *testing.T) {
|
||||
sig := []byte{0x11, 0x22}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: ðpb.BlindedBeaconBlockBellatrix{}, Signature: sig})
|
||||
require.NoError(t, err)
|
||||
|
||||
if !bytes.Equal(sig, wsb.Signature()) {
|
||||
t.Error("Wrong signature returned")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Block(t *testing.T) {
|
||||
blk := ðpb.BlindedBeaconBlockBellatrix{Slot: 54}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: blk})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, blk, wsb.Block().Proto())
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_IsNil(t *testing.T) {
|
||||
_, err := wrapper.WrappedSignedBeaconBlock(nil)
|
||||
require.Equal(t, wrapper.ErrNilObjectWrapped, err)
|
||||
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: ðpb.BlindedBeaconBlockBellatrix{}})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, false, wsb.IsNil())
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Copy(t *testing.T) {
|
||||
t.Skip("TODO: Missing mutation evaluation helpers")
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Proto(t *testing.T) {
|
||||
sb := ðpb.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: ðpb.BlindedBeaconBlockBellatrix{Slot: 66},
|
||||
Signature: []byte{0x11, 0x22},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, sb, wsb.Proto())
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_PbPhase0Block(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: ðpb.BlindedBeaconBlockBellatrix{}})
|
||||
require.NoError(t, err)
|
||||
|
||||
if _, err := wsb.PbPhase0Block(); err != wrapper.ErrUnsupportedPhase0Block {
|
||||
t.Errorf("Wrong error returned. Want %v got %v", wrapper.ErrUnsupportedPhase0Block, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_PbBellatrixBlock(t *testing.T) {
|
||||
sb := ðpb.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: ðpb.BlindedBeaconBlockBellatrix{Slot: 66},
|
||||
Signature: []byte{0x11, 0x22},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = wsb.PbBellatrixBlock()
|
||||
require.ErrorContains(t, "unsupported bellatrix block", err)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_PbBlindedBellatrixBlock(t *testing.T) {
|
||||
sb := ðpb.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: ðpb.BlindedBeaconBlockBellatrix{Slot: 66},
|
||||
Signature: []byte{0x11, 0x22},
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
got, err := wsb.PbBlindedBellatrixBlock()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, sb, got)
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_MarshalSSZTo(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(util.HydrateSignedBlindedBeaconBlockBellatrix(ðpb.SignedBlindedBeaconBlockBellatrix{}))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var b []byte
|
||||
b, err = wsb.MarshalSSZTo(b)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, 0, len(b))
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_SSZ(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(util.HydrateSignedBlindedBeaconBlockBellatrix(ðpb.SignedBlindedBeaconBlockBellatrix{}))
|
||||
assert.NoError(t, err)
|
||||
|
||||
b, err := wsb.MarshalSSZ()
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, 0, len(b))
|
||||
|
||||
assert.NotEqual(t, 0, wsb.SizeSSZ())
|
||||
|
||||
assert.NoError(t, wsb.UnmarshalSSZ(b))
|
||||
}
|
||||
|
||||
func TestBellatrixSignedBlindedBeaconBlock_Version(t *testing.T) {
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(ðpb.SignedBlindedBeaconBlockBellatrix{Block: ðpb.BlindedBeaconBlockBellatrix{}})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, version.Bellatrix, wsb.Version())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_Slot(t *testing.T) {
|
||||
slot := types.Slot(546)
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{Slot: slot})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, slot, wb.Slot())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_ProposerIndex(t *testing.T) {
|
||||
pi := types.ValidatorIndex(555)
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{ProposerIndex: pi})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, pi, wb.ProposerIndex())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_ParentRoot(t *testing.T) {
|
||||
root := []byte{0xAA, 0xBF, 0x33, 0x01}
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{ParentRoot: root})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, root, wb.ParentRoot())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_StateRoot(t *testing.T) {
|
||||
root := []byte{0xAA, 0xBF, 0x33, 0x01}
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{StateRoot: root})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, root, wb.StateRoot())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_Body(t *testing.T) {
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{Graffiti: []byte{0x44}}
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{Body: body})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wb.Body().Proto())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_IsNil(t *testing.T) {
|
||||
_, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(nil)
|
||||
require.Equal(t, wrapper.ErrNilObjectWrapped, err)
|
||||
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, false, wb.IsNil())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_HashTreeRoot(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(util.HydrateBlindedBeaconBlockBellatrix(ðpb.BlindedBeaconBlockBellatrix{}))
|
||||
require.NoError(t, err)
|
||||
|
||||
rt, err := wb.HashTreeRoot()
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, rt)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_Proto(t *testing.T) {
|
||||
blk := ðpb.BlindedBeaconBlockBellatrix{ProposerIndex: 234}
|
||||
wb, err := wrapper.WrappedBeaconBlock(blk)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, blk, wb.Proto())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_SSZ(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(util.HydrateBlindedBeaconBlockBellatrix(ðpb.BlindedBeaconBlockBellatrix{}))
|
||||
assert.NoError(t, err)
|
||||
|
||||
b, err := wb.MarshalSSZ()
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, 0, len(b))
|
||||
|
||||
assert.NotEqual(t, 0, wb.SizeSSZ())
|
||||
|
||||
assert.NoError(t, wb.UnmarshalSSZ(b))
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_Version(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBeaconBlock(ðpb.BlindedBeaconBlockBellatrix{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, version.Bellatrix, wb.Version())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_RandaoReveal(t *testing.T) {
|
||||
root := []byte{0xAA, 0xBF, 0x33, 0x01}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(ðpb.BlindedBeaconBlockBodyBellatrix{RandaoReveal: root})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, root, wbb.RandaoReveal())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_Eth1Data(t *testing.T) {
|
||||
data := ðpb.Eth1Data{}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{
|
||||
Eth1Data: data,
|
||||
}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, data, wbb.Eth1Data())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_Graffiti(t *testing.T) {
|
||||
graffiti := []byte{0x66, 0xAA}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{Graffiti: graffiti}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, graffiti, wbb.Graffiti())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_ProposerSlashings(t *testing.T) {
|
||||
ps := []*ethpb.ProposerSlashing{
|
||||
{Header_1: ðpb.SignedBeaconBlockHeader{
|
||||
Signature: []byte{0x11, 0x20},
|
||||
}},
|
||||
}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{ProposerSlashings: ps}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, ps, wbb.ProposerSlashings())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_AttesterSlashings(t *testing.T) {
|
||||
as := []*ethpb.AttesterSlashing{
|
||||
{Attestation_1: ðpb.IndexedAttestation{Signature: []byte{0x11}}},
|
||||
}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{AttesterSlashings: as}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, as, wbb.AttesterSlashings())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_Attestations(t *testing.T) {
|
||||
atts := []*ethpb.Attestation{{Signature: []byte{0x88}}}
|
||||
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{Attestations: atts}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, atts, wbb.Attestations())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_Deposits(t *testing.T) {
|
||||
deposits := []*ethpb.Deposit{
|
||||
{Proof: [][]byte{{0x54, 0x10}}},
|
||||
}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{Deposits: deposits}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, deposits, wbb.Deposits())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_VoluntaryExits(t *testing.T) {
|
||||
exits := []*ethpb.SignedVoluntaryExit{
|
||||
{Exit: ðpb.VoluntaryExit{Epoch: 54}},
|
||||
}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{VoluntaryExits: exits}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.DeepEqual(t, exits, wbb.VoluntaryExits())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_IsNil(t *testing.T) {
|
||||
_, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(nil)
|
||||
require.Equal(t, wrapper.ErrNilObjectWrapped, err)
|
||||
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(ðpb.BlindedBeaconBlockBodyBellatrix{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, false, wbb.IsNil())
|
||||
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_HashTreeRoot(t *testing.T) {
|
||||
wb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(util.HydrateBlindedBeaconBlockBodyBellatrix(ðpb.BlindedBeaconBlockBodyBellatrix{}))
|
||||
assert.NoError(t, err)
|
||||
|
||||
rt, err := wb.HashTreeRoot()
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, rt)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_Proto(t *testing.T) {
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{Graffiti: []byte{0x66, 0xAA}}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, body, wbb.Proto())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlockBody_ExecutionPayloadHeader(t *testing.T) {
|
||||
payloads := ðpb.ExecutionPayloadHeader{
|
||||
BlockNumber: 100,
|
||||
}
|
||||
body := ðpb.BlindedBeaconBlockBodyBellatrix{ExecutionPayloadHeader: payloads}
|
||||
wbb, err := wrapper.WrappedBellatrixBlindedBeaconBlockBody(body)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = wbb.ExecutionPayload()
|
||||
require.ErrorContains(t, wrapper.ErrUnsupportedField.Error(), err)
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_PbGenericBlock(t *testing.T) {
|
||||
abb := ðpb.SignedBlindedBeaconBlockBellatrix{
|
||||
Block: util.HydrateBlindedBeaconBlockBellatrix(ðpb.BlindedBeaconBlockBellatrix{}),
|
||||
}
|
||||
wsb, err := wrapper.WrappedSignedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
got, err := wsb.PbGenericBlock()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, abb, got.GetBlindedBellatrix())
|
||||
}
|
||||
|
||||
func TestBellatrixBlindedBeaconBlock_AsSignRequestObject(t *testing.T) {
|
||||
abb := util.HydrateBlindedBeaconBlockBellatrix(ðpb.BlindedBeaconBlockBellatrix{})
|
||||
wsb, err := wrapper.WrappedBeaconBlock(abb)
|
||||
require.NoError(t, err)
|
||||
|
||||
sro := wsb.AsSignRequestObject()
|
||||
got, ok := sro.(*validatorpb.SignRequest_BlindedBlockV3)
|
||||
require.Equal(t, true, ok, "Not a SignRequest_BlockV3")
|
||||
assert.Equal(t, abb, got.BlindedBlockV3)
|
||||
}
|
||||
@@ -53,9 +53,9 @@ func NewBeaconBlock() *ethpb.SignedBeaconBlock {
|
||||
RandaoReveal: make([]byte, fieldparams.BLSSignatureLength),
|
||||
Eth1Data: ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, 32),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
},
|
||||
Graffiti: make([]byte, 32),
|
||||
Graffiti: make([]byte, fieldparams.RootLength),
|
||||
Attestations: []*ethpb.Attestation{},
|
||||
AttesterSlashings: []*ethpb.AttesterSlashing{},
|
||||
Deposits: []*ethpb.Deposit{},
|
||||
@@ -175,7 +175,7 @@ func GenerateFullBlock(
|
||||
Attestations: atts,
|
||||
VoluntaryExits: exits,
|
||||
Deposits: newDeposits,
|
||||
Graffiti: make([]byte, 32),
|
||||
Graffiti: make([]byte, fieldparams.RootLength),
|
||||
},
|
||||
}
|
||||
if err := bState.SetSlot(currentSlot); err != nil {
|
||||
@@ -200,7 +200,7 @@ func GenerateProposerSlashingForValidator(
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
ProposerIndex: idx,
|
||||
Slot: bState.Slot(),
|
||||
BodyRoot: bytesutil.PadTo([]byte{0, 1, 0}, 32),
|
||||
BodyRoot: bytesutil.PadTo([]byte{0, 1, 0}, fieldparams.RootLength),
|
||||
},
|
||||
})
|
||||
currentEpoch := time.CurrentEpoch(bState)
|
||||
@@ -214,7 +214,7 @@ func GenerateProposerSlashingForValidator(
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
ProposerIndex: idx,
|
||||
Slot: bState.Slot(),
|
||||
BodyRoot: bytesutil.PadTo([]byte{0, 2, 0}, 32),
|
||||
BodyRoot: bytesutil.PadTo([]byte{0, 2, 0}, fieldparams.RootLength),
|
||||
StateRoot: make([]byte, fieldparams.RootLength),
|
||||
ParentRoot: make([]byte, fieldparams.RootLength),
|
||||
},
|
||||
@@ -451,12 +451,12 @@ func HydrateBeaconBlockBody(b *ethpb.BeaconBlockBody) *ethpb.BeaconBlockBody {
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
return b
|
||||
@@ -479,10 +479,10 @@ func HydrateV1BeaconBlock(b *v1.BeaconBlock) *v1.BeaconBlock {
|
||||
b = &v1.BeaconBlock{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, 32)
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, 32)
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateV1BeaconBlockBody(b.Body)
|
||||
return b
|
||||
@@ -498,12 +498,12 @@ func HydrateV1BeaconBlockBody(b *v1.BeaconBlockBody) *v1.BeaconBlockBody {
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = &v1.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
return b
|
||||
@@ -526,10 +526,10 @@ func HydrateV2AltairBeaconBlock(b *v2.BeaconBlockAltair) *v2.BeaconBlockAltair {
|
||||
b = &v2.BeaconBlockAltair{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, 32)
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, 32)
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateV2AltairBeaconBlockBody(b.Body)
|
||||
return b
|
||||
@@ -545,12 +545,12 @@ func HydrateV2AltairBeaconBlockBody(b *v2.BeaconBlockBodyAltair) *v2.BeaconBlock
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = &v1.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
if b.SyncAggregate == nil {
|
||||
@@ -579,10 +579,10 @@ func HydrateV2BellatrixBeaconBlock(b *v2.BeaconBlockBellatrix) *v2.BeaconBlockBe
|
||||
b = &v2.BeaconBlockBellatrix{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, 32)
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, 32)
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateV2BellatrixBeaconBlockBody(b.Body)
|
||||
return b
|
||||
@@ -598,12 +598,12 @@ func HydrateV2BellatrixBeaconBlockBody(b *v2.BeaconBlockBodyBellatrix) *v2.Beaco
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = &v1.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
if b.SyncAggregate == nil {
|
||||
@@ -614,15 +614,15 @@ func HydrateV2BellatrixBeaconBlockBody(b *v2.BeaconBlockBodyBellatrix) *v2.Beaco
|
||||
}
|
||||
if b.ExecutionPayload == nil {
|
||||
b.ExecutionPayload = &enginev1.ExecutionPayload{
|
||||
ParentHash: make([]byte, 32),
|
||||
ParentHash: make([]byte, fieldparams.RootLength),
|
||||
FeeRecipient: make([]byte, 20),
|
||||
StateRoot: make([]byte, 32),
|
||||
ReceiptsRoot: make([]byte, 32),
|
||||
StateRoot: make([]byte, fieldparams.RootLength),
|
||||
ReceiptsRoot: make([]byte, fieldparams.RootLength),
|
||||
LogsBloom: make([]byte, 256),
|
||||
PrevRandao: make([]byte, 32),
|
||||
ExtraData: make([]byte, 32),
|
||||
BaseFeePerGas: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
PrevRandao: make([]byte, fieldparams.RootLength),
|
||||
ExtraData: make([]byte, fieldparams.RootLength),
|
||||
BaseFeePerGas: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
return b
|
||||
@@ -645,10 +645,10 @@ func HydrateBeaconBlockAltair(b *ethpb.BeaconBlockAltair) *ethpb.BeaconBlockAlta
|
||||
b = ðpb.BeaconBlockAltair{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, 32)
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, 32)
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateBeaconBlockBodyAltair(b.Body)
|
||||
return b
|
||||
@@ -664,12 +664,12 @@ func HydrateBeaconBlockBodyAltair(b *ethpb.BeaconBlockBodyAltair) *ethpb.BeaconB
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
if b.SyncAggregate == nil {
|
||||
@@ -698,10 +698,10 @@ func HydrateBeaconBlockBellatrix(b *ethpb.BeaconBlockBellatrix) *ethpb.BeaconBlo
|
||||
b = ðpb.BeaconBlockBellatrix{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, 32)
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, 32)
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateBeaconBlockBodyBellatrix(b.Body)
|
||||
return b
|
||||
@@ -717,12 +717,12 @@ func HydrateBeaconBlockBodyBellatrix(b *ethpb.BeaconBlockBodyBellatrix) *ethpb.B
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
b.Graffiti = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
if b.SyncAggregate == nil {
|
||||
@@ -733,14 +733,80 @@ func HydrateBeaconBlockBodyBellatrix(b *ethpb.BeaconBlockBodyBellatrix) *ethpb.B
|
||||
}
|
||||
if b.ExecutionPayload == nil {
|
||||
b.ExecutionPayload = &enginev1.ExecutionPayload{
|
||||
ParentHash: make([]byte, 32),
|
||||
ParentHash: make([]byte, fieldparams.RootLength),
|
||||
FeeRecipient: make([]byte, 20),
|
||||
StateRoot: make([]byte, 32),
|
||||
ReceiptsRoot: make([]byte, 32),
|
||||
StateRoot: make([]byte, fieldparams.RootLength),
|
||||
ReceiptsRoot: make([]byte, fieldparams.RootLength),
|
||||
LogsBloom: make([]byte, 256),
|
||||
PrevRandao: make([]byte, 32),
|
||||
BaseFeePerGas: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
PrevRandao: make([]byte, fieldparams.RootLength),
|
||||
BaseFeePerGas: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// HydrateSignedBlindedBeaconBlockBellatrix hydrates a signed blinded beacon block with correct field length sizes
|
||||
// to comply with fssz marshalling and unmarshalling rules.
|
||||
func HydrateSignedBlindedBeaconBlockBellatrix(b *ethpb.SignedBlindedBeaconBlockBellatrix) *ethpb.SignedBlindedBeaconBlockBellatrix {
|
||||
if b.Signature == nil {
|
||||
b.Signature = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
b.Block = HydrateBlindedBeaconBlockBellatrix(b.Block)
|
||||
return b
|
||||
}
|
||||
|
||||
// HydrateBlindedBeaconBlockBellatrix hydrates a blinded beacon block with correct field length sizes
|
||||
// to comply with fssz marshalling and unmarshalling rules.
|
||||
func HydrateBlindedBeaconBlockBellatrix(b *ethpb.BlindedBeaconBlockBellatrix) *ethpb.BlindedBeaconBlockBellatrix {
|
||||
if b == nil {
|
||||
b = ðpb.BlindedBeaconBlockBellatrix{}
|
||||
}
|
||||
if b.ParentRoot == nil {
|
||||
b.ParentRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
if b.StateRoot == nil {
|
||||
b.StateRoot = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
b.Body = HydrateBlindedBeaconBlockBodyBellatrix(b.Body)
|
||||
return b
|
||||
}
|
||||
|
||||
// HydrateBlindedBeaconBlockBodyBellatrix hydrates a blinded beacon block body with correct field length sizes
|
||||
// to comply with fssz marshalling and unmarshalling rules.
|
||||
func HydrateBlindedBeaconBlockBodyBellatrix(b *ethpb.BlindedBeaconBlockBodyBellatrix) *ethpb.BlindedBeaconBlockBodyBellatrix {
|
||||
if b == nil {
|
||||
b = ðpb.BlindedBeaconBlockBodyBellatrix{}
|
||||
}
|
||||
if b.RandaoReveal == nil {
|
||||
b.RandaoReveal = make([]byte, fieldparams.BLSSignatureLength)
|
||||
}
|
||||
if b.Graffiti == nil {
|
||||
b.Graffiti = make([]byte, 32)
|
||||
}
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, fieldparams.RootLength),
|
||||
BlockHash: make([]byte, 32),
|
||||
}
|
||||
}
|
||||
if b.SyncAggregate == nil {
|
||||
b.SyncAggregate = ðpb.SyncAggregate{
|
||||
SyncCommitteeBits: make([]byte, 64),
|
||||
SyncCommitteeSignature: make([]byte, fieldparams.BLSSignatureLength),
|
||||
}
|
||||
}
|
||||
if b.ExecutionPayloadHeader == nil {
|
||||
b.ExecutionPayloadHeader = ðpb.ExecutionPayloadHeader{
|
||||
ParentHash: make([]byte, 32),
|
||||
FeeRecipient: make([]byte, 20),
|
||||
StateRoot: make([]byte, fieldparams.RootLength),
|
||||
ReceiptRoot: make([]byte, fieldparams.RootLength),
|
||||
LogsBloom: make([]byte, 256),
|
||||
PrevRandao: make([]byte, 32),
|
||||
BaseFeePerGas: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
TransactionsRoot: make([]byte, fieldparams.RootLength),
|
||||
}
|
||||
}
|
||||
return b
|
||||
|
||||
@@ -249,3 +249,30 @@ func TestHydrateSignedBeaconBlockAltair_NoError(t *testing.T) {
|
||||
_, err = b.Block.Body.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestHydrateSignedBlindedBeaconBlockBellatrix_NoError(t *testing.T) {
|
||||
b := ðpbalpha.SignedBlindedBeaconBlockBellatrix{}
|
||||
b = HydrateSignedBlindedBeaconBlockBellatrix(b)
|
||||
_, err := b.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
_, err = b.Block.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
_, err = b.Block.Body.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestHydrateBlindedBeaconBlockBellatrix_NoError(t *testing.T) {
|
||||
b := ðpbalpha.BlindedBeaconBlockBellatrix{}
|
||||
b = HydrateBlindedBeaconBlockBellatrix(b)
|
||||
_, err := b.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
_, err = b.Body.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestHydrateBlindedBeaconBlockBodyBellatrix_NoError(t *testing.T) {
|
||||
b := ðpbalpha.BlindedBeaconBlockBodyBellatrix{}
|
||||
b = HydrateBlindedBeaconBlockBodyBellatrix(b)
|
||||
_, err := b.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user