mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 13:58:09 -05:00
Compare commits
4 Commits
v6.0.5-rc.
...
epbs_unsig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
888e76f960 | ||
|
|
cac7024f13 | ||
|
|
e1b9ccd6dc | ||
|
|
2ba1cf494b |
@@ -41,6 +41,17 @@ ssz_gen_marshal(
|
||||
"ExecutionPayloadHeaderCapella",
|
||||
"ExecutionPayloadHeaderDeneb",
|
||||
"ExecutionPayloadDeneb",
|
||||
"PayloadAttestationData",
|
||||
"PayloadAttestation",
|
||||
"PayloadAttestationMessage",
|
||||
"InclusionListSummaryEntry",
|
||||
"InclusionListSummary",
|
||||
"SignedInclusionListSummary",
|
||||
"InclusionList",
|
||||
"ExecutionPayloadHeaderEPBS",
|
||||
"ExecutionPayloadEPBS",
|
||||
"ExecutionPayloadEnvelope",
|
||||
"SignedExecutionPayloadHeaderEnvelope",
|
||||
"BlindedBlobsBundle",
|
||||
"BlobsBundle",
|
||||
"Withdrawal",
|
||||
@@ -50,7 +61,7 @@ ssz_gen_marshal(
|
||||
go_proto_library(
|
||||
name = "go_proto",
|
||||
compilers = [
|
||||
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
|
||||
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v4/proto/engine/v1",
|
||||
proto = ":proto",
|
||||
@@ -60,6 +71,7 @@ go_proto_library(
|
||||
"//proto/eth/ext:go_default_library",
|
||||
"@com_github_golang_protobuf//proto:go_default_library",
|
||||
"@googleapis//google/api:annotations_go_proto",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
|
||||
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
|
||||
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
|
||||
@@ -93,6 +105,7 @@ go_library(
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@googleapis//google/api:annotations_go_proto",
|
||||
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep
|
||||
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
|
||||
"@org_golang_google_protobuf//encoding/protojson:go_default_library",
|
||||
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
|
||||
@@ -104,6 +117,7 @@ ssz_proto_files(
|
||||
name = "ssz_proto_files",
|
||||
srcs = [
|
||||
"execution_engine.proto",
|
||||
"epbs.proto",
|
||||
],
|
||||
config = select({
|
||||
"//conditions:default": "mainnet",
|
||||
|
||||
1392
proto/engine/v1/epbs.pb.go
generated
Executable file
1392
proto/engine/v1/epbs.pb.go
generated
Executable file
File diff suppressed because it is too large
Load Diff
122
proto/engine/v1/epbs.proto
Normal file
122
proto/engine/v1/epbs.proto
Normal file
@@ -0,0 +1,122 @@
|
||||
// Copyright 2024 Prysmatic Labs.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
syntax = "proto3";
|
||||
|
||||
package ethereum.engine.v1;
|
||||
|
||||
import "proto/eth/ext/options.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Engine.V1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v4/proto/engine/v1;enginev1";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ExecutionEngineProto";
|
||||
option java_package = "org.ethereum.engine.v1";
|
||||
option php_namespace = "Ethereum\\Engine\\v1";
|
||||
|
||||
|
||||
message PayloadAttestationData {
|
||||
bytes beacon_block_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"];
|
||||
bool payload_present = 3;
|
||||
}
|
||||
|
||||
message PayloadAttestation {
|
||||
bytes aggregation_bits = 1 [(ethereum.eth.ext.ssz_size) = "ptc.size", (ethereum.eth.ext.cast_type) = "ptc.type"];
|
||||
PayloadAttestationData data = 2;
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message PayloadAttestationMessage {
|
||||
uint64 validator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"];
|
||||
PayloadAttestationData data = 2;
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message InclusionListSummaryEntry {
|
||||
bytes address = 1 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
uint64 gas_limit = 2;
|
||||
}
|
||||
|
||||
message InclusionListSummary {
|
||||
uint64 proposer_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"];
|
||||
repeated InclusionListSummaryEntry entries = 2 [(ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"];
|
||||
}
|
||||
|
||||
message SignedInclusionListSummary {
|
||||
InclusionListSummary message = 1;
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message InclusionList {
|
||||
SignedInclusionListSummary summary = 1;
|
||||
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"];
|
||||
repeated bytes transactions = 3 [(ethereum.eth.ext.ssz_size) = "?,?", (ethereum.eth.ext.ssz_max) = "max_inclusion_list.size,1073741824"];
|
||||
}
|
||||
|
||||
message ExecutionPayloadHeaderEPBS {
|
||||
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 receipts_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "logs_bloom.size"];
|
||||
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) = "extra_data.size"];
|
||||
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"];
|
||||
bytes withdrawals_root = 15 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 blob_gas_used = 16;
|
||||
uint64 excess_blob_gas = 17;
|
||||
bytes inclusion_list_summary_root = 18 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes inclusion_list_exclusions_root = 19 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
}
|
||||
|
||||
message ExecutionPayloadEPBS {
|
||||
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 receipts_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "logs_bloom.size"];
|
||||
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) = "extra_data.size"];
|
||||
bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
repeated bytes transactions = 14 [(ethereum.eth.ext.ssz_size) = "?,?", (ethereum.eth.ext.ssz_max) = "1048576,1073741824"];
|
||||
// MAX_WITHDRAWALS_PER_PAYLOAD
|
||||
repeated Withdrawal withdrawals = 15 [(ethereum.eth.ext.ssz_max) = "withdrawal.size"];
|
||||
uint64 blob_gas_used = 16;
|
||||
uint64 excess_blob_gas = 17;
|
||||
repeated InclusionListSummaryEntry inclusion_list_summary = 18 [(ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"];
|
||||
repeated uint64 inclusion_list_exclusions = 19 [(ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"];
|
||||
}
|
||||
|
||||
message ExecutionPayloadHeaderEnvelope {
|
||||
ExecutionPayloadHeaderEPBS header = 1;
|
||||
uint64 builder_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.ValidatorIndex"];
|
||||
uint64 value = 3;
|
||||
}
|
||||
|
||||
message SignedExecutionPayloadHeaderEnvelope {
|
||||
ExecutionPayloadHeaderEnvelope message = 1;
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -65,6 +65,8 @@ ssz_gen_marshal(
|
||||
"BeaconBlockBodyCapella",
|
||||
"SignedBeaconBlockCapella",
|
||||
"BeaconBlockDeneb",
|
||||
"BeaconBlockePBS",
|
||||
"SignedBeaconBlockePBS",
|
||||
"BeaconBlockBodyDeneb",
|
||||
"SignedBeaconBlockDeneb",
|
||||
"SignedBlindedBeaconBlockCapella",
|
||||
|
||||
2633
proto/prysm/v1alpha1/beacon_block.pb.go
generated
2633
proto/prysm/v1alpha1/beacon_block.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@ import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/attestation.proto";
|
||||
import "proto/prysm/v1alpha1/withdrawals.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
import "proto/engine/v1/epbs.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.v1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1;eth";
|
||||
@@ -51,6 +52,9 @@ message GenericSignedBeaconBlock {
|
||||
SignedBeaconBlockContentsDeneb deneb = 7;
|
||||
|
||||
SignedBlindedBeaconBlockDeneb blinded_deneb = 8;
|
||||
|
||||
// Representing a signed ePBS block
|
||||
SignedBeaconBlockePBS epbs = 9;
|
||||
}
|
||||
bool is_blinded = 100;
|
||||
uint64 payload_value = 101 [deprecated = true];
|
||||
@@ -76,10 +80,13 @@ message GenericBeaconBlock {
|
||||
// Representing a post-Capella fork blinded beacon block.
|
||||
BlindedBeaconBlockCapella blinded_capella = 6;
|
||||
|
||||
// Representing a signed, post-Deneb fork beacon block content.
|
||||
// Representing a post-Deneb fork beacon block.
|
||||
BeaconBlockContentsDeneb deneb = 7;
|
||||
|
||||
BlindedBeaconBlockDeneb blinded_deneb = 8;
|
||||
|
||||
// ePBS block
|
||||
BeaconBlockePBS epbs = 9;
|
||||
}
|
||||
bool is_blinded = 100;
|
||||
string payload_value = 101;
|
||||
@@ -777,4 +784,74 @@ message BlobSidecar {
|
||||
|
||||
message BlobSidecars {
|
||||
repeated BlobSidecar sidecars = 1 [(ethereum.eth.ext.ssz_max) = "max_blobs_per_block.size"];
|
||||
}
|
||||
}
|
||||
|
||||
message BeaconBlockePBS {
|
||||
// Beacon chain slot that this block represents.
|
||||
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"];
|
||||
|
||||
// Validator index of the validator that proposed the block header.
|
||||
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.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 block.
|
||||
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// The beacon block body.
|
||||
BeaconBlockBodyePBS body = 5;
|
||||
}
|
||||
|
||||
message BeaconBlockBodyePBS {
|
||||
// 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"];
|
||||
|
||||
// Block operations
|
||||
// Refer to spec constants at https://github.com/ethereum/consensus-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
|
||||
|
||||
// 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;
|
||||
|
||||
// At most MAX_BLS_TO_EXECUTION_CHANGES. New in Capella network upgrade.
|
||||
repeated SignedBLSToExecutionChange bls_to_execution_changes = 10 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// Signed execution payload header envelope. New in ePBS
|
||||
ethereum.engine.v1.SignedExecutionPayloadHeaderEnvelope signed_execution_payload_header_envelope = 11;
|
||||
|
||||
// Signed inclusion list summary. New in ePBS
|
||||
repeated ethereum.engine.v1.InclusionListSummaryEntry inclusion_list_summary = 12 [(ethereum.eth.ext.ssz_max) = "max_inclusion_list.size"];
|
||||
|
||||
// Payload attestations. New in ePBS
|
||||
repeated ethereum.engine.v1.PayloadAttestation payload_attestations = 13 [(ethereum.eth.ext.ssz_max) = "payload_attestation.size"];
|
||||
}
|
||||
|
||||
message SignedBeaconBlockePBS {
|
||||
// The unsigned beacon block itself.
|
||||
BeaconBlockePBS block = 1;
|
||||
|
||||
// 96 byte BLS signature from the validator that produced this block.
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 28837d1c80ab7592d4877ebbd9881adf756b7da77c5614263c8442c2b3dea5c2
|
||||
// Hash: 0a28aa293f59d8b5b13cfb417c2d50c39111c7d342a173f16fd8b747bb6bf466
|
||||
package eth
|
||||
|
||||
import (
|
||||
@@ -9488,6 +9488,967 @@ func (b *BlobSidecars) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the BeaconBlockePBS object
|
||||
func (b *BeaconBlockePBS) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(b)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the BeaconBlockePBS object to a target array
|
||||
func (b *BeaconBlockePBS) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(84)
|
||||
|
||||
// Field (0) 'Slot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(b.Slot))
|
||||
|
||||
// Field (1) 'ProposerIndex'
|
||||
dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex))
|
||||
|
||||
// Field (2) 'ParentRoot'
|
||||
if size := len(b.ParentRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, b.ParentRoot...)
|
||||
|
||||
// Field (3) 'StateRoot'
|
||||
if size := len(b.StateRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, b.StateRoot...)
|
||||
|
||||
// Offset (4) 'Body'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if b.Body == nil {
|
||||
b.Body = new(BeaconBlockBodyePBS)
|
||||
}
|
||||
offset += b.Body.SizeSSZ()
|
||||
|
||||
// Field (4) 'Body'
|
||||
if dst, err = b.Body.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the BeaconBlockePBS object
|
||||
func (b *BeaconBlockePBS) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 84 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o4 uint64
|
||||
|
||||
// Field (0) 'Slot'
|
||||
b.Slot = github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))
|
||||
|
||||
// Field (1) 'ProposerIndex'
|
||||
b.ProposerIndex = github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
|
||||
|
||||
// Field (2) 'ParentRoot'
|
||||
if cap(b.ParentRoot) == 0 {
|
||||
b.ParentRoot = make([]byte, 0, len(buf[16:48]))
|
||||
}
|
||||
b.ParentRoot = append(b.ParentRoot, buf[16:48]...)
|
||||
|
||||
// Field (3) 'StateRoot'
|
||||
if cap(b.StateRoot) == 0 {
|
||||
b.StateRoot = make([]byte, 0, len(buf[48:80]))
|
||||
}
|
||||
b.StateRoot = append(b.StateRoot, buf[48:80]...)
|
||||
|
||||
// Offset (4) 'Body'
|
||||
if o4 = ssz.ReadOffset(buf[80:84]); o4 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o4 < 84 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (4) 'Body'
|
||||
{
|
||||
buf = tail[o4:]
|
||||
if b.Body == nil {
|
||||
b.Body = new(BeaconBlockBodyePBS)
|
||||
}
|
||||
if err = b.Body.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockePBS object
|
||||
func (b *BeaconBlockePBS) SizeSSZ() (size int) {
|
||||
size = 84
|
||||
|
||||
// Field (4) 'Body'
|
||||
if b.Body == nil {
|
||||
b.Body = new(BeaconBlockBodyePBS)
|
||||
}
|
||||
size += b.Body.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the BeaconBlockePBS object
|
||||
func (b *BeaconBlockePBS) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(b)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the BeaconBlockePBS object with a hasher
|
||||
func (b *BeaconBlockePBS) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Slot'
|
||||
hh.PutUint64(uint64(b.Slot))
|
||||
|
||||
// Field (1) 'ProposerIndex'
|
||||
hh.PutUint64(uint64(b.ProposerIndex))
|
||||
|
||||
// Field (2) 'ParentRoot'
|
||||
if size := len(b.ParentRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(b.ParentRoot)
|
||||
|
||||
// Field (3) 'StateRoot'
|
||||
if size := len(b.StateRoot); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(b.StateRoot)
|
||||
|
||||
// Field (4) 'Body'
|
||||
if err = b.Body.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeVectorizedHTR(indx)
|
||||
} else {
|
||||
hh.Merkleize(indx)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the BeaconBlockBodyePBS object
|
||||
func (b *BeaconBlockBodyePBS) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(b)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the BeaconBlockBodyePBS object to a target array
|
||||
func (b *BeaconBlockBodyePBS) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(396)
|
||||
|
||||
// Field (0) 'RandaoReveal'
|
||||
if size := len(b.RandaoReveal); size != 96 {
|
||||
err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96)
|
||||
return
|
||||
}
|
||||
dst = append(dst, b.RandaoReveal...)
|
||||
|
||||
// Field (1) 'Eth1Data'
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = new(Eth1Data)
|
||||
}
|
||||
if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'Graffiti'
|
||||
if size := len(b.Graffiti); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, b.Graffiti...)
|
||||
|
||||
// Offset (3) 'ProposerSlashings'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.ProposerSlashings) * 416
|
||||
|
||||
// Offset (4) 'AttesterSlashings'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
||||
offset += 4
|
||||
offset += b.AttesterSlashings[ii].SizeSSZ()
|
||||
}
|
||||
|
||||
// Offset (5) 'Attestations'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
for ii := 0; ii < len(b.Attestations); ii++ {
|
||||
offset += 4
|
||||
offset += b.Attestations[ii].SizeSSZ()
|
||||
}
|
||||
|
||||
// Offset (6) 'Deposits'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.Deposits) * 1240
|
||||
|
||||
// Offset (7) 'VoluntaryExits'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.VoluntaryExits) * 112
|
||||
|
||||
// Field (8) 'SyncAggregate'
|
||||
if b.SyncAggregate == nil {
|
||||
b.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Offset (9) 'BlsToExecutionChanges'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.BlsToExecutionChanges) * 172
|
||||
|
||||
// Offset (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if b.SignedExecutionPayloadHeaderEnvelope == nil {
|
||||
b.SignedExecutionPayloadHeaderEnvelope = new(v1.SignedExecutionPayloadHeaderEnvelope)
|
||||
}
|
||||
offset += b.SignedExecutionPayloadHeaderEnvelope.SizeSSZ()
|
||||
|
||||
// Offset (11) 'InclusionListSummary'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.InclusionListSummary) * 28
|
||||
|
||||
// Offset (12) 'PayloadAttestations'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += len(b.PayloadAttestations) * 169
|
||||
|
||||
// Field (3) 'ProposerSlashings'
|
||||
if size := len(b.ProposerSlashings); size > 16 {
|
||||
err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.ProposerSlashings); ii++ {
|
||||
if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (4) 'AttesterSlashings'
|
||||
if size := len(b.AttesterSlashings); size > 2 {
|
||||
err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2)
|
||||
return
|
||||
}
|
||||
{
|
||||
offset = 4 * len(b.AttesterSlashings)
|
||||
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += b.AttesterSlashings[ii].SizeSSZ()
|
||||
}
|
||||
}
|
||||
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
||||
if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (5) 'Attestations'
|
||||
if size := len(b.Attestations); size > 128 {
|
||||
err = ssz.ErrListTooBigFn("--.Attestations", size, 128)
|
||||
return
|
||||
}
|
||||
{
|
||||
offset = 4 * len(b.Attestations)
|
||||
for ii := 0; ii < len(b.Attestations); ii++ {
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
offset += b.Attestations[ii].SizeSSZ()
|
||||
}
|
||||
}
|
||||
for ii := 0; ii < len(b.Attestations); ii++ {
|
||||
if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (6) 'Deposits'
|
||||
if size := len(b.Deposits); size > 16 {
|
||||
err = ssz.ErrListTooBigFn("--.Deposits", size, 16)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.Deposits); ii++ {
|
||||
if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (7) 'VoluntaryExits'
|
||||
if size := len(b.VoluntaryExits); size > 16 {
|
||||
err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.VoluntaryExits); ii++ {
|
||||
if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (9) 'BlsToExecutionChanges'
|
||||
if size := len(b.BlsToExecutionChanges); size > 16 {
|
||||
err = ssz.ErrListTooBigFn("--.BlsToExecutionChanges", size, 16)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.BlsToExecutionChanges); ii++ {
|
||||
if dst, err = b.BlsToExecutionChanges[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
if dst, err = b.SignedExecutionPayloadHeaderEnvelope.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (11) 'InclusionListSummary'
|
||||
if size := len(b.InclusionListSummary); size > 16 {
|
||||
err = ssz.ErrListTooBigFn("--.InclusionListSummary", size, 16)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.InclusionListSummary); ii++ {
|
||||
if dst, err = b.InclusionListSummary[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Field (12) 'PayloadAttestations'
|
||||
if size := len(b.PayloadAttestations); size > 2 {
|
||||
err = ssz.ErrListTooBigFn("--.PayloadAttestations", size, 2)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < len(b.PayloadAttestations); ii++ {
|
||||
if dst, err = b.PayloadAttestations[ii].MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyePBS object
|
||||
func (b *BeaconBlockBodyePBS) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 396 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o3, o4, o5, o6, o7, o9, o10, o11, o12 uint64
|
||||
|
||||
// Field (0) 'RandaoReveal'
|
||||
if cap(b.RandaoReveal) == 0 {
|
||||
b.RandaoReveal = make([]byte, 0, len(buf[0:96]))
|
||||
}
|
||||
b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...)
|
||||
|
||||
// Field (1) 'Eth1Data'
|
||||
if b.Eth1Data == nil {
|
||||
b.Eth1Data = new(Eth1Data)
|
||||
}
|
||||
if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'Graffiti'
|
||||
if cap(b.Graffiti) == 0 {
|
||||
b.Graffiti = make([]byte, 0, len(buf[168:200]))
|
||||
}
|
||||
b.Graffiti = append(b.Graffiti, buf[168:200]...)
|
||||
|
||||
// Offset (3) 'ProposerSlashings'
|
||||
if o3 = ssz.ReadOffset(buf[200:204]); o3 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o3 < 396 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Offset (4) 'AttesterSlashings'
|
||||
if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (5) 'Attestations'
|
||||
if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (6) 'Deposits'
|
||||
if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (7) 'VoluntaryExits'
|
||||
if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (8) 'SyncAggregate'
|
||||
if b.SyncAggregate == nil {
|
||||
b.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Offset (9) 'BlsToExecutionChanges'
|
||||
if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (11) 'InclusionListSummary'
|
||||
if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Offset (12) 'PayloadAttestations'
|
||||
if o12 = ssz.ReadOffset(buf[392:396]); o12 > size || o11 > o12 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (3) 'ProposerSlashings'
|
||||
{
|
||||
buf = tail[o3:o4]
|
||||
num, err := ssz.DivideInt2(len(buf), 416, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.ProposerSlashings = make([]*ProposerSlashing, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.ProposerSlashings[ii] == nil {
|
||||
b.ProposerSlashings[ii] = new(ProposerSlashing)
|
||||
}
|
||||
if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Field (4) 'AttesterSlashings'
|
||||
{
|
||||
buf = tail[o4:o5]
|
||||
num, err := ssz.DecodeDynamicLength(buf, 2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.AttesterSlashings = make([]*AttesterSlashing, num)
|
||||
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
||||
if b.AttesterSlashings[indx] == nil {
|
||||
b.AttesterSlashings[indx] = new(AttesterSlashing)
|
||||
}
|
||||
if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (5) 'Attestations'
|
||||
{
|
||||
buf = tail[o5:o6]
|
||||
num, err := ssz.DecodeDynamicLength(buf, 128)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Attestations = make([]*Attestation, num)
|
||||
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
||||
if b.Attestations[indx] == nil {
|
||||
b.Attestations[indx] = new(Attestation)
|
||||
}
|
||||
if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (6) 'Deposits'
|
||||
{
|
||||
buf = tail[o6:o7]
|
||||
num, err := ssz.DivideInt2(len(buf), 1240, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Deposits = make([]*Deposit, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.Deposits[ii] == nil {
|
||||
b.Deposits[ii] = new(Deposit)
|
||||
}
|
||||
if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Field (7) 'VoluntaryExits'
|
||||
{
|
||||
buf = tail[o7:o9]
|
||||
num, err := ssz.DivideInt2(len(buf), 112, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.VoluntaryExits = make([]*SignedVoluntaryExit, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.VoluntaryExits[ii] == nil {
|
||||
b.VoluntaryExits[ii] = new(SignedVoluntaryExit)
|
||||
}
|
||||
if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Field (9) 'BlsToExecutionChanges'
|
||||
{
|
||||
buf = tail[o9:o10]
|
||||
num, err := ssz.DivideInt2(len(buf), 172, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.BlsToExecutionChanges = make([]*SignedBLSToExecutionChange, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.BlsToExecutionChanges[ii] == nil {
|
||||
b.BlsToExecutionChanges[ii] = new(SignedBLSToExecutionChange)
|
||||
}
|
||||
if err = b.BlsToExecutionChanges[ii].UnmarshalSSZ(buf[ii*172 : (ii+1)*172]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Field (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
{
|
||||
buf = tail[o10:o11]
|
||||
if b.SignedExecutionPayloadHeaderEnvelope == nil {
|
||||
b.SignedExecutionPayloadHeaderEnvelope = new(v1.SignedExecutionPayloadHeaderEnvelope)
|
||||
}
|
||||
if err = b.SignedExecutionPayloadHeaderEnvelope.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (11) 'InclusionListSummary'
|
||||
{
|
||||
buf = tail[o11:o12]
|
||||
num, err := ssz.DivideInt2(len(buf), 28, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.InclusionListSummary = make([]*v1.InclusionListSummaryEntry, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.InclusionListSummary[ii] == nil {
|
||||
b.InclusionListSummary[ii] = new(v1.InclusionListSummaryEntry)
|
||||
}
|
||||
if err = b.InclusionListSummary[ii].UnmarshalSSZ(buf[ii*28 : (ii+1)*28]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Field (12) 'PayloadAttestations'
|
||||
{
|
||||
buf = tail[o12:]
|
||||
num, err := ssz.DivideInt2(len(buf), 169, 2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.PayloadAttestations = make([]*v1.PayloadAttestation, num)
|
||||
for ii := 0; ii < num; ii++ {
|
||||
if b.PayloadAttestations[ii] == nil {
|
||||
b.PayloadAttestations[ii] = new(v1.PayloadAttestation)
|
||||
}
|
||||
if err = b.PayloadAttestations[ii].UnmarshalSSZ(buf[ii*169 : (ii+1)*169]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyePBS object
|
||||
func (b *BeaconBlockBodyePBS) SizeSSZ() (size int) {
|
||||
size = 396
|
||||
|
||||
// Field (3) 'ProposerSlashings'
|
||||
size += len(b.ProposerSlashings) * 416
|
||||
|
||||
// Field (4) 'AttesterSlashings'
|
||||
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
||||
size += 4
|
||||
size += b.AttesterSlashings[ii].SizeSSZ()
|
||||
}
|
||||
|
||||
// Field (5) 'Attestations'
|
||||
for ii := 0; ii < len(b.Attestations); ii++ {
|
||||
size += 4
|
||||
size += b.Attestations[ii].SizeSSZ()
|
||||
}
|
||||
|
||||
// Field (6) 'Deposits'
|
||||
size += len(b.Deposits) * 1240
|
||||
|
||||
// Field (7) 'VoluntaryExits'
|
||||
size += len(b.VoluntaryExits) * 112
|
||||
|
||||
// Field (9) 'BlsToExecutionChanges'
|
||||
size += len(b.BlsToExecutionChanges) * 172
|
||||
|
||||
// Field (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
if b.SignedExecutionPayloadHeaderEnvelope == nil {
|
||||
b.SignedExecutionPayloadHeaderEnvelope = new(v1.SignedExecutionPayloadHeaderEnvelope)
|
||||
}
|
||||
size += b.SignedExecutionPayloadHeaderEnvelope.SizeSSZ()
|
||||
|
||||
// Field (11) 'InclusionListSummary'
|
||||
size += len(b.InclusionListSummary) * 28
|
||||
|
||||
// Field (12) 'PayloadAttestations'
|
||||
size += len(b.PayloadAttestations) * 169
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the BeaconBlockBodyePBS object
|
||||
func (b *BeaconBlockBodyePBS) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(b)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the BeaconBlockBodyePBS object with a hasher
|
||||
func (b *BeaconBlockBodyePBS) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'RandaoReveal'
|
||||
if size := len(b.RandaoReveal); size != 96 {
|
||||
err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(b.RandaoReveal)
|
||||
|
||||
// Field (1) 'Eth1Data'
|
||||
if err = b.Eth1Data.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'Graffiti'
|
||||
if size := len(b.Graffiti); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(b.Graffiti)
|
||||
|
||||
// Field (3) 'ProposerSlashings'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.ProposerSlashings))
|
||||
if num > 16 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.ProposerSlashings {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 16)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (4) 'AttesterSlashings'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.AttesterSlashings))
|
||||
if num > 2 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.AttesterSlashings {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 2)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (5) 'Attestations'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.Attestations))
|
||||
if num > 128 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.Attestations {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 128)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (6) 'Deposits'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.Deposits))
|
||||
if num > 16 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.Deposits {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 16)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (7) 'VoluntaryExits'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.VoluntaryExits))
|
||||
if num > 16 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.VoluntaryExits {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 16)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (8) 'SyncAggregate'
|
||||
if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (9) 'BlsToExecutionChanges'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.BlsToExecutionChanges))
|
||||
if num > 16 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.BlsToExecutionChanges {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 16)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (10) 'SignedExecutionPayloadHeaderEnvelope'
|
||||
if err = b.SignedExecutionPayloadHeaderEnvelope.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (11) 'InclusionListSummary'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.InclusionListSummary))
|
||||
if num > 16 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.InclusionListSummary {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 16)
|
||||
}
|
||||
}
|
||||
|
||||
// Field (12) 'PayloadAttestations'
|
||||
{
|
||||
subIndx := hh.Index()
|
||||
num := uint64(len(b.PayloadAttestations))
|
||||
if num > 2 {
|
||||
err = ssz.ErrIncorrectListSize
|
||||
return
|
||||
}
|
||||
for _, elem := range b.PayloadAttestations {
|
||||
if err = elem.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2)
|
||||
} else {
|
||||
hh.MerkleizeWithMixin(subIndx, num, 2)
|
||||
}
|
||||
}
|
||||
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeVectorizedHTR(indx)
|
||||
} else {
|
||||
hh.Merkleize(indx)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the SignedBeaconBlockePBS object
|
||||
func (s *SignedBeaconBlockePBS) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(s)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the SignedBeaconBlockePBS object to a target array
|
||||
func (s *SignedBeaconBlockePBS) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(100)
|
||||
|
||||
// Offset (0) 'Block'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if s.Block == nil {
|
||||
s.Block = new(BeaconBlockePBS)
|
||||
}
|
||||
offset += s.Block.SizeSSZ()
|
||||
|
||||
// Field (1) 'Signature'
|
||||
if size := len(s.Signature); size != 96 {
|
||||
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
||||
return
|
||||
}
|
||||
dst = append(dst, s.Signature...)
|
||||
|
||||
// Field (0) 'Block'
|
||||
if dst, err = s.Block.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockePBS object
|
||||
func (s *SignedBeaconBlockePBS) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 100 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0 uint64
|
||||
|
||||
// Offset (0) 'Block'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 < 100 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'Signature'
|
||||
if cap(s.Signature) == 0 {
|
||||
s.Signature = make([]byte, 0, len(buf[4:100]))
|
||||
}
|
||||
s.Signature = append(s.Signature, buf[4:100]...)
|
||||
|
||||
// Field (0) 'Block'
|
||||
{
|
||||
buf = tail[o0:]
|
||||
if s.Block == nil {
|
||||
s.Block = new(BeaconBlockePBS)
|
||||
}
|
||||
if err = s.Block.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockePBS object
|
||||
func (s *SignedBeaconBlockePBS) SizeSSZ() (size int) {
|
||||
size = 100
|
||||
|
||||
// Field (0) 'Block'
|
||||
if s.Block == nil {
|
||||
s.Block = new(BeaconBlockePBS)
|
||||
}
|
||||
size += s.Block.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the SignedBeaconBlockePBS object
|
||||
func (s *SignedBeaconBlockePBS) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(s)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the SignedBeaconBlockePBS object with a hasher
|
||||
func (s *SignedBeaconBlockePBS) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Block'
|
||||
if err = s.Block.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'Signature'
|
||||
if size := len(s.Signature); size != 96 {
|
||||
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
||||
return
|
||||
}
|
||||
hh.PutBytes(s.Signature)
|
||||
|
||||
if ssz.EnableVectorizedHTR {
|
||||
hh.MerkleizeVectorizedHTR(indx)
|
||||
} else {
|
||||
hh.Merkleize(indx)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the Deposit_Data object
|
||||
func (d *Deposit_Data) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(d)
|
||||
|
||||
@@ -26,6 +26,10 @@ mainnet = {
|
||||
"max_blobs_per_block.size": "6",
|
||||
"max_blob_commitments.size": "4096",
|
||||
"kzg_commitment_inclusion_proof_depth.size": "17",
|
||||
"max_inclusion_list.size": "16", #MAX_TRANSACTIONS_PER_INCLUSION_LIST
|
||||
"ptc.size": "32", #PTC_SIZE
|
||||
"ptc.type": "github.com/prysmaticlabs/go-bitfield.Bitvector256",
|
||||
"payload_attestation.size": "2",
|
||||
}
|
||||
|
||||
minimal = {
|
||||
@@ -48,6 +52,10 @@ minimal = {
|
||||
"max_blobs_per_block.size": "6",
|
||||
"max_blob_commitments.size": "16",
|
||||
"kzg_commitment_inclusion_proof_depth.size": "9",
|
||||
"max_inclusion_list.size": "16", #MAX_TRANSACTIONS_PER_INCLUSION_LIST
|
||||
"ptc.size": "4", #PTC_SIZE
|
||||
"ptc.type": "github.com/prysmaticlabs/go-bitfield.Bitvector32",
|
||||
"payload_attestation.size": "2",
|
||||
}
|
||||
|
||||
###### Rules definitions #######
|
||||
|
||||
Reference in New Issue
Block a user