diff --git a/beacon-chain/node/BUILD.bazel b/beacon-chain/node/BUILD.bazel index 8fe6c4b29d85..883a6078fd38 100644 --- a/beacon-chain/node/BUILD.bazel +++ b/beacon-chain/node/BUILD.bazel @@ -69,7 +69,6 @@ go_library( "@com_github_gorilla_mux//:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", - "@com_github_prysmaticlabs_fastssz//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", ], diff --git a/beacon-chain/node/config.go b/beacon-chain/node/config.go index e026c940bb6a..bb2aa2de1049 100644 --- a/beacon-chain/node/config.go +++ b/beacon-chain/node/config.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" - fastssz "github.com/prysmaticlabs/fastssz" "github.com/prysmaticlabs/prysm/v5/cmd" "github.com/prysmaticlabs/prysm/v5/cmd/beacon-chain/flags" "github.com/prysmaticlabs/prysm/v5/config/params" @@ -197,7 +196,3 @@ func configureExecutionSetting(cliCtx *cli.Context) error { " Default fee recipient will be used as a fall back", checksumAddress.Hex()) return params.SetActive(c) } - -func configureFastSSZHashingAlgorithm() { - fastssz.EnableVectorizedHTR = true -} diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 473868b82bd2..e965d9956b99 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -277,8 +277,6 @@ func configureBeacon(cliCtx *cli.Context) error { return errors.Wrap(err, "could not configure execution setting") } - configureFastSSZHashingAlgorithm() - return nil } diff --git a/deps.bzl b/deps.bzl index 94d1f3696127..4166f23681c4 100644 --- a/deps.bzl +++ b/deps.bzl @@ -2973,8 +2973,8 @@ def prysm_deps(): go_repository( name = "com_github_prysmaticlabs_fastssz", importpath = "github.com/prysmaticlabs/fastssz", - sum = "h1:c3p3UzV4vFA7xaCDphnDWOjpxcadrQ26l5b+ypsvyxo=", - version = "v0.0.0-20221107182844-78142813af44", + sum = "h1:0LZAwwHnsZFfXm4IK4rzFV4N5IVSKZKLmuBMA4kAlFk=", + version = "v0.0.0-20240620202422-a981b8ef89d3", ) go_repository( name = "com_github_prysmaticlabs_go_bitfield", diff --git a/go.mod b/go.mod index 424111bbfe1d..14285f7f03a7 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/prom2json v1.3.0 - github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44 + github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20230228205207-28762a7b9294 diff --git a/go.sum b/go.sum index 681f95855c84..a91032596541 100644 --- a/go.sum +++ b/go.sum @@ -966,8 +966,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c github.com/prometheus/prom2json v1.3.0 h1:BlqrtbT9lLH3ZsOVhXPsHzFrApCTKRifB7gjJuypu6Y= github.com/prometheus/prom2json v1.3.0/go.mod h1:rMN7m0ApCowcoDlypBHlkNbp5eJQf/+1isKykIP5ZnM= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44 h1:c3p3UzV4vFA7xaCDphnDWOjpxcadrQ26l5b+ypsvyxo= -github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44/go.mod h1:MA5zShstUwCQaE9faGHgCGvEWUbG87p4SAXINhmCkvg= +github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3 h1:0LZAwwHnsZFfXm4IK4rzFV4N5IVSKZKLmuBMA4kAlFk= +github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3/go.mod h1:h2OlIZD/M6wFvV3YMZbW16lFgh3Rsye00G44J2cwLyU= github.com/prysmaticlabs/go-bitfield v0.0.0-20210108222456-8e92c3709aa0/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s= github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e h1:ATgOe+abbzfx9kCPeXIW4fiWyDdxlwHw07j8UGhdTd4= github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= diff --git a/nogo_config.json b/nogo_config.json index c6bc6fe85d55..5902a89ae109 100644 --- a/nogo_config.json +++ b/nogo_config.json @@ -152,7 +152,7 @@ "external/.*": "Third party code", "rules_go_work-.*": "Third party code", ".*\\.pb.*.go": "Generated code is ok", - ".*generated\\.ssz\\.go": "Generated code is ok" + ".*\\.ssz\\.go": "Generated code is ok" } }, "properpermissions": { @@ -180,7 +180,7 @@ "external/.*": "Third party code", "rules_go_work-.*": "Third party code", ".*\\.pb.*.go": "Generated code is ok", - ".*generated\\.ssz\\.go": "Generated code is ok", + ".*\\.ssz\\.go": "Generated code is ok", ".*_test\\.go": "Tests are ok (for now)", "tools/analyzers/ineffassign/ineffassign\\.go": "3rd party code with a massive switch statement" } diff --git a/proto/engine/v1/BUILD.bazel b/proto/engine/v1/BUILD.bazel index 7a3b428d0747..af0a37c8e97f 100644 --- a/proto/engine/v1/BUILD.bazel +++ b/proto/engine/v1/BUILD.bazel @@ -31,6 +31,7 @@ proto_library( ssz_gen_marshal( name = "ssz_generated_files", go_proto = ":go_proto", + out = "engine.ssz.go", includes = [ "//consensus-types/primitives:go_default_library", ], diff --git a/proto/engine/v1/generated.ssz.go b/proto/engine/v1/engine.ssz.go similarity index 94% rename from proto/engine/v1/generated.ssz.go rename to proto/engine/v1/engine.ssz.go index 5cc66b88da2b..8733bbdd88ec 100644 --- a/proto/engine/v1/generated.ssz.go +++ b/proto/engine/v1/engine.ssz.go @@ -190,7 +190,7 @@ func (e *ExecutionPayload) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 508 { + if o10 != 508 { return ssz.ErrInvalidVariableOffset } @@ -336,11 +336,7 @@ func (e *ExecutionPayload) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -374,25 +370,13 @@ func (e *ExecutionPayload) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.AppendBytes32(elem) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1073741824+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1048576) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1048576) - } + hh.MerkleizeWithMixin(subIndx, num, 1048576) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -594,7 +578,7 @@ func (e *ExecutionPayloadCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 512 { + if o10 != 512 { return ssz.ErrInvalidVariableOffset } @@ -766,11 +750,7 @@ func (e *ExecutionPayloadCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -804,18 +784,10 @@ func (e *ExecutionPayloadCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.AppendBytes32(elem) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1073741824+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1048576) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1048576) - } + hh.MerkleizeWithMixin(subIndx, num, 1048576) } // Field (14) 'Withdrawals' @@ -831,18 +803,10 @@ func (e *ExecutionPayloadCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1050,7 +1014,7 @@ func (e *ExecutionPayloadDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 528 { + if o10 != 528 { return ssz.ErrInvalidVariableOffset } @@ -1228,11 +1192,7 @@ func (e *ExecutionPayloadDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -1266,18 +1226,10 @@ func (e *ExecutionPayloadDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.AppendBytes32(elem) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1073741824+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1048576) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1048576) - } + hh.MerkleizeWithMixin(subIndx, num, 1048576) } // Field (14) 'Withdrawals' @@ -1293,11 +1245,7 @@ func (e *ExecutionPayloadDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (15) 'BlobGasUsed' @@ -1306,11 +1254,7 @@ func (e *ExecutionPayloadDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (16) 'ExcessBlobGas' hh.PutUint64(e.ExcessBlobGas) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1548,7 +1492,7 @@ func (e *ExecutionPayloadElectra) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 536 { + if o10 != 536 { return ssz.ErrInvalidVariableOffset } @@ -1778,11 +1722,7 @@ func (e *ExecutionPayloadElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -1816,18 +1756,10 @@ func (e *ExecutionPayloadElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.AppendBytes32(elem) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1073741824+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1048576) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1048576) - } + hh.MerkleizeWithMixin(subIndx, num, 1048576) } // Field (14) 'Withdrawals' @@ -1843,11 +1775,7 @@ func (e *ExecutionPayloadElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (15) 'BlobGasUsed' @@ -1869,11 +1797,7 @@ func (e *ExecutionPayloadElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 8192) - } else { - hh.MerkleizeWithMixin(subIndx, num, 8192) - } + hh.MerkleizeWithMixin(subIndx, num, 8192) } // Field (18) 'WithdrawalRequests' @@ -1889,18 +1813,10 @@ func (e *ExecutionPayloadElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2067,7 +1983,7 @@ func (e *ExecutionPayloadHeader) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 536 { + if o10 != 536 { return ssz.ErrInvalidVariableOffset } @@ -2185,11 +2101,7 @@ func (e *ExecutionPayloadHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -2213,11 +2125,7 @@ func (e *ExecutionPayloadHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(e.TransactionsRoot) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2391,7 +2299,7 @@ func (e *ExecutionPayloadHeaderCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 568 { + if o10 != 568 { return ssz.ErrInvalidVariableOffset } @@ -2515,11 +2423,7 @@ func (e *ExecutionPayloadHeaderCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -2550,11 +2454,7 @@ func (e *ExecutionPayloadHeaderCapella) HashTreeRootWith(hh *ssz.Hasher) (err er } hh.PutBytes(e.WithdrawalsRoot) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2734,7 +2634,7 @@ func (e *ExecutionPayloadHeaderDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 584 { + if o10 != 584 { return ssz.ErrInvalidVariableOffset } @@ -2864,11 +2764,7 @@ func (e *ExecutionPayloadHeaderDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -2905,11 +2801,7 @@ func (e *ExecutionPayloadHeaderDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro // Field (16) 'ExcessBlobGas' hh.PutUint64(e.ExcessBlobGas) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3103,7 +2995,7 @@ func (e *ExecutionPayloadHeaderElectra) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o10 < 648 { + if o10 != 648 { return ssz.ErrInvalidVariableOffset } @@ -3245,11 +3137,7 @@ func (e *ExecutionPayloadHeaderElectra) HashTreeRootWith(hh *ssz.Hasher) (err er return } hh.PutBytes(e.ExtraData) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (32+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) - } + hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' @@ -3300,11 +3188,7 @@ func (e *ExecutionPayloadHeaderElectra) HashTreeRootWith(hh *ssz.Hasher) (err er } hh.PutBytes(e.WithdrawalRequestsRoot) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3393,11 +3277,7 @@ func (w *Withdrawal) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (3) 'Amount' hh.PutUint64(w.Amount) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3481,7 +3361,7 @@ func (b *BlobsBundle) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 12 { + if o0 != 12 { return ssz.ErrInvalidVariableOffset } @@ -3586,11 +3466,7 @@ func (b *BlobsBundle) HashTreeRootWith(hh *ssz.Hasher) (err error) { } numItems := uint64(len(b.KzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (1) 'Proofs' @@ -3609,11 +3485,7 @@ func (b *BlobsBundle) HashTreeRootWith(hh *ssz.Hasher) (err error) { } numItems := uint64(len(b.Proofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (2) 'Blobs' @@ -3632,18 +3504,10 @@ func (b *BlobsBundle) HashTreeRootWith(hh *ssz.Hasher) (err error) { } numItems := uint64(len(b.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3734,11 +3598,7 @@ func (w *WithdrawalRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (2) 'Amount' hh.PutUint64(w.Amount) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3858,10 +3718,6 @@ func (d *DepositRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (4) 'Index' hh.PutUint64(d.Index) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } diff --git a/proto/eth/v1/BUILD.bazel b/proto/eth/v1/BUILD.bazel index 8db674d4cfb0..670f614a9ba9 100644 --- a/proto/eth/v1/BUILD.bazel +++ b/proto/eth/v1/BUILD.bazel @@ -35,6 +35,7 @@ load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal") ssz_gen_marshal( name = "ssz_generated_files", go_proto = ":go_proto", + out = "gateway.ssz.go", includes = [ "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", diff --git a/proto/eth/v1/generated.ssz.go b/proto/eth/v1/gateway.ssz.go similarity index 94% rename from proto/eth/v1/generated.ssz.go rename to proto/eth/v1/gateway.ssz.go index 382eee9836b5..a98bc8044622 100644 --- a/proto/eth/v1/generated.ssz.go +++ b/proto/eth/v1/gateway.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: d06a72227c2f5e350916cce3e89f4e855135a2a22f6ea263dedc68fa506c1ba7 +// Hash: 2874e1dadeb47411763f48fe31e5daaa91ac663e796933d9a508c2e7be94fa5e package v1 import ( @@ -62,7 +62,7 @@ func (a *Attestation) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 228 { + if o0 != 228 { return ssz.ErrInvalidVariableOffset } @@ -132,11 +132,7 @@ func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(a.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -194,7 +190,7 @@ func (a *AggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o1 < 108 { + if o1 != 108 { return ssz.ErrInvalidVariableOffset } @@ -254,11 +250,7 @@ func (a *AggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err err } hh.PutBytes(a.SelectionProof) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -310,7 +302,7 @@ func (s *SignedAggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -367,11 +359,7 @@ func (s *SignedAggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (e } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -493,11 +481,7 @@ func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -568,11 +552,7 @@ func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(c.Root) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -655,7 +635,7 @@ func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -719,11 +699,7 @@ func (b *BeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -775,7 +751,7 @@ func (s *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -832,11 +808,7 @@ func (s *SignedBeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1006,7 +978,7 @@ func (b *BeaconBlockBody) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 220 { + if o3 != 220 { return ssz.ErrInvalidVariableOffset } @@ -1199,11 +1171,7 @@ func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -1219,11 +1187,7 @@ func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -1239,11 +1203,7 @@ func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -1259,11 +1219,7 @@ func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -1279,18 +1235,10 @@ func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1374,11 +1322,7 @@ func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1435,7 +1379,7 @@ func (a *AttesterSlashing) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 8 { + if o0 != 8 { return ssz.ErrInvalidVariableOffset } @@ -1506,11 +1450,7 @@ func (a *AttesterSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1604,12 +1544,7 @@ func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.Append(i) } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } + hh.Merkleize(subIndx) } // Field (1) 'Data' @@ -1617,11 +1552,7 @@ func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1681,11 +1612,7 @@ func (v *VoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (1) 'ValidatorIndex' hh.PutUint64(uint64(v.ValidatorIndex)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1768,11 +1695,7 @@ func (s *SignedVoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1863,11 +1786,7 @@ func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(e.BlockHash) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1987,11 +1906,7 @@ func (b *BeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(b.BodyRoot) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2074,11 +1989,7 @@ func (s *SignedBeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2139,7 +2050,7 @@ func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 228 { + if o0 != 228 { return ssz.ErrInvalidVariableOffset } @@ -2204,11 +2115,7 @@ func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { hh.FillUpTo32() numItems := uint64(len(i.AttestingIndices)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) } // Field (1) 'Data' @@ -2223,11 +2130,7 @@ func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(i.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2309,11 +2212,7 @@ func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.SyncCommitteeSignature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2424,11 +2323,7 @@ func (d *Deposit_Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(d.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2564,10 +2459,6 @@ func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (7) 'WithdrawableEpoch' hh.PutUint64(uint64(v.WithdrawableEpoch)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } diff --git a/proto/eth/v2/BUILD.bazel b/proto/eth/v2/BUILD.bazel index 70099df14b76..f5a6728a6e9f 100644 --- a/proto/eth/v2/BUILD.bazel +++ b/proto/eth/v2/BUILD.bazel @@ -31,6 +31,7 @@ load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal") ssz_gen_marshal( name = "ssz_generated_files", go_proto = ":go_proto", + out = "grpc.ssz.go", includes = [ "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", diff --git a/proto/eth/v2/generated.ssz.go b/proto/eth/v2/grpc.ssz.go similarity index 93% rename from proto/eth/v2/generated.ssz.go rename to proto/eth/v2/grpc.ssz.go index b39ba7517120..3ccde83580b6 100644 --- a/proto/eth/v2/generated.ssz.go +++ b/proto/eth/v2/grpc.ssz.go @@ -1,5 +1,5 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 0394f3a965a034ef0de1398e168f3971f32a9ccce9db6549dd6e6d258c11c89b +// Hash: 6f33097dd41d3dd49d35b7cfceef5a1afca20f05d65b18215748b459db16f99b package eth import ( @@ -57,7 +57,7 @@ func (s *SignedBeaconBlockAltair) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -114,11 +114,7 @@ func (s *SignedBeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -170,7 +166,7 @@ func (s *SignedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -227,11 +223,7 @@ func (s *SignedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -283,7 +275,7 @@ func (s *SignedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -340,11 +332,7 @@ func (s *SignedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -396,7 +384,7 @@ func (s *SignedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -453,11 +441,7 @@ func (s *SignedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -509,7 +493,7 @@ func (s *SignedBlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -566,11 +550,7 @@ func (s *SignedBlindedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (er } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -622,7 +602,7 @@ func (s *SignedBlindedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -679,11 +659,7 @@ func (s *SignedBlindedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -735,7 +711,7 @@ func (s *SignedBlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 100 { + if o0 != 100 { return ssz.ErrInvalidVariableOffset } @@ -792,11 +768,7 @@ func (s *SignedBlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err er } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -879,7 +851,7 @@ func (b *BeaconBlockAltair) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -943,11 +915,7 @@ func (b *BeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1030,7 +998,7 @@ func (b *BeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1094,11 +1062,7 @@ func (b *BeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1181,7 +1145,7 @@ func (b *BlindedBeaconBlockBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1245,11 +1209,7 @@ func (b *BlindedBeaconBlockBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err erro return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1332,7 +1292,7 @@ func (b *BeaconBlockCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1396,11 +1356,7 @@ func (b *BeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1483,7 +1439,7 @@ func (b *BlindedBeaconBlockCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1547,11 +1503,7 @@ func (b *BlindedBeaconBlockCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1634,7 +1586,7 @@ func (b *BeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1698,11 +1650,7 @@ func (b *BeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -1785,7 +1733,7 @@ func (b *BlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o4 < 84 { + if o4 != 84 { return ssz.ErrInvalidVariableOffset } @@ -1849,11 +1797,7 @@ func (b *BlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2031,7 +1975,7 @@ func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 380 { + if o3 != 380 { return ssz.ErrInvalidVariableOffset } @@ -2232,11 +2176,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -2252,11 +2192,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -2272,11 +2208,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -2292,11 +2224,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -2312,11 +2240,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -2324,11 +2248,7 @@ func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -2518,7 +2438,7 @@ func (b *BeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 384 { + if o3 != 384 { return ssz.ErrInvalidVariableOffset } @@ -2741,11 +2661,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -2761,11 +2677,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -2781,11 +2693,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -2801,11 +2709,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -2821,11 +2725,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -2838,11 +2738,7 @@ func (b *BeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3032,7 +2928,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 384 { + if o3 != 384 { return ssz.ErrInvalidVariableOffset } @@ -3255,11 +3151,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -3275,11 +3167,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -3295,11 +3183,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -3315,11 +3199,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -3335,11 +3215,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -3352,11 +3228,7 @@ func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err return } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -3561,7 +3433,7 @@ func (b *BeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 388 { + if o3 != 388 { return ssz.ErrInvalidVariableOffset } @@ -3810,11 +3682,7 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -3830,11 +3698,7 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -3850,11 +3714,7 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -3870,11 +3730,7 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -3890,11 +3746,7 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -3920,18 +3772,10 @@ func (b *BeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -4136,7 +3980,7 @@ func (b *BlindedBeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 388 { + if o3 != 388 { return ssz.ErrInvalidVariableOffset } @@ -4385,11 +4229,7 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -4405,11 +4245,7 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -4425,11 +4261,7 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -4445,11 +4277,7 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -4465,11 +4293,7 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -4495,18 +4319,10 @@ func (b *BlindedBeaconBlockBodyCapella) HashTreeRootWith(hh *ssz.Hasher) (err er return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -4728,7 +4544,7 @@ func (b *BlindedBeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 392 { + if o3 != 392 { return ssz.ErrInvalidVariableOffset } @@ -5001,11 +4817,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -5021,11 +4833,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -5041,11 +4849,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -5061,11 +4865,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -5081,11 +4881,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -5111,11 +4907,7 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (11) 'BlobKzgCommitments' @@ -5134,18 +4926,10 @@ func (b *BlindedBeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err erro } numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -5367,7 +5151,7 @@ func (b *BeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o3 < 392 { + if o3 != 392 { return ssz.ErrInvalidVariableOffset } @@ -5640,11 +5424,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (4) 'AttesterSlashings' @@ -5660,11 +5440,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2) - } + hh.MerkleizeWithMixin(subIndx, num, 2) } // Field (5) 'Attestations' @@ -5680,11 +5456,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 128) - } else { - hh.MerkleizeWithMixin(subIndx, num, 128) - } + hh.MerkleizeWithMixin(subIndx, num, 128) } // Field (6) 'Deposits' @@ -5700,11 +5472,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (7) 'VoluntaryExits' @@ -5720,11 +5488,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (8) 'SyncAggregate' @@ -5750,11 +5514,7 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16) - } + hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (11) 'BlobKzgCommitments' @@ -5773,18 +5533,10 @@ func (b *BeaconBlockBodyDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { } numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -5863,7 +5615,7 @@ func (s *SignedBeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 12 { + if o0 != 12 { return ssz.ErrInvalidVariableOffset } @@ -5971,11 +5723,7 @@ func (s *SignedBeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err e } numItems := uint64(len(s.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (2) 'Blobs' @@ -5994,18 +5742,10 @@ func (s *SignedBeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err e } numItems := uint64(len(s.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -6084,7 +5824,7 @@ func (b *BeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 12 { + if o0 != 12 { return ssz.ErrInvalidVariableOffset } @@ -6192,11 +5932,7 @@ func (b *BeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) } numItems := uint64(len(b.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (2) 'Blobs' @@ -6215,18 +5951,10 @@ func (b *BeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) } numItems := uint64(len(b.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } + hh.MerkleizeWithMixin(subIndx, numItems, 4096) } - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -6297,11 +6025,7 @@ func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) { // Field (1) 'Index' hh.PutUint64(b.Index) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -6392,12 +6116,7 @@ func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(i) } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } + hh.Merkleize(subIndx) } // Field (1) 'AggregatePubkey' @@ -6407,11 +6126,7 @@ func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(s.AggregatePubkey) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -6502,11 +6217,7 @@ func (b *BLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { } hh.PutBytes(b.ToExecutionAddress) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } @@ -6589,10 +6300,6 @@ func (s *SignedBLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error } hh.PutBytes(s.Signature) - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } + hh.Merkleize(indx) return } diff --git a/proto/prysm/v1alpha1/BUILD.bazel b/proto/prysm/v1alpha1/BUILD.bazel index 02c496eabb5e..2b6e52ff9250 100644 --- a/proto/prysm/v1alpha1/BUILD.bazel +++ b/proto/prysm/v1alpha1/BUILD.bazel @@ -45,111 +45,211 @@ proto_library( ############################################################################## # Go ############################################################################## + +ssz_phase0_objs = [ + "AggregateAttestationAndProof", + "Attestation", + "AttestationData", + "AttesterSlashing", + "BeaconBlock", + "BeaconBlockHeader", + "BeaconState", + "Checkpoint", + "Deposit", + "Deposit_Data", + "DepositMessage", + "ENRForkID", + "Eth1Data", + "Fork", + "ForkData", + "HistoricalBatch", + "IndexedAttestation", + "PowBlock", + "ProposerSlashing", + "SignedAggregateAttestationAndProof", + "SignedBeaconBlock", + "SignedBeaconBlockHeader", + "SignedVoluntaryExit", + "SigningData", + "Status", + "Status", + "Validator", + "VoluntaryExit", +] + +ssz_altair_objs = [ + "BeaconBlockAltair", + "BeaconBlockBodyAltair", + "BeaconStateAltair", + "ContributionAndProof", + "SignedBeaconBlockAltair", + "SignedContributionAndProof", + "SyncAggregate", + "SyncAggregate", + "SyncAggregatorSelectionData", + "SyncCommittee", + "SyncCommitteeContribution", + "SyncCommitteeMessage", +] + +ssz_bellatrix_objs = [ + "BeaconBlockBellatrix", + "BeaconBlockBodyBellatrix", + "BeaconStateBellatrix", + "BlindedBeaconBlockBellatrix", + "BlindedBeaconBlockBodyBellatrix", + "SignedBeaconBlockBellatrix", + "SignedBlindedBeaconBlockBellatrix", +] + +ssz_capella_objs = [ + "BLSToExecutionChange", + "BeaconBlockBodyCapella", + "BeaconBlockCapella", + "BeaconStateCapella", + "BlindedBeaconBlockBodyCapella", + "BlindedBeaconBlockCapella", + "BuilderBidCapella", + "HistoricalSummary", + "SignedBLSToExecutionChange", + "SignedBeaconBlockCapella", + "SignedBlindedBeaconBlockCapella", + "Withdrawal", +] + +ssz_deneb_objs = [ + "BeaconBlockBodyDeneb", + "BeaconBlockContentsDeneb", + "BeaconBlockDeneb", + "BeaconStateDeneb", + "BlindedBeaconBlockBodyDeneb", + "BlindedBeaconBlockDeneb", + "BlobIdentifier", + "BlobSidecar", + "BlobSidecars", + "BuilderBidDeneb", + "SignedBeaconBlockContentsDeneb", + "SignedBeaconBlockDeneb", + "SignedBlindedBeaconBlockDeneb", +] + +ssz_electra_objs = [ + "AggregateAttestationAndProofElectra", + "AttestationElectra", + "AttesterSlashingElectra", + "BeaconBlockElectra", + "BeaconBlockElectra", + "BeaconStateElectra", + "BlindedBeaconBlockBodyElectra", + "BlindedBeaconBlockElectra", + "Consolidation", + "IndexedAttestationElectra", + "PendingBalanceDeposit", + "PendingBalanceDeposits", + "PendingConsolidation", + "PendingPartialWithdrawal", + "SignedAggregateAttestationAndProofElectra", + "SignedBeaconBlockElectra", + "SignedBlindedBeaconBlockElectra", + "SignedConsolidation", +] + +ssz_gen_marshal( + name = "ssz_generated_phase0", + go_proto = ":go_proto", + out = "phase0.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_phase0_objs, +) + +ssz_gen_marshal( + name = "ssz_generated_altair", + go_proto = ":go_proto", + out = "altair.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_altair_objs, + exclude_objs = ssz_phase0_objs, +) + +ssz_gen_marshal( + name = "ssz_generated_bellatrix", + go_proto = ":go_proto", + out = "bellatrix.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_bellatrix_objs, + exclude_objs = ssz_phase0_objs + ssz_altair_objs, +) + +ssz_gen_marshal( + name = "ssz_generated_capella", + go_proto = ":go_proto", + out = "capella.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_capella_objs, + exclude_objs = ssz_phase0_objs + ssz_altair_objs + ssz_bellatrix_objs, +) + +ssz_gen_marshal( + name = "ssz_generated_deneb", + go_proto = ":go_proto", + out = "deneb.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_deneb_objs, + exclude_objs = ssz_phase0_objs + ssz_altair_objs + ssz_bellatrix_objs + ssz_capella_objs, +) + +ssz_gen_marshal( + name = "ssz_generated_electra", + go_proto = ":go_proto", + out = "electra.ssz.go", + includes = [ + "//consensus-types/primitives:go_default_library", + "//proto/engine/v1:go_default_library", + "//math:go_default_library", + ], + objs = ssz_electra_objs, + exclude_objs = ssz_phase0_objs + ssz_altair_objs + ssz_bellatrix_objs + ssz_capella_objs + ssz_deneb_objs, +) + + ssz_gen_marshal( - name = "ssz_generated_files", + name = "ssz_generated_non_core", go_proto = ":go_proto", + out = "non-core.ssz.go", includes = [ "//consensus-types/primitives:go_default_library", "//proto/engine/v1:go_default_library", "//math:go_default_library", ], objs = [ - "BeaconBlockAltair", - "BeaconBlockBodyAltair", - "SignedBeaconBlockAltair", - "BeaconBlockBellatrix", - "BeaconBlockBodyBellatrix", - "SignedBeaconBlockBellatrix", - "SignedBlindedBeaconBlockBellatrix", - "BlindedBeaconBlockBellatrix", - "BlindedBeaconBlockBodyBellatrix", - "BeaconBlockCapella", - "BeaconBlockBodyCapella", - "SignedBeaconBlockCapella", - "BeaconBlockDeneb", - "BeaconBlockBodyDeneb", - "SignedBeaconBlockDeneb", - "BeaconBlockElectra", - "BeaconBlockElectra", - "SignedBeaconBlockElectra", - "SignedBlindedBeaconBlockCapella", - "BlindedBeaconBlockCapella", - "BlindedBeaconBlockBodyCapella", - "SignedBlindedBeaconBlockDeneb", - "BeaconBlockContentsDeneb", - "SignedBeaconBlockContentsDeneb", - "BlindedBeaconBlockDeneb", - "BlindedBeaconBlockBodyDeneb", - "SignedBlindedBeaconBlockElectra", - "BlindedBeaconBlockElectra", - "BlindedBeaconBlockBodyElectra", - "SyncAggregate", - "SyncCommitteeMessage", - "SyncCommitteeContribution", - "ContributionAndProof", - "SignedContributionAndProof", "BeaconBlocksByRangeRequest", "BlobSidecarsByRangeRequest", - "ENRForkID", "MetaDataV0", "MetaDataV1", - "Status", - "AggregateAttestationAndProof", - "AggregateAttestationAndProofElectra", - "Attestation", - "AttestationElectra", - "AttestationData", - "AttesterSlashing", - "AttesterSlashingElectra", - "BeaconBlock", - "BeaconBlockHeader", - "Checkpoint", - "Deposit", - "Eth1Data", - "IndexedAttestation", - "IndexedAttestationElectra", - "ProposerSlashing", - "SignedAggregateAttestationAndProof", - "SignedAggregateAttestationAndProofElectra", - "SignedBeaconBlock", - "SignedBeaconBlockHeader", - "SignedVoluntaryExit", - "Validator", - "VoluntaryExit", - "ContributionAndProof", - "SignedContributionAndProof", - "DepositMessage", - "Fork", - "ForkData", - "HistoricalBatch", - "Status", - "BeaconState", - "BeaconStateAltair", - "BeaconStateBellatrix", - "BeaconStateCapella", - "BeaconStateDeneb", - "BeaconStateElectra", - "SigningData", - "SyncCommittee", - "SyncAggregatorSelectionData", - "PowBlock", "SignedValidatorRegistrationV1", "ValidatorRegistrationV1", - "Withdrawal", - "BLSToExecutionChange", - "SignedBLSToExecutionChange", "BuilderBid", - "BuilderBidCapella", - "BuilderBidDeneb", - "BlobSidecar", - "BlobSidecars", - "BlobIdentifier", "DepositSnapshot", - "PendingBalanceDeposit", - "PendingPartialWithdrawal", - "Consolidation", - "SignedConsolidation", - "PendingConsolidation", ], ) @@ -212,7 +312,13 @@ go_library( "eip_7251.go", "sync_committee_mainnet.go", "sync_committee_minimal.go", # keep - ":ssz_generated_files", # keep + ":ssz_generated_non_core", # keep + ":ssz_generated_phase0", # keep + ":ssz_generated_altair", # keep + ":ssz_generated_bellatrix", # keep + ":ssz_generated_capella", # keep + ":ssz_generated_deneb", # keep + ":ssz_generated_electra", # keep ], embed = [ ":go_grpc_gateway_library", diff --git a/proto/prysm/v1alpha1/altair.ssz.go b/proto/prysm/v1alpha1/altair.ssz.go new file mode 100644 index 000000000000..80e4658f00fe --- /dev/null +++ b/proto/prysm/v1alpha1/altair.ssz.go @@ -0,0 +1,2143 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: b49bce5f5d950b8c4ff7cad0c5c96bef67f82b91e1f36b2293b1b00e9755c051 +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" +) + +// MarshalSSZ ssz marshals the BeaconBlockAltair object +func (b *BeaconBlockAltair) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockAltair object to a target array +func (b *BeaconBlockAltair) 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(BeaconBlockBodyAltair) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockAltair object +func (b *BeaconBlockAltair) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyAltair) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockAltair object +func (b *BeaconBlockAltair) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBodyAltair) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockAltair object +func (b *BeaconBlockAltair) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockAltair object with a hasher +func (b *BeaconBlockAltair) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBeaconBlockAltair object +func (s *SignedBeaconBlockAltair) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockAltair object to a target array +func (s *SignedBeaconBlockAltair) 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(BeaconBlockAltair) + } + 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 SignedBeaconBlockAltair object +func (s *SignedBeaconBlockAltair) 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(BeaconBlockAltair) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockAltair object +func (s *SignedBeaconBlockAltair) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlockAltair) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockAltair object +func (s *SignedBeaconBlockAltair) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockAltair object with a hasher +func (s *SignedBeaconBlockAltair) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBodyAltair object +func (b *BeaconBlockBodyAltair) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBodyAltair object to a target array +func (b *BeaconBlockBodyAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(380) + + // 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 + } + + // 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 + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyAltair object +func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 380 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7 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 != 380 { + 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 + } + + // 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:] + 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 + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyAltair object +func (b *BeaconBlockBodyAltair) SizeSSZ() (size int) { + size = 380 + + // 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 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBodyAltair object +func (b *BeaconBlockBodyAltair) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBodyAltair object with a hasher +func (b *BeaconBlockBodyAltair) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SyncAggregate object +func (s *SyncAggregate) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SyncAggregate object to a target array +func (s *SyncAggregate) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SyncCommitteeBits' + if size := len(s.SyncCommitteeBits); size != 64 { + err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) + return + } + dst = append(dst, s.SyncCommitteeBits...) + + // Field (1) 'SyncCommitteeSignature' + if size := len(s.SyncCommitteeSignature); size != 96 { + err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) + return + } + dst = append(dst, s.SyncCommitteeSignature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SyncAggregate object +func (s *SyncAggregate) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 160 { + return ssz.ErrSize + } + + // Field (0) 'SyncCommitteeBits' + if cap(s.SyncCommitteeBits) == 0 { + s.SyncCommitteeBits = make([]byte, 0, len(buf[0:64])) + } + s.SyncCommitteeBits = append(s.SyncCommitteeBits, buf[0:64]...) + + // Field (1) 'SyncCommitteeSignature' + if cap(s.SyncCommitteeSignature) == 0 { + s.SyncCommitteeSignature = make([]byte, 0, len(buf[64:160])) + } + s.SyncCommitteeSignature = append(s.SyncCommitteeSignature, buf[64:160]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregate object +func (s *SyncAggregate) SizeSSZ() (size int) { + size = 160 + return +} + +// HashTreeRoot ssz hashes the SyncAggregate object +func (s *SyncAggregate) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SyncAggregate object with a hasher +func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SyncCommitteeBits' + if size := len(s.SyncCommitteeBits); size != 64 { + err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) + return + } + hh.PutBytes(s.SyncCommitteeBits) + + // Field (1) 'SyncCommitteeSignature' + if size := len(s.SyncCommitteeSignature); size != 96 { + err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) + return + } + hh.PutBytes(s.SyncCommitteeSignature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconStateAltair object +func (b *BeaconStateAltair) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconStateAltair object to a target array +func (b *BeaconStateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2736629) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PreviousEpochParticipation) + + // Offset (16) 'CurrentEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.CurrentEpochParticipation) + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (21) 'InactivityScores' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.InactivityScores) * 8 + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochParticipation' + if size := len(b.PreviousEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.PreviousEpochParticipation...) + + // Field (16) 'CurrentEpochParticipation' + if size := len(b.CurrentEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.CurrentEpochParticipation...) + + // Field (21) 'InactivityScores' + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + for ii := 0; ii < len(b.InactivityScores); ii++ { + dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconStateAltair object +func (b *BeaconStateAltair) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2736629 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16, o21 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2736629 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochParticipation' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochParticipation' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Offset (21) 'InactivityScores' + if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { + return ssz.ErrOffset + } + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { + return err + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { + return err + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochParticipation' + { + buf = tail[o15:o16] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.PreviousEpochParticipation) == 0 { + b.PreviousEpochParticipation = make([]byte, 0, len(buf)) + } + b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) + } + + // Field (16) 'CurrentEpochParticipation' + { + buf = tail[o16:o21] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.CurrentEpochParticipation) == 0 { + b.CurrentEpochParticipation = make([]byte, 0, len(buf)) + } + b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) + } + + // Field (21) 'InactivityScores' + { + buf = tail[o21:] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) + for ii := 0; ii < num; ii++ { + b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateAltair object +func (b *BeaconStateAltair) SizeSSZ() (size int) { + size = 2736629 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochParticipation' + size += len(b.PreviousEpochParticipation) + + // Field (16) 'CurrentEpochParticipation' + size += len(b.CurrentEpochParticipation) + + // Field (21) 'InactivityScores' + size += len(b.InactivityScores) * 8 + + return +} + +// HashTreeRoot ssz hashes the BeaconStateAltair object +func (b *BeaconStateAltair) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconStateAltair object with a hasher +func (b *BeaconStateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.PreviousEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.PreviousEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (16) 'CurrentEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.CurrentEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.CurrentEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (21) 'InactivityScores' + { + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.InactivityScores { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.InactivityScores)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (22) 'CurrentSyncCommittee' + if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SyncCommittee object +func (s *SyncCommittee) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SyncCommittee object to a target array +func (s *SyncCommittee) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Pubkeys' + if size := len(s.Pubkeys); size != 512 { + err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) + return + } + for ii := 0; ii < 512; ii++ { + if size := len(s.Pubkeys[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkeys[ii]", size, 48) + return + } + dst = append(dst, s.Pubkeys[ii]...) + } + + // Field (1) 'AggregatePubkey' + if size := len(s.AggregatePubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) + return + } + dst = append(dst, s.AggregatePubkey...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SyncCommittee object +func (s *SyncCommittee) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 24624 { + return ssz.ErrSize + } + + // Field (0) 'Pubkeys' + s.Pubkeys = make([][]byte, 512) + for ii := 0; ii < 512; ii++ { + if cap(s.Pubkeys[ii]) == 0 { + s.Pubkeys[ii] = make([]byte, 0, len(buf[0:24576][ii*48:(ii+1)*48])) + } + s.Pubkeys[ii] = append(s.Pubkeys[ii], buf[0:24576][ii*48:(ii+1)*48]...) + } + + // Field (1) 'AggregatePubkey' + if cap(s.AggregatePubkey) == 0 { + s.AggregatePubkey = make([]byte, 0, len(buf[24576:24624])) + } + s.AggregatePubkey = append(s.AggregatePubkey, buf[24576:24624]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SyncCommittee object +func (s *SyncCommittee) SizeSSZ() (size int) { + size = 24624 + return +} + +// HashTreeRoot ssz hashes the SyncCommittee object +func (s *SyncCommittee) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SyncCommittee object with a hasher +func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Pubkeys' + { + if size := len(s.Pubkeys); size != 512 { + err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) + return + } + subIndx := hh.Index() + for _, i := range s.Pubkeys { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + hh.Merkleize(subIndx) + } + + // Field (1) 'AggregatePubkey' + if size := len(s.AggregatePubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) + return + } + hh.PutBytes(s.AggregatePubkey) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SyncAggregatorSelectionData object +func (s *SyncAggregatorSelectionData) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SyncAggregatorSelectionData object to a target array +func (s *SyncAggregatorSelectionData) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(s.Slot)) + + // Field (1) 'SubcommitteeIndex' + dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) + + return +} + +// UnmarshalSSZ ssz unmarshals the SyncAggregatorSelectionData object +func (s *SyncAggregatorSelectionData) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'Slot' + s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'SubcommitteeIndex' + s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[8:16]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregatorSelectionData object +func (s *SyncAggregatorSelectionData) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the SyncAggregatorSelectionData object +func (s *SyncAggregatorSelectionData) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SyncAggregatorSelectionData object with a hasher +func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Slot' + hh.PutUint64(uint64(s.Slot)) + + // Field (1) 'SubcommitteeIndex' + hh.PutUint64(s.SubcommitteeIndex) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SyncCommitteeMessage object +func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SyncCommitteeMessage object to a target array +func (s *SyncCommitteeMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(s.Slot)) + + // Field (1) 'BlockRoot' + if size := len(s.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + dst = append(dst, s.BlockRoot...) + + // Field (2) 'ValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(s.ValidatorIndex)) + + // Field (3) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SyncCommitteeMessage object +func (s *SyncCommitteeMessage) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 144 { + return ssz.ErrSize + } + + // Field (0) 'Slot' + s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'BlockRoot' + if cap(s.BlockRoot) == 0 { + s.BlockRoot = make([]byte, 0, len(buf[8:40])) + } + s.BlockRoot = append(s.BlockRoot, buf[8:40]...) + + // Field (2) 'ValidatorIndex' + s.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[48:144])) + } + s.Signature = append(s.Signature, buf[48:144]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeMessage object +func (s *SyncCommitteeMessage) SizeSSZ() (size int) { + size = 144 + return +} + +// HashTreeRoot ssz hashes the SyncCommitteeMessage object +func (s *SyncCommitteeMessage) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SyncCommitteeMessage object with a hasher +func (s *SyncCommitteeMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Slot' + hh.PutUint64(uint64(s.Slot)) + + // Field (1) 'BlockRoot' + if size := len(s.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + hh.PutBytes(s.BlockRoot) + + // Field (2) 'ValidatorIndex' + hh.PutUint64(uint64(s.ValidatorIndex)) + + // Field (3) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(s.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SyncCommitteeContribution object +func (s *SyncCommitteeContribution) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SyncCommitteeContribution object to a target array +func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(s.Slot)) + + // Field (1) 'BlockRoot' + if size := len(s.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + dst = append(dst, s.BlockRoot...) + + // Field (2) 'SubcommitteeIndex' + dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) + + // Field (3) 'AggregationBits' + if size := len(s.AggregationBits); size != 16 { + err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) + return + } + dst = append(dst, s.AggregationBits...) + + // Field (4) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SyncCommitteeContribution object +func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 160 { + return ssz.ErrSize + } + + // Field (0) 'Slot' + s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'BlockRoot' + if cap(s.BlockRoot) == 0 { + s.BlockRoot = make([]byte, 0, len(buf[8:40])) + } + s.BlockRoot = append(s.BlockRoot, buf[8:40]...) + + // Field (2) 'SubcommitteeIndex' + s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[40:48]) + + // Field (3) 'AggregationBits' + if cap(s.AggregationBits) == 0 { + s.AggregationBits = make([]byte, 0, len(buf[48:64])) + } + s.AggregationBits = append(s.AggregationBits, buf[48:64]...) + + // Field (4) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[64:160])) + } + s.Signature = append(s.Signature, buf[64:160]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object +func (s *SyncCommitteeContribution) SizeSSZ() (size int) { + size = 160 + return +} + +// HashTreeRoot ssz hashes the SyncCommitteeContribution object +func (s *SyncCommitteeContribution) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SyncCommitteeContribution object with a hasher +func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Slot' + hh.PutUint64(uint64(s.Slot)) + + // Field (1) 'BlockRoot' + if size := len(s.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + hh.PutBytes(s.BlockRoot) + + // Field (2) 'SubcommitteeIndex' + hh.PutUint64(s.SubcommitteeIndex) + + // Field (3) 'AggregationBits' + if size := len(s.AggregationBits); size != 16 { + err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) + return + } + hh.PutBytes(s.AggregationBits) + + // Field (4) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(s.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the ContributionAndProof object +func (c *ContributionAndProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(c) +} + +// MarshalSSZTo ssz marshals the ContributionAndProof object to a target array +func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'AggregatorIndex' + dst = ssz.MarshalUint64(dst, uint64(c.AggregatorIndex)) + + // Field (1) 'Contribution' + if c.Contribution == nil { + c.Contribution = new(SyncCommitteeContribution) + } + if dst, err = c.Contribution.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'SelectionProof' + if size := len(c.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + dst = append(dst, c.SelectionProof...) + + return +} + +// UnmarshalSSZ ssz unmarshals the ContributionAndProof object +func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 264 { + return ssz.ErrSize + } + + // Field (0) 'AggregatorIndex' + c.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Contribution' + if c.Contribution == nil { + c.Contribution = new(SyncCommitteeContribution) + } + if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil { + return err + } + + // Field (2) 'SelectionProof' + if cap(c.SelectionProof) == 0 { + c.SelectionProof = make([]byte, 0, len(buf[168:264])) + } + c.SelectionProof = append(c.SelectionProof, buf[168:264]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object +func (c *ContributionAndProof) SizeSSZ() (size int) { + size = 264 + return +} + +// HashTreeRoot ssz hashes the ContributionAndProof object +func (c *ContributionAndProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(c) +} + +// HashTreeRootWith ssz hashes the ContributionAndProof object with a hasher +func (c *ContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregatorIndex' + hh.PutUint64(uint64(c.AggregatorIndex)) + + // Field (1) 'Contribution' + if err = c.Contribution.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'SelectionProof' + if size := len(c.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + hh.PutBytes(c.SelectionProof) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedContributionAndProof object +func (s *SignedContributionAndProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedContributionAndProof object to a target array +func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(ContributionAndProof) + } + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedContributionAndProof object +func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 360 { + return ssz.ErrSize + } + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(ContributionAndProof) + } + if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[264:360])) + } + s.Signature = append(s.Signature, buf[264:360]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object +func (s *SignedContributionAndProof) SizeSSZ() (size int) { + size = 360 + return +} + +// HashTreeRoot ssz hashes the SignedContributionAndProof object +func (s *SignedContributionAndProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedContributionAndProof object with a hasher +func (s *SignedContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/bellatrix.ssz.go b/proto/prysm/v1alpha1/bellatrix.ssz.go new file mode 100644 index 000000000000..dc1647191de5 --- /dev/null +++ b/proto/prysm/v1alpha1/bellatrix.ssz.go @@ -0,0 +1,2330 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: ebbdaf40c27b22a94c77b725c65e63314fdb93dca0a54c76f098fb893240044f +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// MarshalSSZ ssz marshals the SignedBeaconBlockBellatrix object +func (s *SignedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockBellatrix object to a target array +func (s *SignedBeaconBlockBellatrix) 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(BeaconBlockBellatrix) + } + 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 SignedBeaconBlockBellatrix object +func (s *SignedBeaconBlockBellatrix) 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(BeaconBlockBellatrix) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockBellatrix object +func (s *SignedBeaconBlockBellatrix) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlockBellatrix) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockBellatrix object +func (s *SignedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockBellatrix object with a hasher +func (s *SignedBeaconBlockBellatrix) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBellatrix object +func (b *BeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBellatrix object to a target array +func (b *BeaconBlockBellatrix) 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(BeaconBlockBodyBellatrix) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBellatrix object +func (b *BeaconBlockBellatrix) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyBellatrix) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBellatrix object +func (b *BeaconBlockBellatrix) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBodyBellatrix) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBellatrix object +func (b *BeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBellatrix object with a hasher +func (b *BeaconBlockBellatrix) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBodyBellatrix object +func (b *BeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBodyBellatrix object to a target array +func (b *BeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(384) + + // 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) 'ExecutionPayload' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayload) + } + offset += b.ExecutionPayload.SizeSSZ() + + // 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) 'ExecutionPayload' + if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyBellatrix object +func (b *BeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 384 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9 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 != 384 { + 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) 'ExecutionPayload' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + 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) 'ExecutionPayload' + { + buf = tail[o9:] + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayload) + } + if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyBellatrix object +func (b *BeaconBlockBodyBellatrix) SizeSSZ() (size int) { + size = 384 + + // 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) 'ExecutionPayload' + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayload) + } + size += b.ExecutionPayload.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBodyBellatrix object +func (b *BeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBodyBellatrix object with a hasher +func (b *BeaconBlockBodyBellatrix) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayload' + if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockBellatrix object +func (s *SignedBlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockBellatrix object to a target array +func (s *SignedBlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBellatrix) + } + 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 SignedBlindedBeaconBlockBellatrix object +func (s *SignedBlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBellatrix) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockBellatrix object +func (s *SignedBlindedBeaconBlockBellatrix) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BlindedBeaconBlockBellatrix) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockBellatrix object +func (s *SignedBlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockBellatrix object with a hasher +func (s *SignedBlindedBeaconBlockBellatrix) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockBellatrix object +func (b *BlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockBellatrix object to a target array +func (b *BlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBodyBellatrix) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBellatrix object +func (b *BlindedBeaconBlockBellatrix) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyBellatrix) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBellatrix object +func (b *BlindedBeaconBlockBellatrix) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BlindedBeaconBlockBodyBellatrix) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockBellatrix object +func (b *BlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockBellatrix object with a hasher +func (b *BlindedBeaconBlockBellatrix) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyBellatrix object +func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyBellatrix object to a target array +func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(384) + + // 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) 'ExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + offset += b.ExecutionPayloadHeader.SizeSSZ() + + // 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) 'ExecutionPayloadHeader' + if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyBellatrix object +func (b *BlindedBeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 384 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9 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 != 384 { + 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) 'ExecutionPayloadHeader' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + 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) 'ExecutionPayloadHeader' + { + buf = tail[o9:] + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyBellatrix object +func (b *BlindedBeaconBlockBodyBellatrix) SizeSSZ() (size int) { + size = 384 + + // 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) 'ExecutionPayloadHeader' + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + size += b.ExecutionPayloadHeader.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyBellatrix object +func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyBellatrix object with a hasher +func (b *BlindedBeaconBlockBodyBellatrix) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayloadHeader' + if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconStateBellatrix object +func (b *BeaconStateBellatrix) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconStateBellatrix object to a target array +func (b *BeaconStateBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2736633) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PreviousEpochParticipation) + + // Offset (16) 'CurrentEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.CurrentEpochParticipation) + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (21) 'InactivityScores' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.InactivityScores) * 8 + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (24) 'LatestExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + offset += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochParticipation' + if size := len(b.PreviousEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.PreviousEpochParticipation...) + + // Field (16) 'CurrentEpochParticipation' + if size := len(b.CurrentEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.CurrentEpochParticipation...) + + // Field (21) 'InactivityScores' + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + for ii := 0; ii < len(b.InactivityScores); ii++ { + dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) + } + + // Field (24) 'LatestExecutionPayloadHeader' + if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconStateBellatrix object +func (b *BeaconStateBellatrix) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2736633 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16, o21, o24 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2736633 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochParticipation' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochParticipation' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Offset (21) 'InactivityScores' + if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { + return ssz.ErrOffset + } + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { + return err + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { + return err + } + + // Offset (24) 'LatestExecutionPayloadHeader' + if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { + return ssz.ErrOffset + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochParticipation' + { + buf = tail[o15:o16] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.PreviousEpochParticipation) == 0 { + b.PreviousEpochParticipation = make([]byte, 0, len(buf)) + } + b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) + } + + // Field (16) 'CurrentEpochParticipation' + { + buf = tail[o16:o21] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.CurrentEpochParticipation) == 0 { + b.CurrentEpochParticipation = make([]byte, 0, len(buf)) + } + b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) + } + + // Field (21) 'InactivityScores' + { + buf = tail[o21:o24] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) + for ii := 0; ii < num; ii++ { + b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (24) 'LatestExecutionPayloadHeader' + { + buf = tail[o24:] + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateBellatrix object +func (b *BeaconStateBellatrix) SizeSSZ() (size int) { + size = 2736633 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochParticipation' + size += len(b.PreviousEpochParticipation) + + // Field (16) 'CurrentEpochParticipation' + size += len(b.CurrentEpochParticipation) + + // Field (21) 'InactivityScores' + size += len(b.InactivityScores) * 8 + + // Field (24) 'LatestExecutionPayloadHeader' + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) + } + size += b.LatestExecutionPayloadHeader.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconStateBellatrix object +func (b *BeaconStateBellatrix) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconStateBellatrix object with a hasher +func (b *BeaconStateBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.PreviousEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.PreviousEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (16) 'CurrentEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.CurrentEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.CurrentEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (21) 'InactivityScores' + { + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.InactivityScores { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.InactivityScores)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (22) 'CurrentSyncCommittee' + if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (24) 'LatestExecutionPayloadHeader' + if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/capella.ssz.go b/proto/prysm/v1alpha1/capella.ssz.go new file mode 100644 index 000000000000..9a3c3448c7d5 --- /dev/null +++ b/proto/prysm/v1alpha1/capella.ssz.go @@ -0,0 +1,2904 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: 665ba6ebbfbcd818d1f4f54220aaf343e8bd814ead5f4d901b3f9bb44608fee2 +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// MarshalSSZ ssz marshals the SignedBeaconBlockCapella object +func (s *SignedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockCapella object to a target array +func (s *SignedBeaconBlockCapella) 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(BeaconBlockCapella) + } + 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 SignedBeaconBlockCapella object +func (s *SignedBeaconBlockCapella) 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(BeaconBlockCapella) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockCapella object +func (s *SignedBeaconBlockCapella) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlockCapella) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockCapella object +func (s *SignedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockCapella object with a hasher +func (s *SignedBeaconBlockCapella) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockCapella object +func (b *BeaconBlockCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockCapella object to a target array +func (b *BeaconBlockCapella) 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(BeaconBlockBodyCapella) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockCapella object +func (b *BeaconBlockCapella) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyCapella) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockCapella object +func (b *BeaconBlockCapella) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBodyCapella) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockCapella object +func (b *BeaconBlockCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockCapella object with a hasher +func (b *BeaconBlockCapella) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBodyCapella object +func (b *BeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBodyCapella object to a target array +func (b *BeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(388) + + // 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) 'ExecutionPayload' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadCapella) + } + offset += b.ExecutionPayload.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // 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) 'ExecutionPayload' + if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyCapella object +func (b *BeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 388 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9, o10 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 != 388 { + 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) 'ExecutionPayload' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + 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) 'ExecutionPayload' + { + buf = tail[o9:o10] + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadCapella) + } + if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[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 + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyCapella object +func (b *BeaconBlockBodyCapella) SizeSSZ() (size int) { + size = 388 + + // 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) 'ExecutionPayload' + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadCapella) + } + size += b.ExecutionPayload.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBodyCapella object +func (b *BeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBodyCapella object with a hasher +func (b *BeaconBlockBodyCapella) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayload' + if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockCapella object +func (s *SignedBlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockCapella object to a target array +func (s *SignedBlindedBeaconBlockCapella) 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(BlindedBeaconBlockCapella) + } + 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 SignedBlindedBeaconBlockCapella object +func (s *SignedBlindedBeaconBlockCapella) 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(BlindedBeaconBlockCapella) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockCapella object +func (s *SignedBlindedBeaconBlockCapella) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BlindedBeaconBlockCapella) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockCapella object +func (s *SignedBlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockCapella object with a hasher +func (s *SignedBlindedBeaconBlockCapella) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockCapella object +func (b *BlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockCapella object to a target array +func (b *BlindedBeaconBlockCapella) 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(BlindedBeaconBlockBodyCapella) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockCapella object +func (b *BlindedBeaconBlockCapella) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyCapella) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockCapella object +func (b *BlindedBeaconBlockCapella) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BlindedBeaconBlockBodyCapella) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockCapella object +func (b *BlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockCapella object with a hasher +func (b *BlindedBeaconBlockCapella) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyCapella object +func (b *BlindedBeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyCapella object to a target array +func (b *BlindedBeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(388) + + // 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) 'ExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + offset += b.ExecutionPayloadHeader.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // 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) 'ExecutionPayloadHeader' + if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyCapella object +func (b *BlindedBeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 388 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9, o10 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 != 388 { + 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) 'ExecutionPayloadHeader' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + 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) 'ExecutionPayloadHeader' + { + buf = tail[o9:o10] + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[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 + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyCapella object +func (b *BlindedBeaconBlockBodyCapella) SizeSSZ() (size int) { + size = 388 + + // 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) 'ExecutionPayloadHeader' + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + size += b.ExecutionPayloadHeader.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyCapella object +func (b *BlindedBeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyCapella object with a hasher +func (b *BlindedBeaconBlockBodyCapella) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayloadHeader' + if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BuilderBidCapella object +func (b *BuilderBidCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BuilderBidCapella object to a target array +func (b *BuilderBidCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(84) + + // Offset (0) 'Header' + dst = ssz.WriteOffset(dst, offset) + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderCapella) + } + offset += b.Header.SizeSSZ() + + // Field (1) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + dst = append(dst, b.Value...) + + // Field (2) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + dst = append(dst, b.Pubkey...) + + // Field (0) 'Header' + if dst, err = b.Header.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BuilderBidCapella object +func (b *BuilderBidCapella) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 84 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Header' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 84 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Value' + if cap(b.Value) == 0 { + b.Value = make([]byte, 0, len(buf[4:36])) + } + b.Value = append(b.Value, buf[4:36]...) + + // Field (2) 'Pubkey' + if cap(b.Pubkey) == 0 { + b.Pubkey = make([]byte, 0, len(buf[36:84])) + } + b.Pubkey = append(b.Pubkey, buf[36:84]...) + + // Field (0) 'Header' + { + buf = tail[o0:] + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderCapella) + } + if err = b.Header.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidCapella object +func (b *BuilderBidCapella) SizeSSZ() (size int) { + size = 84 + + // Field (0) 'Header' + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderCapella) + } + size += b.Header.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BuilderBidCapella object +func (b *BuilderBidCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BuilderBidCapella object with a hasher +func (b *BuilderBidCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Header' + if err = b.Header.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + hh.PutBytes(b.Value) + + // Field (2) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + hh.PutBytes(b.Pubkey) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconStateCapella object +func (b *BeaconStateCapella) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconStateCapella object to a target array +func (b *BeaconStateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2736653) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PreviousEpochParticipation) + + // Offset (16) 'CurrentEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.CurrentEpochParticipation) + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (21) 'InactivityScores' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.InactivityScores) * 8 + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (24) 'LatestExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + offset += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (25) 'NextWithdrawalIndex' + dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) + + // Offset (27) 'HistoricalSummaries' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalSummaries) * 64 + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochParticipation' + if size := len(b.PreviousEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.PreviousEpochParticipation...) + + // Field (16) 'CurrentEpochParticipation' + if size := len(b.CurrentEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.CurrentEpochParticipation...) + + // Field (21) 'InactivityScores' + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + for ii := 0; ii < len(b.InactivityScores); ii++ { + dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) + } + + // Field (24) 'LatestExecutionPayloadHeader' + if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (27) 'HistoricalSummaries' + if size := len(b.HistoricalSummaries); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalSummaries); ii++ { + if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconStateCapella object +func (b *BeaconStateCapella) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2736653 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2736653 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochParticipation' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochParticipation' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Offset (21) 'InactivityScores' + if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { + return ssz.ErrOffset + } + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { + return err + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { + return err + } + + // Offset (24) 'LatestExecutionPayloadHeader' + if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { + return ssz.ErrOffset + } + + // Field (25) 'NextWithdrawalIndex' + b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) + + // Field (26) 'NextWithdrawalValidatorIndex' + b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) + + // Offset (27) 'HistoricalSummaries' + if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { + return ssz.ErrOffset + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochParticipation' + { + buf = tail[o15:o16] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.PreviousEpochParticipation) == 0 { + b.PreviousEpochParticipation = make([]byte, 0, len(buf)) + } + b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) + } + + // Field (16) 'CurrentEpochParticipation' + { + buf = tail[o16:o21] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.CurrentEpochParticipation) == 0 { + b.CurrentEpochParticipation = make([]byte, 0, len(buf)) + } + b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) + } + + // Field (21) 'InactivityScores' + { + buf = tail[o21:o24] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) + for ii := 0; ii < num; ii++ { + b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (24) 'LatestExecutionPayloadHeader' + { + buf = tail[o24:o27] + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (27) 'HistoricalSummaries' + { + buf = tail[o27:] + num, err := ssz.DivideInt2(len(buf), 64, 16777216) + if err != nil { + return err + } + b.HistoricalSummaries = make([]*HistoricalSummary, num) + for ii := 0; ii < num; ii++ { + if b.HistoricalSummaries[ii] == nil { + b.HistoricalSummaries[ii] = new(HistoricalSummary) + } + if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateCapella object +func (b *BeaconStateCapella) SizeSSZ() (size int) { + size = 2736653 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochParticipation' + size += len(b.PreviousEpochParticipation) + + // Field (16) 'CurrentEpochParticipation' + size += len(b.CurrentEpochParticipation) + + // Field (21) 'InactivityScores' + size += len(b.InactivityScores) * 8 + + // Field (24) 'LatestExecutionPayloadHeader' + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) + } + size += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (27) 'HistoricalSummaries' + size += len(b.HistoricalSummaries) * 64 + + return +} + +// HashTreeRoot ssz hashes the BeaconStateCapella object +func (b *BeaconStateCapella) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconStateCapella object with a hasher +func (b *BeaconStateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.PreviousEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.PreviousEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (16) 'CurrentEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.CurrentEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.CurrentEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (21) 'InactivityScores' + { + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.InactivityScores { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.InactivityScores)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (22) 'CurrentSyncCommittee' + if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (24) 'LatestExecutionPayloadHeader' + if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (25) 'NextWithdrawalIndex' + hh.PutUint64(b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) + + // Field (27) 'HistoricalSummaries' + { + subIndx := hh.Index() + num := uint64(len(b.HistoricalSummaries)) + if num > 16777216 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.HistoricalSummaries { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 16777216) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the HistoricalSummary object +func (h *HistoricalSummary) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(h) +} + +// MarshalSSZTo ssz marshals the HistoricalSummary object to a target array +func (h *HistoricalSummary) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'BlockSummaryRoot' + if size := len(h.BlockSummaryRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) + return + } + dst = append(dst, h.BlockSummaryRoot...) + + // Field (1) 'StateSummaryRoot' + if size := len(h.StateSummaryRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) + return + } + dst = append(dst, h.StateSummaryRoot...) + + return +} + +// UnmarshalSSZ ssz unmarshals the HistoricalSummary object +func (h *HistoricalSummary) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 64 { + return ssz.ErrSize + } + + // Field (0) 'BlockSummaryRoot' + if cap(h.BlockSummaryRoot) == 0 { + h.BlockSummaryRoot = make([]byte, 0, len(buf[0:32])) + } + h.BlockSummaryRoot = append(h.BlockSummaryRoot, buf[0:32]...) + + // Field (1) 'StateSummaryRoot' + if cap(h.StateSummaryRoot) == 0 { + h.StateSummaryRoot = make([]byte, 0, len(buf[32:64])) + } + h.StateSummaryRoot = append(h.StateSummaryRoot, buf[32:64]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the HistoricalSummary object +func (h *HistoricalSummary) SizeSSZ() (size int) { + size = 64 + return +} + +// HashTreeRoot ssz hashes the HistoricalSummary object +func (h *HistoricalSummary) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(h) +} + +// HashTreeRootWith ssz hashes the HistoricalSummary object with a hasher +func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'BlockSummaryRoot' + if size := len(h.BlockSummaryRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) + return + } + hh.PutBytes(h.BlockSummaryRoot) + + // Field (1) 'StateSummaryRoot' + if size := len(h.StateSummaryRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) + return + } + hh.PutBytes(h.StateSummaryRoot) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BLSToExecutionChange object +func (b *BLSToExecutionChange) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BLSToExecutionChange object to a target array +func (b *BLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'ValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(b.ValidatorIndex)) + + // Field (1) 'FromBlsPubkey' + if size := len(b.FromBlsPubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) + return + } + dst = append(dst, b.FromBlsPubkey...) + + // Field (2) 'ToExecutionAddress' + if size := len(b.ToExecutionAddress); size != 20 { + err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) + return + } + dst = append(dst, b.ToExecutionAddress...) + + return +} + +// UnmarshalSSZ ssz unmarshals the BLSToExecutionChange object +func (b *BLSToExecutionChange) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 76 { + return ssz.ErrSize + } + + // Field (0) 'ValidatorIndex' + b.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'FromBlsPubkey' + if cap(b.FromBlsPubkey) == 0 { + b.FromBlsPubkey = make([]byte, 0, len(buf[8:56])) + } + b.FromBlsPubkey = append(b.FromBlsPubkey, buf[8:56]...) + + // Field (2) 'ToExecutionAddress' + if cap(b.ToExecutionAddress) == 0 { + b.ToExecutionAddress = make([]byte, 0, len(buf[56:76])) + } + b.ToExecutionAddress = append(b.ToExecutionAddress, buf[56:76]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BLSToExecutionChange object +func (b *BLSToExecutionChange) SizeSSZ() (size int) { + size = 76 + return +} + +// HashTreeRoot ssz hashes the BLSToExecutionChange object +func (b *BLSToExecutionChange) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BLSToExecutionChange object with a hasher +func (b *BLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'ValidatorIndex' + hh.PutUint64(uint64(b.ValidatorIndex)) + + // Field (1) 'FromBlsPubkey' + if size := len(b.FromBlsPubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) + return + } + hh.PutBytes(b.FromBlsPubkey) + + // Field (2) 'ToExecutionAddress' + if size := len(b.ToExecutionAddress); size != 20 { + err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) + return + } + hh.PutBytes(b.ToExecutionAddress) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBLSToExecutionChange object +func (s *SignedBLSToExecutionChange) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBLSToExecutionChange object to a target array +func (s *SignedBLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(BLSToExecutionChange) + } + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedBLSToExecutionChange object +func (s *SignedBLSToExecutionChange) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 172 { + return ssz.ErrSize + } + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(BLSToExecutionChange) + } + if err = s.Message.UnmarshalSSZ(buf[0:76]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[76:172])) + } + s.Signature = append(s.Signature, buf[76:172]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBLSToExecutionChange object +func (s *SignedBLSToExecutionChange) SizeSSZ() (size int) { + size = 172 + return +} + +// HashTreeRoot ssz hashes the SignedBLSToExecutionChange object +func (s *SignedBLSToExecutionChange) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBLSToExecutionChange object with a hasher +func (s *SignedBLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/deneb.ssz.go b/proto/prysm/v1alpha1/deneb.ssz.go new file mode 100644 index 000000000000..272653017ab6 --- /dev/null +++ b/proto/prysm/v1alpha1/deneb.ssz.go @@ -0,0 +1,3595 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: 9f8cc72419818e9c460c4079d52f90e5c23bf6565a6a234b4dee0d8f41d9b1ed +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// MarshalSSZ ssz marshals the SignedBeaconBlockContentsDeneb object +func (s *SignedBeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockContentsDeneb object to a target array +func (s *SignedBeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(12) + + // Offset (0) 'Block' + dst = ssz.WriteOffset(dst, offset) + if s.Block == nil { + s.Block = new(SignedBeaconBlockDeneb) + } + offset += s.Block.SizeSSZ() + + // Offset (1) 'KzgProofs' + dst = ssz.WriteOffset(dst, offset) + offset += len(s.KzgProofs) * 48 + + // Offset (2) 'Blobs' + dst = ssz.WriteOffset(dst, offset) + offset += len(s.Blobs) * 131072 + + // Field (0) 'Block' + if dst, err = s.Block.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'KzgProofs' + if size := len(s.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + for ii := 0; ii < len(s.KzgProofs); ii++ { + if size := len(s.KzgProofs[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) + return + } + dst = append(dst, s.KzgProofs[ii]...) + } + + // Field (2) 'Blobs' + if size := len(s.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + for ii := 0; ii < len(s.Blobs); ii++ { + if size := len(s.Blobs[ii]); size != 131072 { + err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) + return + } + dst = append(dst, s.Blobs[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockContentsDeneb object +func (s *SignedBeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 12 { + return ssz.ErrSize + } + + tail := buf + var o0, o1, o2 uint64 + + // Offset (0) 'Block' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 12 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'KzgProofs' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Offset (2) 'Blobs' + if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Field (0) 'Block' + { + buf = tail[o0:o1] + if s.Block == nil { + s.Block = new(SignedBeaconBlockDeneb) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'KzgProofs' + { + buf = tail[o1:o2] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + s.KzgProofs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(s.KzgProofs[ii]) == 0 { + s.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + s.KzgProofs[ii] = append(s.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (2) 'Blobs' + { + buf = tail[o2:] + num, err := ssz.DivideInt2(len(buf), 131072, 4096) + if err != nil { + return err + } + s.Blobs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(s.Blobs[ii]) == 0 { + s.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) + } + s.Blobs[ii] = append(s.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockContentsDeneb object +func (s *SignedBeaconBlockContentsDeneb) SizeSSZ() (size int) { + size = 12 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(SignedBeaconBlockDeneb) + } + size += s.Block.SizeSSZ() + + // Field (1) 'KzgProofs' + size += len(s.KzgProofs) * 48 + + // Field (2) 'Blobs' + size += len(s.Blobs) * 131072 + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockContentsDeneb object +func (s *SignedBeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockContentsDeneb object with a hasher +func (s *SignedBeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Block' + if err = s.Block.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'KzgProofs' + { + if size := len(s.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range s.KzgProofs { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(s.KzgProofs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (2) 'Blobs' + { + if size := len(s.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range s.Blobs { + if len(i) != 131072 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(s.Blobs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockContentsDeneb object +func (b *BeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockContentsDeneb object to a target array +func (b *BeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(12) + + // Offset (0) 'Block' + dst = ssz.WriteOffset(dst, offset) + if b.Block == nil { + b.Block = new(BeaconBlockDeneb) + } + offset += b.Block.SizeSSZ() + + // Offset (1) 'KzgProofs' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.KzgProofs) * 48 + + // Offset (2) 'Blobs' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Blobs) * 131072 + + // Field (0) 'Block' + if dst, err = b.Block.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'KzgProofs' + if size := len(b.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + for ii := 0; ii < len(b.KzgProofs); ii++ { + if size := len(b.KzgProofs[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) + return + } + dst = append(dst, b.KzgProofs[ii]...) + } + + // Field (2) 'Blobs' + if size := len(b.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + for ii := 0; ii < len(b.Blobs); ii++ { + if size := len(b.Blobs[ii]); size != 131072 { + err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) + return + } + dst = append(dst, b.Blobs[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockContentsDeneb object +func (b *BeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 12 { + return ssz.ErrSize + } + + tail := buf + var o0, o1, o2 uint64 + + // Offset (0) 'Block' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 12 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'KzgProofs' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Offset (2) 'Blobs' + if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { + return ssz.ErrOffset + } + + // Field (0) 'Block' + { + buf = tail[o0:o1] + if b.Block == nil { + b.Block = new(BeaconBlockDeneb) + } + if err = b.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'KzgProofs' + { + buf = tail[o1:o2] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.KzgProofs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.KzgProofs[ii]) == 0 { + b.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.KzgProofs[ii] = append(b.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (2) 'Blobs' + { + buf = tail[o2:] + num, err := ssz.DivideInt2(len(buf), 131072, 4096) + if err != nil { + return err + } + b.Blobs = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.Blobs[ii]) == 0 { + b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) + } + b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockContentsDeneb object +func (b *BeaconBlockContentsDeneb) SizeSSZ() (size int) { + size = 12 + + // Field (0) 'Block' + if b.Block == nil { + b.Block = new(BeaconBlockDeneb) + } + size += b.Block.SizeSSZ() + + // Field (1) 'KzgProofs' + size += len(b.KzgProofs) * 48 + + // Field (2) 'Blobs' + size += len(b.Blobs) * 131072 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockContentsDeneb object +func (b *BeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockContentsDeneb object with a hasher +func (b *BeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Block' + if err = b.Block.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'KzgProofs' + { + if size := len(b.KzgProofs); size > 4096 { + err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.KzgProofs { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.KzgProofs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (2) 'Blobs' + { + if size := len(b.Blobs); size > 4096 { + err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.Blobs { + if len(i) != 131072 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.Blobs)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBeaconBlockDeneb object +func (s *SignedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockDeneb object to a target array +func (s *SignedBeaconBlockDeneb) 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(BeaconBlockDeneb) + } + 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 SignedBeaconBlockDeneb object +func (s *SignedBeaconBlockDeneb) 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(BeaconBlockDeneb) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockDeneb object +func (s *SignedBeaconBlockDeneb) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlockDeneb) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockDeneb object +func (s *SignedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockDeneb object with a hasher +func (s *SignedBeaconBlockDeneb) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockDeneb object +func (b *BeaconBlockDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockDeneb object to a target array +func (b *BeaconBlockDeneb) 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(BeaconBlockBodyDeneb) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockDeneb object +func (b *BeaconBlockDeneb) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyDeneb) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockDeneb object +func (b *BeaconBlockDeneb) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBodyDeneb) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockDeneb object +func (b *BeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockDeneb object with a hasher +func (b *BeaconBlockDeneb) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBodyDeneb object +func (b *BeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBodyDeneb object to a target array +func (b *BeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(392) + + // 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) 'ExecutionPayload' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) + } + offset += b.ExecutionPayload.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // Offset (11) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlobKzgCommitments) * 48 + + // 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) 'ExecutionPayload' + if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 (11) 'BlobKzgCommitments' + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { + if size := len(b.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, b.BlobKzgCommitments[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyDeneb object +func (b *BeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 392 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9, o10, o11 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 != 392 { + 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) 'ExecutionPayload' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + return ssz.ErrOffset + } + + // Offset (11) 'BlobKzgCommitments' + if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { + 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) 'ExecutionPayload' + { + buf = tail[o9:o10] + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) + } + if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[o10:o11] + 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 (11) 'BlobKzgCommitments' + { + buf = tail[o11:] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.BlobKzgCommitments[ii]) == 0 { + b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyDeneb object +func (b *BeaconBlockBodyDeneb) SizeSSZ() (size int) { + size = 392 + + // 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) 'ExecutionPayload' + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) + } + size += b.ExecutionPayload.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + // Field (11) 'BlobKzgCommitments' + size += len(b.BlobKzgCommitments) * 48 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBodyDeneb object +func (b *BeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBodyDeneb object with a hasher +func (b *BeaconBlockBodyDeneb) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayload' + if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (11) 'BlobKzgCommitments' + { + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.BlobKzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockDeneb object +func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockDeneb object to a target array +func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(100) + + // Offset (0) 'Message' + dst = ssz.WriteOffset(dst, offset) + if s.Message == nil { + s.Message = new(BlindedBeaconBlockDeneb) + } + offset += s.Message.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) 'Message' + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockDeneb object +func (s *SignedBlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 100 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Message' + 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) 'Message' + { + buf = tail[o0:] + if s.Message == nil { + s.Message = new(BlindedBeaconBlockDeneb) + } + if err = s.Message.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockDeneb object +func (s *SignedBlindedBeaconBlockDeneb) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(BlindedBeaconBlockDeneb) + } + size += s.Message.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockDeneb object +func (s *SignedBlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockDeneb object with a hasher +func (s *SignedBlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockDeneb object +func (b *BlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockDeneb object to a target array +func (b *BlindedBeaconBlockDeneb) 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(BlindedBeaconBlockBodyDeneb) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockDeneb object +func (b *BlindedBeaconBlockDeneb) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyDeneb) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockDeneb object +func (b *BlindedBeaconBlockDeneb) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BlindedBeaconBlockBodyDeneb) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockDeneb object +func (b *BlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockDeneb object with a hasher +func (b *BlindedBeaconBlockDeneb) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyDeneb object +func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyDeneb object to a target array +func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(392) + + // 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) 'ExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + offset += b.ExecutionPayloadHeader.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // Offset (11) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlobKzgCommitments) * 48 + + // 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) 'ExecutionPayloadHeader' + if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 (11) 'BlobKzgCommitments' + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { + if size := len(b.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, b.BlobKzgCommitments[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyDeneb object +func (b *BlindedBeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 392 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7, o9, o10, o11 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 != 392 { + 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) 'ExecutionPayloadHeader' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + return ssz.ErrOffset + } + + // Offset (11) 'BlobKzgCommitments' + if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { + 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) 'ExecutionPayloadHeader' + { + buf = tail[o9:o10] + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[o10:o11] + 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 (11) 'BlobKzgCommitments' + { + buf = tail[o11:] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.BlobKzgCommitments[ii]) == 0 { + b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyDeneb object +func (b *BlindedBeaconBlockBodyDeneb) SizeSSZ() (size int) { + size = 392 + + // 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) 'ExecutionPayloadHeader' + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + size += b.ExecutionPayloadHeader.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + // Field (11) 'BlobKzgCommitments' + size += len(b.BlobKzgCommitments) * 48 + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyDeneb object +func (b *BlindedBeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyDeneb object with a hasher +func (b *BlindedBeaconBlockBodyDeneb) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayloadHeader' + if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (11) 'BlobKzgCommitments' + { + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.BlobKzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BuilderBidDeneb object +func (b *BuilderBidDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BuilderBidDeneb object to a target array +func (b *BuilderBidDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(88) + + // Offset (0) 'Header' + dst = ssz.WriteOffset(dst, offset) + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderDeneb) + } + offset += b.Header.SizeSSZ() + + // Offset (1) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlobKzgCommitments) * 48 + + // Field (2) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + dst = append(dst, b.Value...) + + // Field (3) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + dst = append(dst, b.Pubkey...) + + // Field (0) 'Header' + if dst, err = b.Header.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'BlobKzgCommitments' + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { + if size := len(b.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, b.BlobKzgCommitments[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BuilderBidDeneb object +func (b *BuilderBidDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 88 { + return ssz.ErrSize + } + + tail := buf + var o0, o1 uint64 + + // Offset (0) 'Header' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 88 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'BlobKzgCommitments' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Field (2) 'Value' + if cap(b.Value) == 0 { + b.Value = make([]byte, 0, len(buf[8:40])) + } + b.Value = append(b.Value, buf[8:40]...) + + // Field (3) 'Pubkey' + if cap(b.Pubkey) == 0 { + b.Pubkey = make([]byte, 0, len(buf[40:88])) + } + b.Pubkey = append(b.Pubkey, buf[40:88]...) + + // Field (0) 'Header' + { + buf = tail[o0:o1] + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderDeneb) + } + if err = b.Header.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'BlobKzgCommitments' + { + buf = tail[o1:] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.BlobKzgCommitments[ii]) == 0 { + b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidDeneb object +func (b *BuilderBidDeneb) SizeSSZ() (size int) { + size = 88 + + // Field (0) 'Header' + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeaderDeneb) + } + size += b.Header.SizeSSZ() + + // Field (1) 'BlobKzgCommitments' + size += len(b.BlobKzgCommitments) * 48 + + return +} + +// HashTreeRoot ssz hashes the BuilderBidDeneb object +func (b *BuilderBidDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BuilderBidDeneb object with a hasher +func (b *BuilderBidDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Header' + if err = b.Header.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'BlobKzgCommitments' + { + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.BlobKzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (2) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + hh.PutBytes(b.Value) + + // Field (3) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + hh.PutBytes(b.Pubkey) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlobSidecar object +func (b *BlobSidecar) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlobSidecar object to a target array +func (b *BlobSidecar) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Index' + dst = ssz.MarshalUint64(dst, b.Index) + + // Field (1) 'Blob' + if size := len(b.Blob); size != 131072 { + err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) + return + } + dst = append(dst, b.Blob...) + + // Field (2) 'KzgCommitment' + if size := len(b.KzgCommitment); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) + return + } + dst = append(dst, b.KzgCommitment...) + + // Field (3) 'KzgProof' + if size := len(b.KzgProof); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) + return + } + dst = append(dst, b.KzgProof...) + + // Field (4) 'SignedBlockHeader' + if b.SignedBlockHeader == nil { + b.SignedBlockHeader = new(SignedBeaconBlockHeader) + } + if dst, err = b.SignedBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'CommitmentInclusionProof' + if size := len(b.CommitmentInclusionProof); size != 17 { + err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) + return + } + for ii := 0; ii < 17; ii++ { + if size := len(b.CommitmentInclusionProof[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.CommitmentInclusionProof[ii]", size, 32) + return + } + dst = append(dst, b.CommitmentInclusionProof[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlobSidecar object +func (b *BlobSidecar) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 131928 { + return ssz.ErrSize + } + + // Field (0) 'Index' + b.Index = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'Blob' + if cap(b.Blob) == 0 { + b.Blob = make([]byte, 0, len(buf[8:131080])) + } + b.Blob = append(b.Blob, buf[8:131080]...) + + // Field (2) 'KzgCommitment' + if cap(b.KzgCommitment) == 0 { + b.KzgCommitment = make([]byte, 0, len(buf[131080:131128])) + } + b.KzgCommitment = append(b.KzgCommitment, buf[131080:131128]...) + + // Field (3) 'KzgProof' + if cap(b.KzgProof) == 0 { + b.KzgProof = make([]byte, 0, len(buf[131128:131176])) + } + b.KzgProof = append(b.KzgProof, buf[131128:131176]...) + + // Field (4) 'SignedBlockHeader' + if b.SignedBlockHeader == nil { + b.SignedBlockHeader = new(SignedBeaconBlockHeader) + } + if err = b.SignedBlockHeader.UnmarshalSSZ(buf[131176:131384]); err != nil { + return err + } + + // Field (5) 'CommitmentInclusionProof' + b.CommitmentInclusionProof = make([][]byte, 17) + for ii := 0; ii < 17; ii++ { + if cap(b.CommitmentInclusionProof[ii]) == 0 { + b.CommitmentInclusionProof[ii] = make([]byte, 0, len(buf[131384:131928][ii*32:(ii+1)*32])) + } + b.CommitmentInclusionProof[ii] = append(b.CommitmentInclusionProof[ii], buf[131384:131928][ii*32:(ii+1)*32]...) + } + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecar object +func (b *BlobSidecar) SizeSSZ() (size int) { + size = 131928 + return +} + +// HashTreeRoot ssz hashes the BlobSidecar object +func (b *BlobSidecar) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlobSidecar object with a hasher +func (b *BlobSidecar) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Index' + hh.PutUint64(b.Index) + + // Field (1) 'Blob' + if size := len(b.Blob); size != 131072 { + err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) + return + } + hh.PutBytes(b.Blob) + + // Field (2) 'KzgCommitment' + if size := len(b.KzgCommitment); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) + return + } + hh.PutBytes(b.KzgCommitment) + + // Field (3) 'KzgProof' + if size := len(b.KzgProof); size != 48 { + err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) + return + } + hh.PutBytes(b.KzgProof) + + // Field (4) 'SignedBlockHeader' + if err = b.SignedBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'CommitmentInclusionProof' + { + if size := len(b.CommitmentInclusionProof); size != 17 { + err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) + return + } + subIndx := hh.Index() + for _, i := range b.CommitmentInclusionProof { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlobSidecars object +func (b *BlobSidecars) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlobSidecars object to a target array +func (b *BlobSidecars) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(4) + + // Offset (0) 'Sidecars' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Sidecars) * 131928 + + // Field (0) 'Sidecars' + if size := len(b.Sidecars); size > 6 { + err = ssz.ErrListTooBigFn("--.Sidecars", size, 6) + return + } + for ii := 0; ii < len(b.Sidecars); ii++ { + if dst, err = b.Sidecars[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlobSidecars object +func (b *BlobSidecars) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 4 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Sidecars' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 4 { + return ssz.ErrInvalidVariableOffset + } + + // Field (0) 'Sidecars' + { + buf = tail[o0:] + num, err := ssz.DivideInt2(len(buf), 131928, 6) + if err != nil { + return err + } + b.Sidecars = make([]*BlobSidecar, num) + for ii := 0; ii < num; ii++ { + if b.Sidecars[ii] == nil { + b.Sidecars[ii] = new(BlobSidecar) + } + if err = b.Sidecars[ii].UnmarshalSSZ(buf[ii*131928 : (ii+1)*131928]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecars object +func (b *BlobSidecars) SizeSSZ() (size int) { + size = 4 + + // Field (0) 'Sidecars' + size += len(b.Sidecars) * 131928 + + return +} + +// HashTreeRoot ssz hashes the BlobSidecars object +func (b *BlobSidecars) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlobSidecars object with a hasher +func (b *BlobSidecars) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Sidecars' + { + subIndx := hh.Index() + num := uint64(len(b.Sidecars)) + if num > 6 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Sidecars { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 6) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconStateDeneb object +func (b *BeaconStateDeneb) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconStateDeneb object to a target array +func (b *BeaconStateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2736653) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PreviousEpochParticipation) + + // Offset (16) 'CurrentEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.CurrentEpochParticipation) + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (21) 'InactivityScores' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.InactivityScores) * 8 + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (24) 'LatestExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + offset += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (25) 'NextWithdrawalIndex' + dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) + + // Offset (27) 'HistoricalSummaries' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalSummaries) * 64 + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochParticipation' + if size := len(b.PreviousEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.PreviousEpochParticipation...) + + // Field (16) 'CurrentEpochParticipation' + if size := len(b.CurrentEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.CurrentEpochParticipation...) + + // Field (21) 'InactivityScores' + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + for ii := 0; ii < len(b.InactivityScores); ii++ { + dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) + } + + // Field (24) 'LatestExecutionPayloadHeader' + if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (27) 'HistoricalSummaries' + if size := len(b.HistoricalSummaries); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalSummaries); ii++ { + if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconStateDeneb object +func (b *BeaconStateDeneb) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2736653 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2736653 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochParticipation' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochParticipation' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Offset (21) 'InactivityScores' + if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { + return ssz.ErrOffset + } + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { + return err + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { + return err + } + + // Offset (24) 'LatestExecutionPayloadHeader' + if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { + return ssz.ErrOffset + } + + // Field (25) 'NextWithdrawalIndex' + b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) + + // Field (26) 'NextWithdrawalValidatorIndex' + b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) + + // Offset (27) 'HistoricalSummaries' + if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { + return ssz.ErrOffset + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochParticipation' + { + buf = tail[o15:o16] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.PreviousEpochParticipation) == 0 { + b.PreviousEpochParticipation = make([]byte, 0, len(buf)) + } + b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) + } + + // Field (16) 'CurrentEpochParticipation' + { + buf = tail[o16:o21] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.CurrentEpochParticipation) == 0 { + b.CurrentEpochParticipation = make([]byte, 0, len(buf)) + } + b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) + } + + // Field (21) 'InactivityScores' + { + buf = tail[o21:o24] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) + for ii := 0; ii < num; ii++ { + b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (24) 'LatestExecutionPayloadHeader' + { + buf = tail[o24:o27] + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (27) 'HistoricalSummaries' + { + buf = tail[o27:] + num, err := ssz.DivideInt2(len(buf), 64, 16777216) + if err != nil { + return err + } + b.HistoricalSummaries = make([]*HistoricalSummary, num) + for ii := 0; ii < num; ii++ { + if b.HistoricalSummaries[ii] == nil { + b.HistoricalSummaries[ii] = new(HistoricalSummary) + } + if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateDeneb object +func (b *BeaconStateDeneb) SizeSSZ() (size int) { + size = 2736653 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochParticipation' + size += len(b.PreviousEpochParticipation) + + // Field (16) 'CurrentEpochParticipation' + size += len(b.CurrentEpochParticipation) + + // Field (21) 'InactivityScores' + size += len(b.InactivityScores) * 8 + + // Field (24) 'LatestExecutionPayloadHeader' + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) + } + size += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (27) 'HistoricalSummaries' + size += len(b.HistoricalSummaries) * 64 + + return +} + +// HashTreeRoot ssz hashes the BeaconStateDeneb object +func (b *BeaconStateDeneb) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconStateDeneb object with a hasher +func (b *BeaconStateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.PreviousEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.PreviousEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (16) 'CurrentEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.CurrentEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.CurrentEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (21) 'InactivityScores' + { + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.InactivityScores { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.InactivityScores)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (22) 'CurrentSyncCommittee' + if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (24) 'LatestExecutionPayloadHeader' + if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (25) 'NextWithdrawalIndex' + hh.PutUint64(b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) + + // Field (27) 'HistoricalSummaries' + { + subIndx := hh.Index() + num := uint64(len(b.HistoricalSummaries)) + if num > 16777216 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.HistoricalSummaries { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 16777216) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlobIdentifier object +func (b *BlobIdentifier) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlobIdentifier object to a target array +func (b *BlobIdentifier) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'BlockRoot' + if size := len(b.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + dst = append(dst, b.BlockRoot...) + + // Field (1) 'Index' + dst = ssz.MarshalUint64(dst, b.Index) + + return +} + +// UnmarshalSSZ ssz unmarshals the BlobIdentifier object +func (b *BlobIdentifier) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 40 { + return ssz.ErrSize + } + + // Field (0) 'BlockRoot' + if cap(b.BlockRoot) == 0 { + b.BlockRoot = make([]byte, 0, len(buf[0:32])) + } + b.BlockRoot = append(b.BlockRoot, buf[0:32]...) + + // Field (1) 'Index' + b.Index = ssz.UnmarshallUint64(buf[32:40]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlobIdentifier object +func (b *BlobIdentifier) SizeSSZ() (size int) { + size = 40 + return +} + +// HashTreeRoot ssz hashes the BlobIdentifier object +func (b *BlobIdentifier) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlobIdentifier object with a hasher +func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'BlockRoot' + if size := len(b.BlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) + return + } + hh.PutBytes(b.BlockRoot) + + // Field (1) 'Index' + hh.PutUint64(b.Index) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/electra.ssz.go b/proto/prysm/v1alpha1/electra.ssz.go new file mode 100644 index 000000000000..6f32288014b8 --- /dev/null +++ b/proto/prysm/v1alpha1/electra.ssz.go @@ -0,0 +1,3964 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: b388c6b0776ab0d4c45d83697580b9f0f823644b7a442cd4fe40d4cf64565134 +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// MarshalSSZ ssz marshals the AttestationElectra object +func (a *AttestationElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AttestationElectra object to a target array +func (a *AttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(236) + + // Offset (0) 'AggregationBits' + dst = ssz.WriteOffset(dst, offset) + offset += len(a.AggregationBits) + + // Field (1) 'Data' + if a.Data == nil { + a.Data = new(AttestationData) + } + if dst, err = a.Data.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'CommitteeBits' + if size := len(a.CommitteeBits); size != 8 { + err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) + return + } + dst = append(dst, a.CommitteeBits...) + + // Field (3) 'Signature' + if size := len(a.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, a.Signature...) + + // Field (0) 'AggregationBits' + if size := len(a.AggregationBits); size > 131072 { + err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 131072) + return + } + dst = append(dst, a.AggregationBits...) + + return +} + +// UnmarshalSSZ ssz unmarshals the AttestationElectra object +func (a *AttestationElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 236 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'AggregationBits' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 236 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Data' + if a.Data == nil { + a.Data = new(AttestationData) + } + if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { + return err + } + + // Field (2) 'CommitteeBits' + if cap(a.CommitteeBits) == 0 { + a.CommitteeBits = make([]byte, 0, len(buf[132:140])) + } + a.CommitteeBits = append(a.CommitteeBits, buf[132:140]...) + + // Field (3) 'Signature' + if cap(a.Signature) == 0 { + a.Signature = make([]byte, 0, len(buf[140:236])) + } + a.Signature = append(a.Signature, buf[140:236]...) + + // Field (0) 'AggregationBits' + { + buf = tail[o0:] + if err = ssz.ValidateBitlist(buf, 131072); err != nil { + return err + } + if cap(a.AggregationBits) == 0 { + a.AggregationBits = make([]byte, 0, len(buf)) + } + a.AggregationBits = append(a.AggregationBits, buf...) + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AttestationElectra object +func (a *AttestationElectra) SizeSSZ() (size int) { + size = 236 + + // Field (0) 'AggregationBits' + size += len(a.AggregationBits) + + return +} + +// HashTreeRoot ssz hashes the AttestationElectra object +func (a *AttestationElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AttestationElectra object with a hasher +func (a *AttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregationBits' + if len(a.AggregationBits) == 0 { + err = ssz.ErrEmptyBitlist + return + } + hh.PutBitlist(a.AggregationBits, 131072) + + // Field (1) 'Data' + if err = a.Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'CommitteeBits' + if size := len(a.CommitteeBits); size != 8 { + err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) + return + } + hh.PutBytes(a.CommitteeBits) + + // Field (3) 'Signature' + if size := len(a.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(a.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the AggregateAttestationAndProofElectra object +func (a *AggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AggregateAttestationAndProofElectra object to a target array +func (a *AggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(108) + + // Field (0) 'AggregatorIndex' + dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) + + // Offset (1) 'Aggregate' + dst = ssz.WriteOffset(dst, offset) + if a.Aggregate == nil { + a.Aggregate = new(AttestationElectra) + } + offset += a.Aggregate.SizeSSZ() + + // Field (2) 'SelectionProof' + if size := len(a.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + dst = append(dst, a.SelectionProof...) + + // Field (1) 'Aggregate' + if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProofElectra object +func (a *AggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 108 { + return ssz.ErrSize + } + + tail := buf + var o1 uint64 + + // Field (0) 'AggregatorIndex' + a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Offset (1) 'Aggregate' + if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { + return ssz.ErrOffset + } + + if o1 != 108 { + return ssz.ErrInvalidVariableOffset + } + + // Field (2) 'SelectionProof' + if cap(a.SelectionProof) == 0 { + a.SelectionProof = make([]byte, 0, len(buf[12:108])) + } + a.SelectionProof = append(a.SelectionProof, buf[12:108]...) + + // Field (1) 'Aggregate' + { + buf = tail[o1:] + if a.Aggregate == nil { + a.Aggregate = new(AttestationElectra) + } + if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProofElectra object +func (a *AggregateAttestationAndProofElectra) SizeSSZ() (size int) { + size = 108 + + // Field (1) 'Aggregate' + if a.Aggregate == nil { + a.Aggregate = new(AttestationElectra) + } + size += a.Aggregate.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the AggregateAttestationAndProofElectra object +func (a *AggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AggregateAttestationAndProofElectra object with a hasher +func (a *AggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregatorIndex' + hh.PutUint64(uint64(a.AggregatorIndex)) + + // Field (1) 'Aggregate' + if err = a.Aggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'SelectionProof' + if size := len(a.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + hh.PutBytes(a.SelectionProof) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedAggregateAttestationAndProofElectra object +func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProofElectra object to a target array +func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(100) + + // Offset (0) 'Message' + dst = ssz.WriteOffset(dst, offset) + if s.Message == nil { + s.Message = new(AggregateAttestationAndProofElectra) + } + offset += s.Message.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) 'Message' + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProofElectra object +func (s *SignedAggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 100 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Message' + 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) 'Message' + { + buf = tail[o0:] + if s.Message == nil { + s.Message = new(AggregateAttestationAndProofElectra) + } + if err = s.Message.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProofElectra object +func (s *SignedAggregateAttestationAndProofElectra) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(AggregateAttestationAndProofElectra) + } + size += s.Message.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProofElectra object +func (s *SignedAggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProofElectra object with a hasher +func (s *SignedAggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the AttesterSlashingElectra object +func (a *AttesterSlashingElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AttesterSlashingElectra object to a target array +func (a *AttesterSlashingElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(8) + + // Offset (0) 'Attestation_1' + dst = ssz.WriteOffset(dst, offset) + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestationElectra) + } + offset += a.Attestation_1.SizeSSZ() + + // Offset (1) 'Attestation_2' + dst = ssz.WriteOffset(dst, offset) + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestationElectra) + } + offset += a.Attestation_2.SizeSSZ() + + // Field (0) 'Attestation_1' + if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Attestation_2' + if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the AttesterSlashingElectra object +func (a *AttesterSlashingElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 8 { + return ssz.ErrSize + } + + tail := buf + var o0, o1 uint64 + + // Offset (0) 'Attestation_1' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 8 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'Attestation_2' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Field (0) 'Attestation_1' + { + buf = tail[o0:o1] + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestationElectra) + } + if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'Attestation_2' + { + buf = tail[o1:] + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestationElectra) + } + if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashingElectra object +func (a *AttesterSlashingElectra) SizeSSZ() (size int) { + size = 8 + + // Field (0) 'Attestation_1' + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestationElectra) + } + size += a.Attestation_1.SizeSSZ() + + // Field (1) 'Attestation_2' + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestationElectra) + } + size += a.Attestation_2.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the AttesterSlashingElectra object +func (a *AttesterSlashingElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AttesterSlashingElectra object with a hasher +func (a *AttesterSlashingElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Attestation_1' + if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'Attestation_2' + if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the IndexedAttestationElectra object +func (i *IndexedAttestationElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(i) +} + +// MarshalSSZTo ssz marshals the IndexedAttestationElectra object to a target array +func (i *IndexedAttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(228) + + // Offset (0) 'AttestingIndices' + dst = ssz.WriteOffset(dst, offset) + offset += len(i.AttestingIndices) * 8 + + // Field (1) 'Data' + if i.Data == nil { + i.Data = new(AttestationData) + } + if dst, err = i.Data.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(i.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, i.Signature...) + + // Field (0) 'AttestingIndices' + if size := len(i.AttestingIndices); size > 131072 { + err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) + return + } + for ii := 0; ii < len(i.AttestingIndices); ii++ { + dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the IndexedAttestationElectra object +func (i *IndexedAttestationElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 228 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'AttestingIndices' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 228 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Data' + if i.Data == nil { + i.Data = new(AttestationData) + } + if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { + return err + } + + // Field (2) 'Signature' + if cap(i.Signature) == 0 { + i.Signature = make([]byte, 0, len(buf[132:228])) + } + i.Signature = append(i.Signature, buf[132:228]...) + + // Field (0) 'AttestingIndices' + { + buf = tail[o0:] + num, err := ssz.DivideInt2(len(buf), 8, 131072) + if err != nil { + return err + } + i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) + for ii := 0; ii < num; ii++ { + i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestationElectra object +func (i *IndexedAttestationElectra) SizeSSZ() (size int) { + size = 228 + + // Field (0) 'AttestingIndices' + size += len(i.AttestingIndices) * 8 + + return +} + +// HashTreeRoot ssz hashes the IndexedAttestationElectra object +func (i *IndexedAttestationElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(i) +} + +// HashTreeRootWith ssz hashes the IndexedAttestationElectra object with a hasher +func (i *IndexedAttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AttestingIndices' + { + if size := len(i.AttestingIndices); size > 131072 { + err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) + return + } + subIndx := hh.Index() + for _, i := range i.AttestingIndices { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(i.AttestingIndices)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(131072, numItems, 8)) + } + + // Field (1) 'Data' + if err = i.Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(i.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(i.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBeaconBlockElectra object +func (s *SignedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockElectra object to a target array +func (s *SignedBeaconBlockElectra) 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(BeaconBlockElectra) + } + 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 SignedBeaconBlockElectra object +func (s *SignedBeaconBlockElectra) 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(BeaconBlockElectra) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockElectra object +func (s *SignedBeaconBlockElectra) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlockElectra) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockElectra object +func (s *SignedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockElectra object with a hasher +func (s *SignedBeaconBlockElectra) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockElectra object +func (b *BeaconBlockElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockElectra object to a target array +func (b *BeaconBlockElectra) 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(BeaconBlockBodyElectra) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockElectra object +func (b *BeaconBlockElectra) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyElectra) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockElectra object +func (b *BeaconBlockElectra) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBodyElectra) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockElectra object +func (b *BeaconBlockElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockElectra object with a hasher +func (b *BeaconBlockElectra) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBodyElectra object +func (b *BeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBodyElectra object to a target array +func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadElectra) + } + offset += b.ExecutionPayload.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // Offset (11) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlobKzgCommitments) * 48 + + // Offset (12) 'Consolidations' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Consolidations) * 120 + + // 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 > 1 { + err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) + 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 > 8 { + err = ssz.ErrListTooBigFn("--.Attestations", size, 8) + 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) 'ExecutionPayload' + if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 (11) 'BlobKzgCommitments' + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { + if size := len(b.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, b.BlobKzgCommitments[ii]...) + } + + // Field (12) 'Consolidations' + if size := len(b.Consolidations); size > 1 { + err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) + return + } + for ii := 0; ii < len(b.Consolidations); ii++ { + if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyElectra object +func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + return ssz.ErrOffset + } + + // Offset (11) 'BlobKzgCommitments' + if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Consolidations' + 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, 1) + if err != nil { + return err + } + b.AttesterSlashings = make([]*AttesterSlashingElectra, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.AttesterSlashings[indx] == nil { + b.AttesterSlashings[indx] = new(AttesterSlashingElectra) + } + 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, 8) + if err != nil { + return err + } + b.Attestations = make([]*AttestationElectra, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.Attestations[indx] == nil { + b.Attestations[indx] = new(AttestationElectra) + } + 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) 'ExecutionPayload' + { + buf = tail[o9:o10] + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadElectra) + } + if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[o10:o11] + 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 (11) 'BlobKzgCommitments' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.BlobKzgCommitments[ii]) == 0 { + b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (12) 'Consolidations' + { + buf = tail[o12:] + num, err := ssz.DivideInt2(len(buf), 120, 1) + if err != nil { + return err + } + b.Consolidations = make([]*SignedConsolidation, num) + for ii := 0; ii < num; ii++ { + if b.Consolidations[ii] == nil { + b.Consolidations[ii] = new(SignedConsolidation) + } + if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyElectra object +func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' + if b.ExecutionPayload == nil { + b.ExecutionPayload = new(v1.ExecutionPayloadElectra) + } + size += b.ExecutionPayload.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + // Field (11) 'BlobKzgCommitments' + size += len(b.BlobKzgCommitments) * 48 + + // Field (12) 'Consolidations' + size += len(b.Consolidations) * 120 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBodyElectra object +func (b *BeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBodyElectra object with a hasher +func (b *BeaconBlockBodyElectra) 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (4) 'AttesterSlashings' + { + subIndx := hh.Index() + num := uint64(len(b.AttesterSlashings)) + if num > 1 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.AttesterSlashings { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1) + } + + // Field (5) 'Attestations' + { + subIndx := hh.Index() + num := uint64(len(b.Attestations)) + if num > 8 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Attestations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 8) + } + + // 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayload' + if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (11) 'BlobKzgCommitments' + { + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.BlobKzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (12) 'Consolidations' + { + subIndx := hh.Index() + num := uint64(len(b.Consolidations)) + if num > 1 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Consolidations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockElectra object +func (s *SignedBlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockElectra object to a target array +func (s *SignedBlindedBeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(100) + + // Offset (0) 'Message' + dst = ssz.WriteOffset(dst, offset) + if s.Message == nil { + s.Message = new(BlindedBeaconBlockElectra) + } + offset += s.Message.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) 'Message' + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockElectra object +func (s *SignedBlindedBeaconBlockElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 100 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Message' + 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) 'Message' + { + buf = tail[o0:] + if s.Message == nil { + s.Message = new(BlindedBeaconBlockElectra) + } + if err = s.Message.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockElectra object +func (s *SignedBlindedBeaconBlockElectra) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(BlindedBeaconBlockElectra) + } + size += s.Message.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockElectra object +func (s *SignedBlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockElectra object with a hasher +func (s *SignedBlindedBeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockElectra object +func (b *BlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockElectra object to a target array +func (b *BlindedBeaconBlockElectra) 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(BlindedBeaconBlockBodyElectra) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockElectra object +func (b *BlindedBeaconBlockElectra) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyElectra) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockElectra object +func (b *BlindedBeaconBlockElectra) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BlindedBeaconBlockBodyElectra) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockElectra object +func (b *BlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockElectra object with a hasher +func (b *BlindedBeaconBlockElectra) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlindedBeaconBlockBodyElectra object +func (b *BlindedBeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyElectra object to a target array +func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + offset += b.ExecutionPayloadHeader.SizeSSZ() + + // Offset (10) 'BlsToExecutionChanges' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlsToExecutionChanges) * 172 + + // Offset (11) 'BlobKzgCommitments' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.BlobKzgCommitments) * 48 + + // Offset (12) 'Consolidations' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Consolidations) * 120 + + // 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 > 1 { + err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) + 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 > 8 { + err = ssz.ErrListTooBigFn("--.Attestations", size, 8) + 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) 'ExecutionPayloadHeader' + if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (10) '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 (11) 'BlobKzgCommitments' + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { + if size := len(b.BlobKzgCommitments[ii]); size != 48 { + err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) + return + } + dst = append(dst, b.BlobKzgCommitments[ii]...) + } + + // Field (12) 'Consolidations' + if size := len(b.Consolidations); size > 1 { + err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) + return + } + for ii := 0; ii < len(b.Consolidations); ii++ { + if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyElectra object +func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' + if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Offset (10) 'BlsToExecutionChanges' + if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { + return ssz.ErrOffset + } + + // Offset (11) 'BlobKzgCommitments' + if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Consolidations' + 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, 1) + if err != nil { + return err + } + b.AttesterSlashings = make([]*AttesterSlashingElectra, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.AttesterSlashings[indx] == nil { + b.AttesterSlashings[indx] = new(AttesterSlashingElectra) + } + 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, 8) + if err != nil { + return err + } + b.Attestations = make([]*AttestationElectra, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.Attestations[indx] == nil { + b.Attestations[indx] = new(AttestationElectra) + } + 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) 'ExecutionPayloadHeader' + { + buf = tail[o9:o10] + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (10) 'BlsToExecutionChanges' + { + buf = tail[o10:o11] + 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 (11) 'BlobKzgCommitments' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 48, 4096) + if err != nil { + return err + } + b.BlobKzgCommitments = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.BlobKzgCommitments[ii]) == 0 { + b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) + } + b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) + } + } + + // Field (12) 'Consolidations' + { + buf = tail[o12:] + num, err := ssz.DivideInt2(len(buf), 120, 1) + if err != nil { + return err + } + b.Consolidations = make([]*SignedConsolidation, num) + for ii := 0; ii < num; ii++ { + if b.Consolidations[ii] == nil { + b.Consolidations[ii] = new(SignedConsolidation) + } + if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyElectra object +func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' + if b.ExecutionPayloadHeader == nil { + b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + size += b.ExecutionPayloadHeader.SizeSSZ() + + // Field (10) 'BlsToExecutionChanges' + size += len(b.BlsToExecutionChanges) * 172 + + // Field (11) 'BlobKzgCommitments' + size += len(b.BlobKzgCommitments) * 48 + + // Field (12) 'Consolidations' + size += len(b.Consolidations) * 120 + + return +} + +// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyElectra object +func (b *BlindedBeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyElectra object with a hasher +func (b *BlindedBeaconBlockBodyElectra) 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (4) 'AttesterSlashings' + { + subIndx := hh.Index() + num := uint64(len(b.AttesterSlashings)) + if num > 1 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.AttesterSlashings { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1) + } + + // Field (5) 'Attestations' + { + subIndx := hh.Index() + num := uint64(len(b.Attestations)) + if num > 8 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Attestations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 8) + } + + // 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (8) 'SyncAggregate' + if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'ExecutionPayloadHeader' + if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (10) '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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + // Field (11) 'BlobKzgCommitments' + { + if size := len(b.BlobKzgCommitments); size > 4096 { + err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) + return + } + subIndx := hh.Index() + for _, i := range b.BlobKzgCommitments { + if len(i) != 48 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(i) + } + + numItems := uint64(len(b.BlobKzgCommitments)) + hh.MerkleizeWithMixin(subIndx, numItems, 4096) + } + + // Field (12) 'Consolidations' + { + subIndx := hh.Index() + num := uint64(len(b.Consolidations)) + if num > 1 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Consolidations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconStateElectra object +func (b *BeaconStateElectra) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconStateElectra object to a target array +func (b *BeaconStateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2736713) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PreviousEpochParticipation) + + // Offset (16) 'CurrentEpochParticipation' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.CurrentEpochParticipation) + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (21) 'InactivityScores' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.InactivityScores) * 8 + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (24) 'LatestExecutionPayloadHeader' + dst = ssz.WriteOffset(dst, offset) + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + offset += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (25) 'NextWithdrawalIndex' + dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) + + // Offset (27) 'HistoricalSummaries' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalSummaries) * 64 + + // Field (28) 'DepositRequestsStartIndex' + dst = ssz.MarshalUint64(dst, b.DepositRequestsStartIndex) + + // Field (29) 'DepositBalanceToConsume' + dst = ssz.MarshalUint64(dst, uint64(b.DepositBalanceToConsume)) + + // Field (30) 'ExitBalanceToConsume' + dst = ssz.MarshalUint64(dst, uint64(b.ExitBalanceToConsume)) + + // Field (31) 'EarliestExitEpoch' + dst = ssz.MarshalUint64(dst, uint64(b.EarliestExitEpoch)) + + // Field (32) 'ConsolidationBalanceToConsume' + dst = ssz.MarshalUint64(dst, uint64(b.ConsolidationBalanceToConsume)) + + // Field (33) 'EarliestConsolidationEpoch' + dst = ssz.MarshalUint64(dst, uint64(b.EarliestConsolidationEpoch)) + + // Offset (34) 'PendingBalanceDeposits' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PendingBalanceDeposits) * 16 + + // Offset (35) 'PendingPartialWithdrawals' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PendingPartialWithdrawals) * 24 + + // Offset (36) 'PendingConsolidations' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.PendingConsolidations) * 16 + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochParticipation' + if size := len(b.PreviousEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.PreviousEpochParticipation...) + + // Field (16) 'CurrentEpochParticipation' + if size := len(b.CurrentEpochParticipation); size > 1099511627776 { + err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) + return + } + dst = append(dst, b.CurrentEpochParticipation...) + + // Field (21) 'InactivityScores' + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + for ii := 0; ii < len(b.InactivityScores); ii++ { + dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) + } + + // Field (24) 'LatestExecutionPayloadHeader' + if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (27) 'HistoricalSummaries' + if size := len(b.HistoricalSummaries); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalSummaries); ii++ { + if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (34) 'PendingBalanceDeposits' + if size := len(b.PendingBalanceDeposits); size > 134217728 { + err = ssz.ErrListTooBigFn("--.PendingBalanceDeposits", size, 134217728) + return + } + for ii := 0; ii < len(b.PendingBalanceDeposits); ii++ { + if dst, err = b.PendingBalanceDeposits[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (35) 'PendingPartialWithdrawals' + if size := len(b.PendingPartialWithdrawals); size > 134217728 { + err = ssz.ErrListTooBigFn("--.PendingPartialWithdrawals", size, 134217728) + return + } + for ii := 0; ii < len(b.PendingPartialWithdrawals); ii++ { + if dst, err = b.PendingPartialWithdrawals[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (36) 'PendingConsolidations' + if size := len(b.PendingConsolidations); size > 262144 { + err = ssz.ErrListTooBigFn("--.PendingConsolidations", size, 262144) + return + } + for ii := 0; ii < len(b.PendingConsolidations); ii++ { + if dst, err = b.PendingConsolidations[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconStateElectra object +func (b *BeaconStateElectra) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2736713 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16, o21, o24, o27, o34, o35, o36 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2736713 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochParticipation' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochParticipation' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Offset (21) 'InactivityScores' + if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { + return ssz.ErrOffset + } + + // Field (22) 'CurrentSyncCommittee' + if b.CurrentSyncCommittee == nil { + b.CurrentSyncCommittee = new(SyncCommittee) + } + if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { + return err + } + + // Field (23) 'NextSyncCommittee' + if b.NextSyncCommittee == nil { + b.NextSyncCommittee = new(SyncCommittee) + } + if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { + return err + } + + // Offset (24) 'LatestExecutionPayloadHeader' + if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { + return ssz.ErrOffset + } + + // Field (25) 'NextWithdrawalIndex' + b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) + + // Field (26) 'NextWithdrawalValidatorIndex' + b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) + + // Offset (27) 'HistoricalSummaries' + if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { + return ssz.ErrOffset + } + + // Field (28) 'DepositRequestsStartIndex' + b.DepositRequestsStartIndex = ssz.UnmarshallUint64(buf[2736653:2736661]) + + // Field (29) 'DepositBalanceToConsume' + b.DepositBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736661:2736669])) + + // Field (30) 'ExitBalanceToConsume' + b.ExitBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736669:2736677])) + + // Field (31) 'EarliestExitEpoch' + b.EarliestExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736677:2736685])) + + // Field (32) 'ConsolidationBalanceToConsume' + b.ConsolidationBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736685:2736693])) + + // Field (33) 'EarliestConsolidationEpoch' + b.EarliestConsolidationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736693:2736701])) + + // Offset (34) 'PendingBalanceDeposits' + if o34 = ssz.ReadOffset(buf[2736701:2736705]); o34 > size || o27 > o34 { + return ssz.ErrOffset + } + + // Offset (35) 'PendingPartialWithdrawals' + if o35 = ssz.ReadOffset(buf[2736705:2736709]); o35 > size || o34 > o35 { + return ssz.ErrOffset + } + + // Offset (36) 'PendingConsolidations' + if o36 = ssz.ReadOffset(buf[2736709:2736713]); o36 > size || o35 > o36 { + return ssz.ErrOffset + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochParticipation' + { + buf = tail[o15:o16] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.PreviousEpochParticipation) == 0 { + b.PreviousEpochParticipation = make([]byte, 0, len(buf)) + } + b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) + } + + // Field (16) 'CurrentEpochParticipation' + { + buf = tail[o16:o21] + if len(buf) > 1099511627776 { + return ssz.ErrBytesLength + } + if cap(b.CurrentEpochParticipation) == 0 { + b.CurrentEpochParticipation = make([]byte, 0, len(buf)) + } + b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) + } + + // Field (21) 'InactivityScores' + { + buf = tail[o21:o24] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) + for ii := 0; ii < num; ii++ { + b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (24) 'LatestExecutionPayloadHeader' + { + buf = tail[o24:o27] + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (27) 'HistoricalSummaries' + { + buf = tail[o27:o34] + num, err := ssz.DivideInt2(len(buf), 64, 16777216) + if err != nil { + return err + } + b.HistoricalSummaries = make([]*HistoricalSummary, num) + for ii := 0; ii < num; ii++ { + if b.HistoricalSummaries[ii] == nil { + b.HistoricalSummaries[ii] = new(HistoricalSummary) + } + if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { + return err + } + } + } + + // Field (34) 'PendingBalanceDeposits' + { + buf = tail[o34:o35] + num, err := ssz.DivideInt2(len(buf), 16, 134217728) + if err != nil { + return err + } + b.PendingBalanceDeposits = make([]*PendingBalanceDeposit, num) + for ii := 0; ii < num; ii++ { + if b.PendingBalanceDeposits[ii] == nil { + b.PendingBalanceDeposits[ii] = new(PendingBalanceDeposit) + } + if err = b.PendingBalanceDeposits[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { + return err + } + } + } + + // Field (35) 'PendingPartialWithdrawals' + { + buf = tail[o35:o36] + num, err := ssz.DivideInt2(len(buf), 24, 134217728) + if err != nil { + return err + } + b.PendingPartialWithdrawals = make([]*PendingPartialWithdrawal, num) + for ii := 0; ii < num; ii++ { + if b.PendingPartialWithdrawals[ii] == nil { + b.PendingPartialWithdrawals[ii] = new(PendingPartialWithdrawal) + } + if err = b.PendingPartialWithdrawals[ii].UnmarshalSSZ(buf[ii*24 : (ii+1)*24]); err != nil { + return err + } + } + } + + // Field (36) 'PendingConsolidations' + { + buf = tail[o36:] + num, err := ssz.DivideInt2(len(buf), 16, 262144) + if err != nil { + return err + } + b.PendingConsolidations = make([]*PendingConsolidation, num) + for ii := 0; ii < num; ii++ { + if b.PendingConsolidations[ii] == nil { + b.PendingConsolidations[ii] = new(PendingConsolidation) + } + if err = b.PendingConsolidations[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { + return err + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateElectra object +func (b *BeaconStateElectra) SizeSSZ() (size int) { + size = 2736713 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochParticipation' + size += len(b.PreviousEpochParticipation) + + // Field (16) 'CurrentEpochParticipation' + size += len(b.CurrentEpochParticipation) + + // Field (21) 'InactivityScores' + size += len(b.InactivityScores) * 8 + + // Field (24) 'LatestExecutionPayloadHeader' + if b.LatestExecutionPayloadHeader == nil { + b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) + } + size += b.LatestExecutionPayloadHeader.SizeSSZ() + + // Field (27) 'HistoricalSummaries' + size += len(b.HistoricalSummaries) * 64 + + // Field (34) 'PendingBalanceDeposits' + size += len(b.PendingBalanceDeposits) * 16 + + // Field (35) 'PendingPartialWithdrawals' + size += len(b.PendingPartialWithdrawals) * 24 + + // Field (36) 'PendingConsolidations' + size += len(b.PendingConsolidations) * 16 + + return +} + +// HashTreeRoot ssz hashes the BeaconStateElectra object +func (b *BeaconStateElectra) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconStateElectra object with a hasher +func (b *BeaconStateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.PreviousEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.PreviousEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (16) 'CurrentEpochParticipation' + { + elemIndx := hh.Index() + byteLen := uint64(len(b.CurrentEpochParticipation)) + if byteLen > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + hh.PutBytes(b.CurrentEpochParticipation) + hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (21) 'InactivityScores' + { + if size := len(b.InactivityScores); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.InactivityScores { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.InactivityScores)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (22) 'CurrentSyncCommittee' + if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (23) 'NextSyncCommittee' + if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { + return + } + + // Field (24) 'LatestExecutionPayloadHeader' + if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (25) 'NextWithdrawalIndex' + hh.PutUint64(b.NextWithdrawalIndex) + + // Field (26) 'NextWithdrawalValidatorIndex' + hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) + + // Field (27) 'HistoricalSummaries' + { + subIndx := hh.Index() + num := uint64(len(b.HistoricalSummaries)) + if num > 16777216 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.HistoricalSummaries { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 16777216) + } + + // Field (28) 'DepositRequestsStartIndex' + hh.PutUint64(b.DepositRequestsStartIndex) + + // Field (29) 'DepositBalanceToConsume' + hh.PutUint64(uint64(b.DepositBalanceToConsume)) + + // Field (30) 'ExitBalanceToConsume' + hh.PutUint64(uint64(b.ExitBalanceToConsume)) + + // Field (31) 'EarliestExitEpoch' + hh.PutUint64(uint64(b.EarliestExitEpoch)) + + // Field (32) 'ConsolidationBalanceToConsume' + hh.PutUint64(uint64(b.ConsolidationBalanceToConsume)) + + // Field (33) 'EarliestConsolidationEpoch' + hh.PutUint64(uint64(b.EarliestConsolidationEpoch)) + + // Field (34) 'PendingBalanceDeposits' + { + subIndx := hh.Index() + num := uint64(len(b.PendingBalanceDeposits)) + if num > 134217728 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.PendingBalanceDeposits { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 134217728) + } + + // Field (35) 'PendingPartialWithdrawals' + { + subIndx := hh.Index() + num := uint64(len(b.PendingPartialWithdrawals)) + if num > 134217728 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.PendingPartialWithdrawals { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 134217728) + } + + // Field (36) 'PendingConsolidations' + { + subIndx := hh.Index() + num := uint64(len(b.PendingConsolidations)) + if num > 262144 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.PendingConsolidations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 262144) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the PendingBalanceDeposit object +func (p *PendingBalanceDeposit) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the PendingBalanceDeposit object to a target array +func (p *PendingBalanceDeposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Index' + dst = ssz.MarshalUint64(dst, uint64(p.Index)) + + // Field (1) 'Amount' + dst = ssz.MarshalUint64(dst, p.Amount) + + return +} + +// UnmarshalSSZ ssz unmarshals the PendingBalanceDeposit object +func (p *PendingBalanceDeposit) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'Index' + p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Amount' + p.Amount = ssz.UnmarshallUint64(buf[8:16]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the PendingBalanceDeposit object +func (p *PendingBalanceDeposit) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the PendingBalanceDeposit object +func (p *PendingBalanceDeposit) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the PendingBalanceDeposit object with a hasher +func (p *PendingBalanceDeposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Index' + hh.PutUint64(uint64(p.Index)) + + // Field (1) 'Amount' + hh.PutUint64(p.Amount) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the PendingPartialWithdrawal object +func (p *PendingPartialWithdrawal) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the PendingPartialWithdrawal object to a target array +func (p *PendingPartialWithdrawal) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Index' + dst = ssz.MarshalUint64(dst, uint64(p.Index)) + + // Field (1) 'Amount' + dst = ssz.MarshalUint64(dst, p.Amount) + + // Field (2) 'WithdrawableEpoch' + dst = ssz.MarshalUint64(dst, uint64(p.WithdrawableEpoch)) + + return +} + +// UnmarshalSSZ ssz unmarshals the PendingPartialWithdrawal object +func (p *PendingPartialWithdrawal) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 24 { + return ssz.ErrSize + } + + // Field (0) 'Index' + p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Amount' + p.Amount = ssz.UnmarshallUint64(buf[8:16]) + + // Field (2) 'WithdrawableEpoch' + p.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the PendingPartialWithdrawal object +func (p *PendingPartialWithdrawal) SizeSSZ() (size int) { + size = 24 + return +} + +// HashTreeRoot ssz hashes the PendingPartialWithdrawal object +func (p *PendingPartialWithdrawal) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the PendingPartialWithdrawal object with a hasher +func (p *PendingPartialWithdrawal) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Index' + hh.PutUint64(uint64(p.Index)) + + // Field (1) 'Amount' + hh.PutUint64(p.Amount) + + // Field (2) 'WithdrawableEpoch' + hh.PutUint64(uint64(p.WithdrawableEpoch)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Consolidation object +func (c *Consolidation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(c) +} + +// MarshalSSZTo ssz marshals the Consolidation object to a target array +func (c *Consolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SourceIndex' + dst = ssz.MarshalUint64(dst, uint64(c.SourceIndex)) + + // Field (1) 'TargetIndex' + dst = ssz.MarshalUint64(dst, uint64(c.TargetIndex)) + + // Field (2) 'Epoch' + dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) + + return +} + +// UnmarshalSSZ ssz unmarshals the Consolidation object +func (c *Consolidation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 24 { + return ssz.ErrSize + } + + // Field (0) 'SourceIndex' + c.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'TargetIndex' + c.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) + + // Field (2) 'Epoch' + c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Consolidation object +func (c *Consolidation) SizeSSZ() (size int) { + size = 24 + return +} + +// HashTreeRoot ssz hashes the Consolidation object +func (c *Consolidation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(c) +} + +// HashTreeRootWith ssz hashes the Consolidation object with a hasher +func (c *Consolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SourceIndex' + hh.PutUint64(uint64(c.SourceIndex)) + + // Field (1) 'TargetIndex' + hh.PutUint64(uint64(c.TargetIndex)) + + // Field (2) 'Epoch' + hh.PutUint64(uint64(c.Epoch)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedConsolidation object +func (s *SignedConsolidation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedConsolidation object to a target array +func (s *SignedConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(Consolidation) + } + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedConsolidation object +func (s *SignedConsolidation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 120 { + return ssz.ErrSize + } + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(Consolidation) + } + if err = s.Message.UnmarshalSSZ(buf[0:24]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[24:120])) + } + s.Signature = append(s.Signature, buf[24:120]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedConsolidation object +func (s *SignedConsolidation) SizeSSZ() (size int) { + size = 120 + return +} + +// HashTreeRoot ssz hashes the SignedConsolidation object +func (s *SignedConsolidation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedConsolidation object with a hasher +func (s *SignedConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the PendingConsolidation object +func (p *PendingConsolidation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the PendingConsolidation object to a target array +func (p *PendingConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SourceIndex' + dst = ssz.MarshalUint64(dst, uint64(p.SourceIndex)) + + // Field (1) 'TargetIndex' + dst = ssz.MarshalUint64(dst, uint64(p.TargetIndex)) + + return +} + +// UnmarshalSSZ ssz unmarshals the PendingConsolidation object +func (p *PendingConsolidation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'SourceIndex' + p.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'TargetIndex' + p.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the PendingConsolidation object +func (p *PendingConsolidation) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the PendingConsolidation object +func (p *PendingConsolidation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the PendingConsolidation object with a hasher +func (p *PendingConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SourceIndex' + hh.PutUint64(uint64(p.SourceIndex)) + + // Field (1) 'TargetIndex' + hh.PutUint64(uint64(p.TargetIndex)) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/generated.ssz.go b/proto/prysm/v1alpha1/generated.ssz.go deleted file mode 100644 index f7836b3609b2..000000000000 --- a/proto/prysm/v1alpha1/generated.ssz.go +++ /dev/null @@ -1,20713 +0,0 @@ -// Code generated by fastssz. DO NOT EDIT. -// Hash: f1b72be7fea0fb1c1fbf8396b0e460f440ff5f7551fe46f0f9a5c7a4be634e1e -package eth - -import ( - ssz "github.com/prysmaticlabs/fastssz" - github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" - v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" -) - -// MarshalSSZ ssz marshals the Attestation object -func (a *Attestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the Attestation object to a target array -func (a *Attestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(a.AggregationBits) - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if dst, err = a.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, a.Signature...) - - // Field (0) 'AggregationBits' - if size := len(a.AggregationBits); size > 2048 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) - return - } - dst = append(dst, a.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Attestation object -func (a *Attestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(a.Signature) == 0 { - a.Signature = make([]byte, 0, len(buf[132:228])) - } - a.Signature = append(a.Signature, buf[132:228]...) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 2048); err != nil { - return err - } - if cap(a.AggregationBits) == 0 { - a.AggregationBits = make([]byte, 0, len(buf)) - } - a.AggregationBits = append(a.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Attestation object -func (a *Attestation) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AggregationBits' - size += len(a.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the Attestation object -func (a *Attestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the Attestation object with a hasher -func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(a.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(a.AggregationBits, 2048) - - // Field (1) 'Data' - if err = a.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(a.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttestationElectra object -func (a *AttestationElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttestationElectra object to a target array -func (a *AttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(236) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(a.AggregationBits) - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if dst, err = a.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'CommitteeBits' - if size := len(a.CommitteeBits); size != 8 { - err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) - return - } - dst = append(dst, a.CommitteeBits...) - - // Field (3) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, a.Signature...) - - // Field (0) 'AggregationBits' - if size := len(a.AggregationBits); size > 131072 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 131072) - return - } - dst = append(dst, a.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the AttestationElectra object -func (a *AttestationElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 236 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 236 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if a.Data == nil { - a.Data = new(AttestationData) - } - if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'CommitteeBits' - if cap(a.CommitteeBits) == 0 { - a.CommitteeBits = make([]byte, 0, len(buf[132:140])) - } - a.CommitteeBits = append(a.CommitteeBits, buf[132:140]...) - - // Field (3) 'Signature' - if cap(a.Signature) == 0 { - a.Signature = make([]byte, 0, len(buf[140:236])) - } - a.Signature = append(a.Signature, buf[140:236]...) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 131072); err != nil { - return err - } - if cap(a.AggregationBits) == 0 { - a.AggregationBits = make([]byte, 0, len(buf)) - } - a.AggregationBits = append(a.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttestationElectra object -func (a *AttestationElectra) SizeSSZ() (size int) { - size = 236 - - // Field (0) 'AggregationBits' - size += len(a.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the AttestationElectra object -func (a *AttestationElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttestationElectra object with a hasher -func (a *AttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(a.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(a.AggregationBits, 131072) - - // Field (1) 'Data' - if err = a.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'CommitteeBits' - if size := len(a.CommitteeBits); size != 8 { - err = ssz.ErrBytesLengthFn("--.CommitteeBits", size, 8) - return - } - hh.PutBytes(a.CommitteeBits) - - // Field (3) 'Signature' - if size := len(a.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(a.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AggregateAttestationAndProof object to a target array -func (a *AggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(108) - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) - - // Offset (1) 'Aggregate' - dst = ssz.WriteOffset(dst, offset) - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - offset += a.Aggregate.SizeSSZ() - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, a.SelectionProof...) - - // Field (1) 'Aggregate' - if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 108 { - return ssz.ErrSize - } - - tail := buf - var o1 uint64 - - // Field (0) 'AggregatorIndex' - a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Offset (1) 'Aggregate' - if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { - return ssz.ErrOffset - } - - if o1 < 108 { - return ssz.ErrInvalidVariableOffset - } - - // Field (2) 'SelectionProof' - if cap(a.SelectionProof) == 0 { - a.SelectionProof = make([]byte, 0, len(buf[12:108])) - } - a.SelectionProof = append(a.SelectionProof, buf[12:108]...) - - // Field (1) 'Aggregate' - { - buf = tail[o1:] - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) SizeSSZ() (size int) { - size = 108 - - // Field (1) 'Aggregate' - if a.Aggregate == nil { - a.Aggregate = new(Attestation) - } - size += a.Aggregate.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AggregateAttestationAndProof object -func (a *AggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AggregateAttestationAndProof object with a hasher -func (a *AggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(a.AggregatorIndex)) - - // Field (1) 'Aggregate' - if err = a.Aggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(a.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AggregateAttestationAndProofElectra object to a target array -func (a *AggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(108) - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) - - // Offset (1) 'Aggregate' - dst = ssz.WriteOffset(dst, offset) - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - offset += a.Aggregate.SizeSSZ() - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, a.SelectionProof...) - - // Field (1) 'Aggregate' - if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 108 { - return ssz.ErrSize - } - - tail := buf - var o1 uint64 - - // Field (0) 'AggregatorIndex' - a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Offset (1) 'Aggregate' - if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { - return ssz.ErrOffset - } - - if o1 < 108 { - return ssz.ErrInvalidVariableOffset - } - - // Field (2) 'SelectionProof' - if cap(a.SelectionProof) == 0 { - a.SelectionProof = make([]byte, 0, len(buf[12:108])) - } - a.SelectionProof = append(a.SelectionProof, buf[12:108]...) - - // Field (1) 'Aggregate' - { - buf = tail[o1:] - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) SizeSSZ() (size int) { - size = 108 - - // Field (1) 'Aggregate' - if a.Aggregate == nil { - a.Aggregate = new(AttestationElectra) - } - size += a.Aggregate.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AggregateAttestationAndProofElectra object -func (a *AggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AggregateAttestationAndProofElectra object with a hasher -func (a *AggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(a.AggregatorIndex)) - - // Field (1) 'Aggregate' - if err = a.Aggregate.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(a.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(a.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProof object to a target array -func (s *SignedAggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - offset += s.Message.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) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - 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) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(AggregateAttestationAndProof) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProof object -func (s *SignedAggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProof object with a hasher -func (s *SignedAggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProofElectra object to a target array -func (s *SignedAggregateAttestationAndProofElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - offset += s.Message.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) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - 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) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(AggregateAttestationAndProofElectra) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProofElectra object -func (s *SignedAggregateAttestationAndProofElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProofElectra object with a hasher -func (s *SignedAggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 AttestationData object -func (a *AttestationData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttestationData object to a target array -func (a *AttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(a.Slot)) - - // Field (1) 'CommitteeIndex' - dst = ssz.MarshalUint64(dst, uint64(a.CommitteeIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(a.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - dst = append(dst, a.BeaconBlockRoot...) - - // Field (3) 'Source' - if a.Source == nil { - a.Source = new(Checkpoint) - } - if dst, err = a.Source.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'Target' - if a.Target == nil { - a.Target = new(Checkpoint) - } - if dst, err = a.Target.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttestationData object -func (a *AttestationData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 128 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - a.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'CommitteeIndex' - a.CommitteeIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'BeaconBlockRoot' - if cap(a.BeaconBlockRoot) == 0 { - a.BeaconBlockRoot = make([]byte, 0, len(buf[16:48])) - } - a.BeaconBlockRoot = append(a.BeaconBlockRoot, buf[16:48]...) - - // Field (3) 'Source' - if a.Source == nil { - a.Source = new(Checkpoint) - } - if err = a.Source.UnmarshalSSZ(buf[48:88]); err != nil { - return err - } - - // Field (4) 'Target' - if a.Target == nil { - a.Target = new(Checkpoint) - } - if err = a.Target.UnmarshalSSZ(buf[88:128]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttestationData object -func (a *AttestationData) SizeSSZ() (size int) { - size = 128 - return -} - -// HashTreeRoot ssz hashes the AttestationData object -func (a *AttestationData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttestationData object with a hasher -func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(a.Slot)) - - // Field (1) 'CommitteeIndex' - hh.PutUint64(uint64(a.CommitteeIndex)) - - // Field (2) 'BeaconBlockRoot' - if size := len(a.BeaconBlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) - return - } - hh.PutBytes(a.BeaconBlockRoot) - - // Field (3) 'Source' - if err = a.Source.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'Target' - if err = a.Target.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Checkpoint object -func (c *Checkpoint) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the Checkpoint object to a target array -func (c *Checkpoint) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) - - // Field (1) 'Root' - if size := len(c.Root); size != 32 { - err = ssz.ErrBytesLengthFn("--.Root", size, 32) - return - } - dst = append(dst, c.Root...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Checkpoint object -func (c *Checkpoint) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 40 { - return ssz.ErrSize - } - - // Field (0) 'Epoch' - c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Root' - if cap(c.Root) == 0 { - c.Root = make([]byte, 0, len(buf[8:40])) - } - c.Root = append(c.Root, buf[8:40]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Checkpoint object -func (c *Checkpoint) SizeSSZ() (size int) { - size = 40 - return -} - -// HashTreeRoot ssz hashes the Checkpoint object -func (c *Checkpoint) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the Checkpoint object with a hasher -func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Epoch' - hh.PutUint64(uint64(c.Epoch)) - - // Field (1) 'Root' - if size := len(c.Root); size != 32 { - err = ssz.ErrBytesLengthFn("--.Root", size, 32) - return - } - hh.PutBytes(c.Root) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlock object -func (b *BeaconBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlock object to a target array -func (b *BeaconBlock) 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(BeaconBlockBody) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlock object -func (b *BeaconBlock) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBody) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlock object -func (b *BeaconBlock) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBody) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlock object -func (b *BeaconBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlock object with a hasher -func (b *BeaconBlock) 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 SignedBeaconBlock object -func (s *SignedBeaconBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlock object to a target array -func (s *SignedBeaconBlock) 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(BeaconBlock) - } - 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 SignedBeaconBlock object -func (s *SignedBeaconBlock) 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(BeaconBlock) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlock object -func (s *SignedBeaconBlock) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlock) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlock object -func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlock object with a hasher -func (s *SignedBeaconBlock) 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 BeaconBlockAltair object -func (b *BeaconBlockAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockAltair object to a target array -func (b *BeaconBlockAltair) 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(BeaconBlockBodyAltair) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockAltair object -func (b *BeaconBlockAltair) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyAltair) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockAltair object -func (b *BeaconBlockAltair) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyAltair) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockAltair object -func (b *BeaconBlockAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockAltair object with a hasher -func (b *BeaconBlockAltair) 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 SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockAltair object to a target array -func (s *SignedBeaconBlockAltair) 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(BeaconBlockAltair) - } - 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 SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) 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(BeaconBlockAltair) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockAltair) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockAltair object -func (s *SignedBeaconBlockAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockAltair object with a hasher -func (s *SignedBeaconBlockAltair) 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 BeaconBlockBody object -func (b *BeaconBlockBody) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBody object to a target array -func (b *BeaconBlockBody) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(220) - - // 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 (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 - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBody object -func (b *BeaconBlockBody) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 220 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7 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 < 220 { - 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 (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:] - 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 - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBody object -func (b *BeaconBlockBody) SizeSSZ() (size int) { - size = 220 - - // 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 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBody object -func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBody object with a hasher -func (b *BeaconBlockBody) 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) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyAltair object to a target array -func (b *BeaconBlockBodyAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(380) - - // 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 - } - - // 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 - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 380 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7 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 < 380 { - 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 - } - - // 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:] - 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 - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) SizeSSZ() (size int) { - size = 380 - - // 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 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyAltair object -func (b *BeaconBlockBodyAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyAltair object with a hasher -func (b *BeaconBlockBodyAltair) 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 - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ProposerSlashing object -func (p *ProposerSlashing) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the ProposerSlashing object to a target array -func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Header_1' - if p.Header_1 == nil { - p.Header_1 = new(SignedBeaconBlockHeader) - } - if dst, err = p.Header_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Header_2' - if p.Header_2 == nil { - p.Header_2 = new(SignedBeaconBlockHeader) - } - if dst, err = p.Header_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the ProposerSlashing object -func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 416 { - return ssz.ErrSize - } - - // Field (0) 'Header_1' - if p.Header_1 == nil { - p.Header_1 = new(SignedBeaconBlockHeader) - } - if err = p.Header_1.UnmarshalSSZ(buf[0:208]); err != nil { - return err - } - - // Field (1) 'Header_2' - if p.Header_2 == nil { - p.Header_2 = new(SignedBeaconBlockHeader) - } - if err = p.Header_2.UnmarshalSSZ(buf[208:416]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ProposerSlashing object -func (p *ProposerSlashing) SizeSSZ() (size int) { - size = 416 - return -} - -// HashTreeRoot ssz hashes the ProposerSlashing object -func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the ProposerSlashing object with a hasher -func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header_1' - if err = p.Header_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Header_2' - if err = p.Header_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttesterSlashing object -func (a *AttesterSlashing) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttesterSlashing object to a target array -func (a *AttesterSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(8) - - // Offset (0) 'Attestation_1' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - offset += a.Attestation_1.SizeSSZ() - - // Offset (1) 'Attestation_2' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - offset += a.Attestation_2.SizeSSZ() - - // Field (0) 'Attestation_1' - if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Attestation_2' - if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttesterSlashing object -func (a *AttesterSlashing) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 8 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Attestation_1' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 8 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'Attestation_2' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (0) 'Attestation_1' - { - buf = tail[o0:o1] - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'Attestation_2' - { - buf = tail[o1:] - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashing object -func (a *AttesterSlashing) SizeSSZ() (size int) { - size = 8 - - // Field (0) 'Attestation_1' - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestation) - } - size += a.Attestation_1.SizeSSZ() - - // Field (1) 'Attestation_2' - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestation) - } - size += a.Attestation_2.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AttesterSlashing object -func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttesterSlashing object with a hasher -func (a *AttesterSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Attestation_1' - if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Attestation_2' - if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(a) -} - -// MarshalSSZTo ssz marshals the AttesterSlashingElectra object to a target array -func (a *AttesterSlashingElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(8) - - // Offset (0) 'Attestation_1' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - offset += a.Attestation_1.SizeSSZ() - - // Offset (1) 'Attestation_2' - dst = ssz.WriteOffset(dst, offset) - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - offset += a.Attestation_2.SizeSSZ() - - // Field (0) 'Attestation_1' - if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Attestation_2' - if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 8 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Attestation_1' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 8 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'Attestation_2' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (0) 'Attestation_1' - { - buf = tail[o0:o1] - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'Attestation_2' - { - buf = tail[o1:] - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) SizeSSZ() (size int) { - size = 8 - - // Field (0) 'Attestation_1' - if a.Attestation_1 == nil { - a.Attestation_1 = new(IndexedAttestationElectra) - } - size += a.Attestation_1.SizeSSZ() - - // Field (1) 'Attestation_2' - if a.Attestation_2 == nil { - a.Attestation_2 = new(IndexedAttestationElectra) - } - size += a.Attestation_2.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the AttesterSlashingElectra object -func (a *AttesterSlashingElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(a) -} - -// HashTreeRootWith ssz hashes the AttesterSlashingElectra object with a hasher -func (a *AttesterSlashingElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Attestation_1' - if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Attestation_2' - if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Deposit object -func (d *Deposit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the Deposit object to a target array -func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Proof' - if size := len(d.Proof); size != 33 { - err = ssz.ErrVectorLengthFn("--.Proof", size, 33) - return - } - for ii := 0; ii < 33; ii++ { - if size := len(d.Proof[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.Proof[ii]", size, 32) - return - } - dst = append(dst, d.Proof[ii]...) - } - - // Field (1) 'Data' - if d.Data == nil { - d.Data = new(Deposit_Data) - } - if dst, err = d.Data.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the Deposit object -func (d *Deposit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 1240 { - return ssz.ErrSize - } - - // Field (0) 'Proof' - d.Proof = make([][]byte, 33) - for ii := 0; ii < 33; ii++ { - if cap(d.Proof[ii]) == 0 { - d.Proof[ii] = make([]byte, 0, len(buf[0:1056][ii*32:(ii+1)*32])) - } - d.Proof[ii] = append(d.Proof[ii], buf[0:1056][ii*32:(ii+1)*32]...) - } - - // Field (1) 'Data' - if d.Data == nil { - d.Data = new(Deposit_Data) - } - if err = d.Data.UnmarshalSSZ(buf[1056:1240]); err != nil { - return err - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Deposit object -func (d *Deposit) SizeSSZ() (size int) { - size = 1240 - return -} - -// HashTreeRoot ssz hashes the Deposit object -func (d *Deposit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the Deposit object with a hasher -func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Proof' - { - if size := len(d.Proof); size != 33 { - err = ssz.ErrVectorLengthFn("--.Proof", size, 33) - return - } - subIndx := hh.Index() - for _, i := range d.Proof { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'Data' - if err = d.Data.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the VoluntaryExit object -func (v *VoluntaryExit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the VoluntaryExit object to a target array -func (v *VoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(v.Epoch)) - - // Field (1) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(v.ValidatorIndex)) - - return -} - -// UnmarshalSSZ ssz unmarshals the VoluntaryExit object -func (v *VoluntaryExit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Epoch' - v.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ValidatorIndex' - v.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the VoluntaryExit object -func (v *VoluntaryExit) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the VoluntaryExit object -func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the VoluntaryExit object with a hasher -func (v *VoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Epoch' - hh.PutUint64(uint64(v.Epoch)) - - // Field (1) 'ValidatorIndex' - hh.PutUint64(uint64(v.ValidatorIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedVoluntaryExit object to a target array -func (s *SignedVoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Exit' - if s.Exit == nil { - s.Exit = new(VoluntaryExit) - } - if dst, err = s.Exit.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 112 { - return ssz.ErrSize - } - - // Field (0) 'Exit' - if s.Exit == nil { - s.Exit = new(VoluntaryExit) - } - if err = s.Exit.UnmarshalSSZ(buf[0:16]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[16:112])) - } - s.Signature = append(s.Signature, buf[16:112]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) SizeSSZ() (size int) { - size = 112 - return -} - -// HashTreeRoot ssz hashes the SignedVoluntaryExit object -func (s *SignedVoluntaryExit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedVoluntaryExit object with a hasher -func (s *SignedVoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Exit' - if err = s.Exit.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 Eth1Data object -func (e *Eth1Data) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(e) -} - -// MarshalSSZTo ssz marshals the Eth1Data object to a target array -func (e *Eth1Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'DepositRoot' - if size := len(e.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - dst = append(dst, e.DepositRoot...) - - // Field (1) 'DepositCount' - dst = ssz.MarshalUint64(dst, e.DepositCount) - - // Field (2) 'BlockHash' - if size := len(e.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - dst = append(dst, e.BlockHash...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Eth1Data object -func (e *Eth1Data) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 72 { - return ssz.ErrSize - } - - // Field (0) 'DepositRoot' - if cap(e.DepositRoot) == 0 { - e.DepositRoot = make([]byte, 0, len(buf[0:32])) - } - e.DepositRoot = append(e.DepositRoot, buf[0:32]...) - - // Field (1) 'DepositCount' - e.DepositCount = ssz.UnmarshallUint64(buf[32:40]) - - // Field (2) 'BlockHash' - if cap(e.BlockHash) == 0 { - e.BlockHash = make([]byte, 0, len(buf[40:72])) - } - e.BlockHash = append(e.BlockHash, buf[40:72]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Eth1Data object -func (e *Eth1Data) SizeSSZ() (size int) { - size = 72 - return -} - -// HashTreeRoot ssz hashes the Eth1Data object -func (e *Eth1Data) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(e) -} - -// HashTreeRootWith ssz hashes the Eth1Data object with a hasher -func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'DepositRoot' - if size := len(e.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - hh.PutBytes(e.DepositRoot) - - // Field (1) 'DepositCount' - hh.PutUint64(e.DepositCount) - - // Field (2) 'BlockHash' - if size := len(e.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - hh.PutBytes(e.BlockHash) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockHeader object -func (b *BeaconBlockHeader) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockHeader object to a target array -func (b *BeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // 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...) - - // Field (4) 'BodyRoot' - if size := len(b.BodyRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) - return - } - dst = append(dst, b.BodyRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockHeader object -func (b *BeaconBlockHeader) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 112 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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]...) - - // Field (4) 'BodyRoot' - if cap(b.BodyRoot) == 0 { - b.BodyRoot = make([]byte, 0, len(buf[80:112])) - } - b.BodyRoot = append(b.BodyRoot, buf[80:112]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockHeader object -func (b *BeaconBlockHeader) SizeSSZ() (size int) { - size = 112 - return -} - -// HashTreeRoot ssz hashes the BeaconBlockHeader object -func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher -func (b *BeaconBlockHeader) 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) 'BodyRoot' - if size := len(b.BodyRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) - return - } - hh.PutBytes(b.BodyRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockHeader object to a target array -func (s *SignedBeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Header' - if s.Header == nil { - s.Header = new(BeaconBlockHeader) - } - if dst, err = s.Header.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 208 { - return ssz.ErrSize - } - - // Field (0) 'Header' - if s.Header == nil { - s.Header = new(BeaconBlockHeader) - } - if err = s.Header.UnmarshalSSZ(buf[0:112]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[112:208])) - } - s.Signature = append(s.Signature, buf[112:208]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) SizeSSZ() (size int) { - size = 208 - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockHeader object -func (s *SignedBeaconBlockHeader) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockHeader object with a hasher -func (s *SignedBeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = s.Header.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 IndexedAttestation object -func (i *IndexedAttestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(i) -} - -// MarshalSSZTo ssz marshals the IndexedAttestation object to a target array -func (i *IndexedAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AttestingIndices' - dst = ssz.WriteOffset(dst, offset) - offset += len(i.AttestingIndices) * 8 - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if dst, err = i.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, i.Signature...) - - // Field (0) 'AttestingIndices' - if size := len(i.AttestingIndices); size > 2048 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) - return - } - for ii := 0; ii < len(i.AttestingIndices); ii++ { - dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the IndexedAttestation object -func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AttestingIndices' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(i.Signature) == 0 { - i.Signature = make([]byte, 0, len(buf[132:228])) - } - i.Signature = append(i.Signature, buf[132:228]...) - - // Field (0) 'AttestingIndices' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 8, 2048) - if err != nil { - return err - } - i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) - for ii := 0; ii < num; ii++ { - i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestation object -func (i *IndexedAttestation) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AttestingIndices' - size += len(i.AttestingIndices) * 8 - - return -} - -// HashTreeRoot ssz hashes the IndexedAttestation object -func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(i) -} - -// HashTreeRootWith ssz hashes the IndexedAttestation object with a hasher -func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AttestingIndices' - { - if size := len(i.AttestingIndices); size > 2048 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) - return - } - subIndx := hh.Index() - for _, i := range i.AttestingIndices { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(i.AttestingIndices)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) - } - } - - // Field (1) 'Data' - if err = i.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(i.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(i) -} - -// MarshalSSZTo ssz marshals the IndexedAttestationElectra object to a target array -func (i *IndexedAttestationElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(228) - - // Offset (0) 'AttestingIndices' - dst = ssz.WriteOffset(dst, offset) - offset += len(i.AttestingIndices) * 8 - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if dst, err = i.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, i.Signature...) - - // Field (0) 'AttestingIndices' - if size := len(i.AttestingIndices); size > 131072 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) - return - } - for ii := 0; ii < len(i.AttestingIndices); ii++ { - dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 228 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AttestingIndices' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 228 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if i.Data == nil { - i.Data = new(AttestationData) - } - if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'Signature' - if cap(i.Signature) == 0 { - i.Signature = make([]byte, 0, len(buf[132:228])) - } - i.Signature = append(i.Signature, buf[132:228]...) - - // Field (0) 'AttestingIndices' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 8, 131072) - if err != nil { - return err - } - i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) - for ii := 0; ii < num; ii++ { - i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) SizeSSZ() (size int) { - size = 228 - - // Field (0) 'AttestingIndices' - size += len(i.AttestingIndices) * 8 - - return -} - -// HashTreeRoot ssz hashes the IndexedAttestationElectra object -func (i *IndexedAttestationElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(i) -} - -// HashTreeRootWith ssz hashes the IndexedAttestationElectra object with a hasher -func (i *IndexedAttestationElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AttestingIndices' - { - if size := len(i.AttestingIndices); size > 131072 { - err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 131072) - return - } - subIndx := hh.Index() - for _, i := range i.AttestingIndices { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(i.AttestingIndices)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(131072, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(131072, numItems, 8)) - } - } - - // Field (1) 'Data' - if err = i.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'Signature' - if size := len(i.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(i.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncAggregate object -func (s *SyncAggregate) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncAggregate object to a target array -func (s *SyncAggregate) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SyncCommitteeBits' - if size := len(s.SyncCommitteeBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) - return - } - dst = append(dst, s.SyncCommitteeBits...) - - // Field (1) 'SyncCommitteeSignature' - if size := len(s.SyncCommitteeSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) - return - } - dst = append(dst, s.SyncCommitteeSignature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncAggregate object -func (s *SyncAggregate) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 160 { - return ssz.ErrSize - } - - // Field (0) 'SyncCommitteeBits' - if cap(s.SyncCommitteeBits) == 0 { - s.SyncCommitteeBits = make([]byte, 0, len(buf[0:64])) - } - s.SyncCommitteeBits = append(s.SyncCommitteeBits, buf[0:64]...) - - // Field (1) 'SyncCommitteeSignature' - if cap(s.SyncCommitteeSignature) == 0 { - s.SyncCommitteeSignature = make([]byte, 0, len(buf[64:160])) - } - s.SyncCommitteeSignature = append(s.SyncCommitteeSignature, buf[64:160]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregate object -func (s *SyncAggregate) SizeSSZ() (size int) { - size = 160 - return -} - -// HashTreeRoot ssz hashes the SyncAggregate object -func (s *SyncAggregate) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncAggregate object with a hasher -func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SyncCommitteeBits' - if size := len(s.SyncCommitteeBits); size != 64 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64) - return - } - hh.PutBytes(s.SyncCommitteeBits) - - // Field (1) 'SyncCommitteeSignature' - if size := len(s.SyncCommitteeSignature); size != 96 { - err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96) - return - } - hh.PutBytes(s.SyncCommitteeSignature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockBellatrix object to a target array -func (s *SignedBeaconBlockBellatrix) 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(BeaconBlockBellatrix) - } - 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 SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) 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(BeaconBlockBellatrix) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockBellatrix) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockBellatrix object -func (s *SignedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockBellatrix object with a hasher -func (s *SignedBeaconBlockBellatrix) 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 BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBellatrix object to a target array -func (b *BeaconBlockBellatrix) 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(BeaconBlockBodyBellatrix) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyBellatrix) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyBellatrix) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBellatrix object -func (b *BeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBellatrix object with a hasher -func (b *BeaconBlockBellatrix) 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 BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyBellatrix object to a target array -func (b *BeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(384) - - // 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) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - offset += b.ExecutionPayload.SizeSSZ() - - // 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) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 384 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9 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 < 384 { - 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) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - 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) 'ExecutionPayload' - { - buf = tail[o9:] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) SizeSSZ() (size int) { - size = 384 - - // 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) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayload) - } - size += b.ExecutionPayload.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyBellatrix object -func (b *BeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyBellatrix object with a hasher -func (b *BeaconBlockBodyBellatrix) 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) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockBellatrix object to a target array -func (s *SignedBlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBellatrix) - } - 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 SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBellatrix) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BlindedBeaconBlockBellatrix) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockBellatrix object -func (s *SignedBlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockBellatrix object with a hasher -func (s *SignedBlindedBeaconBlockBellatrix) 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 BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBellatrix object to a target array -func (b *BlindedBeaconBlockBellatrix) 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(BlindedBeaconBlockBodyBellatrix) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyBellatrix) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyBellatrix) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBellatrix object -func (b *BlindedBeaconBlockBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBellatrix object with a hasher -func (b *BlindedBeaconBlockBellatrix) 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 BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyBellatrix object to a target array -func (b *BlindedBeaconBlockBodyBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(384) - - // 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) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // 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) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 384 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9 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 < 384 { - 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) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - 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) 'ExecutionPayloadHeader' - { - buf = tail[o9:] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) SizeSSZ() (size int) { - size = 384 - - // 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) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyBellatrix object -func (b *BlindedBeaconBlockBodyBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyBellatrix object with a hasher -func (b *BlindedBeaconBlockBodyBellatrix) 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) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockContentsDeneb object to a target array -func (s *SignedBeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(12) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - offset += s.Block.SizeSSZ() - - // Offset (1) 'KzgProofs' - dst = ssz.WriteOffset(dst, offset) - offset += len(s.KzgProofs) * 48 - - // Offset (2) 'Blobs' - dst = ssz.WriteOffset(dst, offset) - offset += len(s.Blobs) * 131072 - - // Field (0) 'Block' - if dst, err = s.Block.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'KzgProofs' - if size := len(s.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - for ii := 0; ii < len(s.KzgProofs); ii++ { - if size := len(s.KzgProofs[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) - return - } - dst = append(dst, s.KzgProofs[ii]...) - } - - // Field (2) 'Blobs' - if size := len(s.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - for ii := 0; ii < len(s.Blobs); ii++ { - if size := len(s.Blobs[ii]); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) - return - } - dst = append(dst, s.Blobs[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 12 { - return ssz.ErrSize - } - - tail := buf - var o0, o1, o2 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 12 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'KzgProofs' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Offset (2) 'Blobs' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset - } - - // Field (0) 'Block' - { - buf = tail[o0:o1] - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'KzgProofs' - { - buf = tail[o1:o2] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - s.KzgProofs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(s.KzgProofs[ii]) == 0 { - s.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - s.KzgProofs[ii] = append(s.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (2) 'Blobs' - { - buf = tail[o2:] - num, err := ssz.DivideInt2(len(buf), 131072, 4096) - if err != nil { - return err - } - s.Blobs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(s.Blobs[ii]) == 0 { - s.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) - } - s.Blobs[ii] = append(s.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) SizeSSZ() (size int) { - size = 12 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(SignedBeaconBlockDeneb) - } - size += s.Block.SizeSSZ() - - // Field (1) 'KzgProofs' - size += len(s.KzgProofs) * 48 - - // Field (2) 'Blobs' - size += len(s.Blobs) * 131072 - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockContentsDeneb object -func (s *SignedBeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockContentsDeneb object with a hasher -func (s *SignedBeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = s.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'KzgProofs' - { - if size := len(s.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range s.KzgProofs { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(s.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Blobs' - { - if size := len(s.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range s.Blobs { - if len(i) != 131072 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(s.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockContentsDeneb object to a target array -func (b *BeaconBlockContentsDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(12) - - // Offset (0) 'Block' - dst = ssz.WriteOffset(dst, offset) - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - offset += b.Block.SizeSSZ() - - // Offset (1) 'KzgProofs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.KzgProofs) * 48 - - // Offset (2) 'Blobs' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Blobs) * 131072 - - // Field (0) 'Block' - if dst, err = b.Block.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'KzgProofs' - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - for ii := 0; ii < len(b.KzgProofs); ii++ { - if size := len(b.KzgProofs[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProofs[ii]", size, 48) - return - } - dst = append(dst, b.KzgProofs[ii]...) - } - - // Field (2) 'Blobs' - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - for ii := 0; ii < len(b.Blobs); ii++ { - if size := len(b.Blobs[ii]); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) - return - } - dst = append(dst, b.Blobs[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 12 { - return ssz.ErrSize - } - - tail := buf - var o0, o1, o2 uint64 - - // Offset (0) 'Block' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 12 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'KzgProofs' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Offset (2) 'Blobs' - if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { - return ssz.ErrOffset - } - - // Field (0) 'Block' - { - buf = tail[o0:o1] - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - if err = b.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'KzgProofs' - { - buf = tail[o1:o2] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.KzgProofs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.KzgProofs[ii]) == 0 { - b.KzgProofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.KzgProofs[ii] = append(b.KzgProofs[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (2) 'Blobs' - { - buf = tail[o2:] - num, err := ssz.DivideInt2(len(buf), 131072, 4096) - if err != nil { - return err - } - b.Blobs = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.Blobs[ii]) == 0 { - b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) - } - b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) SizeSSZ() (size int) { - size = 12 - - // Field (0) 'Block' - if b.Block == nil { - b.Block = new(BeaconBlockDeneb) - } - size += b.Block.SizeSSZ() - - // Field (1) 'KzgProofs' - size += len(b.KzgProofs) * 48 - - // Field (2) 'Blobs' - size += len(b.Blobs) * 131072 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockContentsDeneb object -func (b *BeaconBlockContentsDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockContentsDeneb object with a hasher -func (b *BeaconBlockContentsDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Block' - if err = b.Block.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'KzgProofs' - { - if size := len(b.KzgProofs); size > 4096 { - err = ssz.ErrListTooBigFn("--.KzgProofs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.KzgProofs { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.KzgProofs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Blobs' - { - if size := len(b.Blobs); size > 4096 { - err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.Blobs { - if len(i) != 131072 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.Blobs)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockDeneb object to a target array -func (s *SignedBeaconBlockDeneb) 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(BeaconBlockDeneb) - } - 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 SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) 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(BeaconBlockDeneb) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockDeneb) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockDeneb object -func (s *SignedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockDeneb object with a hasher -func (s *SignedBeaconBlockDeneb) 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 BeaconBlockDeneb object -func (b *BeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockDeneb object to a target array -func (b *BeaconBlockDeneb) 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(BeaconBlockBodyDeneb) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyDeneb) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyDeneb) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockDeneb object -func (b *BeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockDeneb object with a hasher -func (b *BeaconBlockDeneb) 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 BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyDeneb object to a target array -func (b *BeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(392) - - // 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) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // 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) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 392 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11 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 < 392 { - 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) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - 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) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - 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 (11) 'BlobKzgCommitments' - { - buf = tail[o11:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) SizeSSZ() (size int) { - size = 392 - - // 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) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadDeneb) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyDeneb object -func (b *BeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyDeneb object with a hasher -func (b *BeaconBlockBodyDeneb) 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) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockCapella object to a target array -func (s *SignedBeaconBlockCapella) 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(BeaconBlockCapella) - } - 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 SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) 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(BeaconBlockCapella) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockCapella) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockCapella object -func (s *SignedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockCapella object with a hasher -func (s *SignedBeaconBlockCapella) 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 BeaconBlockCapella object -func (b *BeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockCapella object to a target array -func (b *BeaconBlockCapella) 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(BeaconBlockBodyCapella) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockCapella object -func (b *BeaconBlockCapella) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyCapella) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockCapella object -func (b *BeaconBlockCapella) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyCapella) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockCapella object -func (b *BeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockCapella object with a hasher -func (b *BeaconBlockCapella) 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 BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyCapella object to a target array -func (b *BeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(388) - - // 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) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // 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) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 388 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10 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 < 388 { - 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) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - 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) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[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 - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) SizeSSZ() (size int) { - size = 388 - - // 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) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadCapella) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyCapella object -func (b *BeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyCapella object with a hasher -func (b *BeaconBlockBodyCapella) 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) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockCapella object to a target array -func (s *SignedBlindedBeaconBlockCapella) 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(BlindedBeaconBlockCapella) - } - 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 SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) 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(BlindedBeaconBlockCapella) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BlindedBeaconBlockCapella) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockCapella object -func (s *SignedBlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockCapella object with a hasher -func (s *SignedBlindedBeaconBlockCapella) 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 BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockCapella object to a target array -func (b *BlindedBeaconBlockCapella) 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(BlindedBeaconBlockBodyCapella) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyCapella) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyCapella) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockCapella object -func (b *BlindedBeaconBlockCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockCapella object with a hasher -func (b *BlindedBeaconBlockCapella) 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 BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyCapella object to a target array -func (b *BlindedBeaconBlockBodyCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(388) - - // 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) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // 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) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 388 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10 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 < 388 { - 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) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - 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) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[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 - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) SizeSSZ() (size int) { - size = 388 - - // 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) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyCapella object -func (b *BlindedBeaconBlockBodyCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyCapella object with a hasher -func (b *BlindedBeaconBlockBodyCapella) 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) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockDeneb object to a target array -func (s *SignedBlindedBeaconBlockDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - offset += s.Message.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) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - 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) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BlindedBeaconBlockDeneb) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockDeneb object -func (s *SignedBlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockDeneb object with a hasher -func (s *SignedBlindedBeaconBlockDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockDeneb object to a target array -func (b *BlindedBeaconBlockDeneb) 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(BlindedBeaconBlockBodyDeneb) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyDeneb) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyDeneb) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockDeneb object -func (b *BlindedBeaconBlockDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockDeneb object with a hasher -func (b *BlindedBeaconBlockDeneb) 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 BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyDeneb object to a target array -func (b *BlindedBeaconBlockBodyDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(392) - - // 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) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // 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) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 392 { - return ssz.ErrSize - } - - tail := buf - var o3, o4, o5, o6, o7, o9, o10, o11 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 < 392 { - 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) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - 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) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - 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 (11) 'BlobKzgCommitments' - { - buf = tail[o11:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) SizeSSZ() (size int) { - size = 392 - - // 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) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyDeneb object -func (b *BlindedBeaconBlockBodyDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyDeneb object with a hasher -func (b *BlindedBeaconBlockBodyDeneb) 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) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBeaconBlockElectra object to a target array -func (s *SignedBeaconBlockElectra) 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(BeaconBlockElectra) - } - 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 SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) 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(BeaconBlockElectra) - } - if err = s.Block.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Block' - if s.Block == nil { - s.Block = new(BeaconBlockElectra) - } - size += s.Block.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBeaconBlockElectra object -func (s *SignedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBeaconBlockElectra object with a hasher -func (s *SignedBeaconBlockElectra) 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 BeaconBlockElectra object -func (b *BeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockElectra object to a target array -func (b *BeaconBlockElectra) 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(BeaconBlockBodyElectra) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockElectra object -func (b *BeaconBlockElectra) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBodyElectra) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockElectra object -func (b *BeaconBlockElectra) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BeaconBlockBodyElectra) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockElectra object -func (b *BeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockElectra object with a hasher -func (b *BeaconBlockElectra) 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 BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlockBodyElectra object to a target array -func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - offset += b.ExecutionPayload.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Offset (12) 'Consolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Consolidations) * 120 - - // 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 > 1 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) - 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 > 8 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 8) - 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) 'ExecutionPayload' - if dst, err = b.ExecutionPayload.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - // Field (12) 'Consolidations' - if size := len(b.Consolidations); size > 1 { - err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) - return - } - for ii := 0; ii < len(b.Consolidations); ii++ { - if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Consolidations' - 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, 1) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashingElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashingElectra) - } - 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, 8) - if err != nil { - return err - } - b.Attestations = make([]*AttestationElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(AttestationElectra) - } - 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) 'ExecutionPayload' - { - buf = tail[o9:o10] - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - if err = b.ExecutionPayload.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - 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 (11) 'BlobKzgCommitments' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (12) 'Consolidations' - { - buf = tail[o12:] - num, err := ssz.DivideInt2(len(buf), 120, 1) - if err != nil { - return err - } - b.Consolidations = make([]*SignedConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.Consolidations[ii] == nil { - b.Consolidations[ii] = new(SignedConsolidation) - } - if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) 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) 'ExecutionPayload' - if b.ExecutionPayload == nil { - b.ExecutionPayload = new(v1.ExecutionPayloadElectra) - } - size += b.ExecutionPayload.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - // Field (12) 'Consolidations' - size += len(b.Consolidations) * 120 - - return -} - -// HashTreeRoot ssz hashes the BeaconBlockBodyElectra object -func (b *BeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlockBodyElectra object with a hasher -func (b *BeaconBlockBodyElectra) 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 > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 8 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 8) - } else { - hh.MerkleizeWithMixin(subIndx, num, 8) - } - } - - // 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) 'ExecutionPayload' - if err = b.ExecutionPayload.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (12) 'Consolidations' - { - subIndx := hh.Index() - num := uint64(len(b.Consolidations)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Consolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBlindedBeaconBlockElectra object to a target array -func (s *SignedBlindedBeaconBlockElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(100) - - // Offset (0) 'Message' - dst = ssz.WriteOffset(dst, offset) - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - offset += s.Message.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) 'Message' - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 100 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Message' - 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) 'Message' - { - buf = tail[o0:] - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - if err = s.Message.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) SizeSSZ() (size int) { - size = 100 - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BlindedBeaconBlockElectra) - } - size += s.Message.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the SignedBlindedBeaconBlockElectra object -func (s *SignedBlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBlindedBeaconBlockElectra object with a hasher -func (s *SignedBlindedBeaconBlockElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockElectra object to a target array -func (b *BlindedBeaconBlockElectra) 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(BlindedBeaconBlockBodyElectra) - } - offset += b.Body.SizeSSZ() - - // Field (4) 'Body' - if dst, err = b.Body.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'ProposerIndex' - b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BlindedBeaconBlockBodyElectra) - } - if err = b.Body.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) SizeSSZ() (size int) { - size = 84 - - // Field (4) 'Body' - if b.Body == nil { - b.Body = new(BlindedBeaconBlockBodyElectra) - } - size += b.Body.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockElectra object -func (b *BlindedBeaconBlockElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockElectra object with a hasher -func (b *BlindedBeaconBlockElectra) 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 BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlindedBeaconBlockBodyElectra object to a target array -func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - offset += b.ExecutionPayloadHeader.SizeSSZ() - - // Offset (10) 'BlsToExecutionChanges' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlsToExecutionChanges) * 172 - - // Offset (11) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Offset (12) 'Consolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Consolidations) * 120 - - // 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 > 1 { - err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 1) - 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 > 8 { - err = ssz.ErrListTooBigFn("--.Attestations", size, 8) - 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) 'ExecutionPayloadHeader' - if dst, err = b.ExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - // Field (12) 'Consolidations' - if size := len(b.Consolidations); size > 1 { - err = ssz.ErrListTooBigFn("--.Consolidations", size, 1) - return - } - for ii := 0; ii < len(b.Consolidations); ii++ { - if dst, err = b.Consolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' - if o9 = ssz.ReadOffset(buf[380:384]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Offset (10) 'BlsToExecutionChanges' - if o10 = ssz.ReadOffset(buf[384:388]); o10 > size || o9 > o10 { - return ssz.ErrOffset - } - - // Offset (11) 'BlobKzgCommitments' - if o11 = ssz.ReadOffset(buf[388:392]); o11 > size || o10 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Consolidations' - 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, 1) - if err != nil { - return err - } - b.AttesterSlashings = make([]*AttesterSlashingElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.AttesterSlashings[indx] == nil { - b.AttesterSlashings[indx] = new(AttesterSlashingElectra) - } - 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, 8) - if err != nil { - return err - } - b.Attestations = make([]*AttestationElectra, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.Attestations[indx] == nil { - b.Attestations[indx] = new(AttestationElectra) - } - 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) 'ExecutionPayloadHeader' - { - buf = tail[o9:o10] - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - if err = b.ExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (10) 'BlsToExecutionChanges' - { - buf = tail[o10:o11] - 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 (11) 'BlobKzgCommitments' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - - // Field (12) 'Consolidations' - { - buf = tail[o12:] - num, err := ssz.DivideInt2(len(buf), 120, 1) - if err != nil { - return err - } - b.Consolidations = make([]*SignedConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.Consolidations[ii] == nil { - b.Consolidations[ii] = new(SignedConsolidation) - } - if err = b.Consolidations[ii].UnmarshalSSZ(buf[ii*120 : (ii+1)*120]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) 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) 'ExecutionPayloadHeader' - if b.ExecutionPayloadHeader == nil { - b.ExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - size += b.ExecutionPayloadHeader.SizeSSZ() - - // Field (10) 'BlsToExecutionChanges' - size += len(b.BlsToExecutionChanges) * 172 - - // Field (11) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - // Field (12) 'Consolidations' - size += len(b.Consolidations) * 120 - - return -} - -// HashTreeRoot ssz hashes the BlindedBeaconBlockBodyElectra object -func (b *BlindedBeaconBlockBodyElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlindedBeaconBlockBodyElectra object with a hasher -func (b *BlindedBeaconBlockBodyElectra) 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 > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.AttesterSlashings { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - // Field (5) 'Attestations' - { - subIndx := hh.Index() - num := uint64(len(b.Attestations)) - if num > 8 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Attestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 8) - } else { - hh.MerkleizeWithMixin(subIndx, num, 8) - } - } - - // 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) 'ExecutionPayloadHeader' - if err = b.ExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (10) '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 (11) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (12) 'Consolidations' - { - subIndx := hh.Index() - num := uint64(len(b.Consolidations)) - if num > 1 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Consolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the ValidatorRegistrationV1 object to a target array -func (v *ValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'FeeRecipient' - if size := len(v.FeeRecipient); size != 20 { - err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) - return - } - dst = append(dst, v.FeeRecipient...) - - // Field (1) 'GasLimit' - dst = ssz.MarshalUint64(dst, v.GasLimit) - - // Field (2) 'Timestamp' - dst = ssz.MarshalUint64(dst, v.Timestamp) - - // Field (3) 'Pubkey' - if size := len(v.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, v.Pubkey...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 84 { - return ssz.ErrSize - } - - // Field (0) 'FeeRecipient' - if cap(v.FeeRecipient) == 0 { - v.FeeRecipient = make([]byte, 0, len(buf[0:20])) - } - v.FeeRecipient = append(v.FeeRecipient, buf[0:20]...) - - // Field (1) 'GasLimit' - v.GasLimit = ssz.UnmarshallUint64(buf[20:28]) - - // Field (2) 'Timestamp' - v.Timestamp = ssz.UnmarshallUint64(buf[28:36]) - - // Field (3) 'Pubkey' - if cap(v.Pubkey) == 0 { - v.Pubkey = make([]byte, 0, len(buf[36:84])) - } - v.Pubkey = append(v.Pubkey, buf[36:84]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) SizeSSZ() (size int) { - size = 84 - return -} - -// HashTreeRoot ssz hashes the ValidatorRegistrationV1 object -func (v *ValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the ValidatorRegistrationV1 object with a hasher -func (v *ValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'FeeRecipient' - if size := len(v.FeeRecipient); size != 20 { - err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) - return - } - hh.PutBytes(v.FeeRecipient) - - // Field (1) 'GasLimit' - hh.PutUint64(v.GasLimit) - - // Field (2) 'Timestamp' - hh.PutUint64(v.Timestamp) - - // Field (3) 'Pubkey' - if size := len(v.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(v.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedValidatorRegistrationV1 object to a target array -func (s *SignedValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ValidatorRegistrationV1) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 180 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ValidatorRegistrationV1) - } - if err = s.Message.UnmarshalSSZ(buf[0:84]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[84:180])) - } - s.Signature = append(s.Signature, buf[84:180]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) SizeSSZ() (size int) { - size = 180 - return -} - -// HashTreeRoot ssz hashes the SignedValidatorRegistrationV1 object -func (s *SignedValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedValidatorRegistrationV1 object with a hasher -func (s *SignedValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 BuilderBid object -func (b *BuilderBid) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBid object to a target array -func (b *BuilderBid) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - offset += b.Header.SizeSSZ() - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBid object -func (b *BuilderBid) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[4:36])) - } - b.Value = append(b.Value, buf[4:36]...) - - // Field (2) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[36:84])) - } - b.Pubkey = append(b.Pubkey, buf[36:84]...) - - // Field (0) 'Header' - { - buf = tail[o0:] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBid object -func (b *BuilderBid) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeader) - } - size += b.Header.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BuilderBid object -func (b *BuilderBid) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBid object with a hasher -func (b *BuilderBid) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BuilderBidCapella object -func (b *BuilderBidCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBidCapella object to a target array -func (b *BuilderBidCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.Header.SizeSSZ() - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBidCapella object -func (b *BuilderBidCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[4:36])) - } - b.Value = append(b.Value, buf[4:36]...) - - // Field (2) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[36:84])) - } - b.Pubkey = append(b.Pubkey, buf[36:84]...) - - // Field (0) 'Header' - { - buf = tail[o0:] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidCapella object -func (b *BuilderBidCapella) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.Header.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BuilderBidCapella object -func (b *BuilderBidCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBidCapella object with a hasher -func (b *BuilderBidCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (2) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BuilderBidDeneb object -func (b *BuilderBidDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BuilderBidDeneb object to a target array -func (b *BuilderBidDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(88) - - // Offset (0) 'Header' - dst = ssz.WriteOffset(dst, offset) - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.Header.SizeSSZ() - - // Offset (1) 'BlobKzgCommitments' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.BlobKzgCommitments) * 48 - - // Field (2) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - dst = append(dst, b.Value...) - - // Field (3) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - dst = append(dst, b.Pubkey...) - - // Field (0) 'Header' - if dst, err = b.Header.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'BlobKzgCommitments' - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - for ii := 0; ii < len(b.BlobKzgCommitments); ii++ { - if size := len(b.BlobKzgCommitments[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.BlobKzgCommitments[ii]", size, 48) - return - } - dst = append(dst, b.BlobKzgCommitments[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BuilderBidDeneb object -func (b *BuilderBidDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 88 { - return ssz.ErrSize - } - - tail := buf - var o0, o1 uint64 - - // Offset (0) 'Header' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 88 { - return ssz.ErrInvalidVariableOffset - } - - // Offset (1) 'BlobKzgCommitments' - if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { - return ssz.ErrOffset - } - - // Field (2) 'Value' - if cap(b.Value) == 0 { - b.Value = make([]byte, 0, len(buf[8:40])) - } - b.Value = append(b.Value, buf[8:40]...) - - // Field (3) 'Pubkey' - if cap(b.Pubkey) == 0 { - b.Pubkey = make([]byte, 0, len(buf[40:88])) - } - b.Pubkey = append(b.Pubkey, buf[40:88]...) - - // Field (0) 'Header' - { - buf = tail[o0:o1] - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.Header.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (1) 'BlobKzgCommitments' - { - buf = tail[o1:] - num, err := ssz.DivideInt2(len(buf), 48, 4096) - if err != nil { - return err - } - b.BlobKzgCommitments = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.BlobKzgCommitments[ii]) == 0 { - b.BlobKzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) - } - b.BlobKzgCommitments[ii] = append(b.BlobKzgCommitments[ii], buf[ii*48:(ii+1)*48]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BuilderBidDeneb object -func (b *BuilderBidDeneb) SizeSSZ() (size int) { - size = 88 - - // Field (0) 'Header' - if b.Header == nil { - b.Header = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.Header.SizeSSZ() - - // Field (1) 'BlobKzgCommitments' - size += len(b.BlobKzgCommitments) * 48 - - return -} - -// HashTreeRoot ssz hashes the BuilderBidDeneb object -func (b *BuilderBidDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BuilderBidDeneb object with a hasher -func (b *BuilderBidDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Header' - if err = b.Header.HashTreeRootWith(hh); err != nil { - return - } - - // Field (1) 'BlobKzgCommitments' - { - if size := len(b.BlobKzgCommitments); size > 4096 { - err = ssz.ErrListTooBigFn("--.BlobKzgCommitments", size, 4096) - return - } - subIndx := hh.Index() - for _, i := range b.BlobKzgCommitments { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - numItems := uint64(len(b.BlobKzgCommitments)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 4096) - } - } - - // Field (2) 'Value' - if size := len(b.Value); size != 32 { - err = ssz.ErrBytesLengthFn("--.Value", size, 32) - return - } - hh.PutBytes(b.Value) - - // Field (3) 'Pubkey' - if size := len(b.Pubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) - return - } - hh.PutBytes(b.Pubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecar object -func (b *BlobSidecar) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecar object to a target array -func (b *BlobSidecar) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, b.Index) - - // Field (1) 'Blob' - if size := len(b.Blob); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) - return - } - dst = append(dst, b.Blob...) - - // Field (2) 'KzgCommitment' - if size := len(b.KzgCommitment); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) - return - } - dst = append(dst, b.KzgCommitment...) - - // Field (3) 'KzgProof' - if size := len(b.KzgProof); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) - return - } - dst = append(dst, b.KzgProof...) - - // Field (4) 'SignedBlockHeader' - if b.SignedBlockHeader == nil { - b.SignedBlockHeader = new(SignedBeaconBlockHeader) - } - if dst, err = b.SignedBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'CommitmentInclusionProof' - if size := len(b.CommitmentInclusionProof); size != 17 { - err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) - return - } - for ii := 0; ii < 17; ii++ { - if size := len(b.CommitmentInclusionProof[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.CommitmentInclusionProof[ii]", size, 32) - return - } - dst = append(dst, b.CommitmentInclusionProof[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecar object -func (b *BlobSidecar) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 131928 { - return ssz.ErrSize - } - - // Field (0) 'Index' - b.Index = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Blob' - if cap(b.Blob) == 0 { - b.Blob = make([]byte, 0, len(buf[8:131080])) - } - b.Blob = append(b.Blob, buf[8:131080]...) - - // Field (2) 'KzgCommitment' - if cap(b.KzgCommitment) == 0 { - b.KzgCommitment = make([]byte, 0, len(buf[131080:131128])) - } - b.KzgCommitment = append(b.KzgCommitment, buf[131080:131128]...) - - // Field (3) 'KzgProof' - if cap(b.KzgProof) == 0 { - b.KzgProof = make([]byte, 0, len(buf[131128:131176])) - } - b.KzgProof = append(b.KzgProof, buf[131128:131176]...) - - // Field (4) 'SignedBlockHeader' - if b.SignedBlockHeader == nil { - b.SignedBlockHeader = new(SignedBeaconBlockHeader) - } - if err = b.SignedBlockHeader.UnmarshalSSZ(buf[131176:131384]); err != nil { - return err - } - - // Field (5) 'CommitmentInclusionProof' - b.CommitmentInclusionProof = make([][]byte, 17) - for ii := 0; ii < 17; ii++ { - if cap(b.CommitmentInclusionProof[ii]) == 0 { - b.CommitmentInclusionProof[ii] = make([]byte, 0, len(buf[131384:131928][ii*32:(ii+1)*32])) - } - b.CommitmentInclusionProof[ii] = append(b.CommitmentInclusionProof[ii], buf[131384:131928][ii*32:(ii+1)*32]...) - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecar object -func (b *BlobSidecar) SizeSSZ() (size int) { - size = 131928 - return -} - -// HashTreeRoot ssz hashes the BlobSidecar object -func (b *BlobSidecar) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecar object with a hasher -func (b *BlobSidecar) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(b.Index) - - // Field (1) 'Blob' - if size := len(b.Blob); size != 131072 { - err = ssz.ErrBytesLengthFn("--.Blob", size, 131072) - return - } - hh.PutBytes(b.Blob) - - // Field (2) 'KzgCommitment' - if size := len(b.KzgCommitment); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgCommitment", size, 48) - return - } - hh.PutBytes(b.KzgCommitment) - - // Field (3) 'KzgProof' - if size := len(b.KzgProof); size != 48 { - err = ssz.ErrBytesLengthFn("--.KzgProof", size, 48) - return - } - hh.PutBytes(b.KzgProof) - - // Field (4) 'SignedBlockHeader' - if err = b.SignedBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'CommitmentInclusionProof' - { - if size := len(b.CommitmentInclusionProof); size != 17 { - err = ssz.ErrVectorLengthFn("--.CommitmentInclusionProof", size, 17) - return - } - subIndx := hh.Index() - for _, i := range b.CommitmentInclusionProof { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecars object -func (b *BlobSidecars) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecars object to a target array -func (b *BlobSidecars) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(4) - - // Offset (0) 'Sidecars' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Sidecars) * 131928 - - // Field (0) 'Sidecars' - if size := len(b.Sidecars); size > 6 { - err = ssz.ErrListTooBigFn("--.Sidecars", size, 6) - return - } - for ii := 0; ii < len(b.Sidecars); ii++ { - if dst, err = b.Sidecars[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecars object -func (b *BlobSidecars) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 4 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Sidecars' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 4 { - return ssz.ErrInvalidVariableOffset - } - - // Field (0) 'Sidecars' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 131928, 6) - if err != nil { - return err - } - b.Sidecars = make([]*BlobSidecar, num) - for ii := 0; ii < num; ii++ { - if b.Sidecars[ii] == nil { - b.Sidecars[ii] = new(BlobSidecar) - } - if err = b.Sidecars[ii].UnmarshalSSZ(buf[ii*131928 : (ii+1)*131928]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecars object -func (b *BlobSidecars) SizeSSZ() (size int) { - size = 4 - - // Field (0) 'Sidecars' - size += len(b.Sidecars) * 131928 - - return -} - -// HashTreeRoot ssz hashes the BlobSidecars object -func (b *BlobSidecars) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecars object with a hasher -func (b *BlobSidecars) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Sidecars' - { - subIndx := hh.Index() - num := uint64(len(b.Sidecars)) - if num > 6 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Sidecars { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 6) - } else { - hh.MerkleizeWithMixin(subIndx, num, 6) - } - } - - 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) -} - -// MarshalSSZTo ssz marshals the Deposit_Data object to a target array -func (d *Deposit_Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, d.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, d.WithdrawalCredentials...) - - // Field (2) 'Amount' - dst = ssz.MarshalUint64(dst, d.Amount) - - // Field (3) 'Signature' - if size := len(d.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, d.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the Deposit_Data object -func (d *Deposit_Data) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 184 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(d.PublicKey) == 0 { - d.PublicKey = make([]byte, 0, len(buf[0:48])) - } - d.PublicKey = append(d.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(d.WithdrawalCredentials) == 0 { - d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'Amount' - d.Amount = ssz.UnmarshallUint64(buf[80:88]) - - // Field (3) 'Signature' - if cap(d.Signature) == 0 { - d.Signature = make([]byte, 0, len(buf[88:184])) - } - d.Signature = append(d.Signature, buf[88:184]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Deposit_Data object -func (d *Deposit_Data) SizeSSZ() (size int) { - size = 184 - return -} - -// HashTreeRoot ssz hashes the Deposit_Data object -func (d *Deposit_Data) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the Deposit_Data object with a hasher -func (d *Deposit_Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(d.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(d.WithdrawalCredentials) - - // Field (2) 'Amount' - hh.PutUint64(d.Amount) - - // Field (3) 'Signature' - if size := len(d.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - hh.PutBytes(d.Signature) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconState object -func (b *BeaconState) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconState object to a target array -func (b *BeaconState) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2687377) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochAttestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - offset += 4 - offset += b.PreviousEpochAttestations[ii].SizeSSZ() - } - - // Offset (16) 'CurrentEpochAttestations' - dst = ssz.WriteOffset(dst, offset) - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - offset += 4 - offset += b.CurrentEpochAttestations[ii].SizeSSZ() - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochAttestations' - if size := len(b.PreviousEpochAttestations); size > 4096 { - err = ssz.ErrListTooBigFn("--.PreviousEpochAttestations", size, 4096) - return - } - { - offset = 4 * len(b.PreviousEpochAttestations) - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.PreviousEpochAttestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - if dst, err = b.PreviousEpochAttestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (16) 'CurrentEpochAttestations' - if size := len(b.CurrentEpochAttestations); size > 4096 { - err = ssz.ErrListTooBigFn("--.CurrentEpochAttestations", size, 4096) - return - } - { - offset = 4 * len(b.CurrentEpochAttestations) - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - dst = ssz.WriteOffset(dst, offset) - offset += b.CurrentEpochAttestations[ii].SizeSSZ() - } - } - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - if dst, err = b.CurrentEpochAttestations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconState object -func (b *BeaconState) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2687377 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2687377 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochAttestations' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochAttestations' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochAttestations' - { - buf = tail[o15:o16] - num, err := ssz.DecodeDynamicLength(buf, 4096) - if err != nil { - return err - } - b.PreviousEpochAttestations = make([]*PendingAttestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.PreviousEpochAttestations[indx] == nil { - b.PreviousEpochAttestations[indx] = new(PendingAttestation) - } - if err = b.PreviousEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - - // Field (16) 'CurrentEpochAttestations' - { - buf = tail[o16:] - num, err := ssz.DecodeDynamicLength(buf, 4096) - if err != nil { - return err - } - b.CurrentEpochAttestations = make([]*PendingAttestation, num) - err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { - if b.CurrentEpochAttestations[indx] == nil { - b.CurrentEpochAttestations[indx] = new(PendingAttestation) - } - if err = b.CurrentEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { - return err - } - return nil - }) - if err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconState object -func (b *BeaconState) SizeSSZ() (size int) { - size = 2687377 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochAttestations' - for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { - size += 4 - size += b.PreviousEpochAttestations[ii].SizeSSZ() - } - - // Field (16) 'CurrentEpochAttestations' - for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { - size += 4 - size += b.CurrentEpochAttestations[ii].SizeSSZ() - } - - return -} - -// HashTreeRoot ssz hashes the BeaconState object -func (b *BeaconState) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconState object with a hasher -func (b *BeaconState) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochAttestations' - { - subIndx := hh.Index() - num := uint64(len(b.PreviousEpochAttestations)) - if num > 4096 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PreviousEpochAttestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, num, 4096) - } - } - - // Field (16) 'CurrentEpochAttestations' - { - subIndx := hh.Index() - num := uint64(len(b.CurrentEpochAttestations)) - if num > 4096 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.CurrentEpochAttestations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 4096) - } else { - hh.MerkleizeWithMixin(subIndx, num, 4096) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateAltair object -func (b *BeaconStateAltair) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateAltair object to a target array -func (b *BeaconStateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736629) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateAltair object -func (b *BeaconStateAltair) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736629 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736629 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateAltair object -func (b *BeaconStateAltair) SizeSSZ() (size int) { - size = 2736629 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateAltair object -func (b *BeaconStateAltair) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateAltair object with a hasher -func (b *BeaconStateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Fork object -func (f *Fork) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(f) -} - -// MarshalSSZTo ssz marshals the Fork object to a target array -func (f *Fork) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PreviousVersion' - if size := len(f.PreviousVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) - return - } - dst = append(dst, f.PreviousVersion...) - - // Field (1) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - dst = append(dst, f.CurrentVersion...) - - // Field (2) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(f.Epoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Fork object -func (f *Fork) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'PreviousVersion' - if cap(f.PreviousVersion) == 0 { - f.PreviousVersion = make([]byte, 0, len(buf[0:4])) - } - f.PreviousVersion = append(f.PreviousVersion, buf[0:4]...) - - // Field (1) 'CurrentVersion' - if cap(f.CurrentVersion) == 0 { - f.CurrentVersion = make([]byte, 0, len(buf[4:8])) - } - f.CurrentVersion = append(f.CurrentVersion, buf[4:8]...) - - // Field (2) 'Epoch' - f.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Fork object -func (f *Fork) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the Fork object -func (f *Fork) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(f) -} - -// HashTreeRootWith ssz hashes the Fork object with a hasher -func (f *Fork) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PreviousVersion' - if size := len(f.PreviousVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) - return - } - hh.PutBytes(f.PreviousVersion) - - // Field (1) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - hh.PutBytes(f.CurrentVersion) - - // Field (2) 'Epoch' - hh.PutUint64(uint64(f.Epoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingAttestation object -func (p *PendingAttestation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingAttestation object to a target array -func (p *PendingAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(148) - - // Offset (0) 'AggregationBits' - dst = ssz.WriteOffset(dst, offset) - offset += len(p.AggregationBits) - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(AttestationData) - } - if dst, err = p.Data.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'InclusionDelay' - dst = ssz.MarshalUint64(dst, uint64(p.InclusionDelay)) - - // Field (3) 'ProposerIndex' - dst = ssz.MarshalUint64(dst, uint64(p.ProposerIndex)) - - // Field (0) 'AggregationBits' - if size := len(p.AggregationBits); size > 2048 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) - return - } - dst = append(dst, p.AggregationBits...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingAttestation object -func (p *PendingAttestation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 148 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'AggregationBits' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 148 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'Data' - if p.Data == nil { - p.Data = new(AttestationData) - } - if err = p.Data.UnmarshalSSZ(buf[4:132]); err != nil { - return err - } - - // Field (2) 'InclusionDelay' - p.InclusionDelay = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[132:140])) - - // Field (3) 'ProposerIndex' - p.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[140:148])) - - // Field (0) 'AggregationBits' - { - buf = tail[o0:] - if err = ssz.ValidateBitlist(buf, 2048); err != nil { - return err - } - if cap(p.AggregationBits) == 0 { - p.AggregationBits = make([]byte, 0, len(buf)) - } - p.AggregationBits = append(p.AggregationBits, buf...) - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingAttestation object -func (p *PendingAttestation) SizeSSZ() (size int) { - size = 148 - - // Field (0) 'AggregationBits' - size += len(p.AggregationBits) - - return -} - -// HashTreeRoot ssz hashes the PendingAttestation object -func (p *PendingAttestation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingAttestation object with a hasher -func (p *PendingAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregationBits' - if len(p.AggregationBits) == 0 { - err = ssz.ErrEmptyBitlist - return - } - hh.PutBitlist(p.AggregationBits, 2048) - - // Field (1) 'Data' - if err = p.Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'InclusionDelay' - hh.PutUint64(uint64(p.InclusionDelay)) - - // Field (3) 'ProposerIndex' - hh.PutUint64(uint64(p.ProposerIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the HistoricalBatch object -func (h *HistoricalBatch) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(h) -} - -// MarshalSSZTo ssz marshals the HistoricalBatch object to a target array -func (h *HistoricalBatch) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockRoots' - if size := len(h.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(h.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, h.BlockRoots[ii]...) - } - - // Field (1) 'StateRoots' - if size := len(h.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(h.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, h.StateRoots[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the HistoricalBatch object -func (h *HistoricalBatch) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 524288 { - return ssz.ErrSize - } - - // Field (0) 'BlockRoots' - h.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(h.BlockRoots[ii]) == 0 { - h.BlockRoots[ii] = make([]byte, 0, len(buf[0:262144][ii*32:(ii+1)*32])) - } - h.BlockRoots[ii] = append(h.BlockRoots[ii], buf[0:262144][ii*32:(ii+1)*32]...) - } - - // Field (1) 'StateRoots' - h.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(h.StateRoots[ii]) == 0 { - h.StateRoots[ii] = make([]byte, 0, len(buf[262144:524288][ii*32:(ii+1)*32])) - } - h.StateRoots[ii] = append(h.StateRoots[ii], buf[262144:524288][ii*32:(ii+1)*32]...) - } - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the HistoricalBatch object -func (h *HistoricalBatch) SizeSSZ() (size int) { - size = 524288 - return -} - -// HashTreeRoot ssz hashes the HistoricalBatch object -func (h *HistoricalBatch) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(h) -} - -// HashTreeRootWith ssz hashes the HistoricalBatch object with a hasher -func (h *HistoricalBatch) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockRoots' - { - if size := len(h.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range h.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'StateRoots' - { - if size := len(h.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range h.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SigningData object -func (s *SigningData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SigningData object to a target array -func (s *SigningData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ObjectRoot' - if size := len(s.ObjectRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) - return - } - dst = append(dst, s.ObjectRoot...) - - // Field (1) 'Domain' - if size := len(s.Domain); size != 32 { - err = ssz.ErrBytesLengthFn("--.Domain", size, 32) - return - } - dst = append(dst, s.Domain...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SigningData object -func (s *SigningData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 64 { - return ssz.ErrSize - } - - // Field (0) 'ObjectRoot' - if cap(s.ObjectRoot) == 0 { - s.ObjectRoot = make([]byte, 0, len(buf[0:32])) - } - s.ObjectRoot = append(s.ObjectRoot, buf[0:32]...) - - // Field (1) 'Domain' - if cap(s.Domain) == 0 { - s.Domain = make([]byte, 0, len(buf[32:64])) - } - s.Domain = append(s.Domain, buf[32:64]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SigningData object -func (s *SigningData) SizeSSZ() (size int) { - size = 64 - return -} - -// HashTreeRoot ssz hashes the SigningData object -func (s *SigningData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SigningData object with a hasher -func (s *SigningData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ObjectRoot' - if size := len(s.ObjectRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) - return - } - hh.PutBytes(s.ObjectRoot) - - // Field (1) 'Domain' - if size := len(s.Domain); size != 32 { - err = ssz.ErrBytesLengthFn("--.Domain", size, 32) - return - } - hh.PutBytes(s.Domain) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ForkData object -func (f *ForkData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(f) -} - -// MarshalSSZTo ssz marshals the ForkData object to a target array -func (f *ForkData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - dst = append(dst, f.CurrentVersion...) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(f.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, f.GenesisValidatorsRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ForkData object -func (f *ForkData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 36 { - return ssz.ErrSize - } - - // Field (0) 'CurrentVersion' - if cap(f.CurrentVersion) == 0 { - f.CurrentVersion = make([]byte, 0, len(buf[0:4])) - } - f.CurrentVersion = append(f.CurrentVersion, buf[0:4]...) - - // Field (1) 'GenesisValidatorsRoot' - if cap(f.GenesisValidatorsRoot) == 0 { - f.GenesisValidatorsRoot = make([]byte, 0, len(buf[4:36])) - } - f.GenesisValidatorsRoot = append(f.GenesisValidatorsRoot, buf[4:36]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ForkData object -func (f *ForkData) SizeSSZ() (size int) { - size = 36 - return -} - -// HashTreeRoot ssz hashes the ForkData object -func (f *ForkData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(f) -} - -// HashTreeRootWith ssz hashes the ForkData object with a hasher -func (f *ForkData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'CurrentVersion' - if size := len(f.CurrentVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) - return - } - hh.PutBytes(f.CurrentVersion) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(f.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(f.GenesisValidatorsRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the DepositMessage object -func (d *DepositMessage) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the DepositMessage object to a target array -func (d *DepositMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, d.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, d.WithdrawalCredentials...) - - // Field (2) 'Amount' - dst = ssz.MarshalUint64(dst, d.Amount) - - return -} - -// UnmarshalSSZ ssz unmarshals the DepositMessage object -func (d *DepositMessage) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 88 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(d.PublicKey) == 0 { - d.PublicKey = make([]byte, 0, len(buf[0:48])) - } - d.PublicKey = append(d.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(d.WithdrawalCredentials) == 0 { - d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'Amount' - d.Amount = ssz.UnmarshallUint64(buf[80:88]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the DepositMessage object -func (d *DepositMessage) SizeSSZ() (size int) { - size = 88 - return -} - -// HashTreeRoot ssz hashes the DepositMessage object -func (d *DepositMessage) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the DepositMessage object with a hasher -func (d *DepositMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(d.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(d.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(d.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(d.WithdrawalCredentials) - - // Field (2) 'Amount' - hh.PutUint64(d.Amount) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncCommittee object -func (s *SyncCommittee) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommittee object to a target array -func (s *SyncCommittee) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Pubkeys' - if size := len(s.Pubkeys); size != 512 { - err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) - return - } - for ii := 0; ii < 512; ii++ { - if size := len(s.Pubkeys[ii]); size != 48 { - err = ssz.ErrBytesLengthFn("--.Pubkeys[ii]", size, 48) - return - } - dst = append(dst, s.Pubkeys[ii]...) - } - - // Field (1) 'AggregatePubkey' - if size := len(s.AggregatePubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) - return - } - dst = append(dst, s.AggregatePubkey...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommittee object -func (s *SyncCommittee) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24624 { - return ssz.ErrSize - } - - // Field (0) 'Pubkeys' - s.Pubkeys = make([][]byte, 512) - for ii := 0; ii < 512; ii++ { - if cap(s.Pubkeys[ii]) == 0 { - s.Pubkeys[ii] = make([]byte, 0, len(buf[0:24576][ii*48:(ii+1)*48])) - } - s.Pubkeys[ii] = append(s.Pubkeys[ii], buf[0:24576][ii*48:(ii+1)*48]...) - } - - // Field (1) 'AggregatePubkey' - if cap(s.AggregatePubkey) == 0 { - s.AggregatePubkey = make([]byte, 0, len(buf[24576:24624])) - } - s.AggregatePubkey = append(s.AggregatePubkey, buf[24576:24624]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommittee object -func (s *SyncCommittee) SizeSSZ() (size int) { - size = 24624 - return -} - -// HashTreeRoot ssz hashes the SyncCommittee object -func (s *SyncCommittee) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommittee object with a hasher -func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Pubkeys' - { - if size := len(s.Pubkeys); size != 512 { - err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512) - return - } - subIndx := hh.Index() - for _, i := range s.Pubkeys { - if len(i) != 48 { - err = ssz.ErrBytesLength - return - } - hh.PutBytes(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (1) 'AggregatePubkey' - if size := len(s.AggregatePubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48) - return - } - hh.PutBytes(s.AggregatePubkey) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncAggregatorSelectionData object to a target array -func (s *SyncAggregatorSelectionData) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'SubcommitteeIndex' - dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'SubcommitteeIndex' - s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the SyncAggregatorSelectionData object -func (s *SyncAggregatorSelectionData) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncAggregatorSelectionData object with a hasher -func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'SubcommitteeIndex' - hh.PutUint64(s.SubcommitteeIndex) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateBellatrix object to a target array -func (b *BeaconStateBellatrix) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736633) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736633 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736633 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) SizeSSZ() (size int) { - size = 2736633 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeader) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - return -} - -// HashTreeRoot ssz hashes the BeaconStateBellatrix object -func (b *BeaconStateBellatrix) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateBellatrix object with a hasher -func (b *BeaconStateBellatrix) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateCapella object -func (b *BeaconStateCapella) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateCapella object to a target array -func (b *BeaconStateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736653) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateCapella object -func (b *BeaconStateCapella) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736653 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736653 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateCapella object -func (b *BeaconStateCapella) SizeSSZ() (size int) { - size = 2736653 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderCapella) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateCapella object -func (b *BeaconStateCapella) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateCapella object with a hasher -func (b *BeaconStateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateDeneb object -func (b *BeaconStateDeneb) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateDeneb object to a target array -func (b *BeaconStateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736653) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateDeneb object -func (b *BeaconStateDeneb) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736653 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736653 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateDeneb object -func (b *BeaconStateDeneb) SizeSSZ() (size int) { - size = 2736653 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderDeneb) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateDeneb object -func (b *BeaconStateDeneb) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateDeneb object with a hasher -func (b *BeaconStateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconStateElectra object -func (b *BeaconStateElectra) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconStateElectra object to a target array -func (b *BeaconStateElectra) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(2736713) - - // Field (0) 'GenesisTime' - dst = ssz.MarshalUint64(dst, b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - dst = append(dst, b.GenesisValidatorsRoot...) - - // Field (2) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(b.Slot)) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (5) 'BlockRoots' - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.BlockRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) - return - } - dst = append(dst, b.BlockRoots[ii]...) - } - - // Field (6) 'StateRoots' - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - if size := len(b.StateRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) - return - } - dst = append(dst, b.StateRoots[ii]...) - } - - // Offset (7) 'HistoricalRoots' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalRoots) * 32 - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (9) 'Eth1DataVotes' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Eth1DataVotes) * 72 - - // Field (10) 'Eth1DepositIndex' - dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) - - // Offset (11) 'Validators' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Validators) * 121 - - // Offset (12) 'Balances' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.Balances) * 8 - - // Field (13) 'RandaoMixes' - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - for ii := 0; ii < 65536; ii++ { - if size := len(b.RandaoMixes[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) - return - } - dst = append(dst, b.RandaoMixes[ii]...) - } - - // Field (14) 'Slashings' - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - for ii := 0; ii < 8192; ii++ { - dst = ssz.MarshalUint64(dst, b.Slashings[ii]) - } - - // Offset (15) 'PreviousEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PreviousEpochParticipation) - - // Offset (16) 'CurrentEpochParticipation' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.CurrentEpochParticipation) - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - dst = append(dst, b.JustificationBits...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (21) 'InactivityScores' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.InactivityScores) * 8 - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil { - return - } - - // Offset (24) 'LatestExecutionPayloadHeader' - dst = ssz.WriteOffset(dst, offset) - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - offset += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (25) 'NextWithdrawalIndex' - dst = ssz.MarshalUint64(dst, b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.NextWithdrawalValidatorIndex)) - - // Offset (27) 'HistoricalSummaries' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.HistoricalSummaries) * 64 - - // Field (28) 'DepositRequestsStartIndex' - dst = ssz.MarshalUint64(dst, b.DepositRequestsStartIndex) - - // Field (29) 'DepositBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.DepositBalanceToConsume)) - - // Field (30) 'ExitBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ExitBalanceToConsume)) - - // Field (31) 'EarliestExitEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestExitEpoch)) - - // Field (32) 'ConsolidationBalanceToConsume' - dst = ssz.MarshalUint64(dst, uint64(b.ConsolidationBalanceToConsume)) - - // Field (33) 'EarliestConsolidationEpoch' - dst = ssz.MarshalUint64(dst, uint64(b.EarliestConsolidationEpoch)) - - // Offset (34) 'PendingBalanceDeposits' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingBalanceDeposits) * 16 - - // Offset (35) 'PendingPartialWithdrawals' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingPartialWithdrawals) * 24 - - // Offset (36) 'PendingConsolidations' - dst = ssz.WriteOffset(dst, offset) - offset += len(b.PendingConsolidations) * 16 - - // Field (7) 'HistoricalRoots' - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalRoots); ii++ { - if size := len(b.HistoricalRoots[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) - return - } - dst = append(dst, b.HistoricalRoots[ii]...) - } - - // Field (9) 'Eth1DataVotes' - if size := len(b.Eth1DataVotes); size > 2048 { - err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) - return - } - for ii := 0; ii < len(b.Eth1DataVotes); ii++ { - if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (11) 'Validators' - if size := len(b.Validators); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Validators); ii++ { - if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (12) 'Balances' - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - for ii := 0; ii < len(b.Balances); ii++ { - dst = ssz.MarshalUint64(dst, b.Balances[ii]) - } - - // Field (15) 'PreviousEpochParticipation' - if size := len(b.PreviousEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.PreviousEpochParticipation...) - - // Field (16) 'CurrentEpochParticipation' - if size := len(b.CurrentEpochParticipation); size > 1099511627776 { - err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776) - return - } - dst = append(dst, b.CurrentEpochParticipation...) - - // Field (21) 'InactivityScores' - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - for ii := 0; ii < len(b.InactivityScores); ii++ { - dst = ssz.MarshalUint64(dst, b.InactivityScores[ii]) - } - - // Field (24) 'LatestExecutionPayloadHeader' - if dst, err = b.LatestExecutionPayloadHeader.MarshalSSZTo(dst); err != nil { - return - } - - // Field (27) 'HistoricalSummaries' - if size := len(b.HistoricalSummaries); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalSummaries", size, 16777216) - return - } - for ii := 0; ii < len(b.HistoricalSummaries); ii++ { - if dst, err = b.HistoricalSummaries[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (34) 'PendingBalanceDeposits' - if size := len(b.PendingBalanceDeposits); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingBalanceDeposits", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingBalanceDeposits); ii++ { - if dst, err = b.PendingBalanceDeposits[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (35) 'PendingPartialWithdrawals' - if size := len(b.PendingPartialWithdrawals); size > 134217728 { - err = ssz.ErrListTooBigFn("--.PendingPartialWithdrawals", size, 134217728) - return - } - for ii := 0; ii < len(b.PendingPartialWithdrawals); ii++ { - if dst, err = b.PendingPartialWithdrawals[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - // Field (36) 'PendingConsolidations' - if size := len(b.PendingConsolidations); size > 262144 { - err = ssz.ErrListTooBigFn("--.PendingConsolidations", size, 262144) - return - } - for ii := 0; ii < len(b.PendingConsolidations); ii++ { - if dst, err = b.PendingConsolidations[ii].MarshalSSZTo(dst); err != nil { - return - } - } - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconStateElectra object -func (b *BeaconStateElectra) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 2736713 { - return ssz.ErrSize - } - - tail := buf - var o7, o9, o11, o12, o15, o16, o21, o24, o27, o34, o35, o36 uint64 - - // Field (0) 'GenesisTime' - b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'GenesisValidatorsRoot' - if cap(b.GenesisValidatorsRoot) == 0 { - b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) - } - b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) - - // Field (2) 'Slot' - b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Fork' - if b.Fork == nil { - b.Fork = new(Fork) - } - if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { - return err - } - - // Field (4) 'LatestBlockHeader' - if b.LatestBlockHeader == nil { - b.LatestBlockHeader = new(BeaconBlockHeader) - } - if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { - return err - } - - // Field (5) 'BlockRoots' - b.BlockRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.BlockRoots[ii]) == 0 { - b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) - } - b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) - } - - // Field (6) 'StateRoots' - b.StateRoots = make([][]byte, 8192) - for ii := 0; ii < 8192; ii++ { - if cap(b.StateRoots[ii]) == 0 { - b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) - } - b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) - } - - // Offset (7) 'HistoricalRoots' - if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { - return ssz.ErrOffset - } - - if o7 < 2736713 { - return ssz.ErrInvalidVariableOffset - } - - // Field (8) 'Eth1Data' - if b.Eth1Data == nil { - b.Eth1Data = new(Eth1Data) - } - if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { - return err - } - - // Offset (9) 'Eth1DataVotes' - if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { - return ssz.ErrOffset - } - - // Field (10) 'Eth1DepositIndex' - b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) - - // Offset (11) 'Validators' - if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { - return ssz.ErrOffset - } - - // Offset (12) 'Balances' - if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { - return ssz.ErrOffset - } - - // Field (13) 'RandaoMixes' - b.RandaoMixes = make([][]byte, 65536) - for ii := 0; ii < 65536; ii++ { - if cap(b.RandaoMixes[ii]) == 0 { - b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) - } - b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) - } - - // Field (14) 'Slashings' - b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) - for ii := 0; ii < 8192; ii++ { - b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) - } - - // Offset (15) 'PreviousEpochParticipation' - if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { - return ssz.ErrOffset - } - - // Offset (16) 'CurrentEpochParticipation' - if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { - return ssz.ErrOffset - } - - // Field (17) 'JustificationBits' - if cap(b.JustificationBits) == 0 { - b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) - } - b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) - - // Field (18) 'PreviousJustifiedCheckpoint' - if b.PreviousJustifiedCheckpoint == nil { - b.PreviousJustifiedCheckpoint = new(Checkpoint) - } - if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { - return err - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if b.CurrentJustifiedCheckpoint == nil { - b.CurrentJustifiedCheckpoint = new(Checkpoint) - } - if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { - return err - } - - // Field (20) 'FinalizedCheckpoint' - if b.FinalizedCheckpoint == nil { - b.FinalizedCheckpoint = new(Checkpoint) - } - if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { - return err - } - - // Offset (21) 'InactivityScores' - if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 { - return ssz.ErrOffset - } - - // Field (22) 'CurrentSyncCommittee' - if b.CurrentSyncCommittee == nil { - b.CurrentSyncCommittee = new(SyncCommittee) - } - if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil { - return err - } - - // Field (23) 'NextSyncCommittee' - if b.NextSyncCommittee == nil { - b.NextSyncCommittee = new(SyncCommittee) - } - if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil { - return err - } - - // Offset (24) 'LatestExecutionPayloadHeader' - if o24 = ssz.ReadOffset(buf[2736629:2736633]); o24 > size || o21 > o24 { - return ssz.ErrOffset - } - - // Field (25) 'NextWithdrawalIndex' - b.NextWithdrawalIndex = ssz.UnmarshallUint64(buf[2736633:2736641]) - - // Field (26) 'NextWithdrawalValidatorIndex' - b.NextWithdrawalValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[2736641:2736649])) - - // Offset (27) 'HistoricalSummaries' - if o27 = ssz.ReadOffset(buf[2736649:2736653]); o27 > size || o24 > o27 { - return ssz.ErrOffset - } - - // Field (28) 'DepositRequestsStartIndex' - b.DepositRequestsStartIndex = ssz.UnmarshallUint64(buf[2736653:2736661]) - - // Field (29) 'DepositBalanceToConsume' - b.DepositBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736661:2736669])) - - // Field (30) 'ExitBalanceToConsume' - b.ExitBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736669:2736677])) - - // Field (31) 'EarliestExitEpoch' - b.EarliestExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736677:2736685])) - - // Field (32) 'ConsolidationBalanceToConsume' - b.ConsolidationBalanceToConsume = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Gwei(ssz.UnmarshallUint64(buf[2736685:2736693])) - - // Field (33) 'EarliestConsolidationEpoch' - b.EarliestConsolidationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[2736693:2736701])) - - // Offset (34) 'PendingBalanceDeposits' - if o34 = ssz.ReadOffset(buf[2736701:2736705]); o34 > size || o27 > o34 { - return ssz.ErrOffset - } - - // Offset (35) 'PendingPartialWithdrawals' - if o35 = ssz.ReadOffset(buf[2736705:2736709]); o35 > size || o34 > o35 { - return ssz.ErrOffset - } - - // Offset (36) 'PendingConsolidations' - if o36 = ssz.ReadOffset(buf[2736709:2736713]); o36 > size || o35 > o36 { - return ssz.ErrOffset - } - - // Field (7) 'HistoricalRoots' - { - buf = tail[o7:o9] - num, err := ssz.DivideInt2(len(buf), 32, 16777216) - if err != nil { - return err - } - b.HistoricalRoots = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(b.HistoricalRoots[ii]) == 0 { - b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) - } - } - - // Field (9) 'Eth1DataVotes' - { - buf = tail[o9:o11] - num, err := ssz.DivideInt2(len(buf), 72, 2048) - if err != nil { - return err - } - b.Eth1DataVotes = make([]*Eth1Data, num) - for ii := 0; ii < num; ii++ { - if b.Eth1DataVotes[ii] == nil { - b.Eth1DataVotes[ii] = new(Eth1Data) - } - if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { - return err - } - } - } - - // Field (11) 'Validators' - { - buf = tail[o11:o12] - num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) - if err != nil { - return err - } - b.Validators = make([]*Validator, num) - for ii := 0; ii < num; ii++ { - if b.Validators[ii] == nil { - b.Validators[ii] = new(Validator) - } - if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { - return err - } - } - } - - // Field (12) 'Balances' - { - buf = tail[o12:o15] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.Balances = ssz.ExtendUint64(b.Balances, num) - for ii := 0; ii < num; ii++ { - b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - buf = tail[o15:o16] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.PreviousEpochParticipation) == 0 { - b.PreviousEpochParticipation = make([]byte, 0, len(buf)) - } - b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...) - } - - // Field (16) 'CurrentEpochParticipation' - { - buf = tail[o16:o21] - if len(buf) > 1099511627776 { - return ssz.ErrBytesLength - } - if cap(b.CurrentEpochParticipation) == 0 { - b.CurrentEpochParticipation = make([]byte, 0, len(buf)) - } - b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...) - } - - // Field (21) 'InactivityScores' - { - buf = tail[o21:o24] - num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) - if err != nil { - return err - } - b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num) - for ii := 0; ii < num; ii++ { - b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) - } - } - - // Field (24) 'LatestExecutionPayloadHeader' - { - buf = tail[o24:o27] - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - if err = b.LatestExecutionPayloadHeader.UnmarshalSSZ(buf); err != nil { - return err - } - } - - // Field (27) 'HistoricalSummaries' - { - buf = tail[o27:o34] - num, err := ssz.DivideInt2(len(buf), 64, 16777216) - if err != nil { - return err - } - b.HistoricalSummaries = make([]*HistoricalSummary, num) - for ii := 0; ii < num; ii++ { - if b.HistoricalSummaries[ii] == nil { - b.HistoricalSummaries[ii] = new(HistoricalSummary) - } - if err = b.HistoricalSummaries[ii].UnmarshalSSZ(buf[ii*64 : (ii+1)*64]); err != nil { - return err - } - } - } - - // Field (34) 'PendingBalanceDeposits' - { - buf = tail[o34:o35] - num, err := ssz.DivideInt2(len(buf), 16, 134217728) - if err != nil { - return err - } - b.PendingBalanceDeposits = make([]*PendingBalanceDeposit, num) - for ii := 0; ii < num; ii++ { - if b.PendingBalanceDeposits[ii] == nil { - b.PendingBalanceDeposits[ii] = new(PendingBalanceDeposit) - } - if err = b.PendingBalanceDeposits[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - - // Field (35) 'PendingPartialWithdrawals' - { - buf = tail[o35:o36] - num, err := ssz.DivideInt2(len(buf), 24, 134217728) - if err != nil { - return err - } - b.PendingPartialWithdrawals = make([]*PendingPartialWithdrawal, num) - for ii := 0; ii < num; ii++ { - if b.PendingPartialWithdrawals[ii] == nil { - b.PendingPartialWithdrawals[ii] = new(PendingPartialWithdrawal) - } - if err = b.PendingPartialWithdrawals[ii].UnmarshalSSZ(buf[ii*24 : (ii+1)*24]); err != nil { - return err - } - } - } - - // Field (36) 'PendingConsolidations' - { - buf = tail[o36:] - num, err := ssz.DivideInt2(len(buf), 16, 262144) - if err != nil { - return err - } - b.PendingConsolidations = make([]*PendingConsolidation, num) - for ii := 0; ii < num; ii++ { - if b.PendingConsolidations[ii] == nil { - b.PendingConsolidations[ii] = new(PendingConsolidation) - } - if err = b.PendingConsolidations[ii].UnmarshalSSZ(buf[ii*16 : (ii+1)*16]); err != nil { - return err - } - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateElectra object -func (b *BeaconStateElectra) SizeSSZ() (size int) { - size = 2736713 - - // Field (7) 'HistoricalRoots' - size += len(b.HistoricalRoots) * 32 - - // Field (9) 'Eth1DataVotes' - size += len(b.Eth1DataVotes) * 72 - - // Field (11) 'Validators' - size += len(b.Validators) * 121 - - // Field (12) 'Balances' - size += len(b.Balances) * 8 - - // Field (15) 'PreviousEpochParticipation' - size += len(b.PreviousEpochParticipation) - - // Field (16) 'CurrentEpochParticipation' - size += len(b.CurrentEpochParticipation) - - // Field (21) 'InactivityScores' - size += len(b.InactivityScores) * 8 - - // Field (24) 'LatestExecutionPayloadHeader' - if b.LatestExecutionPayloadHeader == nil { - b.LatestExecutionPayloadHeader = new(v1.ExecutionPayloadHeaderElectra) - } - size += b.LatestExecutionPayloadHeader.SizeSSZ() - - // Field (27) 'HistoricalSummaries' - size += len(b.HistoricalSummaries) * 64 - - // Field (34) 'PendingBalanceDeposits' - size += len(b.PendingBalanceDeposits) * 16 - - // Field (35) 'PendingPartialWithdrawals' - size += len(b.PendingPartialWithdrawals) * 24 - - // Field (36) 'PendingConsolidations' - size += len(b.PendingConsolidations) * 16 - - return -} - -// HashTreeRoot ssz hashes the BeaconStateElectra object -func (b *BeaconStateElectra) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconStateElectra object with a hasher -func (b *BeaconStateElectra) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'GenesisTime' - hh.PutUint64(b.GenesisTime) - - // Field (1) 'GenesisValidatorsRoot' - if size := len(b.GenesisValidatorsRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) - return - } - hh.PutBytes(b.GenesisValidatorsRoot) - - // Field (2) 'Slot' - hh.PutUint64(uint64(b.Slot)) - - // Field (3) 'Fork' - if err = b.Fork.HashTreeRootWith(hh); err != nil { - return - } - - // Field (4) 'LatestBlockHeader' - if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (5) 'BlockRoots' - { - if size := len(b.BlockRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.BlockRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (6) 'StateRoots' - { - if size := len(b.StateRoots); size != 8192 { - err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.StateRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (7) 'HistoricalRoots' - { - if size := len(b.HistoricalRoots); size > 16777216 { - err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) - return - } - subIndx := hh.Index() - for _, i := range b.HistoricalRoots { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(b.HistoricalRoots)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 16777216) - } - } - - // Field (8) 'Eth1Data' - if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { - return - } - - // Field (9) 'Eth1DataVotes' - { - subIndx := hh.Index() - num := uint64(len(b.Eth1DataVotes)) - if num > 2048 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Eth1DataVotes { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 2048) - } else { - hh.MerkleizeWithMixin(subIndx, num, 2048) - } - } - - // Field (10) 'Eth1DepositIndex' - hh.PutUint64(b.Eth1DepositIndex) - - // Field (11) 'Validators' - { - subIndx := hh.Index() - num := uint64(len(b.Validators)) - if num > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.Validators { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 1099511627776) - } else { - hh.MerkleizeWithMixin(subIndx, num, 1099511627776) - } - } - - // Field (12) 'Balances' - { - if size := len(b.Balances); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.Balances { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.Balances)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (13) 'RandaoMixes' - { - if size := len(b.RandaoMixes); size != 65536 { - err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) - return - } - subIndx := hh.Index() - for _, i := range b.RandaoMixes { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (14) 'Slashings' - { - if size := len(b.Slashings); size != 8192 { - err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) - return - } - subIndx := hh.Index() - for _, i := range b.Slashings { - hh.AppendUint64(i) - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(subIndx) - } else { - hh.Merkleize(subIndx) - } - } - - // Field (15) 'PreviousEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.PreviousEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.PreviousEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (16) 'CurrentEpochParticipation' - { - elemIndx := hh.Index() - byteLen := uint64(len(b.CurrentEpochParticipation)) - if byteLen > 1099511627776 { - err = ssz.ErrIncorrectListSize - return - } - hh.PutBytes(b.CurrentEpochParticipation) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(elemIndx, byteLen, (1099511627776+31)/32) - } else { - hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32) - } - } - - // Field (17) 'JustificationBits' - if size := len(b.JustificationBits); size != 1 { - err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) - return - } - hh.PutBytes(b.JustificationBits) - - // Field (18) 'PreviousJustifiedCheckpoint' - if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (19) 'CurrentJustifiedCheckpoint' - if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (20) 'FinalizedCheckpoint' - if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { - return - } - - // Field (21) 'InactivityScores' - { - if size := len(b.InactivityScores); size > 1099511627776 { - err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776) - return - } - subIndx := hh.Index() - for _, i := range b.InactivityScores { - hh.AppendUint64(i) - } - hh.FillUpTo32() - - numItems := uint64(len(b.InactivityScores)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) - } - } - - // Field (22) 'CurrentSyncCommittee' - if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (23) 'NextSyncCommittee' - if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil { - return - } - - // Field (24) 'LatestExecutionPayloadHeader' - if err = b.LatestExecutionPayloadHeader.HashTreeRootWith(hh); err != nil { - return - } - - // Field (25) 'NextWithdrawalIndex' - hh.PutUint64(b.NextWithdrawalIndex) - - // Field (26) 'NextWithdrawalValidatorIndex' - hh.PutUint64(uint64(b.NextWithdrawalValidatorIndex)) - - // Field (27) 'HistoricalSummaries' - { - subIndx := hh.Index() - num := uint64(len(b.HistoricalSummaries)) - if num > 16777216 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.HistoricalSummaries { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 16777216) - } else { - hh.MerkleizeWithMixin(subIndx, num, 16777216) - } - } - - // Field (28) 'DepositRequestsStartIndex' - hh.PutUint64(b.DepositRequestsStartIndex) - - // Field (29) 'DepositBalanceToConsume' - hh.PutUint64(uint64(b.DepositBalanceToConsume)) - - // Field (30) 'ExitBalanceToConsume' - hh.PutUint64(uint64(b.ExitBalanceToConsume)) - - // Field (31) 'EarliestExitEpoch' - hh.PutUint64(uint64(b.EarliestExitEpoch)) - - // Field (32) 'ConsolidationBalanceToConsume' - hh.PutUint64(uint64(b.ConsolidationBalanceToConsume)) - - // Field (33) 'EarliestConsolidationEpoch' - hh.PutUint64(uint64(b.EarliestConsolidationEpoch)) - - // Field (34) 'PendingBalanceDeposits' - { - subIndx := hh.Index() - num := uint64(len(b.PendingBalanceDeposits)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingBalanceDeposits { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (35) 'PendingPartialWithdrawals' - { - subIndx := hh.Index() - num := uint64(len(b.PendingPartialWithdrawals)) - if num > 134217728 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingPartialWithdrawals { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 134217728) - } else { - hh.MerkleizeWithMixin(subIndx, num, 134217728) - } - } - - // Field (36) 'PendingConsolidations' - { - subIndx := hh.Index() - num := uint64(len(b.PendingConsolidations)) - if num > 262144 { - err = ssz.ErrIncorrectListSize - return - } - for _, elem := range b.PendingConsolidations { - if err = elem.HashTreeRootWith(hh); err != nil { - return - } - } - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, num, 262144) - } else { - hh.MerkleizeWithMixin(subIndx, num, 262144) - } - } - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PowBlock object -func (p *PowBlock) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PowBlock object to a target array -func (p *PowBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockHash' - if size := len(p.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - dst = append(dst, p.BlockHash...) - - // Field (1) 'ParentHash' - if size := len(p.ParentHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) - return - } - dst = append(dst, p.ParentHash...) - - // Field (2) 'TotalDifficulty' - if size := len(p.TotalDifficulty); size != 32 { - err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) - return - } - dst = append(dst, p.TotalDifficulty...) - - return -} - -// UnmarshalSSZ ssz unmarshals the PowBlock object -func (p *PowBlock) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 96 { - return ssz.ErrSize - } - - // Field (0) 'BlockHash' - if cap(p.BlockHash) == 0 { - p.BlockHash = make([]byte, 0, len(buf[0:32])) - } - p.BlockHash = append(p.BlockHash, buf[0:32]...) - - // Field (1) 'ParentHash' - if cap(p.ParentHash) == 0 { - p.ParentHash = make([]byte, 0, len(buf[32:64])) - } - p.ParentHash = append(p.ParentHash, buf[32:64]...) - - // Field (2) 'TotalDifficulty' - if cap(p.TotalDifficulty) == 0 { - p.TotalDifficulty = make([]byte, 0, len(buf[64:96])) - } - p.TotalDifficulty = append(p.TotalDifficulty, buf[64:96]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PowBlock object -func (p *PowBlock) SizeSSZ() (size int) { - size = 96 - return -} - -// HashTreeRoot ssz hashes the PowBlock object -func (p *PowBlock) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PowBlock object with a hasher -func (p *PowBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockHash' - if size := len(p.BlockHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) - return - } - hh.PutBytes(p.BlockHash) - - // Field (1) 'ParentHash' - if size := len(p.ParentHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) - return - } - hh.PutBytes(p.ParentHash) - - // Field (2) 'TotalDifficulty' - if size := len(p.TotalDifficulty); size != 32 { - err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) - return - } - hh.PutBytes(p.TotalDifficulty) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the HistoricalSummary object -func (h *HistoricalSummary) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(h) -} - -// MarshalSSZTo ssz marshals the HistoricalSummary object to a target array -func (h *HistoricalSummary) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockSummaryRoot' - if size := len(h.BlockSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) - return - } - dst = append(dst, h.BlockSummaryRoot...) - - // Field (1) 'StateSummaryRoot' - if size := len(h.StateSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) - return - } - dst = append(dst, h.StateSummaryRoot...) - - return -} - -// UnmarshalSSZ ssz unmarshals the HistoricalSummary object -func (h *HistoricalSummary) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 64 { - return ssz.ErrSize - } - - // Field (0) 'BlockSummaryRoot' - if cap(h.BlockSummaryRoot) == 0 { - h.BlockSummaryRoot = make([]byte, 0, len(buf[0:32])) - } - h.BlockSummaryRoot = append(h.BlockSummaryRoot, buf[0:32]...) - - // Field (1) 'StateSummaryRoot' - if cap(h.StateSummaryRoot) == 0 { - h.StateSummaryRoot = make([]byte, 0, len(buf[32:64])) - } - h.StateSummaryRoot = append(h.StateSummaryRoot, buf[32:64]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the HistoricalSummary object -func (h *HistoricalSummary) SizeSSZ() (size int) { - size = 64 - return -} - -// HashTreeRoot ssz hashes the HistoricalSummary object -func (h *HistoricalSummary) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(h) -} - -// HashTreeRootWith ssz hashes the HistoricalSummary object with a hasher -func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockSummaryRoot' - if size := len(h.BlockSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockSummaryRoot", size, 32) - return - } - hh.PutBytes(h.BlockSummaryRoot) - - // Field (1) 'StateSummaryRoot' - if size := len(h.StateSummaryRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.StateSummaryRoot", size, 32) - return - } - hh.PutBytes(h.StateSummaryRoot) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobIdentifier object -func (b *BlobIdentifier) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobIdentifier object to a target array -func (b *BlobIdentifier) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'BlockRoot' - if size := len(b.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, b.BlockRoot...) - - // Field (1) 'Index' - dst = ssz.MarshalUint64(dst, b.Index) - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobIdentifier object -func (b *BlobIdentifier) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 40 { - return ssz.ErrSize - } - - // Field (0) 'BlockRoot' - if cap(b.BlockRoot) == 0 { - b.BlockRoot = make([]byte, 0, len(buf[0:32])) - } - b.BlockRoot = append(b.BlockRoot, buf[0:32]...) - - // Field (1) 'Index' - b.Index = ssz.UnmarshallUint64(buf[32:40]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobIdentifier object -func (b *BlobIdentifier) SizeSSZ() (size int) { - size = 40 - return -} - -// HashTreeRoot ssz hashes the BlobIdentifier object -func (b *BlobIdentifier) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobIdentifier object with a hasher -func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'BlockRoot' - if size := len(b.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(b.BlockRoot) - - // Field (1) 'Index' - hh.PutUint64(b.Index) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingBalanceDeposit object to a target array -func (p *PendingBalanceDeposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, uint64(p.Index)) - - // Field (1) 'Amount' - dst = ssz.MarshalUint64(dst, p.Amount) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'Index' - p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Amount' - p.Amount = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the PendingBalanceDeposit object -func (p *PendingBalanceDeposit) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingBalanceDeposit object with a hasher -func (p *PendingBalanceDeposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(uint64(p.Index)) - - // Field (1) 'Amount' - hh.PutUint64(p.Amount) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingPartialWithdrawal object to a target array -func (p *PendingPartialWithdrawal) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Index' - dst = ssz.MarshalUint64(dst, uint64(p.Index)) - - // Field (1) 'Amount' - dst = ssz.MarshalUint64(dst, p.Amount) - - // Field (2) 'WithdrawableEpoch' - dst = ssz.MarshalUint64(dst, uint64(p.WithdrawableEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'Index' - p.Index = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Amount' - p.Amount = ssz.UnmarshallUint64(buf[8:16]) - - // Field (2) 'WithdrawableEpoch' - p.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the PendingPartialWithdrawal object -func (p *PendingPartialWithdrawal) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingPartialWithdrawal object with a hasher -func (p *PendingPartialWithdrawal) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Index' - hh.PutUint64(uint64(p.Index)) - - // Field (1) 'Amount' - hh.PutUint64(p.Amount) - - // Field (2) 'WithdrawableEpoch' - hh.PutUint64(uint64(p.WithdrawableEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Consolidation object -func (c *Consolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the Consolidation object to a target array -func (c *Consolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SourceIndex' - dst = ssz.MarshalUint64(dst, uint64(c.SourceIndex)) - - // Field (1) 'TargetIndex' - dst = ssz.MarshalUint64(dst, uint64(c.TargetIndex)) - - // Field (2) 'Epoch' - dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Consolidation object -func (c *Consolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'SourceIndex' - c.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'TargetIndex' - c.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - // Field (2) 'Epoch' - c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[16:24])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Consolidation object -func (c *Consolidation) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the Consolidation object -func (c *Consolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the Consolidation object with a hasher -func (c *Consolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SourceIndex' - hh.PutUint64(uint64(c.SourceIndex)) - - // Field (1) 'TargetIndex' - hh.PutUint64(uint64(c.TargetIndex)) - - // Field (2) 'Epoch' - hh.PutUint64(uint64(c.Epoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedConsolidation object -func (s *SignedConsolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedConsolidation object to a target array -func (s *SignedConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(Consolidation) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedConsolidation object -func (s *SignedConsolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 120 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(Consolidation) - } - if err = s.Message.UnmarshalSSZ(buf[0:24]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[24:120])) - } - s.Signature = append(s.Signature, buf[24:120]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedConsolidation object -func (s *SignedConsolidation) SizeSSZ() (size int) { - size = 120 - return -} - -// HashTreeRoot ssz hashes the SignedConsolidation object -func (s *SignedConsolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedConsolidation object with a hasher -func (s *SignedConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 PendingConsolidation object -func (p *PendingConsolidation) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(p) -} - -// MarshalSSZTo ssz marshals the PendingConsolidation object to a target array -func (p *PendingConsolidation) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SourceIndex' - dst = ssz.MarshalUint64(dst, uint64(p.SourceIndex)) - - // Field (1) 'TargetIndex' - dst = ssz.MarshalUint64(dst, uint64(p.TargetIndex)) - - return -} - -// UnmarshalSSZ ssz unmarshals the PendingConsolidation object -func (p *PendingConsolidation) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'SourceIndex' - p.SourceIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'TargetIndex' - p.TargetIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the PendingConsolidation object -func (p *PendingConsolidation) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the PendingConsolidation object -func (p *PendingConsolidation) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(p) -} - -// HashTreeRootWith ssz hashes the PendingConsolidation object with a hasher -func (p *PendingConsolidation) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SourceIndex' - hh.PutUint64(uint64(p.SourceIndex)) - - // Field (1) 'TargetIndex' - hh.PutUint64(uint64(p.TargetIndex)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the Status object -func (s *Status) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the Status object to a target array -func (s *Status) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ForkDigest' - if size := len(s.ForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) - return - } - dst = append(dst, s.ForkDigest...) - - // Field (1) 'FinalizedRoot' - if size := len(s.FinalizedRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) - return - } - dst = append(dst, s.FinalizedRoot...) - - // Field (2) 'FinalizedEpoch' - dst = ssz.MarshalUint64(dst, uint64(s.FinalizedEpoch)) - - // Field (3) 'HeadRoot' - if size := len(s.HeadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) - return - } - dst = append(dst, s.HeadRoot...) - - // Field (4) 'HeadSlot' - dst = ssz.MarshalUint64(dst, uint64(s.HeadSlot)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Status object -func (s *Status) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 84 { - return ssz.ErrSize - } - - // Field (0) 'ForkDigest' - if cap(s.ForkDigest) == 0 { - s.ForkDigest = make([]byte, 0, len(buf[0:4])) - } - s.ForkDigest = append(s.ForkDigest, buf[0:4]...) - - // Field (1) 'FinalizedRoot' - if cap(s.FinalizedRoot) == 0 { - s.FinalizedRoot = make([]byte, 0, len(buf[4:36])) - } - s.FinalizedRoot = append(s.FinalizedRoot, buf[4:36]...) - - // Field (2) 'FinalizedEpoch' - s.FinalizedEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[36:44])) - - // Field (3) 'HeadRoot' - if cap(s.HeadRoot) == 0 { - s.HeadRoot = make([]byte, 0, len(buf[44:76])) - } - s.HeadRoot = append(s.HeadRoot, buf[44:76]...) - - // Field (4) 'HeadSlot' - s.HeadSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[76:84])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Status object -func (s *Status) SizeSSZ() (size int) { - size = 84 - return -} - -// HashTreeRoot ssz hashes the Status object -func (s *Status) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the Status object with a hasher -func (s *Status) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ForkDigest' - if size := len(s.ForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) - return - } - hh.PutBytes(s.ForkDigest) - - // Field (1) 'FinalizedRoot' - if size := len(s.FinalizedRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) - return - } - hh.PutBytes(s.FinalizedRoot) - - // Field (2) 'FinalizedEpoch' - hh.PutUint64(uint64(s.FinalizedEpoch)) - - // Field (3) 'HeadRoot' - if size := len(s.HeadRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) - return - } - hh.PutBytes(s.HeadRoot) - - // Field (4) 'HeadSlot' - hh.PutUint64(uint64(s.HeadSlot)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BeaconBlocksByRangeRequest object to a target array -func (b *BeaconBlocksByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'StartSlot' - dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) - - // Field (1) 'Count' - dst = ssz.MarshalUint64(dst, b.Count) - - // Field (2) 'Step' - dst = ssz.MarshalUint64(dst, b.Step) - - return -} - -// UnmarshalSSZ ssz unmarshals the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 24 { - return ssz.ErrSize - } - - // Field (0) 'StartSlot' - b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Count' - b.Count = ssz.UnmarshallUint64(buf[8:16]) - - // Field (2) 'Step' - b.Step = ssz.UnmarshallUint64(buf[16:24]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) SizeSSZ() (size int) { - size = 24 - return -} - -// HashTreeRoot ssz hashes the BeaconBlocksByRangeRequest object -func (b *BeaconBlocksByRangeRequest) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BeaconBlocksByRangeRequest object with a hasher -func (b *BeaconBlocksByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'StartSlot' - hh.PutUint64(uint64(b.StartSlot)) - - // Field (1) 'Count' - hh.PutUint64(b.Count) - - // Field (2) 'Step' - hh.PutUint64(b.Step) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the ENRForkID object -func (e *ENRForkID) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(e) -} - -// MarshalSSZTo ssz marshals the ENRForkID object to a target array -func (e *ENRForkID) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'CurrentForkDigest' - if size := len(e.CurrentForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) - return - } - dst = append(dst, e.CurrentForkDigest...) - - // Field (1) 'NextForkVersion' - if size := len(e.NextForkVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) - return - } - dst = append(dst, e.NextForkVersion...) - - // Field (2) 'NextForkEpoch' - dst = ssz.MarshalUint64(dst, uint64(e.NextForkEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the ENRForkID object -func (e *ENRForkID) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'CurrentForkDigest' - if cap(e.CurrentForkDigest) == 0 { - e.CurrentForkDigest = make([]byte, 0, len(buf[0:4])) - } - e.CurrentForkDigest = append(e.CurrentForkDigest, buf[0:4]...) - - // Field (1) 'NextForkVersion' - if cap(e.NextForkVersion) == 0 { - e.NextForkVersion = make([]byte, 0, len(buf[4:8])) - } - e.NextForkVersion = append(e.NextForkVersion, buf[4:8]...) - - // Field (2) 'NextForkEpoch' - e.NextForkEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ENRForkID object -func (e *ENRForkID) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the ENRForkID object -func (e *ENRForkID) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(e) -} - -// HashTreeRootWith ssz hashes the ENRForkID object with a hasher -func (e *ENRForkID) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'CurrentForkDigest' - if size := len(e.CurrentForkDigest); size != 4 { - err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) - return - } - hh.PutBytes(e.CurrentForkDigest) - - // Field (1) 'NextForkVersion' - if size := len(e.NextForkVersion); size != 4 { - err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) - return - } - hh.PutBytes(e.NextForkVersion) - - // Field (2) 'NextForkEpoch' - hh.PutUint64(uint64(e.NextForkEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the MetaDataV0 object -func (m *MetaDataV0) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(m) -} - -// MarshalSSZTo ssz marshals the MetaDataV0 object to a target array -func (m *MetaDataV0) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SeqNumber' - dst = ssz.MarshalUint64(dst, m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - dst = append(dst, m.Attnets...) - - return -} - -// UnmarshalSSZ ssz unmarshals the MetaDataV0 object -func (m *MetaDataV0) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'SeqNumber' - m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Attnets' - if cap(m.Attnets) == 0 { - m.Attnets = make([]byte, 0, len(buf[8:16])) - } - m.Attnets = append(m.Attnets, buf[8:16]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV0 object -func (m *MetaDataV0) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the MetaDataV0 object -func (m *MetaDataV0) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(m) -} - -// HashTreeRootWith ssz hashes the MetaDataV0 object with a hasher -func (m *MetaDataV0) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SeqNumber' - hh.PutUint64(m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - hh.PutBytes(m.Attnets) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the MetaDataV1 object -func (m *MetaDataV1) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(m) -} - -// MarshalSSZTo ssz marshals the MetaDataV1 object to a target array -func (m *MetaDataV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'SeqNumber' - dst = ssz.MarshalUint64(dst, m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - dst = append(dst, m.Attnets...) - - // Field (2) 'Syncnets' - if size := len(m.Syncnets); size != 1 { - err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) - return - } - dst = append(dst, m.Syncnets...) - - return -} - -// UnmarshalSSZ ssz unmarshals the MetaDataV1 object -func (m *MetaDataV1) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 17 { - return ssz.ErrSize - } - - // Field (0) 'SeqNumber' - m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) - - // Field (1) 'Attnets' - if cap(m.Attnets) == 0 { - m.Attnets = make([]byte, 0, len(buf[8:16])) - } - m.Attnets = append(m.Attnets, buf[8:16]...) - - // Field (2) 'Syncnets' - if cap(m.Syncnets) == 0 { - m.Syncnets = make([]byte, 0, len(buf[16:17])) - } - m.Syncnets = append(m.Syncnets, buf[16:17]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV1 object -func (m *MetaDataV1) SizeSSZ() (size int) { - size = 17 - return -} - -// HashTreeRoot ssz hashes the MetaDataV1 object -func (m *MetaDataV1) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(m) -} - -// HashTreeRootWith ssz hashes the MetaDataV1 object with a hasher -func (m *MetaDataV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'SeqNumber' - hh.PutUint64(m.SeqNumber) - - // Field (1) 'Attnets' - if size := len(m.Attnets); size != 8 { - err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) - return - } - hh.PutBytes(m.Attnets) - - // Field (2) 'Syncnets' - if size := len(m.Syncnets); size != 1 { - err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) - return - } - hh.PutBytes(m.Syncnets) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BlobSidecarsByRangeRequest object to a target array -func (b *BlobSidecarsByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'StartSlot' - dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) - - // Field (1) 'Count' - dst = ssz.MarshalUint64(dst, b.Count) - - return -} - -// UnmarshalSSZ ssz unmarshals the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 16 { - return ssz.ErrSize - } - - // Field (0) 'StartSlot' - b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Count' - b.Count = ssz.UnmarshallUint64(buf[8:16]) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) SizeSSZ() (size int) { - size = 16 - return -} - -// HashTreeRoot ssz hashes the BlobSidecarsByRangeRequest object -func (b *BlobSidecarsByRangeRequest) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BlobSidecarsByRangeRequest object with a hasher -func (b *BlobSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'StartSlot' - hh.PutUint64(uint64(b.StartSlot)) - - // Field (1) 'Count' - hh.PutUint64(b.Count) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the DepositSnapshot object -func (d *DepositSnapshot) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(d) -} - -// MarshalSSZTo ssz marshals the DepositSnapshot object to a target array -func (d *DepositSnapshot) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - offset := int(84) - - // Offset (0) 'Finalized' - dst = ssz.WriteOffset(dst, offset) - offset += len(d.Finalized) * 32 - - // Field (1) 'DepositRoot' - if size := len(d.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - dst = append(dst, d.DepositRoot...) - - // Field (2) 'DepositCount' - dst = ssz.MarshalUint64(dst, d.DepositCount) - - // Field (3) 'ExecutionHash' - if size := len(d.ExecutionHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) - return - } - dst = append(dst, d.ExecutionHash...) - - // Field (4) 'ExecutionDepth' - dst = ssz.MarshalUint64(dst, d.ExecutionDepth) - - // Field (0) 'Finalized' - if size := len(d.Finalized); size > 32 { - err = ssz.ErrListTooBigFn("--.Finalized", size, 32) - return - } - for ii := 0; ii < len(d.Finalized); ii++ { - if size := len(d.Finalized[ii]); size != 32 { - err = ssz.ErrBytesLengthFn("--.Finalized[ii]", size, 32) - return - } - dst = append(dst, d.Finalized[ii]...) - } - - return -} - -// UnmarshalSSZ ssz unmarshals the DepositSnapshot object -func (d *DepositSnapshot) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size < 84 { - return ssz.ErrSize - } - - tail := buf - var o0 uint64 - - // Offset (0) 'Finalized' - if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { - return ssz.ErrOffset - } - - if o0 < 84 { - return ssz.ErrInvalidVariableOffset - } - - // Field (1) 'DepositRoot' - if cap(d.DepositRoot) == 0 { - d.DepositRoot = make([]byte, 0, len(buf[4:36])) - } - d.DepositRoot = append(d.DepositRoot, buf[4:36]...) - - // Field (2) 'DepositCount' - d.DepositCount = ssz.UnmarshallUint64(buf[36:44]) - - // Field (3) 'ExecutionHash' - if cap(d.ExecutionHash) == 0 { - d.ExecutionHash = make([]byte, 0, len(buf[44:76])) - } - d.ExecutionHash = append(d.ExecutionHash, buf[44:76]...) - - // Field (4) 'ExecutionDepth' - d.ExecutionDepth = ssz.UnmarshallUint64(buf[76:84]) - - // Field (0) 'Finalized' - { - buf = tail[o0:] - num, err := ssz.DivideInt2(len(buf), 32, 32) - if err != nil { - return err - } - d.Finalized = make([][]byte, num) - for ii := 0; ii < num; ii++ { - if cap(d.Finalized[ii]) == 0 { - d.Finalized[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) - } - d.Finalized[ii] = append(d.Finalized[ii], buf[ii*32:(ii+1)*32]...) - } - } - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the DepositSnapshot object -func (d *DepositSnapshot) SizeSSZ() (size int) { - size = 84 - - // Field (0) 'Finalized' - size += len(d.Finalized) * 32 - - return -} - -// HashTreeRoot ssz hashes the DepositSnapshot object -func (d *DepositSnapshot) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(d) -} - -// HashTreeRootWith ssz hashes the DepositSnapshot object with a hasher -func (d *DepositSnapshot) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Finalized' - { - if size := len(d.Finalized); size > 32 { - err = ssz.ErrListTooBigFn("--.Finalized", size, 32) - return - } - subIndx := hh.Index() - for _, i := range d.Finalized { - if len(i) != 32 { - err = ssz.ErrBytesLength - return - } - hh.Append(i) - } - - numItems := uint64(len(d.Finalized)) - if ssz.EnableVectorizedHTR { - hh.MerkleizeWithMixinVectorizedHTR(subIndx, numItems, 32) - } else { - hh.MerkleizeWithMixin(subIndx, numItems, 32) - } - } - - // Field (1) 'DepositRoot' - if size := len(d.DepositRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) - return - } - hh.PutBytes(d.DepositRoot) - - // Field (2) 'DepositCount' - hh.PutUint64(d.DepositCount) - - // Field (3) 'ExecutionHash' - if size := len(d.ExecutionHash); size != 32 { - err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) - return - } - hh.PutBytes(d.ExecutionHash) - - // Field (4) 'ExecutionDepth' - hh.PutUint64(d.ExecutionDepth) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommitteeMessage object to a target array -func (s *SyncCommitteeMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, s.BlockRoot...) - - // Field (2) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(s.ValidatorIndex)) - - // Field (3) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 144 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'BlockRoot' - if cap(s.BlockRoot) == 0 { - s.BlockRoot = make([]byte, 0, len(buf[8:40])) - } - s.BlockRoot = append(s.BlockRoot, buf[8:40]...) - - // Field (2) 'ValidatorIndex' - s.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[40:48])) - - // Field (3) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[48:144])) - } - s.Signature = append(s.Signature, buf[48:144]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) SizeSSZ() (size int) { - size = 144 - return -} - -// HashTreeRoot ssz hashes the SyncCommitteeMessage object -func (s *SyncCommitteeMessage) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommitteeMessage object with a hasher -func (s *SyncCommitteeMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(s.BlockRoot) - - // Field (2) 'ValidatorIndex' - hh.PutUint64(uint64(s.ValidatorIndex)) - - // Field (3) '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 SyncCommitteeContribution object -func (s *SyncCommitteeContribution) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SyncCommitteeContribution object to a target array -func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Slot' - dst = ssz.MarshalUint64(dst, uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - dst = append(dst, s.BlockRoot...) - - // Field (2) 'SubcommitteeIndex' - dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) - - // Field (3) 'AggregationBits' - if size := len(s.AggregationBits); size != 16 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) - return - } - dst = append(dst, s.AggregationBits...) - - // Field (4) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 160 { - return ssz.ErrSize - } - - // Field (0) 'Slot' - s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'BlockRoot' - if cap(s.BlockRoot) == 0 { - s.BlockRoot = make([]byte, 0, len(buf[8:40])) - } - s.BlockRoot = append(s.BlockRoot, buf[8:40]...) - - // Field (2) 'SubcommitteeIndex' - s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[40:48]) - - // Field (3) 'AggregationBits' - if cap(s.AggregationBits) == 0 { - s.AggregationBits = make([]byte, 0, len(buf[48:64])) - } - s.AggregationBits = append(s.AggregationBits, buf[48:64]...) - - // Field (4) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[64:160])) - } - s.Signature = append(s.Signature, buf[64:160]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) SizeSSZ() (size int) { - size = 160 - return -} - -// HashTreeRoot ssz hashes the SyncCommitteeContribution object -func (s *SyncCommitteeContribution) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SyncCommitteeContribution object with a hasher -func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Slot' - hh.PutUint64(uint64(s.Slot)) - - // Field (1) 'BlockRoot' - if size := len(s.BlockRoot); size != 32 { - err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32) - return - } - hh.PutBytes(s.BlockRoot) - - // Field (2) 'SubcommitteeIndex' - hh.PutUint64(s.SubcommitteeIndex) - - // Field (3) 'AggregationBits' - if size := len(s.AggregationBits); size != 16 { - err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16) - return - } - hh.PutBytes(s.AggregationBits) - - // Field (4) '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 ContributionAndProof object -func (c *ContributionAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(c) -} - -// MarshalSSZTo ssz marshals the ContributionAndProof object to a target array -func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'AggregatorIndex' - dst = ssz.MarshalUint64(dst, uint64(c.AggregatorIndex)) - - // Field (1) 'Contribution' - if c.Contribution == nil { - c.Contribution = new(SyncCommitteeContribution) - } - if dst, err = c.Contribution.MarshalSSZTo(dst); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(c.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - dst = append(dst, c.SelectionProof...) - - return -} - -// UnmarshalSSZ ssz unmarshals the ContributionAndProof object -func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 264 { - return ssz.ErrSize - } - - // Field (0) 'AggregatorIndex' - c.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'Contribution' - if c.Contribution == nil { - c.Contribution = new(SyncCommitteeContribution) - } - if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil { - return err - } - - // Field (2) 'SelectionProof' - if cap(c.SelectionProof) == 0 { - c.SelectionProof = make([]byte, 0, len(buf[168:264])) - } - c.SelectionProof = append(c.SelectionProof, buf[168:264]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object -func (c *ContributionAndProof) SizeSSZ() (size int) { - size = 264 - return -} - -// HashTreeRoot ssz hashes the ContributionAndProof object -func (c *ContributionAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(c) -} - -// HashTreeRootWith ssz hashes the ContributionAndProof object with a hasher -func (c *ContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'AggregatorIndex' - hh.PutUint64(uint64(c.AggregatorIndex)) - - // Field (1) 'Contribution' - if err = c.Contribution.HashTreeRootWith(hh); err != nil { - return - } - - // Field (2) 'SelectionProof' - if size := len(c.SelectionProof); size != 96 { - err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) - return - } - hh.PutBytes(c.SelectionProof) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedContributionAndProof object -func (s *SignedContributionAndProof) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedContributionAndProof object to a target array -func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ContributionAndProof) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedContributionAndProof object -func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 360 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(ContributionAndProof) - } - if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[264:360])) - } - s.Signature = append(s.Signature, buf[264:360]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object -func (s *SignedContributionAndProof) SizeSSZ() (size int) { - size = 360 - return -} - -// HashTreeRoot ssz hashes the SignedContributionAndProof object -func (s *SignedContributionAndProof) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedContributionAndProof object with a hasher -func (s *SignedContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 Validator object -func (v *Validator) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(v) -} - -// MarshalSSZTo ssz marshals the Validator object to a target array -func (v *Validator) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'PublicKey' - if size := len(v.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - dst = append(dst, v.PublicKey...) - - // Field (1) 'WithdrawalCredentials' - if size := len(v.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - dst = append(dst, v.WithdrawalCredentials...) - - // Field (2) 'EffectiveBalance' - dst = ssz.MarshalUint64(dst, v.EffectiveBalance) - - // Field (3) 'Slashed' - dst = ssz.MarshalBool(dst, v.Slashed) - - // Field (4) 'ActivationEligibilityEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ActivationEligibilityEpoch)) - - // Field (5) 'ActivationEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ActivationEpoch)) - - // Field (6) 'ExitEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.ExitEpoch)) - - // Field (7) 'WithdrawableEpoch' - dst = ssz.MarshalUint64(dst, uint64(v.WithdrawableEpoch)) - - return -} - -// UnmarshalSSZ ssz unmarshals the Validator object -func (v *Validator) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 121 { - return ssz.ErrSize - } - - // Field (0) 'PublicKey' - if cap(v.PublicKey) == 0 { - v.PublicKey = make([]byte, 0, len(buf[0:48])) - } - v.PublicKey = append(v.PublicKey, buf[0:48]...) - - // Field (1) 'WithdrawalCredentials' - if cap(v.WithdrawalCredentials) == 0 { - v.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) - } - v.WithdrawalCredentials = append(v.WithdrawalCredentials, buf[48:80]...) - - // Field (2) 'EffectiveBalance' - v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88]) - - // Field (3) 'Slashed' - v.Slashed = ssz.UnmarshalBool(buf[88:89]) - - // Field (4) 'ActivationEligibilityEpoch' - v.ActivationEligibilityEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[89:97])) - - // Field (5) 'ActivationEpoch' - v.ActivationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[97:105])) - - // Field (6) 'ExitEpoch' - v.ExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[105:113])) - - // Field (7) 'WithdrawableEpoch' - v.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[113:121])) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the Validator object -func (v *Validator) SizeSSZ() (size int) { - size = 121 - return -} - -// HashTreeRoot ssz hashes the Validator object -func (v *Validator) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(v) -} - -// HashTreeRootWith ssz hashes the Validator object with a hasher -func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'PublicKey' - if size := len(v.PublicKey); size != 48 { - err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) - return - } - hh.PutBytes(v.PublicKey) - - // Field (1) 'WithdrawalCredentials' - if size := len(v.WithdrawalCredentials); size != 32 { - err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) - return - } - hh.PutBytes(v.WithdrawalCredentials) - - // Field (2) 'EffectiveBalance' - hh.PutUint64(v.EffectiveBalance) - - // Field (3) 'Slashed' - hh.PutBool(v.Slashed) - - // Field (4) 'ActivationEligibilityEpoch' - hh.PutUint64(uint64(v.ActivationEligibilityEpoch)) - - // Field (5) 'ActivationEpoch' - hh.PutUint64(uint64(v.ActivationEpoch)) - - // Field (6) 'ExitEpoch' - hh.PutUint64(uint64(v.ExitEpoch)) - - // Field (7) 'WithdrawableEpoch' - hh.PutUint64(uint64(v.WithdrawableEpoch)) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the BLSToExecutionChange object -func (b *BLSToExecutionChange) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(b) -} - -// MarshalSSZTo ssz marshals the BLSToExecutionChange object to a target array -func (b *BLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'ValidatorIndex' - dst = ssz.MarshalUint64(dst, uint64(b.ValidatorIndex)) - - // Field (1) 'FromBlsPubkey' - if size := len(b.FromBlsPubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) - return - } - dst = append(dst, b.FromBlsPubkey...) - - // Field (2) 'ToExecutionAddress' - if size := len(b.ToExecutionAddress); size != 20 { - err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) - return - } - dst = append(dst, b.ToExecutionAddress...) - - return -} - -// UnmarshalSSZ ssz unmarshals the BLSToExecutionChange object -func (b *BLSToExecutionChange) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 76 { - return ssz.ErrSize - } - - // Field (0) 'ValidatorIndex' - b.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) - - // Field (1) 'FromBlsPubkey' - if cap(b.FromBlsPubkey) == 0 { - b.FromBlsPubkey = make([]byte, 0, len(buf[8:56])) - } - b.FromBlsPubkey = append(b.FromBlsPubkey, buf[8:56]...) - - // Field (2) 'ToExecutionAddress' - if cap(b.ToExecutionAddress) == 0 { - b.ToExecutionAddress = make([]byte, 0, len(buf[56:76])) - } - b.ToExecutionAddress = append(b.ToExecutionAddress, buf[56:76]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the BLSToExecutionChange object -func (b *BLSToExecutionChange) SizeSSZ() (size int) { - size = 76 - return -} - -// HashTreeRoot ssz hashes the BLSToExecutionChange object -func (b *BLSToExecutionChange) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(b) -} - -// HashTreeRootWith ssz hashes the BLSToExecutionChange object with a hasher -func (b *BLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'ValidatorIndex' - hh.PutUint64(uint64(b.ValidatorIndex)) - - // Field (1) 'FromBlsPubkey' - if size := len(b.FromBlsPubkey); size != 48 { - err = ssz.ErrBytesLengthFn("--.FromBlsPubkey", size, 48) - return - } - hh.PutBytes(b.FromBlsPubkey) - - // Field (2) 'ToExecutionAddress' - if size := len(b.ToExecutionAddress); size != 20 { - err = ssz.ErrBytesLengthFn("--.ToExecutionAddress", size, 20) - return - } - hh.PutBytes(b.ToExecutionAddress) - - if ssz.EnableVectorizedHTR { - hh.MerkleizeVectorizedHTR(indx) - } else { - hh.Merkleize(indx) - } - return -} - -// MarshalSSZ ssz marshals the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) MarshalSSZ() ([]byte, error) { - return ssz.MarshalSSZ(s) -} - -// MarshalSSZTo ssz marshals the SignedBLSToExecutionChange object to a target array -func (s *SignedBLSToExecutionChange) MarshalSSZTo(buf []byte) (dst []byte, err error) { - dst = buf - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BLSToExecutionChange) - } - if dst, err = s.Message.MarshalSSZTo(dst); err != nil { - return - } - - // Field (1) 'Signature' - if size := len(s.Signature); size != 96 { - err = ssz.ErrBytesLengthFn("--.Signature", size, 96) - return - } - dst = append(dst, s.Signature...) - - return -} - -// UnmarshalSSZ ssz unmarshals the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) UnmarshalSSZ(buf []byte) error { - var err error - size := uint64(len(buf)) - if size != 172 { - return ssz.ErrSize - } - - // Field (0) 'Message' - if s.Message == nil { - s.Message = new(BLSToExecutionChange) - } - if err = s.Message.UnmarshalSSZ(buf[0:76]); err != nil { - return err - } - - // Field (1) 'Signature' - if cap(s.Signature) == 0 { - s.Signature = make([]byte, 0, len(buf[76:172])) - } - s.Signature = append(s.Signature, buf[76:172]...) - - return err -} - -// SizeSSZ returns the ssz encoded size in bytes for the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) SizeSSZ() (size int) { - size = 172 - return -} - -// HashTreeRoot ssz hashes the SignedBLSToExecutionChange object -func (s *SignedBLSToExecutionChange) HashTreeRoot() ([32]byte, error) { - return ssz.HashWithDefaultHasher(s) -} - -// HashTreeRootWith ssz hashes the SignedBLSToExecutionChange object with a hasher -func (s *SignedBLSToExecutionChange) HashTreeRootWith(hh *ssz.Hasher) (err error) { - indx := hh.Index() - - // Field (0) 'Message' - if err = s.Message.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 -} diff --git a/proto/prysm/v1alpha1/non-core.ssz.go b/proto/prysm/v1alpha1/non-core.ssz.go new file mode 100644 index 000000000000..52616b8d46f5 --- /dev/null +++ b/proto/prysm/v1alpha1/non-core.ssz.go @@ -0,0 +1,780 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: 9da8a498bd074553137a73197dadcae4d3b4239484f64bab4f0a734dce528d24 +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + v1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1" +) + +// MarshalSSZ ssz marshals the ValidatorRegistrationV1 object +func (v *ValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(v) +} + +// MarshalSSZTo ssz marshals the ValidatorRegistrationV1 object to a target array +func (v *ValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'FeeRecipient' + if size := len(v.FeeRecipient); size != 20 { + err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) + return + } + dst = append(dst, v.FeeRecipient...) + + // Field (1) 'GasLimit' + dst = ssz.MarshalUint64(dst, v.GasLimit) + + // Field (2) 'Timestamp' + dst = ssz.MarshalUint64(dst, v.Timestamp) + + // Field (3) 'Pubkey' + if size := len(v.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + dst = append(dst, v.Pubkey...) + + return +} + +// UnmarshalSSZ ssz unmarshals the ValidatorRegistrationV1 object +func (v *ValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 84 { + return ssz.ErrSize + } + + // Field (0) 'FeeRecipient' + if cap(v.FeeRecipient) == 0 { + v.FeeRecipient = make([]byte, 0, len(buf[0:20])) + } + v.FeeRecipient = append(v.FeeRecipient, buf[0:20]...) + + // Field (1) 'GasLimit' + v.GasLimit = ssz.UnmarshallUint64(buf[20:28]) + + // Field (2) 'Timestamp' + v.Timestamp = ssz.UnmarshallUint64(buf[28:36]) + + // Field (3) 'Pubkey' + if cap(v.Pubkey) == 0 { + v.Pubkey = make([]byte, 0, len(buf[36:84])) + } + v.Pubkey = append(v.Pubkey, buf[36:84]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the ValidatorRegistrationV1 object +func (v *ValidatorRegistrationV1) SizeSSZ() (size int) { + size = 84 + return +} + +// HashTreeRoot ssz hashes the ValidatorRegistrationV1 object +func (v *ValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(v) +} + +// HashTreeRootWith ssz hashes the ValidatorRegistrationV1 object with a hasher +func (v *ValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'FeeRecipient' + if size := len(v.FeeRecipient); size != 20 { + err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) + return + } + hh.PutBytes(v.FeeRecipient) + + // Field (1) 'GasLimit' + hh.PutUint64(v.GasLimit) + + // Field (2) 'Timestamp' + hh.PutUint64(v.Timestamp) + + // Field (3) 'Pubkey' + if size := len(v.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + hh.PutBytes(v.Pubkey) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedValidatorRegistrationV1 object +func (s *SignedValidatorRegistrationV1) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedValidatorRegistrationV1 object to a target array +func (s *SignedValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(ValidatorRegistrationV1) + } + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedValidatorRegistrationV1 object +func (s *SignedValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 180 { + return ssz.ErrSize + } + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(ValidatorRegistrationV1) + } + if err = s.Message.UnmarshalSSZ(buf[0:84]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[84:180])) + } + s.Signature = append(s.Signature, buf[84:180]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedValidatorRegistrationV1 object +func (s *SignedValidatorRegistrationV1) SizeSSZ() (size int) { + size = 180 + return +} + +// HashTreeRoot ssz hashes the SignedValidatorRegistrationV1 object +func (s *SignedValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedValidatorRegistrationV1 object with a hasher +func (s *SignedValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BuilderBid object +func (b *BuilderBid) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BuilderBid object to a target array +func (b *BuilderBid) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(84) + + // Offset (0) 'Header' + dst = ssz.WriteOffset(dst, offset) + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeader) + } + offset += b.Header.SizeSSZ() + + // Field (1) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + dst = append(dst, b.Value...) + + // Field (2) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + dst = append(dst, b.Pubkey...) + + // Field (0) 'Header' + if dst, err = b.Header.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BuilderBid object +func (b *BuilderBid) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 84 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Header' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 84 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Value' + if cap(b.Value) == 0 { + b.Value = make([]byte, 0, len(buf[4:36])) + } + b.Value = append(b.Value, buf[4:36]...) + + // Field (2) 'Pubkey' + if cap(b.Pubkey) == 0 { + b.Pubkey = make([]byte, 0, len(buf[36:84])) + } + b.Pubkey = append(b.Pubkey, buf[36:84]...) + + // Field (0) 'Header' + { + buf = tail[o0:] + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeader) + } + if err = b.Header.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BuilderBid object +func (b *BuilderBid) SizeSSZ() (size int) { + size = 84 + + // Field (0) 'Header' + if b.Header == nil { + b.Header = new(v1.ExecutionPayloadHeader) + } + size += b.Header.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BuilderBid object +func (b *BuilderBid) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BuilderBid object with a hasher +func (b *BuilderBid) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Header' + if err = b.Header.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'Value' + if size := len(b.Value); size != 32 { + err = ssz.ErrBytesLengthFn("--.Value", size, 32) + return + } + hh.PutBytes(b.Value) + + // Field (2) 'Pubkey' + if size := len(b.Pubkey); size != 48 { + err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) + return + } + hh.PutBytes(b.Pubkey) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlocksByRangeRequest object +func (b *BeaconBlocksByRangeRequest) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlocksByRangeRequest object to a target array +func (b *BeaconBlocksByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'StartSlot' + dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) + + // Field (1) 'Count' + dst = ssz.MarshalUint64(dst, b.Count) + + // Field (2) 'Step' + dst = ssz.MarshalUint64(dst, b.Step) + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlocksByRangeRequest object +func (b *BeaconBlocksByRangeRequest) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 24 { + return ssz.ErrSize + } + + // Field (0) 'StartSlot' + b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Count' + b.Count = ssz.UnmarshallUint64(buf[8:16]) + + // Field (2) 'Step' + b.Step = ssz.UnmarshallUint64(buf[16:24]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlocksByRangeRequest object +func (b *BeaconBlocksByRangeRequest) SizeSSZ() (size int) { + size = 24 + return +} + +// HashTreeRoot ssz hashes the BeaconBlocksByRangeRequest object +func (b *BeaconBlocksByRangeRequest) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlocksByRangeRequest object with a hasher +func (b *BeaconBlocksByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'StartSlot' + hh.PutUint64(uint64(b.StartSlot)) + + // Field (1) 'Count' + hh.PutUint64(b.Count) + + // Field (2) 'Step' + hh.PutUint64(b.Step) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the MetaDataV0 object +func (m *MetaDataV0) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(m) +} + +// MarshalSSZTo ssz marshals the MetaDataV0 object to a target array +func (m *MetaDataV0) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SeqNumber' + dst = ssz.MarshalUint64(dst, m.SeqNumber) + + // Field (1) 'Attnets' + if size := len(m.Attnets); size != 8 { + err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) + return + } + dst = append(dst, m.Attnets...) + + return +} + +// UnmarshalSSZ ssz unmarshals the MetaDataV0 object +func (m *MetaDataV0) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'SeqNumber' + m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'Attnets' + if cap(m.Attnets) == 0 { + m.Attnets = make([]byte, 0, len(buf[8:16])) + } + m.Attnets = append(m.Attnets, buf[8:16]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV0 object +func (m *MetaDataV0) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the MetaDataV0 object +func (m *MetaDataV0) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(m) +} + +// HashTreeRootWith ssz hashes the MetaDataV0 object with a hasher +func (m *MetaDataV0) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SeqNumber' + hh.PutUint64(m.SeqNumber) + + // Field (1) 'Attnets' + if size := len(m.Attnets); size != 8 { + err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) + return + } + hh.PutBytes(m.Attnets) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the MetaDataV1 object +func (m *MetaDataV1) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(m) +} + +// MarshalSSZTo ssz marshals the MetaDataV1 object to a target array +func (m *MetaDataV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SeqNumber' + dst = ssz.MarshalUint64(dst, m.SeqNumber) + + // Field (1) 'Attnets' + if size := len(m.Attnets); size != 8 { + err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) + return + } + dst = append(dst, m.Attnets...) + + // Field (2) 'Syncnets' + if size := len(m.Syncnets); size != 1 { + err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) + return + } + dst = append(dst, m.Syncnets...) + + return +} + +// UnmarshalSSZ ssz unmarshals the MetaDataV1 object +func (m *MetaDataV1) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 17 { + return ssz.ErrSize + } + + // Field (0) 'SeqNumber' + m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'Attnets' + if cap(m.Attnets) == 0 { + m.Attnets = make([]byte, 0, len(buf[8:16])) + } + m.Attnets = append(m.Attnets, buf[8:16]...) + + // Field (2) 'Syncnets' + if cap(m.Syncnets) == 0 { + m.Syncnets = make([]byte, 0, len(buf[16:17])) + } + m.Syncnets = append(m.Syncnets, buf[16:17]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV1 object +func (m *MetaDataV1) SizeSSZ() (size int) { + size = 17 + return +} + +// HashTreeRoot ssz hashes the MetaDataV1 object +func (m *MetaDataV1) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(m) +} + +// HashTreeRootWith ssz hashes the MetaDataV1 object with a hasher +func (m *MetaDataV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SeqNumber' + hh.PutUint64(m.SeqNumber) + + // Field (1) 'Attnets' + if size := len(m.Attnets); size != 8 { + err = ssz.ErrBytesLengthFn("--.Attnets", size, 8) + return + } + hh.PutBytes(m.Attnets) + + // Field (2) 'Syncnets' + if size := len(m.Syncnets); size != 1 { + err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1) + return + } + hh.PutBytes(m.Syncnets) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BlobSidecarsByRangeRequest object +func (b *BlobSidecarsByRangeRequest) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BlobSidecarsByRangeRequest object to a target array +func (b *BlobSidecarsByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'StartSlot' + dst = ssz.MarshalUint64(dst, uint64(b.StartSlot)) + + // Field (1) 'Count' + dst = ssz.MarshalUint64(dst, b.Count) + + return +} + +// UnmarshalSSZ ssz unmarshals the BlobSidecarsByRangeRequest object +func (b *BlobSidecarsByRangeRequest) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'StartSlot' + b.StartSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Count' + b.Count = ssz.UnmarshallUint64(buf[8:16]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecarsByRangeRequest object +func (b *BlobSidecarsByRangeRequest) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the BlobSidecarsByRangeRequest object +func (b *BlobSidecarsByRangeRequest) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BlobSidecarsByRangeRequest object with a hasher +func (b *BlobSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'StartSlot' + hh.PutUint64(uint64(b.StartSlot)) + + // Field (1) 'Count' + hh.PutUint64(b.Count) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the DepositSnapshot object +func (d *DepositSnapshot) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(d) +} + +// MarshalSSZTo ssz marshals the DepositSnapshot object to a target array +func (d *DepositSnapshot) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(84) + + // Offset (0) 'Finalized' + dst = ssz.WriteOffset(dst, offset) + offset += len(d.Finalized) * 32 + + // Field (1) 'DepositRoot' + if size := len(d.DepositRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) + return + } + dst = append(dst, d.DepositRoot...) + + // Field (2) 'DepositCount' + dst = ssz.MarshalUint64(dst, d.DepositCount) + + // Field (3) 'ExecutionHash' + if size := len(d.ExecutionHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) + return + } + dst = append(dst, d.ExecutionHash...) + + // Field (4) 'ExecutionDepth' + dst = ssz.MarshalUint64(dst, d.ExecutionDepth) + + // Field (0) 'Finalized' + if size := len(d.Finalized); size > 32 { + err = ssz.ErrListTooBigFn("--.Finalized", size, 32) + return + } + for ii := 0; ii < len(d.Finalized); ii++ { + if size := len(d.Finalized[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.Finalized[ii]", size, 32) + return + } + dst = append(dst, d.Finalized[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the DepositSnapshot object +func (d *DepositSnapshot) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 84 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Finalized' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 84 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'DepositRoot' + if cap(d.DepositRoot) == 0 { + d.DepositRoot = make([]byte, 0, len(buf[4:36])) + } + d.DepositRoot = append(d.DepositRoot, buf[4:36]...) + + // Field (2) 'DepositCount' + d.DepositCount = ssz.UnmarshallUint64(buf[36:44]) + + // Field (3) 'ExecutionHash' + if cap(d.ExecutionHash) == 0 { + d.ExecutionHash = make([]byte, 0, len(buf[44:76])) + } + d.ExecutionHash = append(d.ExecutionHash, buf[44:76]...) + + // Field (4) 'ExecutionDepth' + d.ExecutionDepth = ssz.UnmarshallUint64(buf[76:84]) + + // Field (0) 'Finalized' + { + buf = tail[o0:] + num, err := ssz.DivideInt2(len(buf), 32, 32) + if err != nil { + return err + } + d.Finalized = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(d.Finalized[ii]) == 0 { + d.Finalized[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + d.Finalized[ii] = append(d.Finalized[ii], buf[ii*32:(ii+1)*32]...) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the DepositSnapshot object +func (d *DepositSnapshot) SizeSSZ() (size int) { + size = 84 + + // Field (0) 'Finalized' + size += len(d.Finalized) * 32 + + return +} + +// HashTreeRoot ssz hashes the DepositSnapshot object +func (d *DepositSnapshot) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(d) +} + +// HashTreeRootWith ssz hashes the DepositSnapshot object with a hasher +func (d *DepositSnapshot) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Finalized' + { + if size := len(d.Finalized); size > 32 { + err = ssz.ErrListTooBigFn("--.Finalized", size, 32) + return + } + subIndx := hh.Index() + for _, i := range d.Finalized { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(d.Finalized)) + hh.MerkleizeWithMixin(subIndx, numItems, 32) + } + + // Field (1) 'DepositRoot' + if size := len(d.DepositRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) + return + } + hh.PutBytes(d.DepositRoot) + + // Field (2) 'DepositCount' + hh.PutUint64(d.DepositCount) + + // Field (3) 'ExecutionHash' + if size := len(d.ExecutionHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32) + return + } + hh.PutBytes(d.ExecutionHash) + + // Field (4) 'ExecutionDepth' + hh.PutUint64(d.ExecutionDepth) + + hh.Merkleize(indx) + return +} diff --git a/proto/prysm/v1alpha1/phase0.ssz.go b/proto/prysm/v1alpha1/phase0.ssz.go new file mode 100644 index 000000000000..8be3c0272475 --- /dev/null +++ b/proto/prysm/v1alpha1/phase0.ssz.go @@ -0,0 +1,4048 @@ +// Code generated by fastssz. DO NOT EDIT. +// Hash: eba8aa2c3520e9086420bb8b3b54fa3824148a30659a4a9413a1eebbec22712a +package eth + +import ( + ssz "github.com/prysmaticlabs/fastssz" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" +) + +// MarshalSSZ ssz marshals the Attestation object +func (a *Attestation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the Attestation object to a target array +func (a *Attestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(228) + + // Offset (0) 'AggregationBits' + dst = ssz.WriteOffset(dst, offset) + offset += len(a.AggregationBits) + + // Field (1) 'Data' + if a.Data == nil { + a.Data = new(AttestationData) + } + if dst, err = a.Data.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(a.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, a.Signature...) + + // Field (0) 'AggregationBits' + if size := len(a.AggregationBits); size > 2048 { + err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) + return + } + dst = append(dst, a.AggregationBits...) + + return +} + +// UnmarshalSSZ ssz unmarshals the Attestation object +func (a *Attestation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 228 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'AggregationBits' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 228 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Data' + if a.Data == nil { + a.Data = new(AttestationData) + } + if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil { + return err + } + + // Field (2) 'Signature' + if cap(a.Signature) == 0 { + a.Signature = make([]byte, 0, len(buf[132:228])) + } + a.Signature = append(a.Signature, buf[132:228]...) + + // Field (0) 'AggregationBits' + { + buf = tail[o0:] + if err = ssz.ValidateBitlist(buf, 2048); err != nil { + return err + } + if cap(a.AggregationBits) == 0 { + a.AggregationBits = make([]byte, 0, len(buf)) + } + a.AggregationBits = append(a.AggregationBits, buf...) + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Attestation object +func (a *Attestation) SizeSSZ() (size int) { + size = 228 + + // Field (0) 'AggregationBits' + size += len(a.AggregationBits) + + return +} + +// HashTreeRoot ssz hashes the Attestation object +func (a *Attestation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the Attestation object with a hasher +func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregationBits' + if len(a.AggregationBits) == 0 { + err = ssz.ErrEmptyBitlist + return + } + hh.PutBitlist(a.AggregationBits, 2048) + + // Field (1) 'Data' + if err = a.Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(a.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(a.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the AggregateAttestationAndProof object +func (a *AggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AggregateAttestationAndProof object to a target array +func (a *AggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(108) + + // Field (0) 'AggregatorIndex' + dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex)) + + // Offset (1) 'Aggregate' + dst = ssz.WriteOffset(dst, offset) + if a.Aggregate == nil { + a.Aggregate = new(Attestation) + } + offset += a.Aggregate.SizeSSZ() + + // Field (2) 'SelectionProof' + if size := len(a.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + dst = append(dst, a.SelectionProof...) + + // Field (1) 'Aggregate' + if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProof object +func (a *AggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 108 { + return ssz.ErrSize + } + + tail := buf + var o1 uint64 + + // Field (0) 'AggregatorIndex' + a.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) + + // Offset (1) 'Aggregate' + if o1 = ssz.ReadOffset(buf[8:12]); o1 > size { + return ssz.ErrOffset + } + + if o1 != 108 { + return ssz.ErrInvalidVariableOffset + } + + // Field (2) 'SelectionProof' + if cap(a.SelectionProof) == 0 { + a.SelectionProof = make([]byte, 0, len(buf[12:108])) + } + a.SelectionProof = append(a.SelectionProof, buf[12:108]...) + + // Field (1) 'Aggregate' + { + buf = tail[o1:] + if a.Aggregate == nil { + a.Aggregate = new(Attestation) + } + if err = a.Aggregate.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProof object +func (a *AggregateAttestationAndProof) SizeSSZ() (size int) { + size = 108 + + // Field (1) 'Aggregate' + if a.Aggregate == nil { + a.Aggregate = new(Attestation) + } + size += a.Aggregate.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the AggregateAttestationAndProof object +func (a *AggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AggregateAttestationAndProof object with a hasher +func (a *AggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregatorIndex' + hh.PutUint64(uint64(a.AggregatorIndex)) + + // Field (1) 'Aggregate' + if err = a.Aggregate.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'SelectionProof' + if size := len(a.SelectionProof); size != 96 { + err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96) + return + } + hh.PutBytes(a.SelectionProof) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedAggregateAttestationAndProof object +func (s *SignedAggregateAttestationAndProof) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProof object to a target array +func (s *SignedAggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(100) + + // Offset (0) 'Message' + dst = ssz.WriteOffset(dst, offset) + if s.Message == nil { + s.Message = new(AggregateAttestationAndProof) + } + offset += s.Message.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) 'Message' + if dst, err = s.Message.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProof object +func (s *SignedAggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 100 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'Message' + 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) 'Message' + { + buf = tail[o0:] + if s.Message == nil { + s.Message = new(AggregateAttestationAndProof) + } + if err = s.Message.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProof object +func (s *SignedAggregateAttestationAndProof) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Message' + if s.Message == nil { + s.Message = new(AggregateAttestationAndProof) + } + size += s.Message.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedAggregateAttestationAndProof object +func (s *SignedAggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProof object with a hasher +func (s *SignedAggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Message' + if err = s.Message.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the AttestationData object +func (a *AttestationData) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AttestationData object to a target array +func (a *AttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(a.Slot)) + + // Field (1) 'CommitteeIndex' + dst = ssz.MarshalUint64(dst, uint64(a.CommitteeIndex)) + + // Field (2) 'BeaconBlockRoot' + if size := len(a.BeaconBlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) + return + } + dst = append(dst, a.BeaconBlockRoot...) + + // Field (3) 'Source' + if a.Source == nil { + a.Source = new(Checkpoint) + } + if dst, err = a.Source.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'Target' + if a.Target == nil { + a.Target = new(Checkpoint) + } + if dst, err = a.Target.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the AttestationData object +func (a *AttestationData) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 128 { + return ssz.ErrSize + } + + // Field (0) 'Slot' + a.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'CommitteeIndex' + a.CommitteeIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex(ssz.UnmarshallUint64(buf[8:16])) + + // Field (2) 'BeaconBlockRoot' + if cap(a.BeaconBlockRoot) == 0 { + a.BeaconBlockRoot = make([]byte, 0, len(buf[16:48])) + } + a.BeaconBlockRoot = append(a.BeaconBlockRoot, buf[16:48]...) + + // Field (3) 'Source' + if a.Source == nil { + a.Source = new(Checkpoint) + } + if err = a.Source.UnmarshalSSZ(buf[48:88]); err != nil { + return err + } + + // Field (4) 'Target' + if a.Target == nil { + a.Target = new(Checkpoint) + } + if err = a.Target.UnmarshalSSZ(buf[88:128]); err != nil { + return err + } + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AttestationData object +func (a *AttestationData) SizeSSZ() (size int) { + size = 128 + return +} + +// HashTreeRoot ssz hashes the AttestationData object +func (a *AttestationData) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AttestationData object with a hasher +func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Slot' + hh.PutUint64(uint64(a.Slot)) + + // Field (1) 'CommitteeIndex' + hh.PutUint64(uint64(a.CommitteeIndex)) + + // Field (2) 'BeaconBlockRoot' + if size := len(a.BeaconBlockRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BeaconBlockRoot", size, 32) + return + } + hh.PutBytes(a.BeaconBlockRoot) + + // Field (3) 'Source' + if err = a.Source.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'Target' + if err = a.Target.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Checkpoint object +func (c *Checkpoint) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(c) +} + +// MarshalSSZTo ssz marshals the Checkpoint object to a target array +func (c *Checkpoint) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Epoch' + dst = ssz.MarshalUint64(dst, uint64(c.Epoch)) + + // Field (1) 'Root' + if size := len(c.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + dst = append(dst, c.Root...) + + return +} + +// UnmarshalSSZ ssz unmarshals the Checkpoint object +func (c *Checkpoint) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 40 { + return ssz.ErrSize + } + + // Field (0) 'Epoch' + c.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'Root' + if cap(c.Root) == 0 { + c.Root = make([]byte, 0, len(buf[8:40])) + } + c.Root = append(c.Root, buf[8:40]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Checkpoint object +func (c *Checkpoint) SizeSSZ() (size int) { + size = 40 + return +} + +// HashTreeRoot ssz hashes the Checkpoint object +func (c *Checkpoint) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(c) +} + +// HashTreeRootWith ssz hashes the Checkpoint object with a hasher +func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Epoch' + hh.PutUint64(uint64(c.Epoch)) + + // Field (1) 'Root' + if size := len(c.Root); size != 32 { + err = ssz.ErrBytesLengthFn("--.Root", size, 32) + return + } + hh.PutBytes(c.Root) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlock object +func (b *BeaconBlock) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlock object to a target array +func (b *BeaconBlock) 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(BeaconBlockBody) + } + offset += b.Body.SizeSSZ() + + // Field (4) 'Body' + if dst, err = b.Body.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlock object +func (b *BeaconBlock) 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_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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(BeaconBlockBody) + } + if err = b.Body.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlock object +func (b *BeaconBlock) SizeSSZ() (size int) { + size = 84 + + // Field (4) 'Body' + if b.Body == nil { + b.Body = new(BeaconBlockBody) + } + size += b.Body.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the BeaconBlock object +func (b *BeaconBlock) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlock object with a hasher +func (b *BeaconBlock) 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 + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBeaconBlock object +func (s *SignedBeaconBlock) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlock object to a target array +func (s *SignedBeaconBlock) 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(BeaconBlock) + } + 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 SignedBeaconBlock object +func (s *SignedBeaconBlock) 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(BeaconBlock) + } + if err = s.Block.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlock object +func (s *SignedBeaconBlock) SizeSSZ() (size int) { + size = 100 + + // Field (0) 'Block' + if s.Block == nil { + s.Block = new(BeaconBlock) + } + size += s.Block.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlock object +func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlock object with a hasher +func (s *SignedBeaconBlock) 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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockBody object +func (b *BeaconBlockBody) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockBody object to a target array +func (b *BeaconBlockBody) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(220) + + // 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 (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 + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockBody object +func (b *BeaconBlockBody) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 220 { + return ssz.ErrSize + } + + tail := buf + var o3, o4, o5, o6, o7 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 != 220 { + 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 (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:] + 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 + } + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBody object +func (b *BeaconBlockBody) SizeSSZ() (size int) { + size = 220 + + // 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 + + return +} + +// HashTreeRoot ssz hashes the BeaconBlockBody object +func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockBody object with a hasher +func (b *BeaconBlockBody) 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + 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 + } + } + hh.MerkleizeWithMixin(subIndx, num, 16) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the ProposerSlashing object +func (p *ProposerSlashing) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the ProposerSlashing object to a target array +func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Header_1' + if p.Header_1 == nil { + p.Header_1 = new(SignedBeaconBlockHeader) + } + if dst, err = p.Header_1.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Header_2' + if p.Header_2 == nil { + p.Header_2 = new(SignedBeaconBlockHeader) + } + if dst, err = p.Header_2.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the ProposerSlashing object +func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 416 { + return ssz.ErrSize + } + + // Field (0) 'Header_1' + if p.Header_1 == nil { + p.Header_1 = new(SignedBeaconBlockHeader) + } + if err = p.Header_1.UnmarshalSSZ(buf[0:208]); err != nil { + return err + } + + // Field (1) 'Header_2' + if p.Header_2 == nil { + p.Header_2 = new(SignedBeaconBlockHeader) + } + if err = p.Header_2.UnmarshalSSZ(buf[208:416]); err != nil { + return err + } + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the ProposerSlashing object +func (p *ProposerSlashing) SizeSSZ() (size int) { + size = 416 + return +} + +// HashTreeRoot ssz hashes the ProposerSlashing object +func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the ProposerSlashing object with a hasher +func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Header_1' + if err = p.Header_1.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'Header_2' + if err = p.Header_2.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the AttesterSlashing object +func (a *AttesterSlashing) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(a) +} + +// MarshalSSZTo ssz marshals the AttesterSlashing object to a target array +func (a *AttesterSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(8) + + // Offset (0) 'Attestation_1' + dst = ssz.WriteOffset(dst, offset) + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestation) + } + offset += a.Attestation_1.SizeSSZ() + + // Offset (1) 'Attestation_2' + dst = ssz.WriteOffset(dst, offset) + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestation) + } + offset += a.Attestation_2.SizeSSZ() + + // Field (0) 'Attestation_1' + if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Attestation_2' + if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the AttesterSlashing object +func (a *AttesterSlashing) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 8 { + return ssz.ErrSize + } + + tail := buf + var o0, o1 uint64 + + // Offset (0) 'Attestation_1' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 8 { + return ssz.ErrInvalidVariableOffset + } + + // Offset (1) 'Attestation_2' + if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { + return ssz.ErrOffset + } + + // Field (0) 'Attestation_1' + { + buf = tail[o0:o1] + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestation) + } + if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil { + return err + } + } + + // Field (1) 'Attestation_2' + { + buf = tail[o1:] + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestation) + } + if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashing object +func (a *AttesterSlashing) SizeSSZ() (size int) { + size = 8 + + // Field (0) 'Attestation_1' + if a.Attestation_1 == nil { + a.Attestation_1 = new(IndexedAttestation) + } + size += a.Attestation_1.SizeSSZ() + + // Field (1) 'Attestation_2' + if a.Attestation_2 == nil { + a.Attestation_2 = new(IndexedAttestation) + } + size += a.Attestation_2.SizeSSZ() + + return +} + +// HashTreeRoot ssz hashes the AttesterSlashing object +func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(a) +} + +// HashTreeRootWith ssz hashes the AttesterSlashing object with a hasher +func (a *AttesterSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Attestation_1' + if err = a.Attestation_1.HashTreeRootWith(hh); err != nil { + return + } + + // Field (1) 'Attestation_2' + if err = a.Attestation_2.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Deposit object +func (d *Deposit) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(d) +} + +// MarshalSSZTo ssz marshals the Deposit object to a target array +func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Proof' + if size := len(d.Proof); size != 33 { + err = ssz.ErrVectorLengthFn("--.Proof", size, 33) + return + } + for ii := 0; ii < 33; ii++ { + if size := len(d.Proof[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.Proof[ii]", size, 32) + return + } + dst = append(dst, d.Proof[ii]...) + } + + // Field (1) 'Data' + if d.Data == nil { + d.Data = new(Deposit_Data) + } + if dst, err = d.Data.MarshalSSZTo(dst); err != nil { + return + } + + return +} + +// UnmarshalSSZ ssz unmarshals the Deposit object +func (d *Deposit) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 1240 { + return ssz.ErrSize + } + + // Field (0) 'Proof' + d.Proof = make([][]byte, 33) + for ii := 0; ii < 33; ii++ { + if cap(d.Proof[ii]) == 0 { + d.Proof[ii] = make([]byte, 0, len(buf[0:1056][ii*32:(ii+1)*32])) + } + d.Proof[ii] = append(d.Proof[ii], buf[0:1056][ii*32:(ii+1)*32]...) + } + + // Field (1) 'Data' + if d.Data == nil { + d.Data = new(Deposit_Data) + } + if err = d.Data.UnmarshalSSZ(buf[1056:1240]); err != nil { + return err + } + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Deposit object +func (d *Deposit) SizeSSZ() (size int) { + size = 1240 + return +} + +// HashTreeRoot ssz hashes the Deposit object +func (d *Deposit) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(d) +} + +// HashTreeRootWith ssz hashes the Deposit object with a hasher +func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Proof' + { + if size := len(d.Proof); size != 33 { + err = ssz.ErrVectorLengthFn("--.Proof", size, 33) + return + } + subIndx := hh.Index() + for _, i := range d.Proof { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (1) 'Data' + if err = d.Data.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the VoluntaryExit object +func (v *VoluntaryExit) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(v) +} + +// MarshalSSZTo ssz marshals the VoluntaryExit object to a target array +func (v *VoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Epoch' + dst = ssz.MarshalUint64(dst, uint64(v.Epoch)) + + // Field (1) 'ValidatorIndex' + dst = ssz.MarshalUint64(dst, uint64(v.ValidatorIndex)) + + return +} + +// UnmarshalSSZ ssz unmarshals the VoluntaryExit object +func (v *VoluntaryExit) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'Epoch' + v.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ValidatorIndex' + v.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the VoluntaryExit object +func (v *VoluntaryExit) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the VoluntaryExit object +func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(v) +} + +// HashTreeRootWith ssz hashes the VoluntaryExit object with a hasher +func (v *VoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Epoch' + hh.PutUint64(uint64(v.Epoch)) + + // Field (1) 'ValidatorIndex' + hh.PutUint64(uint64(v.ValidatorIndex)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedVoluntaryExit object +func (s *SignedVoluntaryExit) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedVoluntaryExit object to a target array +func (s *SignedVoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Exit' + if s.Exit == nil { + s.Exit = new(VoluntaryExit) + } + if dst, err = s.Exit.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedVoluntaryExit object +func (s *SignedVoluntaryExit) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 112 { + return ssz.ErrSize + } + + // Field (0) 'Exit' + if s.Exit == nil { + s.Exit = new(VoluntaryExit) + } + if err = s.Exit.UnmarshalSSZ(buf[0:16]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[16:112])) + } + s.Signature = append(s.Signature, buf[16:112]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedVoluntaryExit object +func (s *SignedVoluntaryExit) SizeSSZ() (size int) { + size = 112 + return +} + +// HashTreeRoot ssz hashes the SignedVoluntaryExit object +func (s *SignedVoluntaryExit) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedVoluntaryExit object with a hasher +func (s *SignedVoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Exit' + if err = s.Exit.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Eth1Data object +func (e *Eth1Data) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(e) +} + +// MarshalSSZTo ssz marshals the Eth1Data object to a target array +func (e *Eth1Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'DepositRoot' + if size := len(e.DepositRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) + return + } + dst = append(dst, e.DepositRoot...) + + // Field (1) 'DepositCount' + dst = ssz.MarshalUint64(dst, e.DepositCount) + + // Field (2) 'BlockHash' + if size := len(e.BlockHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) + return + } + dst = append(dst, e.BlockHash...) + + return +} + +// UnmarshalSSZ ssz unmarshals the Eth1Data object +func (e *Eth1Data) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 72 { + return ssz.ErrSize + } + + // Field (0) 'DepositRoot' + if cap(e.DepositRoot) == 0 { + e.DepositRoot = make([]byte, 0, len(buf[0:32])) + } + e.DepositRoot = append(e.DepositRoot, buf[0:32]...) + + // Field (1) 'DepositCount' + e.DepositCount = ssz.UnmarshallUint64(buf[32:40]) + + // Field (2) 'BlockHash' + if cap(e.BlockHash) == 0 { + e.BlockHash = make([]byte, 0, len(buf[40:72])) + } + e.BlockHash = append(e.BlockHash, buf[40:72]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Eth1Data object +func (e *Eth1Data) SizeSSZ() (size int) { + size = 72 + return +} + +// HashTreeRoot ssz hashes the Eth1Data object +func (e *Eth1Data) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(e) +} + +// HashTreeRootWith ssz hashes the Eth1Data object with a hasher +func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'DepositRoot' + if size := len(e.DepositRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32) + return + } + hh.PutBytes(e.DepositRoot) + + // Field (1) 'DepositCount' + hh.PutUint64(e.DepositCount) + + // Field (2) 'BlockHash' + if size := len(e.BlockHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) + return + } + hh.PutBytes(e.BlockHash) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconBlockHeader object +func (b *BeaconBlockHeader) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconBlockHeader object to a target array +func (b *BeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // 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...) + + // Field (4) 'BodyRoot' + if size := len(b.BodyRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) + return + } + dst = append(dst, b.BodyRoot...) + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconBlockHeader object +func (b *BeaconBlockHeader) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 112 { + return ssz.ErrSize + } + + // Field (0) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8])) + + // Field (1) 'ProposerIndex' + b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_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]...) + + // Field (4) 'BodyRoot' + if cap(b.BodyRoot) == 0 { + b.BodyRoot = make([]byte, 0, len(buf[80:112])) + } + b.BodyRoot = append(b.BodyRoot, buf[80:112]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockHeader object +func (b *BeaconBlockHeader) SizeSSZ() (size int) { + size = 112 + return +} + +// HashTreeRoot ssz hashes the BeaconBlockHeader object +func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher +func (b *BeaconBlockHeader) 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) 'BodyRoot' + if size := len(b.BodyRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.BodyRoot", size, 32) + return + } + hh.PutBytes(b.BodyRoot) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SignedBeaconBlockHeader object +func (s *SignedBeaconBlockHeader) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SignedBeaconBlockHeader object to a target array +func (s *SignedBeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'Header' + if s.Header == nil { + s.Header = new(BeaconBlockHeader) + } + if dst, err = s.Header.MarshalSSZTo(dst); err != nil { + return + } + + // Field (1) 'Signature' + if size := len(s.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, s.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockHeader object +func (s *SignedBeaconBlockHeader) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 208 { + return ssz.ErrSize + } + + // Field (0) 'Header' + if s.Header == nil { + s.Header = new(BeaconBlockHeader) + } + if err = s.Header.UnmarshalSSZ(buf[0:112]); err != nil { + return err + } + + // Field (1) 'Signature' + if cap(s.Signature) == 0 { + s.Signature = make([]byte, 0, len(buf[112:208])) + } + s.Signature = append(s.Signature, buf[112:208]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockHeader object +func (s *SignedBeaconBlockHeader) SizeSSZ() (size int) { + size = 208 + return +} + +// HashTreeRoot ssz hashes the SignedBeaconBlockHeader object +func (s *SignedBeaconBlockHeader) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SignedBeaconBlockHeader object with a hasher +func (s *SignedBeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'Header' + if err = s.Header.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) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the IndexedAttestation object +func (i *IndexedAttestation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(i) +} + +// MarshalSSZTo ssz marshals the IndexedAttestation object to a target array +func (i *IndexedAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(228) + + // Offset (0) 'AttestingIndices' + dst = ssz.WriteOffset(dst, offset) + offset += len(i.AttestingIndices) * 8 + + // Field (1) 'Data' + if i.Data == nil { + i.Data = new(AttestationData) + } + if dst, err = i.Data.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(i.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, i.Signature...) + + // Field (0) 'AttestingIndices' + if size := len(i.AttestingIndices); size > 2048 { + err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) + return + } + for ii := 0; ii < len(i.AttestingIndices); ii++ { + dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii]) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the IndexedAttestation object +func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 228 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'AttestingIndices' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 228 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Data' + if i.Data == nil { + i.Data = new(AttestationData) + } + if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil { + return err + } + + // Field (2) 'Signature' + if cap(i.Signature) == 0 { + i.Signature = make([]byte, 0, len(buf[132:228])) + } + i.Signature = append(i.Signature, buf[132:228]...) + + // Field (0) 'AttestingIndices' + { + buf = tail[o0:] + num, err := ssz.DivideInt2(len(buf), 8, 2048) + if err != nil { + return err + } + i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num) + for ii := 0; ii < num; ii++ { + i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestation object +func (i *IndexedAttestation) SizeSSZ() (size int) { + size = 228 + + // Field (0) 'AttestingIndices' + size += len(i.AttestingIndices) * 8 + + return +} + +// HashTreeRoot ssz hashes the IndexedAttestation object +func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(i) +} + +// HashTreeRootWith ssz hashes the IndexedAttestation object with a hasher +func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AttestingIndices' + { + if size := len(i.AttestingIndices); size > 2048 { + err = ssz.ErrListTooBigFn("--.AttestingIndices", size, 2048) + return + } + subIndx := hh.Index() + for _, i := range i.AttestingIndices { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(i.AttestingIndices)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8)) + } + + // Field (1) 'Data' + if err = i.Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'Signature' + if size := len(i.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(i.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Deposit_Data object +func (d *Deposit_Data) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(d) +} + +// MarshalSSZTo ssz marshals the Deposit_Data object to a target array +func (d *Deposit_Data) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'PublicKey' + if size := len(d.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + dst = append(dst, d.PublicKey...) + + // Field (1) 'WithdrawalCredentials' + if size := len(d.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + dst = append(dst, d.WithdrawalCredentials...) + + // Field (2) 'Amount' + dst = ssz.MarshalUint64(dst, d.Amount) + + // Field (3) 'Signature' + if size := len(d.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + dst = append(dst, d.Signature...) + + return +} + +// UnmarshalSSZ ssz unmarshals the Deposit_Data object +func (d *Deposit_Data) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 184 { + return ssz.ErrSize + } + + // Field (0) 'PublicKey' + if cap(d.PublicKey) == 0 { + d.PublicKey = make([]byte, 0, len(buf[0:48])) + } + d.PublicKey = append(d.PublicKey, buf[0:48]...) + + // Field (1) 'WithdrawalCredentials' + if cap(d.WithdrawalCredentials) == 0 { + d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) + } + d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) + + // Field (2) 'Amount' + d.Amount = ssz.UnmarshallUint64(buf[80:88]) + + // Field (3) 'Signature' + if cap(d.Signature) == 0 { + d.Signature = make([]byte, 0, len(buf[88:184])) + } + d.Signature = append(d.Signature, buf[88:184]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Deposit_Data object +func (d *Deposit_Data) SizeSSZ() (size int) { + size = 184 + return +} + +// HashTreeRoot ssz hashes the Deposit_Data object +func (d *Deposit_Data) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(d) +} + +// HashTreeRootWith ssz hashes the Deposit_Data object with a hasher +func (d *Deposit_Data) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'PublicKey' + if size := len(d.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + hh.PutBytes(d.PublicKey) + + // Field (1) 'WithdrawalCredentials' + if size := len(d.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + hh.PutBytes(d.WithdrawalCredentials) + + // Field (2) 'Amount' + hh.PutUint64(d.Amount) + + // Field (3) 'Signature' + if size := len(d.Signature); size != 96 { + err = ssz.ErrBytesLengthFn("--.Signature", size, 96) + return + } + hh.PutBytes(d.Signature) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the BeaconState object +func (b *BeaconState) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(b) +} + +// MarshalSSZTo ssz marshals the BeaconState object to a target array +func (b *BeaconState) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(2687377) + + // Field (0) 'GenesisTime' + dst = ssz.MarshalUint64(dst, b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, b.GenesisValidatorsRoot...) + + // Field (2) 'Slot' + dst = ssz.MarshalUint64(dst, uint64(b.Slot)) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if dst, err = b.Fork.MarshalSSZTo(dst); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil { + return + } + + // Field (5) 'BlockRoots' + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, b.BlockRoots[ii]...) + } + + // Field (6) 'StateRoots' + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(b.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, b.StateRoots[ii]...) + } + + // Offset (7) 'HistoricalRoots' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.HistoricalRoots) * 32 + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { + return + } + + // Offset (9) 'Eth1DataVotes' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Eth1DataVotes) * 72 + + // Field (10) 'Eth1DepositIndex' + dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex) + + // Offset (11) 'Validators' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Validators) * 121 + + // Offset (12) 'Balances' + dst = ssz.WriteOffset(dst, offset) + offset += len(b.Balances) * 8 + + // Field (13) 'RandaoMixes' + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + for ii := 0; ii < 65536; ii++ { + if size := len(b.RandaoMixes[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32) + return + } + dst = append(dst, b.RandaoMixes[ii]...) + } + + // Field (14) 'Slashings' + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + dst = ssz.MarshalUint64(dst, b.Slashings[ii]) + } + + // Offset (15) 'PreviousEpochAttestations' + dst = ssz.WriteOffset(dst, offset) + for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { + offset += 4 + offset += b.PreviousEpochAttestations[ii].SizeSSZ() + } + + // Offset (16) 'CurrentEpochAttestations' + dst = ssz.WriteOffset(dst, offset) + for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { + offset += 4 + offset += b.CurrentEpochAttestations[ii].SizeSSZ() + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + dst = append(dst, b.JustificationBits...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil { + return + } + + // Field (7) 'HistoricalRoots' + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + for ii := 0; ii < len(b.HistoricalRoots); ii++ { + if size := len(b.HistoricalRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32) + return + } + dst = append(dst, b.HistoricalRoots[ii]...) + } + + // Field (9) 'Eth1DataVotes' + if size := len(b.Eth1DataVotes); size > 2048 { + err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048) + return + } + for ii := 0; ii < len(b.Eth1DataVotes); ii++ { + if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (11) 'Validators' + if size := len(b.Validators); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Validators); ii++ { + if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (12) 'Balances' + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + for ii := 0; ii < len(b.Balances); ii++ { + dst = ssz.MarshalUint64(dst, b.Balances[ii]) + } + + // Field (15) 'PreviousEpochAttestations' + if size := len(b.PreviousEpochAttestations); size > 4096 { + err = ssz.ErrListTooBigFn("--.PreviousEpochAttestations", size, 4096) + return + } + { + offset = 4 * len(b.PreviousEpochAttestations) + for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { + dst = ssz.WriteOffset(dst, offset) + offset += b.PreviousEpochAttestations[ii].SizeSSZ() + } + } + for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { + if dst, err = b.PreviousEpochAttestations[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + // Field (16) 'CurrentEpochAttestations' + if size := len(b.CurrentEpochAttestations); size > 4096 { + err = ssz.ErrListTooBigFn("--.CurrentEpochAttestations", size, 4096) + return + } + { + offset = 4 * len(b.CurrentEpochAttestations) + for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { + dst = ssz.WriteOffset(dst, offset) + offset += b.CurrentEpochAttestations[ii].SizeSSZ() + } + } + for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { + if dst, err = b.CurrentEpochAttestations[ii].MarshalSSZTo(dst); err != nil { + return + } + } + + return +} + +// UnmarshalSSZ ssz unmarshals the BeaconState object +func (b *BeaconState) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 2687377 { + return ssz.ErrSize + } + + tail := buf + var o7, o9, o11, o12, o15, o16 uint64 + + // Field (0) 'GenesisTime' + b.GenesisTime = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'GenesisValidatorsRoot' + if cap(b.GenesisValidatorsRoot) == 0 { + b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40])) + } + b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...) + + // Field (2) 'Slot' + b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48])) + + // Field (3) 'Fork' + if b.Fork == nil { + b.Fork = new(Fork) + } + if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil { + return err + } + + // Field (4) 'LatestBlockHeader' + if b.LatestBlockHeader == nil { + b.LatestBlockHeader = new(BeaconBlockHeader) + } + if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil { + return err + } + + // Field (5) 'BlockRoots' + b.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.BlockRoots[ii]) == 0 { + b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32])) + } + b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...) + } + + // Field (6) 'StateRoots' + b.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(b.StateRoots[ii]) == 0 { + b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32])) + } + b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...) + } + + // Offset (7) 'HistoricalRoots' + if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size { + return ssz.ErrOffset + } + + if o7 != 2687377 { + return ssz.ErrInvalidVariableOffset + } + + // Field (8) 'Eth1Data' + if b.Eth1Data == nil { + b.Eth1Data = new(Eth1Data) + } + if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil { + return err + } + + // Offset (9) 'Eth1DataVotes' + if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 { + return ssz.ErrOffset + } + + // Field (10) 'Eth1DepositIndex' + b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552]) + + // Offset (11) 'Validators' + if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 { + return ssz.ErrOffset + } + + // Offset (12) 'Balances' + if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 { + return ssz.ErrOffset + } + + // Field (13) 'RandaoMixes' + b.RandaoMixes = make([][]byte, 65536) + for ii := 0; ii < 65536; ii++ { + if cap(b.RandaoMixes[ii]) == 0 { + b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32])) + } + b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...) + } + + // Field (14) 'Slashings' + b.Slashings = ssz.ExtendUint64(b.Slashings, 8192) + for ii := 0; ii < 8192; ii++ { + b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8]) + } + + // Offset (15) 'PreviousEpochAttestations' + if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 { + return ssz.ErrOffset + } + + // Offset (16) 'CurrentEpochAttestations' + if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 { + return ssz.ErrOffset + } + + // Field (17) 'JustificationBits' + if cap(b.JustificationBits) == 0 { + b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257])) + } + b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...) + + // Field (18) 'PreviousJustifiedCheckpoint' + if b.PreviousJustifiedCheckpoint == nil { + b.PreviousJustifiedCheckpoint = new(Checkpoint) + } + if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil { + return err + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if b.CurrentJustifiedCheckpoint == nil { + b.CurrentJustifiedCheckpoint = new(Checkpoint) + } + if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil { + return err + } + + // Field (20) 'FinalizedCheckpoint' + if b.FinalizedCheckpoint == nil { + b.FinalizedCheckpoint = new(Checkpoint) + } + if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil { + return err + } + + // Field (7) 'HistoricalRoots' + { + buf = tail[o7:o9] + num, err := ssz.DivideInt2(len(buf), 32, 16777216) + if err != nil { + return err + } + b.HistoricalRoots = make([][]byte, num) + for ii := 0; ii < num; ii++ { + if cap(b.HistoricalRoots[ii]) == 0 { + b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32])) + } + b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...) + } + } + + // Field (9) 'Eth1DataVotes' + { + buf = tail[o9:o11] + num, err := ssz.DivideInt2(len(buf), 72, 2048) + if err != nil { + return err + } + b.Eth1DataVotes = make([]*Eth1Data, num) + for ii := 0; ii < num; ii++ { + if b.Eth1DataVotes[ii] == nil { + b.Eth1DataVotes[ii] = new(Eth1Data) + } + if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil { + return err + } + } + } + + // Field (11) 'Validators' + { + buf = tail[o11:o12] + num, err := ssz.DivideInt2(len(buf), 121, 1099511627776) + if err != nil { + return err + } + b.Validators = make([]*Validator, num) + for ii := 0; ii < num; ii++ { + if b.Validators[ii] == nil { + b.Validators[ii] = new(Validator) + } + if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil { + return err + } + } + } + + // Field (12) 'Balances' + { + buf = tail[o12:o15] + num, err := ssz.DivideInt2(len(buf), 8, 1099511627776) + if err != nil { + return err + } + b.Balances = ssz.ExtendUint64(b.Balances, num) + for ii := 0; ii < num; ii++ { + b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8]) + } + } + + // Field (15) 'PreviousEpochAttestations' + { + buf = tail[o15:o16] + num, err := ssz.DecodeDynamicLength(buf, 4096) + if err != nil { + return err + } + b.PreviousEpochAttestations = make([]*PendingAttestation, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.PreviousEpochAttestations[indx] == nil { + b.PreviousEpochAttestations[indx] = new(PendingAttestation) + } + if err = b.PreviousEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { + return err + } + return nil + }) + if err != nil { + return err + } + } + + // Field (16) 'CurrentEpochAttestations' + { + buf = tail[o16:] + num, err := ssz.DecodeDynamicLength(buf, 4096) + if err != nil { + return err + } + b.CurrentEpochAttestations = make([]*PendingAttestation, num) + err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { + if b.CurrentEpochAttestations[indx] == nil { + b.CurrentEpochAttestations[indx] = new(PendingAttestation) + } + if err = b.CurrentEpochAttestations[indx].UnmarshalSSZ(buf); err != nil { + return err + } + return nil + }) + if err != nil { + return err + } + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the BeaconState object +func (b *BeaconState) SizeSSZ() (size int) { + size = 2687377 + + // Field (7) 'HistoricalRoots' + size += len(b.HistoricalRoots) * 32 + + // Field (9) 'Eth1DataVotes' + size += len(b.Eth1DataVotes) * 72 + + // Field (11) 'Validators' + size += len(b.Validators) * 121 + + // Field (12) 'Balances' + size += len(b.Balances) * 8 + + // Field (15) 'PreviousEpochAttestations' + for ii := 0; ii < len(b.PreviousEpochAttestations); ii++ { + size += 4 + size += b.PreviousEpochAttestations[ii].SizeSSZ() + } + + // Field (16) 'CurrentEpochAttestations' + for ii := 0; ii < len(b.CurrentEpochAttestations); ii++ { + size += 4 + size += b.CurrentEpochAttestations[ii].SizeSSZ() + } + + return +} + +// HashTreeRoot ssz hashes the BeaconState object +func (b *BeaconState) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(b) +} + +// HashTreeRootWith ssz hashes the BeaconState object with a hasher +func (b *BeaconState) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'GenesisTime' + hh.PutUint64(b.GenesisTime) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(b.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(b.GenesisValidatorsRoot) + + // Field (2) 'Slot' + hh.PutUint64(uint64(b.Slot)) + + // Field (3) 'Fork' + if err = b.Fork.HashTreeRootWith(hh); err != nil { + return + } + + // Field (4) 'LatestBlockHeader' + if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil { + return + } + + // Field (5) 'BlockRoots' + { + if size := len(b.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (6) 'StateRoots' + { + if size := len(b.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (7) 'HistoricalRoots' + { + if size := len(b.HistoricalRoots); size > 16777216 { + err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216) + return + } + subIndx := hh.Index() + for _, i := range b.HistoricalRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + + numItems := uint64(len(b.HistoricalRoots)) + hh.MerkleizeWithMixin(subIndx, numItems, 16777216) + } + + // Field (8) 'Eth1Data' + if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (9) 'Eth1DataVotes' + { + subIndx := hh.Index() + num := uint64(len(b.Eth1DataVotes)) + if num > 2048 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Eth1DataVotes { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 2048) + } + + // Field (10) 'Eth1DepositIndex' + hh.PutUint64(b.Eth1DepositIndex) + + // Field (11) 'Validators' + { + subIndx := hh.Index() + num := uint64(len(b.Validators)) + if num > 1099511627776 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.Validators { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 1099511627776) + } + + // Field (12) 'Balances' + { + if size := len(b.Balances); size > 1099511627776 { + err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776) + return + } + subIndx := hh.Index() + for _, i := range b.Balances { + hh.AppendUint64(i) + } + hh.FillUpTo32() + + numItems := uint64(len(b.Balances)) + hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8)) + } + + // Field (13) 'RandaoMixes' + { + if size := len(b.RandaoMixes); size != 65536 { + err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536) + return + } + subIndx := hh.Index() + for _, i := range b.RandaoMixes { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (14) 'Slashings' + { + if size := len(b.Slashings); size != 8192 { + err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range b.Slashings { + hh.AppendUint64(i) + } + hh.Merkleize(subIndx) + } + + // Field (15) 'PreviousEpochAttestations' + { + subIndx := hh.Index() + num := uint64(len(b.PreviousEpochAttestations)) + if num > 4096 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.PreviousEpochAttestations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 4096) + } + + // Field (16) 'CurrentEpochAttestations' + { + subIndx := hh.Index() + num := uint64(len(b.CurrentEpochAttestations)) + if num > 4096 { + err = ssz.ErrIncorrectListSize + return + } + for _, elem := range b.CurrentEpochAttestations { + if err = elem.HashTreeRootWith(hh); err != nil { + return + } + } + hh.MerkleizeWithMixin(subIndx, num, 4096) + } + + // Field (17) 'JustificationBits' + if size := len(b.JustificationBits); size != 1 { + err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1) + return + } + hh.PutBytes(b.JustificationBits) + + // Field (18) 'PreviousJustifiedCheckpoint' + if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (19) 'CurrentJustifiedCheckpoint' + if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + // Field (20) 'FinalizedCheckpoint' + if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil { + return + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Fork object +func (f *Fork) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(f) +} + +// MarshalSSZTo ssz marshals the Fork object to a target array +func (f *Fork) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'PreviousVersion' + if size := len(f.PreviousVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) + return + } + dst = append(dst, f.PreviousVersion...) + + // Field (1) 'CurrentVersion' + if size := len(f.CurrentVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) + return + } + dst = append(dst, f.CurrentVersion...) + + // Field (2) 'Epoch' + dst = ssz.MarshalUint64(dst, uint64(f.Epoch)) + + return +} + +// UnmarshalSSZ ssz unmarshals the Fork object +func (f *Fork) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'PreviousVersion' + if cap(f.PreviousVersion) == 0 { + f.PreviousVersion = make([]byte, 0, len(buf[0:4])) + } + f.PreviousVersion = append(f.PreviousVersion, buf[0:4]...) + + // Field (1) 'CurrentVersion' + if cap(f.CurrentVersion) == 0 { + f.CurrentVersion = make([]byte, 0, len(buf[4:8])) + } + f.CurrentVersion = append(f.CurrentVersion, buf[4:8]...) + + // Field (2) 'Epoch' + f.Epoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Fork object +func (f *Fork) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the Fork object +func (f *Fork) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(f) +} + +// HashTreeRootWith ssz hashes the Fork object with a hasher +func (f *Fork) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'PreviousVersion' + if size := len(f.PreviousVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.PreviousVersion", size, 4) + return + } + hh.PutBytes(f.PreviousVersion) + + // Field (1) 'CurrentVersion' + if size := len(f.CurrentVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) + return + } + hh.PutBytes(f.CurrentVersion) + + // Field (2) 'Epoch' + hh.PutUint64(uint64(f.Epoch)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the PendingAttestation object +func (p *PendingAttestation) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the PendingAttestation object to a target array +func (p *PendingAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + offset := int(148) + + // Offset (0) 'AggregationBits' + dst = ssz.WriteOffset(dst, offset) + offset += len(p.AggregationBits) + + // Field (1) 'Data' + if p.Data == nil { + p.Data = new(AttestationData) + } + if dst, err = p.Data.MarshalSSZTo(dst); err != nil { + return + } + + // Field (2) 'InclusionDelay' + dst = ssz.MarshalUint64(dst, uint64(p.InclusionDelay)) + + // Field (3) 'ProposerIndex' + dst = ssz.MarshalUint64(dst, uint64(p.ProposerIndex)) + + // Field (0) 'AggregationBits' + if size := len(p.AggregationBits); size > 2048 { + err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 2048) + return + } + dst = append(dst, p.AggregationBits...) + + return +} + +// UnmarshalSSZ ssz unmarshals the PendingAttestation object +func (p *PendingAttestation) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size < 148 { + return ssz.ErrSize + } + + tail := buf + var o0 uint64 + + // Offset (0) 'AggregationBits' + if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { + return ssz.ErrOffset + } + + if o0 != 148 { + return ssz.ErrInvalidVariableOffset + } + + // Field (1) 'Data' + if p.Data == nil { + p.Data = new(AttestationData) + } + if err = p.Data.UnmarshalSSZ(buf[4:132]); err != nil { + return err + } + + // Field (2) 'InclusionDelay' + p.InclusionDelay = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[132:140])) + + // Field (3) 'ProposerIndex' + p.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[140:148])) + + // Field (0) 'AggregationBits' + { + buf = tail[o0:] + if err = ssz.ValidateBitlist(buf, 2048); err != nil { + return err + } + if cap(p.AggregationBits) == 0 { + p.AggregationBits = make([]byte, 0, len(buf)) + } + p.AggregationBits = append(p.AggregationBits, buf...) + } + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the PendingAttestation object +func (p *PendingAttestation) SizeSSZ() (size int) { + size = 148 + + // Field (0) 'AggregationBits' + size += len(p.AggregationBits) + + return +} + +// HashTreeRoot ssz hashes the PendingAttestation object +func (p *PendingAttestation) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the PendingAttestation object with a hasher +func (p *PendingAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'AggregationBits' + if len(p.AggregationBits) == 0 { + err = ssz.ErrEmptyBitlist + return + } + hh.PutBitlist(p.AggregationBits, 2048) + + // Field (1) 'Data' + if err = p.Data.HashTreeRootWith(hh); err != nil { + return + } + + // Field (2) 'InclusionDelay' + hh.PutUint64(uint64(p.InclusionDelay)) + + // Field (3) 'ProposerIndex' + hh.PutUint64(uint64(p.ProposerIndex)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the HistoricalBatch object +func (h *HistoricalBatch) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(h) +} + +// MarshalSSZTo ssz marshals the HistoricalBatch object to a target array +func (h *HistoricalBatch) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'BlockRoots' + if size := len(h.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(h.BlockRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32) + return + } + dst = append(dst, h.BlockRoots[ii]...) + } + + // Field (1) 'StateRoots' + if size := len(h.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + for ii := 0; ii < 8192; ii++ { + if size := len(h.StateRoots[ii]); size != 32 { + err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32) + return + } + dst = append(dst, h.StateRoots[ii]...) + } + + return +} + +// UnmarshalSSZ ssz unmarshals the HistoricalBatch object +func (h *HistoricalBatch) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 524288 { + return ssz.ErrSize + } + + // Field (0) 'BlockRoots' + h.BlockRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(h.BlockRoots[ii]) == 0 { + h.BlockRoots[ii] = make([]byte, 0, len(buf[0:262144][ii*32:(ii+1)*32])) + } + h.BlockRoots[ii] = append(h.BlockRoots[ii], buf[0:262144][ii*32:(ii+1)*32]...) + } + + // Field (1) 'StateRoots' + h.StateRoots = make([][]byte, 8192) + for ii := 0; ii < 8192; ii++ { + if cap(h.StateRoots[ii]) == 0 { + h.StateRoots[ii] = make([]byte, 0, len(buf[262144:524288][ii*32:(ii+1)*32])) + } + h.StateRoots[ii] = append(h.StateRoots[ii], buf[262144:524288][ii*32:(ii+1)*32]...) + } + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the HistoricalBatch object +func (h *HistoricalBatch) SizeSSZ() (size int) { + size = 524288 + return +} + +// HashTreeRoot ssz hashes the HistoricalBatch object +func (h *HistoricalBatch) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(h) +} + +// HashTreeRootWith ssz hashes the HistoricalBatch object with a hasher +func (h *HistoricalBatch) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'BlockRoots' + { + if size := len(h.BlockRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range h.BlockRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + // Field (1) 'StateRoots' + { + if size := len(h.StateRoots); size != 8192 { + err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192) + return + } + subIndx := hh.Index() + for _, i := range h.StateRoots { + if len(i) != 32 { + err = ssz.ErrBytesLength + return + } + hh.Append(i) + } + hh.Merkleize(subIndx) + } + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the SigningData object +func (s *SigningData) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the SigningData object to a target array +func (s *SigningData) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'ObjectRoot' + if size := len(s.ObjectRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) + return + } + dst = append(dst, s.ObjectRoot...) + + // Field (1) 'Domain' + if size := len(s.Domain); size != 32 { + err = ssz.ErrBytesLengthFn("--.Domain", size, 32) + return + } + dst = append(dst, s.Domain...) + + return +} + +// UnmarshalSSZ ssz unmarshals the SigningData object +func (s *SigningData) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 64 { + return ssz.ErrSize + } + + // Field (0) 'ObjectRoot' + if cap(s.ObjectRoot) == 0 { + s.ObjectRoot = make([]byte, 0, len(buf[0:32])) + } + s.ObjectRoot = append(s.ObjectRoot, buf[0:32]...) + + // Field (1) 'Domain' + if cap(s.Domain) == 0 { + s.Domain = make([]byte, 0, len(buf[32:64])) + } + s.Domain = append(s.Domain, buf[32:64]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the SigningData object +func (s *SigningData) SizeSSZ() (size int) { + size = 64 + return +} + +// HashTreeRoot ssz hashes the SigningData object +func (s *SigningData) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the SigningData object with a hasher +func (s *SigningData) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'ObjectRoot' + if size := len(s.ObjectRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.ObjectRoot", size, 32) + return + } + hh.PutBytes(s.ObjectRoot) + + // Field (1) 'Domain' + if size := len(s.Domain); size != 32 { + err = ssz.ErrBytesLengthFn("--.Domain", size, 32) + return + } + hh.PutBytes(s.Domain) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the ForkData object +func (f *ForkData) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(f) +} + +// MarshalSSZTo ssz marshals the ForkData object to a target array +func (f *ForkData) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'CurrentVersion' + if size := len(f.CurrentVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) + return + } + dst = append(dst, f.CurrentVersion...) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(f.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + dst = append(dst, f.GenesisValidatorsRoot...) + + return +} + +// UnmarshalSSZ ssz unmarshals the ForkData object +func (f *ForkData) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 36 { + return ssz.ErrSize + } + + // Field (0) 'CurrentVersion' + if cap(f.CurrentVersion) == 0 { + f.CurrentVersion = make([]byte, 0, len(buf[0:4])) + } + f.CurrentVersion = append(f.CurrentVersion, buf[0:4]...) + + // Field (1) 'GenesisValidatorsRoot' + if cap(f.GenesisValidatorsRoot) == 0 { + f.GenesisValidatorsRoot = make([]byte, 0, len(buf[4:36])) + } + f.GenesisValidatorsRoot = append(f.GenesisValidatorsRoot, buf[4:36]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the ForkData object +func (f *ForkData) SizeSSZ() (size int) { + size = 36 + return +} + +// HashTreeRoot ssz hashes the ForkData object +func (f *ForkData) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(f) +} + +// HashTreeRootWith ssz hashes the ForkData object with a hasher +func (f *ForkData) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'CurrentVersion' + if size := len(f.CurrentVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentVersion", size, 4) + return + } + hh.PutBytes(f.CurrentVersion) + + // Field (1) 'GenesisValidatorsRoot' + if size := len(f.GenesisValidatorsRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32) + return + } + hh.PutBytes(f.GenesisValidatorsRoot) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the DepositMessage object +func (d *DepositMessage) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(d) +} + +// MarshalSSZTo ssz marshals the DepositMessage object to a target array +func (d *DepositMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'PublicKey' + if size := len(d.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + dst = append(dst, d.PublicKey...) + + // Field (1) 'WithdrawalCredentials' + if size := len(d.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + dst = append(dst, d.WithdrawalCredentials...) + + // Field (2) 'Amount' + dst = ssz.MarshalUint64(dst, d.Amount) + + return +} + +// UnmarshalSSZ ssz unmarshals the DepositMessage object +func (d *DepositMessage) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 88 { + return ssz.ErrSize + } + + // Field (0) 'PublicKey' + if cap(d.PublicKey) == 0 { + d.PublicKey = make([]byte, 0, len(buf[0:48])) + } + d.PublicKey = append(d.PublicKey, buf[0:48]...) + + // Field (1) 'WithdrawalCredentials' + if cap(d.WithdrawalCredentials) == 0 { + d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) + } + d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) + + // Field (2) 'Amount' + d.Amount = ssz.UnmarshallUint64(buf[80:88]) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the DepositMessage object +func (d *DepositMessage) SizeSSZ() (size int) { + size = 88 + return +} + +// HashTreeRoot ssz hashes the DepositMessage object +func (d *DepositMessage) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(d) +} + +// HashTreeRootWith ssz hashes the DepositMessage object with a hasher +func (d *DepositMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'PublicKey' + if size := len(d.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + hh.PutBytes(d.PublicKey) + + // Field (1) 'WithdrawalCredentials' + if size := len(d.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + hh.PutBytes(d.WithdrawalCredentials) + + // Field (2) 'Amount' + hh.PutUint64(d.Amount) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the PowBlock object +func (p *PowBlock) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(p) +} + +// MarshalSSZTo ssz marshals the PowBlock object to a target array +func (p *PowBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'BlockHash' + if size := len(p.BlockHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) + return + } + dst = append(dst, p.BlockHash...) + + // Field (1) 'ParentHash' + if size := len(p.ParentHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) + return + } + dst = append(dst, p.ParentHash...) + + // Field (2) 'TotalDifficulty' + if size := len(p.TotalDifficulty); size != 32 { + err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) + return + } + dst = append(dst, p.TotalDifficulty...) + + return +} + +// UnmarshalSSZ ssz unmarshals the PowBlock object +func (p *PowBlock) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 96 { + return ssz.ErrSize + } + + // Field (0) 'BlockHash' + if cap(p.BlockHash) == 0 { + p.BlockHash = make([]byte, 0, len(buf[0:32])) + } + p.BlockHash = append(p.BlockHash, buf[0:32]...) + + // Field (1) 'ParentHash' + if cap(p.ParentHash) == 0 { + p.ParentHash = make([]byte, 0, len(buf[32:64])) + } + p.ParentHash = append(p.ParentHash, buf[32:64]...) + + // Field (2) 'TotalDifficulty' + if cap(p.TotalDifficulty) == 0 { + p.TotalDifficulty = make([]byte, 0, len(buf[64:96])) + } + p.TotalDifficulty = append(p.TotalDifficulty, buf[64:96]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the PowBlock object +func (p *PowBlock) SizeSSZ() (size int) { + size = 96 + return +} + +// HashTreeRoot ssz hashes the PowBlock object +func (p *PowBlock) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(p) +} + +// HashTreeRootWith ssz hashes the PowBlock object with a hasher +func (p *PowBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'BlockHash' + if size := len(p.BlockHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) + return + } + hh.PutBytes(p.BlockHash) + + // Field (1) 'ParentHash' + if size := len(p.ParentHash); size != 32 { + err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) + return + } + hh.PutBytes(p.ParentHash) + + // Field (2) 'TotalDifficulty' + if size := len(p.TotalDifficulty); size != 32 { + err = ssz.ErrBytesLengthFn("--.TotalDifficulty", size, 32) + return + } + hh.PutBytes(p.TotalDifficulty) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Status object +func (s *Status) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(s) +} + +// MarshalSSZTo ssz marshals the Status object to a target array +func (s *Status) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'ForkDigest' + if size := len(s.ForkDigest); size != 4 { + err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) + return + } + dst = append(dst, s.ForkDigest...) + + // Field (1) 'FinalizedRoot' + if size := len(s.FinalizedRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) + return + } + dst = append(dst, s.FinalizedRoot...) + + // Field (2) 'FinalizedEpoch' + dst = ssz.MarshalUint64(dst, uint64(s.FinalizedEpoch)) + + // Field (3) 'HeadRoot' + if size := len(s.HeadRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) + return + } + dst = append(dst, s.HeadRoot...) + + // Field (4) 'HeadSlot' + dst = ssz.MarshalUint64(dst, uint64(s.HeadSlot)) + + return +} + +// UnmarshalSSZ ssz unmarshals the Status object +func (s *Status) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 84 { + return ssz.ErrSize + } + + // Field (0) 'ForkDigest' + if cap(s.ForkDigest) == 0 { + s.ForkDigest = make([]byte, 0, len(buf[0:4])) + } + s.ForkDigest = append(s.ForkDigest, buf[0:4]...) + + // Field (1) 'FinalizedRoot' + if cap(s.FinalizedRoot) == 0 { + s.FinalizedRoot = make([]byte, 0, len(buf[4:36])) + } + s.FinalizedRoot = append(s.FinalizedRoot, buf[4:36]...) + + // Field (2) 'FinalizedEpoch' + s.FinalizedEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[36:44])) + + // Field (3) 'HeadRoot' + if cap(s.HeadRoot) == 0 { + s.HeadRoot = make([]byte, 0, len(buf[44:76])) + } + s.HeadRoot = append(s.HeadRoot, buf[44:76]...) + + // Field (4) 'HeadSlot' + s.HeadSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[76:84])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Status object +func (s *Status) SizeSSZ() (size int) { + size = 84 + return +} + +// HashTreeRoot ssz hashes the Status object +func (s *Status) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(s) +} + +// HashTreeRootWith ssz hashes the Status object with a hasher +func (s *Status) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'ForkDigest' + if size := len(s.ForkDigest); size != 4 { + err = ssz.ErrBytesLengthFn("--.ForkDigest", size, 4) + return + } + hh.PutBytes(s.ForkDigest) + + // Field (1) 'FinalizedRoot' + if size := len(s.FinalizedRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.FinalizedRoot", size, 32) + return + } + hh.PutBytes(s.FinalizedRoot) + + // Field (2) 'FinalizedEpoch' + hh.PutUint64(uint64(s.FinalizedEpoch)) + + // Field (3) 'HeadRoot' + if size := len(s.HeadRoot); size != 32 { + err = ssz.ErrBytesLengthFn("--.HeadRoot", size, 32) + return + } + hh.PutBytes(s.HeadRoot) + + // Field (4) 'HeadSlot' + hh.PutUint64(uint64(s.HeadSlot)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the ENRForkID object +func (e *ENRForkID) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(e) +} + +// MarshalSSZTo ssz marshals the ENRForkID object to a target array +func (e *ENRForkID) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'CurrentForkDigest' + if size := len(e.CurrentForkDigest); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) + return + } + dst = append(dst, e.CurrentForkDigest...) + + // Field (1) 'NextForkVersion' + if size := len(e.NextForkVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) + return + } + dst = append(dst, e.NextForkVersion...) + + // Field (2) 'NextForkEpoch' + dst = ssz.MarshalUint64(dst, uint64(e.NextForkEpoch)) + + return +} + +// UnmarshalSSZ ssz unmarshals the ENRForkID object +func (e *ENRForkID) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 16 { + return ssz.ErrSize + } + + // Field (0) 'CurrentForkDigest' + if cap(e.CurrentForkDigest) == 0 { + e.CurrentForkDigest = make([]byte, 0, len(buf[0:4])) + } + e.CurrentForkDigest = append(e.CurrentForkDigest, buf[0:4]...) + + // Field (1) 'NextForkVersion' + if cap(e.NextForkVersion) == 0 { + e.NextForkVersion = make([]byte, 0, len(buf[4:8])) + } + e.NextForkVersion = append(e.NextForkVersion, buf[4:8]...) + + // Field (2) 'NextForkEpoch' + e.NextForkEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[8:16])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the ENRForkID object +func (e *ENRForkID) SizeSSZ() (size int) { + size = 16 + return +} + +// HashTreeRoot ssz hashes the ENRForkID object +func (e *ENRForkID) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(e) +} + +// HashTreeRootWith ssz hashes the ENRForkID object with a hasher +func (e *ENRForkID) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'CurrentForkDigest' + if size := len(e.CurrentForkDigest); size != 4 { + err = ssz.ErrBytesLengthFn("--.CurrentForkDigest", size, 4) + return + } + hh.PutBytes(e.CurrentForkDigest) + + // Field (1) 'NextForkVersion' + if size := len(e.NextForkVersion); size != 4 { + err = ssz.ErrBytesLengthFn("--.NextForkVersion", size, 4) + return + } + hh.PutBytes(e.NextForkVersion) + + // Field (2) 'NextForkEpoch' + hh.PutUint64(uint64(e.NextForkEpoch)) + + hh.Merkleize(indx) + return +} + +// MarshalSSZ ssz marshals the Validator object +func (v *Validator) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(v) +} + +// MarshalSSZTo ssz marshals the Validator object to a target array +func (v *Validator) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'PublicKey' + if size := len(v.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + dst = append(dst, v.PublicKey...) + + // Field (1) 'WithdrawalCredentials' + if size := len(v.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + dst = append(dst, v.WithdrawalCredentials...) + + // Field (2) 'EffectiveBalance' + dst = ssz.MarshalUint64(dst, v.EffectiveBalance) + + // Field (3) 'Slashed' + dst = ssz.MarshalBool(dst, v.Slashed) + + // Field (4) 'ActivationEligibilityEpoch' + dst = ssz.MarshalUint64(dst, uint64(v.ActivationEligibilityEpoch)) + + // Field (5) 'ActivationEpoch' + dst = ssz.MarshalUint64(dst, uint64(v.ActivationEpoch)) + + // Field (6) 'ExitEpoch' + dst = ssz.MarshalUint64(dst, uint64(v.ExitEpoch)) + + // Field (7) 'WithdrawableEpoch' + dst = ssz.MarshalUint64(dst, uint64(v.WithdrawableEpoch)) + + return +} + +// UnmarshalSSZ ssz unmarshals the Validator object +func (v *Validator) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 121 { + return ssz.ErrSize + } + + // Field (0) 'PublicKey' + if cap(v.PublicKey) == 0 { + v.PublicKey = make([]byte, 0, len(buf[0:48])) + } + v.PublicKey = append(v.PublicKey, buf[0:48]...) + + // Field (1) 'WithdrawalCredentials' + if cap(v.WithdrawalCredentials) == 0 { + v.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) + } + v.WithdrawalCredentials = append(v.WithdrawalCredentials, buf[48:80]...) + + // Field (2) 'EffectiveBalance' + v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88]) + + // Field (3) 'Slashed' + v.Slashed = ssz.UnmarshalBool(buf[88:89]) + + // Field (4) 'ActivationEligibilityEpoch' + v.ActivationEligibilityEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[89:97])) + + // Field (5) 'ActivationEpoch' + v.ActivationEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[97:105])) + + // Field (6) 'ExitEpoch' + v.ExitEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[105:113])) + + // Field (7) 'WithdrawableEpoch' + v.WithdrawableEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[113:121])) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the Validator object +func (v *Validator) SizeSSZ() (size int) { + size = 121 + return +} + +// HashTreeRoot ssz hashes the Validator object +func (v *Validator) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(v) +} + +// HashTreeRootWith ssz hashes the Validator object with a hasher +func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'PublicKey' + if size := len(v.PublicKey); size != 48 { + err = ssz.ErrBytesLengthFn("--.PublicKey", size, 48) + return + } + hh.PutBytes(v.PublicKey) + + // Field (1) 'WithdrawalCredentials' + if size := len(v.WithdrawalCredentials); size != 32 { + err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) + return + } + hh.PutBytes(v.WithdrawalCredentials) + + // Field (2) 'EffectiveBalance' + hh.PutUint64(v.EffectiveBalance) + + // Field (3) 'Slashed' + hh.PutBool(v.Slashed) + + // Field (4) 'ActivationEligibilityEpoch' + hh.PutUint64(uint64(v.ActivationEligibilityEpoch)) + + // Field (5) 'ActivationEpoch' + hh.PutUint64(uint64(v.ActivationEpoch)) + + // Field (6) 'ExitEpoch' + hh.PutUint64(uint64(v.ExitEpoch)) + + // Field (7) 'WithdrawableEpoch' + hh.PutUint64(uint64(v.WithdrawableEpoch)) + + hh.Merkleize(indx) + return +} diff --git a/tools/ssz.bzl b/tools/ssz.bzl index e5630e832c12..763972a42289 100644 --- a/tools/ssz.bzl +++ b/tools/ssz.bzl @@ -60,6 +60,9 @@ def _ssz_go_proto_library_impl(ctx): if len(ctx.attr.objs) > 0: args.append("--objs=%s" % ",".join(ctx.attr.objs)) + if len(ctx.attr.exclude_objs) > 0: + args.append("--exclude-objs=%s" % ",".join(ctx.attr.exclude_objs)) + ctx.actions.run( executable = ctx.executable.sszgen, progress_message = "Generating ssz marshal and unmarshal functions", @@ -79,9 +82,10 @@ ssz_gen_marshal = rule( cfg = "exec", ), "objs": attr.string_list(), + "exclude_objs": attr.string_list(), "includes": attr.label_list(providers = [GoLibrary]), + "out": attr.output(), }, - outputs = {"out": "generated.ssz.go"}, ) SSZ_DEPS = ["@com_github_prysmaticlabs_fastssz//:go_default_library"] diff --git a/validator/node/BUILD.bazel b/validator/node/BUILD.bazel index c8b5611c24fe..2a76b823f091 100644 --- a/validator/node/BUILD.bazel +++ b/validator/node/BUILD.bazel @@ -71,7 +71,6 @@ go_library( "@com_github_gorilla_mux//:go_default_library", "@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library", "@com_github_pkg_errors//:go_default_library", - "@com_github_prysmaticlabs_fastssz//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", "@org_golang_google_protobuf//encoding/protojson:go_default_library", diff --git a/validator/node/node.go b/validator/node/node.go index 7091c9d7786c..e2a023361672 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -22,7 +22,6 @@ import ( "github.com/gorilla/mux" gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/pkg/errors" - fastssz "github.com/prysmaticlabs/fastssz" "github.com/prysmaticlabs/prysm/v5/api" "github.com/prysmaticlabs/prysm/v5/api/gateway" "github.com/prysmaticlabs/prysm/v5/api/server/middleware" @@ -122,8 +121,6 @@ func NewValidatorClient(cliCtx *cli.Context) (*ValidatorClient, error) { } } - configureFastSSZHashingAlgorithm() - // initialize router used for endpoints router := newRouter(cliCtx) // If the --web flag is enabled to administer the validator @@ -794,7 +791,3 @@ func clearDB(ctx context.Context, dataDir string, force bool, isDatabaseMinimal return nil } - -func configureFastSSZHashingAlgorithm() { - fastssz.EnableVectorizedHTR = true -}