mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 13:58:09 -05:00
Compare commits
7 Commits
alpha7
...
release-v5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
944f94a9bf | ||
|
|
3fa6d3bd9d | ||
|
|
56f0eb1437 | ||
|
|
7fc5c714a1 | ||
|
|
cfbfccb203 | ||
|
|
884b663455 | ||
|
|
0f1d16c599 |
@@ -14,11 +14,14 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
|
||||
- Light client support: Add light client database changes.
|
||||
- Light client support: Implement capella and deneb changes.
|
||||
- Light client support: Implement `BlockToLightClientHeader` function.
|
||||
- Light client support: Consensus types.
|
||||
- GetBeaconStateV2: add Electra case.
|
||||
- Implement [consensus-specs/3875](https://github.com/ethereum/consensus-specs/pull/3875)
|
||||
- Tests to ensure sepolia config matches the official upstream yaml
|
||||
- HTTP endpoint for PublishBlobs
|
||||
- GetBlockV2, GetBlindedBlock, ProduceBlockV2, ProduceBlockV3: add Electra case.
|
||||
- Add Electra support and tests for light client functions
|
||||
- fastssz version bump (better error messages).
|
||||
- SSE implementation that sheds stuck clients. [pr](https://github.com/prysmaticlabs/prysm/pull/14413)
|
||||
|
||||
### Changed
|
||||
@@ -47,6 +50,8 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
|
||||
- Update light client helper functions to reference `dev` branch of CL specs
|
||||
- Updated Libp2p Dependencies to allow prysm to use gossipsub v1.2 .
|
||||
- Updated Sepolia bootnodes.
|
||||
- Make committee aware packing the default by deprecating `--enable-committee-aware-packing`.
|
||||
- Moved `ConvertKzgCommitmentToVersionedHash` to the `primitives` package.
|
||||
|
||||
### Deprecated
|
||||
- `--disable-grpc-gateway` flag is deprecated due to grpc gateway removal.
|
||||
|
||||
@@ -2,7 +2,6 @@ package blockchain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@@ -28,8 +27,6 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const blobCommitmentVersionKZG uint8 = 0x01
|
||||
|
||||
var defaultLatestValidHash = bytesutil.PadTo([]byte{0xff}, 32)
|
||||
|
||||
// notifyForkchoiceUpdate signals execution engine the fork choice updates. Execution engine should:
|
||||
@@ -402,13 +399,7 @@ func kzgCommitmentsToVersionedHashes(body interfaces.ReadOnlyBeaconBlockBody) ([
|
||||
|
||||
versionedHashes := make([]common.Hash, len(commitments))
|
||||
for i, commitment := range commitments {
|
||||
versionedHashes[i] = ConvertKzgCommitmentToVersionedHash(commitment)
|
||||
versionedHashes[i] = primitives.ConvertKzgCommitmentToVersionedHash(commitment)
|
||||
}
|
||||
return versionedHashes, nil
|
||||
}
|
||||
|
||||
func ConvertKzgCommitmentToVersionedHash(commitment []byte) common.Hash {
|
||||
versionedHash := sha256.Sum256(commitment)
|
||||
versionedHash[0] = blobCommitmentVersionKZG
|
||||
return versionedHash
|
||||
}
|
||||
|
||||
@@ -243,8 +243,8 @@ func createDefaultLightClientUpdate() (*ethpbv2.LightClientUpdate, error) {
|
||||
Pubkeys: pubKeys,
|
||||
AggregatePubkey: make([]byte, fieldparams.BLSPubkeyLength),
|
||||
}
|
||||
nextSyncCommitteeBranch := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
for i := 0; i < fieldparams.NextSyncCommitteeBranchDepth; i++ {
|
||||
nextSyncCommitteeBranch := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
|
||||
for i := 0; i < fieldparams.SyncCommitteeBranchDepth; i++ {
|
||||
nextSyncCommitteeBranch[i] = make([]byte, fieldparams.RootLength)
|
||||
}
|
||||
executionBranch := make([][]byte, executionBranchNumOfLeaves)
|
||||
@@ -321,10 +321,10 @@ func BlockToLightClientHeader(block interfaces.ReadOnlySignedBeaconBlock) (*ethp
|
||||
HeaderCapella: capellaHeader,
|
||||
},
|
||||
}, nil
|
||||
case version.Deneb:
|
||||
case version.Deneb, version.Electra:
|
||||
denebHeader, err := blockToLightClientHeaderDeneb(context.Background(), block)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get deneb header")
|
||||
return nil, errors.Wrap(err, "could not get header")
|
||||
}
|
||||
return ðpbv2.LightClientHeaderContainer{
|
||||
Header: ðpbv2.LightClientHeaderContainer_HeaderDeneb{
|
||||
@@ -337,7 +337,7 @@ func BlockToLightClientHeader(block interfaces.ReadOnlySignedBeaconBlock) (*ethp
|
||||
}
|
||||
|
||||
func blockToLightClientHeaderAltair(block interfaces.ReadOnlySignedBeaconBlock) (*ethpbv2.LightClientHeader, error) {
|
||||
if block.Version() != version.Altair {
|
||||
if block.Version() < version.Altair {
|
||||
return nil, fmt.Errorf("block version is %s instead of Altair", version.String(block.Version()))
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ func blockToLightClientHeaderAltair(block interfaces.ReadOnlySignedBeaconBlock)
|
||||
}
|
||||
|
||||
func blockToLightClientHeaderCapella(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) (*ethpbv2.LightClientHeaderCapella, error) {
|
||||
if block.Version() != version.Capella {
|
||||
if block.Version() < version.Capella {
|
||||
return nil, fmt.Errorf("block version is %s instead of Capella", version.String(block.Version()))
|
||||
}
|
||||
|
||||
@@ -422,8 +422,8 @@ func blockToLightClientHeaderCapella(ctx context.Context, block interfaces.ReadO
|
||||
}
|
||||
|
||||
func blockToLightClientHeaderDeneb(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) (*ethpbv2.LightClientHeaderDeneb, error) {
|
||||
if block.Version() != version.Deneb {
|
||||
return nil, fmt.Errorf("block version is %s instead of Deneb", version.String(block.Version()))
|
||||
if block.Version() < version.Deneb {
|
||||
return nil, fmt.Errorf("block version is %s instead of Deneb/Electra", version.String(block.Version()))
|
||||
}
|
||||
|
||||
payload, err := block.Block().Body().Execution()
|
||||
|
||||
@@ -599,4 +599,130 @@ func TestLightClient_BlockToLightClientHeader(t *testing.T) {
|
||||
require.DeepSSZEqual(t, executionPayloadProof, header.ExecutionBranch, "Execution payload proofs are not equal")
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Electra", func(t *testing.T) {
|
||||
t.Run("Non-Blinded Beacon Block", func(t *testing.T) {
|
||||
l := util.NewTestLightClient(t).SetupTestElectra(false)
|
||||
|
||||
container, err := lightClient.BlockToLightClientHeader(l.Block)
|
||||
require.NoError(t, err)
|
||||
header := container.GetHeaderDeneb()
|
||||
require.NotNil(t, header, "header is nil")
|
||||
|
||||
parentRoot := l.Block.Block().ParentRoot()
|
||||
stateRoot := l.Block.Block().StateRoot()
|
||||
bodyRoot, err := l.Block.Block().Body().HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
|
||||
payload, err := l.Block.Block().Body().Execution()
|
||||
require.NoError(t, err)
|
||||
|
||||
transactionsRoot, err := lightClient.ComputeTransactionsRoot(payload)
|
||||
require.NoError(t, err)
|
||||
|
||||
withdrawalsRoot, err := lightClient.ComputeWithdrawalsRoot(payload)
|
||||
require.NoError(t, err)
|
||||
|
||||
blobGasUsed, err := payload.BlobGasUsed()
|
||||
require.NoError(t, err)
|
||||
|
||||
excessBlobGas, err := payload.ExcessBlobGas()
|
||||
require.NoError(t, err)
|
||||
|
||||
executionHeader := &v11.ExecutionPayloadHeaderElectra{
|
||||
ParentHash: payload.ParentHash(),
|
||||
FeeRecipient: payload.FeeRecipient(),
|
||||
StateRoot: payload.StateRoot(),
|
||||
ReceiptsRoot: payload.ReceiptsRoot(),
|
||||
LogsBloom: payload.LogsBloom(),
|
||||
PrevRandao: payload.PrevRandao(),
|
||||
BlockNumber: payload.BlockNumber(),
|
||||
GasLimit: payload.GasLimit(),
|
||||
GasUsed: payload.GasUsed(),
|
||||
Timestamp: payload.Timestamp(),
|
||||
ExtraData: payload.ExtraData(),
|
||||
BaseFeePerGas: payload.BaseFeePerGas(),
|
||||
BlockHash: payload.BlockHash(),
|
||||
TransactionsRoot: transactionsRoot,
|
||||
WithdrawalsRoot: withdrawalsRoot,
|
||||
BlobGasUsed: blobGasUsed,
|
||||
ExcessBlobGas: excessBlobGas,
|
||||
}
|
||||
|
||||
executionPayloadProof, err := blocks.PayloadProof(l.Ctx, l.Block.Block())
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, l.Block.Block().Slot(), header.Beacon.Slot, "Slot is not equal")
|
||||
require.Equal(t, l.Block.Block().ProposerIndex(), header.Beacon.ProposerIndex, "Proposer index is not equal")
|
||||
require.DeepSSZEqual(t, parentRoot[:], header.Beacon.ParentRoot, "Parent root is not equal")
|
||||
require.DeepSSZEqual(t, stateRoot[:], header.Beacon.StateRoot, "State root is not equal")
|
||||
require.DeepSSZEqual(t, bodyRoot[:], header.Beacon.BodyRoot, "Body root is not equal")
|
||||
|
||||
require.DeepSSZEqual(t, executionHeader, header.Execution, "Execution headers are not equal")
|
||||
|
||||
require.DeepSSZEqual(t, executionPayloadProof, header.ExecutionBranch, "Execution payload proofs are not equal")
|
||||
})
|
||||
|
||||
t.Run("Blinded Beacon Block", func(t *testing.T) {
|
||||
l := util.NewTestLightClient(t).SetupTestElectra(true)
|
||||
|
||||
container, err := lightClient.BlockToLightClientHeader(l.Block)
|
||||
require.NoError(t, err)
|
||||
header := container.GetHeaderDeneb()
|
||||
require.NotNil(t, header, "header is nil")
|
||||
|
||||
parentRoot := l.Block.Block().ParentRoot()
|
||||
stateRoot := l.Block.Block().StateRoot()
|
||||
bodyRoot, err := l.Block.Block().Body().HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
|
||||
payload, err := l.Block.Block().Body().Execution()
|
||||
require.NoError(t, err)
|
||||
|
||||
transactionsRoot, err := payload.TransactionsRoot()
|
||||
require.NoError(t, err)
|
||||
|
||||
withdrawalsRoot, err := payload.WithdrawalsRoot()
|
||||
require.NoError(t, err)
|
||||
|
||||
blobGasUsed, err := payload.BlobGasUsed()
|
||||
require.NoError(t, err)
|
||||
|
||||
excessBlobGas, err := payload.ExcessBlobGas()
|
||||
require.NoError(t, err)
|
||||
|
||||
executionHeader := &v11.ExecutionPayloadHeaderElectra{
|
||||
ParentHash: payload.ParentHash(),
|
||||
FeeRecipient: payload.FeeRecipient(),
|
||||
StateRoot: payload.StateRoot(),
|
||||
ReceiptsRoot: payload.ReceiptsRoot(),
|
||||
LogsBloom: payload.LogsBloom(),
|
||||
PrevRandao: payload.PrevRandao(),
|
||||
BlockNumber: payload.BlockNumber(),
|
||||
GasLimit: payload.GasLimit(),
|
||||
GasUsed: payload.GasUsed(),
|
||||
Timestamp: payload.Timestamp(),
|
||||
ExtraData: payload.ExtraData(),
|
||||
BaseFeePerGas: payload.BaseFeePerGas(),
|
||||
BlockHash: payload.BlockHash(),
|
||||
TransactionsRoot: transactionsRoot,
|
||||
WithdrawalsRoot: withdrawalsRoot,
|
||||
BlobGasUsed: blobGasUsed,
|
||||
ExcessBlobGas: excessBlobGas,
|
||||
}
|
||||
|
||||
executionPayloadProof, err := blocks.PayloadProof(l.Ctx, l.Block.Block())
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, l.Block.Block().Slot(), header.Beacon.Slot, "Slot is not equal")
|
||||
require.Equal(t, l.Block.Block().ProposerIndex(), header.Beacon.ProposerIndex, "Proposer index is not equal")
|
||||
require.DeepSSZEqual(t, parentRoot[:], header.Beacon.ParentRoot, "Parent root is not equal")
|
||||
require.DeepSSZEqual(t, stateRoot[:], header.Beacon.StateRoot, "State root is not equal")
|
||||
require.DeepSSZEqual(t, bodyRoot[:], header.Beacon.BodyRoot, "Body root is not equal")
|
||||
|
||||
require.DeepSSZEqual(t, executionHeader, header.Execution, "Execution headers are not equal")
|
||||
|
||||
require.DeepSSZEqual(t, executionPayloadProof, header.ExecutionBranch, "Execution payload proofs are not equal")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ go_library(
|
||||
"//beacon-chain/core/time:go_default_library",
|
||||
"//beacon-chain/core/transition:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//monitoring/tracing/trace:go_default_library",
|
||||
"//network/httputil:go_default_library",
|
||||
"//proto/eth/v1:go_default_library",
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/api"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/operation"
|
||||
statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
chaintime "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/time"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/transition"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace"
|
||||
"github.com/prysmaticlabs/prysm/v5/network/httputil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/eth/v1"
|
||||
@@ -71,6 +71,7 @@ var (
|
||||
errSlowReader = errors.New("client failed to read fast enough to keep outgoing buffer below threshold")
|
||||
errNotRequested = errors.New("event not requested by client")
|
||||
errUnhandledEventData = errors.New("unable to represent event data in the event stream")
|
||||
errWriterUnusable = errors.New("http response writer is unusable")
|
||||
)
|
||||
|
||||
// StreamingResponseWriter defines a type that can be used by the eventStreamer.
|
||||
@@ -309,10 +310,21 @@ func (es *eventStreamer) outboxWriteLoop(ctx context.Context, cancel context.Can
|
||||
}
|
||||
}
|
||||
|
||||
func writeLazyReaderWithRecover(w StreamingResponseWriter, lr lazyReader) (err error) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.WithField("panic", r).Error("Recovered from panic while writing event to client.")
|
||||
err = errWriterUnusable
|
||||
}
|
||||
}()
|
||||
_, err = io.Copy(w, lr())
|
||||
return err
|
||||
}
|
||||
|
||||
func (es *eventStreamer) writeOutbox(ctx context.Context, w StreamingResponseWriter, first lazyReader) error {
|
||||
needKeepAlive := true
|
||||
if first != nil {
|
||||
if _, err := io.Copy(w, first()); err != nil {
|
||||
if err := writeLazyReaderWithRecover(w, first); err != nil {
|
||||
return err
|
||||
}
|
||||
needKeepAlive = false
|
||||
@@ -325,13 +337,13 @@ func (es *eventStreamer) writeOutbox(ctx context.Context, w StreamingResponseWri
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case rf := <-es.outbox:
|
||||
if _, err := io.Copy(w, rf()); err != nil {
|
||||
if err := writeLazyReaderWithRecover(w, rf); err != nil {
|
||||
return err
|
||||
}
|
||||
needKeepAlive = false
|
||||
default:
|
||||
if needKeepAlive {
|
||||
if _, err := io.Copy(w, newlineReader()); err != nil {
|
||||
if err := writeLazyReaderWithRecover(w, newlineReader); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -447,7 +459,7 @@ func (s *Server) lazyReaderForEvent(ctx context.Context, event *feed.Event, topi
|
||||
}, nil
|
||||
case *operation.BlobSidecarReceivedData:
|
||||
return func() io.Reader {
|
||||
versionedHash := blockchain.ConvertKzgCommitmentToVersionedHash(v.Blob.KzgCommitment)
|
||||
versionedHash := primitives.ConvertKzgCommitmentToVersionedHash(v.Blob.KzgCommitment)
|
||||
return jsonMarshalReader(eventName, &structs.BlobSidecarEvent{
|
||||
BlockRoot: hexutil.Encode(v.Blob.BlockRootSlice()),
|
||||
Index: fmt.Sprintf("%d", v.Blob.Index),
|
||||
|
||||
@@ -146,6 +146,46 @@ func TestLightClientHandler_GetLightClientBootstrap_Deneb(t *testing.T) {
|
||||
require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch)
|
||||
}
|
||||
|
||||
func TestLightClientHandler_GetLightClientBootstrap_Electra(t *testing.T) {
|
||||
l := util.NewTestLightClient(t).SetupTestElectra(false) // result is same for true and false
|
||||
|
||||
slot := l.State.Slot()
|
||||
stateRoot, err := l.State.HashTreeRoot(l.Ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
mockBlocker := &testutil.MockBlocker{BlockToReturn: l.Block}
|
||||
mockChainService := &mock.ChainService{Optimistic: true, Slot: &slot}
|
||||
s := &Server{
|
||||
Stater: &testutil.MockStater{StatesBySlot: map[primitives.Slot]state.BeaconState{
|
||||
slot: l.State,
|
||||
}},
|
||||
Blocker: mockBlocker,
|
||||
HeadFetcher: mockChainService,
|
||||
}
|
||||
request := httptest.NewRequest("GET", "http://foo.com/", nil)
|
||||
request.SetPathValue("block_root", hexutil.Encode(stateRoot[:]))
|
||||
writer := httptest.NewRecorder()
|
||||
writer.Body = &bytes.Buffer{}
|
||||
|
||||
s.GetLightClientBootstrap(writer, request)
|
||||
require.Equal(t, http.StatusOK, writer.Code)
|
||||
var resp structs.LightClientBootstrapResponse
|
||||
err = json.Unmarshal(writer.Body.Bytes(), &resp)
|
||||
require.NoError(t, err)
|
||||
var respHeader structs.LightClientHeader
|
||||
err = json.Unmarshal(resp.Data.Header, &respHeader)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "electra", resp.Version)
|
||||
|
||||
blockHeader, err := l.Block.Header()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, hexutil.Encode(blockHeader.Header.BodyRoot), respHeader.Beacon.BodyRoot)
|
||||
require.Equal(t, strconv.FormatUint(uint64(blockHeader.Header.Slot), 10), respHeader.Beacon.Slot)
|
||||
|
||||
require.NotNil(t, resp.Data.CurrentSyncCommittee)
|
||||
require.NotNil(t, resp.Data.CurrentSyncCommitteeBranch)
|
||||
}
|
||||
|
||||
func TestLightClientHandler_GetLightClientUpdatesByRangeAltair(t *testing.T) {
|
||||
helpers.ClearCache()
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -30,7 +30,7 @@ func createLightClientBootstrap(ctx context.Context, state state.BeaconState, bl
|
||||
return createLightClientBootstrapAltair(ctx, state, blk)
|
||||
case version.Capella:
|
||||
return createLightClientBootstrapCapella(ctx, state, blk)
|
||||
case version.Deneb:
|
||||
case version.Deneb, version.Electra:
|
||||
return createLightClientBootstrapDeneb(ctx, state, blk)
|
||||
}
|
||||
return nil, fmt.Errorf("unsupported block version %s", version.String(blk.Version()))
|
||||
@@ -91,7 +91,7 @@ func createLightClientBootstrapAltair(ctx context.Context, state state.BeaconSta
|
||||
return nil, errors.Wrap(err, "could not get current sync committee proof")
|
||||
}
|
||||
|
||||
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
branch := make([]string, fieldparams.SyncCommitteeBranchDepth)
|
||||
for i, proof := range currentSyncCommitteeProof {
|
||||
branch[i] = hexutil.Encode(proof)
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func createLightClientBootstrapCapella(ctx context.Context, state state.BeaconSt
|
||||
return nil, errors.Wrap(err, "could not get current sync committee proof")
|
||||
}
|
||||
|
||||
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
branch := make([]string, fieldparams.SyncCommitteeBranchDepth)
|
||||
for i, proof := range currentSyncCommitteeProof {
|
||||
branch[i] = hexutil.Encode(proof)
|
||||
}
|
||||
@@ -226,8 +226,13 @@ func createLightClientBootstrapDeneb(ctx context.Context, state state.BeaconStat
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get current sync committee proof")
|
||||
}
|
||||
|
||||
branch := make([]string, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
var branch []string
|
||||
switch block.Version() {
|
||||
case version.Deneb:
|
||||
branch = make([]string, fieldparams.SyncCommitteeBranchDepth)
|
||||
case version.Electra:
|
||||
branch = make([]string, fieldparams.SyncCommitteeBranchDepthElectra)
|
||||
}
|
||||
for i, proof := range currentSyncCommitteeProof {
|
||||
branch[i] = hexutil.Encode(proof)
|
||||
}
|
||||
@@ -288,7 +293,7 @@ func newLightClientOptimisticUpdateFromBeaconState(
|
||||
}
|
||||
|
||||
func IsSyncCommitteeUpdate(update *v2.LightClientUpdate) bool {
|
||||
nextSyncCommitteeBranch := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
nextSyncCommitteeBranch := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
|
||||
return !reflect.DeepEqual(update.NextSyncCommitteeBranch, nextSyncCommitteeBranch)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
// When the update has relevant sync committee
|
||||
func createNonEmptySyncCommitteeBranch() [][]byte {
|
||||
res := make([][]byte, fieldparams.NextSyncCommitteeBranchDepth)
|
||||
res := make([][]byte, fieldparams.SyncCommitteeBranchDepth)
|
||||
res[0] = []byte("xyz")
|
||||
return res
|
||||
}
|
||||
@@ -101,7 +101,7 @@ func TestIsBetterUpdate(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
},
|
||||
NextSyncCommitteeBranch: make([][]byte, fieldparams.NextSyncCommitteeBranchDepth),
|
||||
NextSyncCommitteeBranch: make([][]byte, fieldparams.SyncCommitteeBranchDepth),
|
||||
SignatureSlot: 9999,
|
||||
},
|
||||
newUpdate: ðpbv2.LightClientUpdate{
|
||||
@@ -147,7 +147,7 @@ func TestIsBetterUpdate(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
},
|
||||
NextSyncCommitteeBranch: make([][]byte, fieldparams.NextSyncCommitteeBranchDepth),
|
||||
NextSyncCommitteeBranch: make([][]byte, fieldparams.SyncCommitteeBranchDepth),
|
||||
SignatureSlot: 9999,
|
||||
},
|
||||
expectedResult: false,
|
||||
|
||||
@@ -217,10 +217,10 @@ func (a proposerAtts) sort() (proposerAtts, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
if features.Get().EnableCommitteeAwarePacking {
|
||||
return a.sortBySlotAndCommittee()
|
||||
if features.Get().DisableCommitteeAwarePacking {
|
||||
return a.sortByProfitabilityUsingMaxCover()
|
||||
}
|
||||
return a.sortByProfitabilityUsingMaxCover()
|
||||
return a.sortBySlotAndCommittee()
|
||||
}
|
||||
|
||||
// Separate attestations by slot, as slot number takes higher precedence when sorting.
|
||||
|
||||
@@ -21,6 +21,11 @@ import (
|
||||
)
|
||||
|
||||
func TestProposer_ProposerAtts_sort(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.DisableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
type testData struct {
|
||||
slot primitives.Slot
|
||||
bits bitfield.Bitlist
|
||||
@@ -186,11 +191,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("no atts", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
atts := getAtts([]testData{})
|
||||
want := getAtts([]testData{})
|
||||
atts, err := atts.sort()
|
||||
@@ -201,11 +201,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("single att", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
atts := getAtts([]testData{
|
||||
{4, bitfield.Bitlist{0b11100000, 0b1}},
|
||||
})
|
||||
@@ -220,11 +215,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("single att per slot", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
atts := getAtts([]testData{
|
||||
{1, bitfield.Bitlist{0b11000000, 0b1}},
|
||||
{4, bitfield.Bitlist{0b11100000, 0b1}},
|
||||
@@ -241,10 +231,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("two atts on one of the slots", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
atts := getAtts([]testData{
|
||||
{1, bitfield.Bitlist{0b11000000, 0b1}},
|
||||
@@ -263,11 +249,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("compare to native sort", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
// The max-cover based approach will select 0b00001100 instead, despite lower bit count
|
||||
// (since it has two new/unknown bits).
|
||||
t.Run("max-cover", func(t *testing.T) {
|
||||
@@ -289,11 +270,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("multiple slots", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
atts := getAtts([]testData{
|
||||
{2, bitfield.Bitlist{0b11100000, 0b1}},
|
||||
{4, bitfield.Bitlist{0b11100000, 0b1}},
|
||||
@@ -316,11 +292,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("follows max-cover", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
// Items at slot 4 must be first split into two lists by max-cover, with
|
||||
// 0b10000011 being selected and 0b11100001 being leftover (despite naive bit count suggesting otherwise).
|
||||
atts := getAtts([]testData{
|
||||
@@ -350,11 +321,6 @@ func TestProposer_ProposerAtts_committeeAwareSort(t *testing.T) {
|
||||
|
||||
func TestProposer_sort_DifferentCommittees(t *testing.T) {
|
||||
t.Run("one att per committee", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
c1_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11111000, 0b1}, Data: ðpb.AttestationData{CommitteeIndex: 1}})
|
||||
c2_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11100000, 0b1}, Data: ðpb.AttestationData{CommitteeIndex: 2}})
|
||||
atts := proposerAtts{c1_a1, c2_a1}
|
||||
@@ -364,11 +330,6 @@ func TestProposer_sort_DifferentCommittees(t *testing.T) {
|
||||
assert.DeepEqual(t, want, atts)
|
||||
})
|
||||
t.Run("multiple atts per committee", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
c1_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11111100, 0b1}, Data: ðpb.AttestationData{CommitteeIndex: 1}})
|
||||
c1_a2 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000010, 0b1}, Data: ðpb.AttestationData{CommitteeIndex: 1}})
|
||||
c2_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11110000, 0b1}, Data: ðpb.AttestationData{CommitteeIndex: 2}})
|
||||
@@ -381,11 +342,6 @@ func TestProposer_sort_DifferentCommittees(t *testing.T) {
|
||||
assert.DeepEqual(t, want, atts)
|
||||
})
|
||||
t.Run("multiple atts per committee, multiple slots", func(t *testing.T) {
|
||||
feat := features.Get()
|
||||
feat.EnableCommitteeAwarePacking = true
|
||||
reset := features.InitWithReset(feat)
|
||||
defer reset()
|
||||
|
||||
s2_c1_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11111100, 0b1}, Data: ðpb.AttestationData{Slot: 2, CommitteeIndex: 1}})
|
||||
s2_c1_a2 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b10000010, 0b1}, Data: ðpb.AttestationData{Slot: 2, CommitteeIndex: 1}})
|
||||
s2_c2_a1 := util.HydrateAttestation(ðpb.Attestation{AggregationBits: bitfield.Bitlist{0b11110000, 0b1}, Data: ðpb.AttestationData{Slot: 2, CommitteeIndex: 2}})
|
||||
|
||||
@@ -48,7 +48,7 @@ type Flags struct {
|
||||
EnableDoppelGanger bool // EnableDoppelGanger enables doppelganger protection on startup for the validator.
|
||||
EnableHistoricalSpaceRepresentation bool // EnableHistoricalSpaceRepresentation enables the saving of registry validators in separate buckets to save space
|
||||
EnableBeaconRESTApi bool // EnableBeaconRESTApi enables experimental usage of the beacon REST API by the validator when querying a beacon node
|
||||
EnableCommitteeAwarePacking bool // EnableCommitteeAwarePacking TODO
|
||||
DisableCommitteeAwarePacking bool // DisableCommitteeAwarePacking changes the attestation packing algorithm to one that is not aware of attesting committees.
|
||||
// Logging related toggles.
|
||||
DisableGRPCConnectionLogs bool // Disables logging when a new grpc client has connected.
|
||||
EnableFullSSZDataLogging bool // Enables logging for full ssz data on rejected gossip messages
|
||||
@@ -256,9 +256,9 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
|
||||
logEnabled(EnableQUIC)
|
||||
cfg.EnableQUIC = true
|
||||
}
|
||||
if ctx.IsSet(EnableCommitteeAwarePacking.Name) {
|
||||
logEnabled(EnableCommitteeAwarePacking)
|
||||
cfg.EnableCommitteeAwarePacking = true
|
||||
if ctx.IsSet(DisableCommitteeAwarePacking.Name) {
|
||||
logEnabled(DisableCommitteeAwarePacking)
|
||||
cfg.DisableCommitteeAwarePacking = true
|
||||
}
|
||||
|
||||
cfg.AggregateIntervals = [3]time.Duration{aggregateFirstInterval.Value, aggregateSecondInterval.Value, aggregateThirdInterval.Value}
|
||||
|
||||
@@ -77,6 +77,12 @@ var (
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
deprecatedEnableCommitteeAwarePacking = &cli.BoolFlag{
|
||||
Name: "enable-committee-aware-packing",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated flags for both the beacon node and validator client.
|
||||
@@ -94,6 +100,7 @@ var deprecatedFlags = []cli.Flag{
|
||||
deprecatedBeaconRPCGatewayProviderFlag,
|
||||
deprecatedDisableGRPCGateway,
|
||||
deprecatedEnableExperimentalState,
|
||||
deprecatedEnableCommitteeAwarePacking,
|
||||
}
|
||||
|
||||
// deprecatedBeaconFlags contains flags that are still used by other components
|
||||
|
||||
@@ -166,9 +166,9 @@ var (
|
||||
Name: "enable-quic",
|
||||
Usage: "Enables connection using the QUIC protocol for peers which support it.",
|
||||
}
|
||||
EnableCommitteeAwarePacking = &cli.BoolFlag{
|
||||
Name: "enable-committee-aware-packing",
|
||||
Usage: "Changes the attestation packing algorithm to one that is aware of attesting committees.",
|
||||
DisableCommitteeAwarePacking = &cli.BoolFlag{
|
||||
Name: "disable-committee-aware-packing",
|
||||
Usage: "Changes the attestation packing algorithm to one that is not aware of attesting committees.",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -226,7 +226,7 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c
|
||||
EnableLightClient,
|
||||
BlobSaveFsync,
|
||||
EnableQUIC,
|
||||
EnableCommitteeAwarePacking,
|
||||
DisableCommitteeAwarePacking,
|
||||
}...)...)
|
||||
|
||||
// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
|
||||
|
||||
@@ -33,7 +33,10 @@ const (
|
||||
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
|
||||
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
|
||||
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
|
||||
NextSyncCommitteeBranchDepth = 5 // NextSyncCommitteeBranchDepth defines the depth of the next sync committee branch.
|
||||
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
|
||||
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
|
||||
SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra defines the number of leaves in a merkle proof of a sync committee.
|
||||
FinalityBranchDepth = 6 // FinalityBranchDepth defines the number of leaves in a merkle proof of the finalized checkpoint root.
|
||||
PendingBalanceDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
|
||||
PendingPartialWithdrawalsLimit = 134217728 // Maximum number of pending partial withdrawals in the beacon state.
|
||||
PendingConsolidationsLimit = 262144 // Maximum number of pending consolidations in the beacon state.
|
||||
|
||||
@@ -33,7 +33,10 @@ const (
|
||||
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
|
||||
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
|
||||
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
|
||||
NextSyncCommitteeBranchDepth = 5 // NextSyncCommitteeBranchDepth defines the depth of the next sync committee branch.
|
||||
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
|
||||
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
|
||||
SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra defines the number of leaves in a merkle proof of a sync committee.
|
||||
FinalityBranchDepth = 6 // FinalityBranchDepth defines the number of leaves in a merkle proof of the finalized checkpoint root.
|
||||
PendingBalanceDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
|
||||
PendingPartialWithdrawalsLimit = 64 // Maximum number of pending partial withdrawals in the beacon state.
|
||||
PendingConsolidationsLimit = 64 // Maximum number of pending consolidations in the beacon state.
|
||||
|
||||
@@ -5,6 +5,7 @@ go_library(
|
||||
srcs = [
|
||||
"beacon_block.go",
|
||||
"error.go",
|
||||
"light_client.go",
|
||||
"utils.go",
|
||||
"validator.go",
|
||||
],
|
||||
|
||||
58
consensus-types/interfaces/light_client.go
Normal file
58
consensus-types/interfaces/light_client.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
ssz "github.com/prysmaticlabs/fastssz"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
type LightClientExecutionBranch = [fieldparams.ExecutionBranchDepth][fieldparams.RootLength]byte
|
||||
type LightClientSyncCommitteeBranch = [fieldparams.SyncCommitteeBranchDepth][fieldparams.RootLength]byte
|
||||
type LightClientFinalityBranch = [fieldparams.FinalityBranchDepth][fieldparams.RootLength]byte
|
||||
|
||||
type LightClientHeader interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
Beacon() *pb.BeaconBlockHeader
|
||||
Execution() (ExecutionData, error)
|
||||
ExecutionBranch() (LightClientExecutionBranch, error)
|
||||
}
|
||||
|
||||
type LightClientBootstrap interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
Header() LightClientHeader
|
||||
CurrentSyncCommittee() *pb.SyncCommittee
|
||||
CurrentSyncCommitteeBranch() LightClientSyncCommitteeBranch
|
||||
}
|
||||
|
||||
type LightClientUpdate interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
AttestedHeader() LightClientHeader
|
||||
NextSyncCommittee() *pb.SyncCommittee
|
||||
NextSyncCommitteeBranch() LightClientSyncCommitteeBranch
|
||||
FinalizedHeader() LightClientHeader
|
||||
FinalityBranch() LightClientFinalityBranch
|
||||
SyncAggregate() *pb.SyncAggregate
|
||||
SignatureSlot() primitives.Slot
|
||||
}
|
||||
|
||||
type LightClientFinalityUpdate interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
AttestedHeader() LightClientHeader
|
||||
FinalizedHeader() LightClientHeader
|
||||
FinalityBranch() LightClientFinalityBranch
|
||||
SyncAggregate() *pb.SyncAggregate
|
||||
SignatureSlot() primitives.Slot
|
||||
}
|
||||
|
||||
type LightClientOptimisticUpdate interface {
|
||||
ssz.Marshaler
|
||||
Version() int
|
||||
AttestedHeader() LightClientHeader
|
||||
SyncAggregate() *pb.SyncAggregate
|
||||
SignatureSlot() primitives.Slot
|
||||
}
|
||||
26
consensus-types/light-client/BUILD.bazel
Normal file
26
consensus-types/light-client/BUILD.bazel
Normal file
@@ -0,0 +1,26 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"bootstrap.go",
|
||||
"finality_update.go",
|
||||
"header.go",
|
||||
"helpers.go",
|
||||
"optimistic_update.go",
|
||||
"update.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/light-client",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//consensus-types:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//consensus-types/interfaces:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
208
consensus-types/light-client/bootstrap.go
Normal file
208
consensus-types/light-client/bootstrap.go
Normal file
@@ -0,0 +1,208 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewWrappedBootstrap(m proto.Message) (interfaces.LightClientBootstrap, error) {
|
||||
if m == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
switch t := m.(type) {
|
||||
case *pb.LightClientBootstrapAltair:
|
||||
return NewWrappedBootstrapAltair(t)
|
||||
case *pb.LightClientBootstrapCapella:
|
||||
return NewWrappedBootstrapCapella(t)
|
||||
case *pb.LightClientBootstrapDeneb:
|
||||
return NewWrappedBootstrapDeneb(t)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot construct light client bootstrap from type %T", t)
|
||||
}
|
||||
}
|
||||
|
||||
type bootstrapAltair struct {
|
||||
p *pb.LightClientBootstrapAltair
|
||||
header interfaces.LightClientHeader
|
||||
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientBootstrap = &bootstrapAltair{}
|
||||
|
||||
func NewWrappedBootstrapAltair(p *pb.LightClientBootstrapAltair) (interfaces.LightClientBootstrap, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeaderAltair(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &bootstrapAltair{
|
||||
p: p,
|
||||
header: header,
|
||||
currentSyncCommitteeBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapAltair) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return h.currentSyncCommitteeBranch
|
||||
}
|
||||
|
||||
type bootstrapCapella struct {
|
||||
p *pb.LightClientBootstrapCapella
|
||||
header interfaces.LightClientHeader
|
||||
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientBootstrap = &bootstrapCapella{}
|
||||
|
||||
func NewWrappedBootstrapCapella(p *pb.LightClientBootstrapCapella) (interfaces.LightClientBootstrap, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeaderCapella(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &bootstrapCapella{
|
||||
p: p,
|
||||
header: header,
|
||||
currentSyncCommitteeBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) Version() int {
|
||||
return version.Capella
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapCapella) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return h.currentSyncCommitteeBranch
|
||||
}
|
||||
|
||||
type bootstrapDeneb struct {
|
||||
p *pb.LightClientBootstrapDeneb
|
||||
header interfaces.LightClientHeader
|
||||
currentSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientBootstrap = &bootstrapDeneb{}
|
||||
|
||||
func NewWrappedBootstrapDeneb(p *pb.LightClientBootstrapDeneb) (interfaces.LightClientBootstrap, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
header, err := NewWrappedHeaderDeneb(p.Header)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.CurrentSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &bootstrapDeneb{
|
||||
p: p,
|
||||
header: header,
|
||||
currentSyncCommitteeBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) Version() int {
|
||||
return version.Deneb
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) Header() interfaces.LightClientHeader {
|
||||
return h.header
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) CurrentSyncCommittee() *pb.SyncCommittee {
|
||||
return h.p.CurrentSyncCommittee
|
||||
}
|
||||
|
||||
func (h *bootstrapDeneb) CurrentSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return h.currentSyncCommitteeBranch
|
||||
}
|
||||
251
consensus-types/light-client/finality_update.go
Normal file
251
consensus-types/light-client/finality_update.go
Normal file
@@ -0,0 +1,251 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewWrappedFinalityUpdate(m proto.Message) (interfaces.LightClientFinalityUpdate, error) {
|
||||
if m == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
switch t := m.(type) {
|
||||
case *pb.LightClientFinalityUpdateAltair:
|
||||
return NewWrappedFinalityUpdateAltair(t)
|
||||
case *pb.LightClientFinalityUpdateCapella:
|
||||
return NewWrappedFinalityUpdateCapella(t)
|
||||
case *pb.LightClientFinalityUpdateDeneb:
|
||||
return NewWrappedFinalityUpdateDeneb(t)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot construct light client finality update from type %T", t)
|
||||
}
|
||||
}
|
||||
|
||||
type finalityUpdateAltair struct {
|
||||
p *pb.LightClientFinalityUpdateAltair
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateAltair{}
|
||||
|
||||
func NewWrappedFinalityUpdateAltair(p *pb.LightClientFinalityUpdateAltair) (interfaces.LightClientFinalityUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderAltair(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &finalityUpdateAltair{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *finalityUpdateAltair) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type finalityUpdateCapella struct {
|
||||
p *pb.LightClientFinalityUpdateCapella
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateCapella{}
|
||||
|
||||
func NewWrappedFinalityUpdateCapella(p *pb.LightClientFinalityUpdateCapella) (interfaces.LightClientFinalityUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderCapella(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &finalityUpdateCapella{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) Version() int {
|
||||
return version.Capella
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *finalityUpdateCapella) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type finalityUpdateDeneb struct {
|
||||
p *pb.LightClientFinalityUpdateDeneb
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientFinalityUpdate = &finalityUpdateDeneb{}
|
||||
|
||||
func NewWrappedFinalityUpdateDeneb(p *pb.LightClientFinalityUpdateDeneb) (interfaces.LightClientFinalityUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderDeneb(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &finalityUpdateDeneb{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) Version() int {
|
||||
return version.Deneb
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *finalityUpdateDeneb) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
192
consensus-types/light-client/header.go
Normal file
192
consensus-types/light-client/header.go
Normal file
@@ -0,0 +1,192 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewWrappedHeader(m proto.Message) (interfaces.LightClientHeader, error) {
|
||||
if m == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
switch t := m.(type) {
|
||||
case *pb.LightClientHeaderAltair:
|
||||
return NewWrappedHeaderAltair(t)
|
||||
case *pb.LightClientHeaderCapella:
|
||||
return NewWrappedHeaderCapella(t)
|
||||
case *pb.LightClientHeaderDeneb:
|
||||
return NewWrappedHeaderDeneb(t)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot construct light client header from type %T", t)
|
||||
}
|
||||
}
|
||||
|
||||
type headerAltair struct {
|
||||
p *pb.LightClientHeaderAltair
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientHeader = &headerAltair{}
|
||||
|
||||
func NewWrappedHeaderAltair(p *pb.LightClientHeaderAltair) (interfaces.LightClientHeader, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
return &headerAltair{p: p}, nil
|
||||
}
|
||||
|
||||
func (h *headerAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *headerAltair) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *headerAltair) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *headerAltair) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
func (h *headerAltair) Beacon() *pb.BeaconBlockHeader {
|
||||
return h.p.Beacon
|
||||
}
|
||||
|
||||
func (h *headerAltair) Execution() (interfaces.ExecutionData, error) {
|
||||
return nil, consensustypes.ErrNotSupported("Execution", version.Altair)
|
||||
}
|
||||
|
||||
func (h *headerAltair) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
|
||||
return interfaces.LightClientExecutionBranch{}, consensustypes.ErrNotSupported("ExecutionBranch", version.Altair)
|
||||
}
|
||||
|
||||
type headerCapella struct {
|
||||
p *pb.LightClientHeaderCapella
|
||||
execution interfaces.ExecutionData
|
||||
executionBranch interfaces.LightClientExecutionBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientHeader = &headerCapella{}
|
||||
|
||||
func NewWrappedHeaderCapella(p *pb.LightClientHeaderCapella) (interfaces.LightClientHeader, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
execution, err := blocks.WrappedExecutionPayloadHeaderCapella(p.Execution)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientExecutionBranch](
|
||||
"execution",
|
||||
p.ExecutionBranch,
|
||||
fieldparams.ExecutionBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &headerCapella{
|
||||
p: p,
|
||||
execution: execution,
|
||||
executionBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *headerCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *headerCapella) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *headerCapella) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *headerCapella) Version() int {
|
||||
return version.Capella
|
||||
}
|
||||
|
||||
func (h *headerCapella) Beacon() *pb.BeaconBlockHeader {
|
||||
return h.p.Beacon
|
||||
}
|
||||
|
||||
func (h *headerCapella) Execution() (interfaces.ExecutionData, error) {
|
||||
return h.execution, nil
|
||||
}
|
||||
|
||||
func (h *headerCapella) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
|
||||
return h.executionBranch, nil
|
||||
}
|
||||
|
||||
type headerDeneb struct {
|
||||
p *pb.LightClientHeaderDeneb
|
||||
execution interfaces.ExecutionData
|
||||
executionBranch interfaces.LightClientExecutionBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientHeader = &headerDeneb{}
|
||||
|
||||
func NewWrappedHeaderDeneb(p *pb.LightClientHeaderDeneb) (interfaces.LightClientHeader, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
execution, err := blocks.WrappedExecutionPayloadHeaderDeneb(p.Execution)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
branch, err := createBranch[interfaces.LightClientExecutionBranch](
|
||||
"execution",
|
||||
p.ExecutionBranch,
|
||||
fieldparams.ExecutionBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &headerDeneb{
|
||||
p: p,
|
||||
execution: execution,
|
||||
executionBranch: branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *headerDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return h.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (h *headerDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return h.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (h *headerDeneb) SizeSSZ() int {
|
||||
return h.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (h *headerDeneb) Version() int {
|
||||
return version.Deneb
|
||||
}
|
||||
|
||||
func (h *headerDeneb) Beacon() *pb.BeaconBlockHeader {
|
||||
return h.p.Beacon
|
||||
}
|
||||
|
||||
func (h *headerDeneb) Execution() (interfaces.ExecutionData, error) {
|
||||
return h.execution, nil
|
||||
}
|
||||
|
||||
func (h *headerDeneb) ExecutionBranch() (interfaces.LightClientExecutionBranch, error) {
|
||||
return h.executionBranch, nil
|
||||
}
|
||||
30
consensus-types/light-client/helpers.go
Normal file
30
consensus-types/light-client/helpers.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
)
|
||||
|
||||
type branchConstraint interface {
|
||||
~interfaces.LightClientExecutionBranch | ~interfaces.LightClientSyncCommitteeBranch | ~interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
func createBranch[T branchConstraint](name string, input [][]byte, depth int) (T, error) {
|
||||
var zero T
|
||||
|
||||
if len(input) != depth {
|
||||
return zero, fmt.Errorf("%s branch has %d leaves instead of expected %d", name, len(input), depth)
|
||||
}
|
||||
var branch T
|
||||
for i, leaf := range input {
|
||||
if len(leaf) != fieldparams.RootLength {
|
||||
return zero, fmt.Errorf("%s branch leaf at index %d has length %d instead of expected %d", name, i, len(leaf), fieldparams.RootLength)
|
||||
}
|
||||
branch[i] = bytesutil.ToBytes32(leaf)
|
||||
}
|
||||
|
||||
return branch, nil
|
||||
}
|
||||
178
consensus-types/light-client/optimistic_update.go
Normal file
178
consensus-types/light-client/optimistic_update.go
Normal file
@@ -0,0 +1,178 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewWrappedOptimisticUpdate(m proto.Message) (interfaces.LightClientOptimisticUpdate, error) {
|
||||
if m == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
switch t := m.(type) {
|
||||
case *pb.LightClientOptimisticUpdateAltair:
|
||||
return NewWrappedOptimisticUpdateAltair(t)
|
||||
case *pb.LightClientOptimisticUpdateCapella:
|
||||
return NewWrappedOptimisticUpdateCapella(t)
|
||||
case *pb.LightClientOptimisticUpdateDeneb:
|
||||
return NewWrappedOptimisticUpdateDeneb(t)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot construct light client optimistic update from type %T", t)
|
||||
}
|
||||
}
|
||||
|
||||
type OptimisticUpdateAltair struct {
|
||||
p *pb.LightClientOptimisticUpdateAltair
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateAltair{}
|
||||
|
||||
func NewWrappedOptimisticUpdateAltair(p *pb.LightClientOptimisticUpdateAltair) (interfaces.LightClientOptimisticUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OptimisticUpdateAltair{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateAltair) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type OptimisticUpdateCapella struct {
|
||||
p *pb.LightClientOptimisticUpdateCapella
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateCapella{}
|
||||
|
||||
func NewWrappedOptimisticUpdateCapella(p *pb.LightClientOptimisticUpdateCapella) (interfaces.LightClientOptimisticUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OptimisticUpdateCapella{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) Version() int {
|
||||
return version.Capella
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateCapella) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type OptimisticUpdateDeneb struct {
|
||||
p *pb.LightClientOptimisticUpdateDeneb
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientOptimisticUpdate = &OptimisticUpdateDeneb{}
|
||||
|
||||
func NewWrappedOptimisticUpdateDeneb(p *pb.LightClientOptimisticUpdateDeneb) (interfaces.LightClientOptimisticUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OptimisticUpdateDeneb{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) Version() int {
|
||||
return version.Deneb
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *OptimisticUpdateDeneb) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
305
consensus-types/light-client/update.go
Normal file
305
consensus-types/light-client/update.go
Normal file
@@ -0,0 +1,305 @@
|
||||
package light_client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewWrappedUpdate(m proto.Message) (interfaces.LightClientUpdate, error) {
|
||||
if m == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
switch t := m.(type) {
|
||||
case *pb.LightClientUpdateAltair:
|
||||
return NewWrappedUpdateAltair(t)
|
||||
case *pb.LightClientUpdateCapella:
|
||||
return NewWrappedUpdateCapella(t)
|
||||
case *pb.LightClientUpdateDeneb:
|
||||
return NewWrappedUpdateDeneb(t)
|
||||
default:
|
||||
return nil, fmt.Errorf("cannot construct light client update from type %T", t)
|
||||
}
|
||||
}
|
||||
|
||||
type updateAltair struct {
|
||||
p *pb.LightClientUpdateAltair
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientUpdate = &updateAltair{}
|
||||
|
||||
func NewWrappedUpdateAltair(p *pb.LightClientUpdateAltair) (interfaces.LightClientUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderAltair(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderAltair(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.NextSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &updateAltair{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
nextSyncCommitteeBranch: scBranch,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: finalityBranch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *updateAltair) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *updateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *updateAltair) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *updateAltair) Version() int {
|
||||
return version.Altair
|
||||
}
|
||||
|
||||
func (u *updateAltair) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *updateAltair) NextSyncCommittee() *pb.SyncCommittee {
|
||||
return u.p.NextSyncCommittee
|
||||
}
|
||||
|
||||
func (u *updateAltair) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return u.nextSyncCommitteeBranch
|
||||
}
|
||||
|
||||
func (u *updateAltair) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *updateAltair) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *updateAltair) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *updateAltair) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type updateCapella struct {
|
||||
p *pb.LightClientUpdateCapella
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientUpdate = &updateCapella{}
|
||||
|
||||
func NewWrappedUpdateCapella(p *pb.LightClientUpdateCapella) (interfaces.LightClientUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderCapella(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderCapella(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.NextSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &updateCapella{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
nextSyncCommitteeBranch: scBranch,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: finalityBranch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *updateCapella) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *updateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *updateCapella) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *updateCapella) Version() int {
|
||||
return version.Capella
|
||||
}
|
||||
|
||||
func (u *updateCapella) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *updateCapella) NextSyncCommittee() *pb.SyncCommittee {
|
||||
return u.p.NextSyncCommittee
|
||||
}
|
||||
|
||||
func (u *updateCapella) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return u.nextSyncCommitteeBranch
|
||||
}
|
||||
|
||||
func (u *updateCapella) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *updateCapella) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *updateCapella) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *updateCapella) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
|
||||
type updateDeneb struct {
|
||||
p *pb.LightClientUpdateDeneb
|
||||
attestedHeader interfaces.LightClientHeader
|
||||
nextSyncCommitteeBranch interfaces.LightClientSyncCommitteeBranch
|
||||
finalizedHeader interfaces.LightClientHeader
|
||||
finalityBranch interfaces.LightClientFinalityBranch
|
||||
}
|
||||
|
||||
var _ interfaces.LightClientUpdate = &updateDeneb{}
|
||||
|
||||
func NewWrappedUpdateDeneb(p *pb.LightClientUpdateDeneb) (interfaces.LightClientUpdate, error) {
|
||||
if p == nil {
|
||||
return nil, consensustypes.ErrNilObjectWrapped
|
||||
}
|
||||
attestedHeader, err := NewWrappedHeaderDeneb(p.AttestedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalizedHeader, err := NewWrappedHeaderDeneb(p.FinalizedHeader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scBranch, err := createBranch[interfaces.LightClientSyncCommitteeBranch](
|
||||
"sync committee",
|
||||
p.NextSyncCommitteeBranch,
|
||||
fieldparams.SyncCommitteeBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalityBranch, err := createBranch[interfaces.LightClientFinalityBranch](
|
||||
"finality",
|
||||
p.FinalityBranch,
|
||||
fieldparams.FinalityBranchDepth,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &updateDeneb{
|
||||
p: p,
|
||||
attestedHeader: attestedHeader,
|
||||
nextSyncCommitteeBranch: scBranch,
|
||||
finalizedHeader: finalizedHeader,
|
||||
finalityBranch: finalityBranch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *updateDeneb) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return u.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
func (u *updateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return u.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
func (u *updateDeneb) SizeSSZ() int {
|
||||
return u.p.SizeSSZ()
|
||||
}
|
||||
|
||||
func (u *updateDeneb) Version() int {
|
||||
return version.Deneb
|
||||
}
|
||||
|
||||
func (u *updateDeneb) AttestedHeader() interfaces.LightClientHeader {
|
||||
return u.attestedHeader
|
||||
}
|
||||
|
||||
func (u *updateDeneb) NextSyncCommittee() *pb.SyncCommittee {
|
||||
return u.p.NextSyncCommittee
|
||||
}
|
||||
|
||||
func (u *updateDeneb) NextSyncCommitteeBranch() interfaces.LightClientSyncCommitteeBranch {
|
||||
return u.nextSyncCommitteeBranch
|
||||
}
|
||||
|
||||
func (u *updateDeneb) FinalizedHeader() interfaces.LightClientHeader {
|
||||
return u.finalizedHeader
|
||||
}
|
||||
|
||||
func (u *updateDeneb) FinalityBranch() interfaces.LightClientFinalityBranch {
|
||||
return u.finalityBranch
|
||||
}
|
||||
|
||||
func (u *updateDeneb) SyncAggregate() *pb.SyncAggregate {
|
||||
return u.p.SyncAggregate
|
||||
}
|
||||
|
||||
func (u *updateDeneb) SignatureSlot() primitives.Slot {
|
||||
return u.p.SignatureSlot
|
||||
}
|
||||
@@ -9,6 +9,7 @@ go_library(
|
||||
"domain.go",
|
||||
"epoch.go",
|
||||
"execution_address.go",
|
||||
"kzg.go",
|
||||
"payload_id.go",
|
||||
"randao.go",
|
||||
"slot.go",
|
||||
@@ -21,6 +22,7 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//math:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
|
||||
],
|
||||
|
||||
15
consensus-types/primitives/kzg.go
Normal file
15
consensus-types/primitives/kzg.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package primitives
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
const blobCommitmentVersionKZG uint8 = 0x01
|
||||
|
||||
func ConvertKzgCommitmentToVersionedHash(commitment []byte) common.Hash {
|
||||
versionedHash := sha256.Sum256(commitment)
|
||||
versionedHash[0] = blobCommitmentVersionKZG
|
||||
return versionedHash
|
||||
}
|
||||
4
deps.bzl
4
deps.bzl
@@ -2781,8 +2781,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_fastssz",
|
||||
importpath = "github.com/prysmaticlabs/fastssz",
|
||||
sum = "h1:0LZAwwHnsZFfXm4IK4rzFV4N5IVSKZKLmuBMA4kAlFk=",
|
||||
version = "v0.0.0-20240620202422-a981b8ef89d3",
|
||||
sum = "h1:xuVAdtz5ShYblG2sPyb4gw01DF8InbOI/kBCQjk7NiM=",
|
||||
version = "v0.0.0-20241008181541-518c4ce73516",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_go_bitfield",
|
||||
|
||||
2
go.mod
2
go.mod
@@ -62,7 +62,7 @@ require (
|
||||
github.com/prometheus/client_golang v1.20.0
|
||||
github.com/prometheus/client_model v0.6.1
|
||||
github.com/prometheus/prom2json v1.3.0
|
||||
github.com/prysmaticlabs/fastssz v0.0.0-20240620202422-a981b8ef89d3
|
||||
github.com/prysmaticlabs/fastssz v0.0.0-20241008181541-518c4ce73516
|
||||
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
|
||||
|
||||
4
go.sum
4
go.sum
@@ -897,8 +897,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/prometheus/prom2json v1.3.0 h1:BlqrtbT9lLH3ZsOVhXPsHzFrApCTKRifB7gjJuypu6Y=
|
||||
github.com/prometheus/prom2json v1.3.0/go.mod h1:rMN7m0ApCowcoDlypBHlkNbp5eJQf/+1isKykIP5ZnM=
|
||||
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/fastssz v0.0.0-20241008181541-518c4ce73516 h1:xuVAdtz5ShYblG2sPyb4gw01DF8InbOI/kBCQjk7NiM=
|
||||
github.com/prysmaticlabs/fastssz v0.0.0-20241008181541-518c4ce73516/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=
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 13c946aa898cca1afa84687b619bc5a10fc79a46340e98dcfb07dde835d39a0c
|
||||
// Hash: 2874e1dadeb47411763f48fe31e5daaa91ac663e796933d9a508c2e7be94fa5e
|
||||
package v1
|
||||
|
||||
import (
|
||||
@@ -2395,7 +2395,10 @@ func (v *Validator) UnmarshalSSZ(buf []byte) error {
|
||||
v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88])
|
||||
|
||||
// Field (3) 'Slashed'
|
||||
v.Slashed = ssz.UnmarshalBool(buf[88:89])
|
||||
v.Slashed, err = ssz.DecodeBool(buf[88:89])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'ActivationEligibilityEpoch'
|
||||
v.ActivationEligibilityEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[89:97]))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: bc8a0f7f6c8dadac6bcb0eaab2dea4888cc44c5b3f4fe9998a71e15f1a059399
|
||||
// Hash: 298a6e797d2a244a4eee0e60b198b11fd30b4b8596a8a5b911dd2e14fafebdad
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
@@ -81,6 +81,11 @@ ssz_altair_objs = [
|
||||
"BeaconBlockBodyAltair",
|
||||
"BeaconStateAltair",
|
||||
"ContributionAndProof",
|
||||
"LightClientBootstrapAltair",
|
||||
"LightClientFinalityUpdateAltair",
|
||||
"LightClientHeaderAltair",
|
||||
"LightClientOptimisticUpdateAltair",
|
||||
"LightClientUpdateAltair",
|
||||
"SignedBeaconBlockAltair",
|
||||
"SignedContributionAndProof",
|
||||
"SyncAggregate",
|
||||
@@ -110,6 +115,11 @@ ssz_capella_objs = [
|
||||
"BlindedBeaconBlockCapella",
|
||||
"BuilderBidCapella",
|
||||
"HistoricalSummary",
|
||||
"LightClientBootstrapCapella",
|
||||
"LightClientFinalityUpdateCapella",
|
||||
"LightClientHeaderCapella",
|
||||
"LightClientOptimisticUpdateCapella",
|
||||
"LightClientUpdateCapella",
|
||||
"SignedBLSToExecutionChange",
|
||||
"SignedBeaconBlockCapella",
|
||||
"SignedBlindedBeaconBlockCapella",
|
||||
@@ -127,6 +137,11 @@ ssz_deneb_objs = [
|
||||
"BlobSidecar",
|
||||
"BlobSidecars",
|
||||
"BuilderBidDeneb",
|
||||
"LightClientBootstrapDeneb",
|
||||
"LightClientFinalityUpdateDeneb",
|
||||
"LightClientHeaderDeneb",
|
||||
"LightClientOptimisticUpdateDeneb",
|
||||
"LightClientUpdateDeneb",
|
||||
"SignedBeaconBlockContentsDeneb",
|
||||
"SignedBeaconBlockDeneb",
|
||||
"SignedBlindedBeaconBlockDeneb",
|
||||
@@ -334,6 +349,7 @@ ssz_proto_files(
|
||||
"beacon_block.proto",
|
||||
"beacon_state.proto",
|
||||
"blobs.proto",
|
||||
"light_client.proto",
|
||||
"sync_committee.proto",
|
||||
"withdrawals.proto",
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: bb838fc0c2dfdadd4a8274dd1b438b1051f7b84d7c8e7470900621284dba8f43
|
||||
// Hash: 18a07a11eb3d1daaafe0b6b1ac8934e9333ea6eceed7d5ef30166b9c2fb50d39
|
||||
package eth
|
||||
|
||||
import (
|
||||
@@ -1747,6 +1747,651 @@ func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err erro
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientHeaderAltair object
|
||||
func (l *LightClientHeaderAltair) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientHeaderAltair object to a target array
|
||||
func (l *LightClientHeaderAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientHeaderAltair object
|
||||
func (l *LightClientHeaderAltair) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 112 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderAltair object
|
||||
func (l *LightClientHeaderAltair) SizeSSZ() (size int) {
|
||||
size = 112
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientHeaderAltair object
|
||||
func (l *LightClientHeaderAltair) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientHeaderAltair object with a hasher
|
||||
func (l *LightClientHeaderAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientBootstrapAltair object
|
||||
func (l *LightClientBootstrapAltair) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientBootstrapAltair object to a target array
|
||||
func (l *LightClientBootstrapAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
|
||||
// Field (0) 'Header'
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapAltair object
|
||||
func (l *LightClientBootstrapAltair) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 24896 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
// Field (0) 'Header'
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.Header.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
|
||||
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapAltair object
|
||||
func (l *LightClientBootstrapAltair) SizeSSZ() (size int) {
|
||||
size = 24896
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientBootstrapAltair object
|
||||
func (l *LightClientBootstrapAltair) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientBootstrapAltair object with a hasher
|
||||
func (l *LightClientBootstrapAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Header'
|
||||
if err = l.Header.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.CurrentSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientUpdateAltair object
|
||||
func (l *LightClientUpdateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientUpdateAltair object to a target array
|
||||
func (l *LightClientUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientUpdateAltair object
|
||||
func (l *LightClientUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 25368 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
l.NextSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
|
||||
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf[24896:25008]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[25008:25200][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[25008:25200][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[25200:25360]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25360:25368]))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateAltair object
|
||||
func (l *LightClientUpdateAltair) SizeSSZ() (size int) {
|
||||
size = 25368
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientUpdateAltair object
|
||||
func (l *LightClientUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientUpdateAltair object with a hasher
|
||||
func (l *LightClientUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.NextSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientFinalityUpdateAltair object
|
||||
func (l *LightClientFinalityUpdateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateAltair object to a target array
|
||||
func (l *LightClientFinalityUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateAltair object
|
||||
func (l *LightClientFinalityUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 584 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf[112:224]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[224:416][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[224:416][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[416:576]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[576:584]))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateAltair object
|
||||
func (l *LightClientFinalityUpdateAltair) SizeSSZ() (size int) {
|
||||
size = 584
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientFinalityUpdateAltair object
|
||||
func (l *LightClientFinalityUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateAltair object with a hasher
|
||||
func (l *LightClientFinalityUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateAltair object
|
||||
func (l *LightClientOptimisticUpdateAltair) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateAltair object to a target array
|
||||
func (l *LightClientOptimisticUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateAltair object
|
||||
func (l *LightClientOptimisticUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 280 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderAltair)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[112:272]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[272:280]))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateAltair object
|
||||
func (l *LightClientOptimisticUpdateAltair) SizeSSZ() (size int) {
|
||||
size = 280
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateAltair object
|
||||
func (l *LightClientOptimisticUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateAltair object with a hasher
|
||||
func (l *LightClientOptimisticUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the SyncCommitteeMessage object
|
||||
func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(s)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 693cad07de8560b2681132d912aebb927e668fe15e5cb9f42e8a36bbac6e2c5e
|
||||
// Hash: c6614861443f105e2d5445ca29187cc78c2a929161d0a15b36ce2f0e6517a0ea
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: a5507ef7d71897486989f37eb4dbb19fc2c49e7c47f244291a9f3122c9bfe546
|
||||
// Hash: 6bee0cf7c5707af68be518a221b248ce37edd4b0b1e6fec9703c6152a5107a1d
|
||||
package eth
|
||||
|
||||
import (
|
||||
@@ -2729,6 +2729,877 @@ func (h *HistoricalSummary) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientHeaderCapella object
|
||||
func (l *LightClientHeaderCapella) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientHeaderCapella object to a target array
|
||||
func (l *LightClientHeaderCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(244)
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Offset (1) 'Execution'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
|
||||
}
|
||||
offset += l.Execution.SizeSSZ()
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
if size := len(l.ExecutionBranch); size != 4 {
|
||||
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 4; ii++ {
|
||||
if size := len(l.ExecutionBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.ExecutionBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.ExecutionBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if dst, err = l.Execution.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientHeaderCapella object
|
||||
func (l *LightClientHeaderCapella) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 244 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o1 uint64
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Offset (1) 'Execution'
|
||||
if o1 = ssz.ReadOffset(buf[112:116]); o1 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o1 != 244 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
l.ExecutionBranch = make([][]byte, 4)
|
||||
for ii := 0; ii < 4; ii++ {
|
||||
if cap(l.ExecutionBranch[ii]) == 0 {
|
||||
l.ExecutionBranch[ii] = make([]byte, 0, len(buf[116:244][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.ExecutionBranch[ii] = append(l.ExecutionBranch[ii], buf[116:244][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
{
|
||||
buf = tail[o1:]
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
|
||||
}
|
||||
if err = l.Execution.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderCapella object
|
||||
func (l *LightClientHeaderCapella) SizeSSZ() (size int) {
|
||||
size = 244
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderCapella)
|
||||
}
|
||||
size += l.Execution.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientHeaderCapella object
|
||||
func (l *LightClientHeaderCapella) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientHeaderCapella object with a hasher
|
||||
func (l *LightClientHeaderCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if err = l.Execution.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
{
|
||||
if size := len(l.ExecutionBranch); size != 4 {
|
||||
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.ExecutionBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientBootstrapCapella object
|
||||
func (l *LightClientBootstrapCapella) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientBootstrapCapella object to a target array
|
||||
func (l *LightClientBootstrapCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(24788)
|
||||
|
||||
// Offset (0) 'Header'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.Header.SizeSSZ()
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (0) 'Header'
|
||||
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapCapella object
|
||||
func (l *LightClientBootstrapCapella) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 24788 {
|
||||
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 != 24788 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
|
||||
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (0) 'Header'
|
||||
{
|
||||
buf = tail[o0:]
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.Header.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapCapella object
|
||||
func (l *LightClientBootstrapCapella) SizeSSZ() (size int) {
|
||||
size = 24788
|
||||
|
||||
// Field (0) 'Header'
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.Header.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientBootstrapCapella object
|
||||
func (l *LightClientBootstrapCapella) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientBootstrapCapella object with a hasher
|
||||
func (l *LightClientBootstrapCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Header'
|
||||
if err = l.Header.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.CurrentSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientUpdateCapella object
|
||||
func (l *LightClientUpdateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientUpdateCapella object to a target array
|
||||
func (l *LightClientUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(25152)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
// Offset (3) 'FinalizedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientUpdateCapella object
|
||||
func (l *LightClientUpdateCapella) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 25152 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0, o3 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 25152 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
l.NextSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
|
||||
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Offset (3) 'FinalizedHeader'
|
||||
if o3 = ssz.ReadOffset(buf[24788:24792]); o3 > size || o0 > o3 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[24792:24984][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24792:24984][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[24984:25144]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25144:25152]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:o3]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
{
|
||||
buf = tail[o3:]
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateCapella object
|
||||
func (l *LightClientUpdateCapella) SizeSSZ() (size int) {
|
||||
size = 25152
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientUpdateCapella object
|
||||
func (l *LightClientUpdateCapella) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientUpdateCapella object with a hasher
|
||||
func (l *LightClientUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.NextSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientFinalityUpdateCapella object
|
||||
func (l *LightClientFinalityUpdateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateCapella object to a target array
|
||||
func (l *LightClientFinalityUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(368)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Offset (1) 'FinalizedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateCapella object
|
||||
func (l *LightClientFinalityUpdateCapella) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 368 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0, o1 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 368 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Offset (1) 'FinalizedHeader'
|
||||
if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:200][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:200][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[200:360]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[360:368]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:o1]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
{
|
||||
buf = tail[o1:]
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateCapella object
|
||||
func (l *LightClientFinalityUpdateCapella) SizeSSZ() (size int) {
|
||||
size = 368
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientFinalityUpdateCapella object
|
||||
func (l *LightClientFinalityUpdateCapella) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateCapella object with a hasher
|
||||
func (l *LightClientFinalityUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateCapella object
|
||||
func (l *LightClientOptimisticUpdateCapella) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateCapella object to a target array
|
||||
func (l *LightClientOptimisticUpdateCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(172)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateCapella object
|
||||
func (l *LightClientOptimisticUpdateCapella) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 172 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 172 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[4:164]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[164:172]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateCapella object
|
||||
func (l *LightClientOptimisticUpdateCapella) SizeSSZ() (size int) {
|
||||
size = 172
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderCapella)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateCapella object
|
||||
func (l *LightClientOptimisticUpdateCapella) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateCapella object with a hasher
|
||||
func (l *LightClientOptimisticUpdateCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the BLSToExecutionChange object
|
||||
func (b *BLSToExecutionChange) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(b)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 4c3e6932bf84838e8de21e5c121c14d03cbccb051c3990d3b924932f531f4d30
|
||||
// Hash: dc56f26fb2603482588d88426187e889583abce2eeb7556ac0dc1ebaa891c455
|
||||
package eth
|
||||
|
||||
import (
|
||||
@@ -3593,3 +3593,874 @@ func (b *BlobIdentifier) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientHeaderDeneb object
|
||||
func (l *LightClientHeaderDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientHeaderDeneb object to a target array
|
||||
func (l *LightClientHeaderDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(244)
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Offset (1) 'Execution'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
|
||||
}
|
||||
offset += l.Execution.SizeSSZ()
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
if size := len(l.ExecutionBranch); size != 4 {
|
||||
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 4; ii++ {
|
||||
if size := len(l.ExecutionBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.ExecutionBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.ExecutionBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if dst, err = l.Execution.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientHeaderDeneb object
|
||||
func (l *LightClientHeaderDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 244 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o1 uint64
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if l.Beacon == nil {
|
||||
l.Beacon = new(BeaconBlockHeader)
|
||||
}
|
||||
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Offset (1) 'Execution'
|
||||
if o1 = ssz.ReadOffset(buf[112:116]); o1 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o1 != 244 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
l.ExecutionBranch = make([][]byte, 4)
|
||||
for ii := 0; ii < 4; ii++ {
|
||||
if cap(l.ExecutionBranch[ii]) == 0 {
|
||||
l.ExecutionBranch[ii] = make([]byte, 0, len(buf[116:244][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.ExecutionBranch[ii] = append(l.ExecutionBranch[ii], buf[116:244][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
{
|
||||
buf = tail[o1:]
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
|
||||
}
|
||||
if err = l.Execution.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderDeneb object
|
||||
func (l *LightClientHeaderDeneb) SizeSSZ() (size int) {
|
||||
size = 244
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if l.Execution == nil {
|
||||
l.Execution = new(v1.ExecutionPayloadHeaderDeneb)
|
||||
}
|
||||
size += l.Execution.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientHeaderDeneb object
|
||||
func (l *LightClientHeaderDeneb) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientHeaderDeneb object with a hasher
|
||||
func (l *LightClientHeaderDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Beacon'
|
||||
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'Execution'
|
||||
if err = l.Execution.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'ExecutionBranch'
|
||||
{
|
||||
if size := len(l.ExecutionBranch); size != 4 {
|
||||
err = ssz.ErrVectorLengthFn("--.ExecutionBranch", size, 4)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.ExecutionBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientBootstrapDeneb object
|
||||
func (l *LightClientBootstrapDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientBootstrapDeneb object to a target array
|
||||
func (l *LightClientBootstrapDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(24788)
|
||||
|
||||
// Offset (0) 'Header'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.Header.SizeSSZ()
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (0) 'Header'
|
||||
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapDeneb object
|
||||
func (l *LightClientBootstrapDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 24788 {
|
||||
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 != 24788 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if l.CurrentSyncCommittee == nil {
|
||||
l.CurrentSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
|
||||
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (0) 'Header'
|
||||
{
|
||||
buf = tail[o0:]
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.Header.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapDeneb object
|
||||
func (l *LightClientBootstrapDeneb) SizeSSZ() (size int) {
|
||||
size = 24788
|
||||
|
||||
// Field (0) 'Header'
|
||||
if l.Header == nil {
|
||||
l.Header = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.Header.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientBootstrapDeneb object
|
||||
func (l *LightClientBootstrapDeneb) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientBootstrapDeneb object with a hasher
|
||||
func (l *LightClientBootstrapDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'Header'
|
||||
if err = l.Header.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'CurrentSyncCommittee'
|
||||
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'CurrentSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.CurrentSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientUpdateDeneb object
|
||||
func (l *LightClientUpdateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientUpdateDeneb object to a target array
|
||||
func (l *LightClientUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(25152)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
|
||||
}
|
||||
|
||||
// Offset (3) 'FinalizedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientUpdateDeneb object
|
||||
func (l *LightClientUpdateDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 25152 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0, o3 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 25152 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if l.NextSyncCommittee == nil {
|
||||
l.NextSyncCommittee = new(SyncCommittee)
|
||||
}
|
||||
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[4:24628]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
l.NextSyncCommitteeBranch = make([][]byte, 5)
|
||||
for ii := 0; ii < 5; ii++ {
|
||||
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
|
||||
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24628:24788][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24628:24788][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Offset (3) 'FinalizedHeader'
|
||||
if o3 = ssz.ReadOffset(buf[24788:24792]); o3 > size || o0 > o3 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[24792:24984][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[24792:24984][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[24984:25144]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25144:25152]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:o3]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
{
|
||||
buf = tail[o3:]
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateDeneb object
|
||||
func (l *LightClientUpdateDeneb) SizeSSZ() (size int) {
|
||||
size = 25152
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientUpdateDeneb object
|
||||
func (l *LightClientUpdateDeneb) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientUpdateDeneb object with a hasher
|
||||
func (l *LightClientUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'NextSyncCommittee'
|
||||
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'NextSyncCommitteeBranch'
|
||||
{
|
||||
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
||||
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.NextSyncCommitteeBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (5) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (6) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientFinalityUpdateDeneb object
|
||||
func (l *LightClientFinalityUpdateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateDeneb object to a target array
|
||||
func (l *LightClientFinalityUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(368)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Offset (1) 'FinalizedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if size := len(l.FinalityBranch[ii]); size != 32 {
|
||||
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
||||
return
|
||||
}
|
||||
dst = append(dst, l.FinalityBranch[ii]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateDeneb object
|
||||
func (l *LightClientFinalityUpdateDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 368 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0, o1 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 368 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Offset (1) 'FinalizedHeader'
|
||||
if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
l.FinalityBranch = make([][]byte, 6)
|
||||
for ii := 0; ii < 6; ii++ {
|
||||
if cap(l.FinalityBranch[ii]) == 0 {
|
||||
l.FinalityBranch[ii] = make([]byte, 0, len(buf[8:200][ii*32:(ii+1)*32]))
|
||||
}
|
||||
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[8:200][ii*32:(ii+1)*32]...)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[200:360]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[360:368]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:o1]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
{
|
||||
buf = tail[o1:]
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.FinalizedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateDeneb object
|
||||
func (l *LightClientFinalityUpdateDeneb) SizeSSZ() (size int) {
|
||||
size = 368
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if l.FinalizedHeader == nil {
|
||||
l.FinalizedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.FinalizedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientFinalityUpdateDeneb object
|
||||
func (l *LightClientFinalityUpdateDeneb) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateDeneb object with a hasher
|
||||
func (l *LightClientFinalityUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'FinalizedHeader'
|
||||
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'FinalityBranch'
|
||||
{
|
||||
if size := len(l.FinalityBranch); size != 6 {
|
||||
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
||||
return
|
||||
}
|
||||
subIndx := hh.Index()
|
||||
for _, i := range l.FinalityBranch {
|
||||
if len(i) != 32 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
hh.Append(i)
|
||||
}
|
||||
hh.Merkleize(subIndx)
|
||||
}
|
||||
|
||||
// Field (3) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (4) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateDeneb object
|
||||
func (l *LightClientOptimisticUpdateDeneb) MarshalSSZ() ([]byte, error) {
|
||||
return ssz.MarshalSSZ(l)
|
||||
}
|
||||
|
||||
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateDeneb object to a target array
|
||||
func (l *LightClientOptimisticUpdateDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||
dst = buf
|
||||
offset := int(172)
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
dst = ssz.WriteOffset(dst, offset)
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
offset += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateDeneb object
|
||||
func (l *LightClientOptimisticUpdateDeneb) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size < 172 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
tail := buf
|
||||
var o0 uint64
|
||||
|
||||
// Offset (0) 'AttestedHeader'
|
||||
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
||||
return ssz.ErrOffset
|
||||
}
|
||||
|
||||
if o0 != 172 {
|
||||
return ssz.ErrInvalidVariableOffset
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if l.SyncAggregate == nil {
|
||||
l.SyncAggregate = new(SyncAggregate)
|
||||
}
|
||||
if err = l.SyncAggregate.UnmarshalSSZ(buf[4:164]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[164:172]))
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
{
|
||||
buf = tail[o0:]
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
if err = l.AttestedHeader.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateDeneb object
|
||||
func (l *LightClientOptimisticUpdateDeneb) SizeSSZ() (size int) {
|
||||
size = 172
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if l.AttestedHeader == nil {
|
||||
l.AttestedHeader = new(LightClientHeaderDeneb)
|
||||
}
|
||||
size += l.AttestedHeader.SizeSSZ()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateDeneb object
|
||||
func (l *LightClientOptimisticUpdateDeneb) HashTreeRoot() ([32]byte, error) {
|
||||
return ssz.HashWithDefaultHasher(l)
|
||||
}
|
||||
|
||||
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateDeneb object with a hasher
|
||||
func (l *LightClientOptimisticUpdateDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
||||
indx := hh.Index()
|
||||
|
||||
// Field (0) 'AttestedHeader'
|
||||
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (1) 'SyncAggregate'
|
||||
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Field (2) 'SignatureSlot'
|
||||
hh.PutUint64(uint64(l.SignatureSlot))
|
||||
|
||||
hh.Merkleize(indx)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 8009dff4967583f3039317182cf9c9f5c46922f00fe10c357d9d32b0a264e28b
|
||||
// Hash: 3a2dbf56ebf4e81fbf961840a4cd2addac9047b17c12bad04e60879df5b69277
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
1759
proto/prysm/v1alpha1/light_client.pb.go
generated
Executable file
1759
proto/prysm/v1alpha1/light_client.pb.go
generated
Executable file
File diff suppressed because it is too large
Load Diff
134
proto/prysm/v1alpha1/light_client.proto
Normal file
134
proto/prysm/v1alpha1/light_client.proto
Normal file
@@ -0,0 +1,134 @@
|
||||
// Copyright 2024 Prysmatic Labs.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
syntax = "proto3";
|
||||
|
||||
package ethereum.eth.v1alpha1;
|
||||
|
||||
import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/beacon_block.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
import "proto/prysm/v1alpha1/beacon_state.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.V1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/eth/v1alpha1;eth";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "LightClientProto";
|
||||
option java_package = "org.ethereum.eth.v1alpha1";
|
||||
option php_namespace = "Ethereum\\Eth\\v1alpha1";
|
||||
|
||||
message LightClientHeaderAltair {
|
||||
BeaconBlockHeader beacon = 1;
|
||||
}
|
||||
|
||||
message LightClientHeaderCapella {
|
||||
BeaconBlockHeader beacon = 1;
|
||||
ethereum.engine.v1.ExecutionPayloadHeaderCapella execution = 2;
|
||||
repeated bytes execution_branch = 3 [(ethereum.eth.ext.ssz_size) = "4,32"];
|
||||
}
|
||||
|
||||
message LightClientHeaderDeneb {
|
||||
BeaconBlockHeader beacon = 1;
|
||||
ethereum.engine.v1.ExecutionPayloadHeaderDeneb execution = 2;
|
||||
repeated bytes execution_branch = 3 [(ethereum.eth.ext.ssz_size) = "4,32"];
|
||||
}
|
||||
|
||||
message LightClientBootstrapAltair {
|
||||
LightClientHeaderAltair header = 1;
|
||||
SyncCommittee current_sync_committee = 2;
|
||||
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
}
|
||||
|
||||
message LightClientBootstrapCapella {
|
||||
LightClientHeaderCapella header = 1;
|
||||
SyncCommittee current_sync_committee = 2;
|
||||
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
}
|
||||
|
||||
message LightClientBootstrapDeneb {
|
||||
LightClientHeaderDeneb header = 1;
|
||||
SyncCommittee current_sync_committee = 2;
|
||||
repeated bytes current_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
}
|
||||
|
||||
message LightClientUpdateAltair {
|
||||
LightClientHeaderAltair attested_header = 1;
|
||||
SyncCommittee next_sync_committee = 2;
|
||||
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
LightClientHeaderAltair finalized_header = 4;
|
||||
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 6;
|
||||
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientUpdateCapella {
|
||||
LightClientHeaderCapella attested_header = 1;
|
||||
SyncCommittee next_sync_committee = 2;
|
||||
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
LightClientHeaderCapella finalized_header = 4;
|
||||
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 6;
|
||||
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientUpdateDeneb {
|
||||
LightClientHeaderDeneb attested_header = 1;
|
||||
SyncCommittee next_sync_committee = 2;
|
||||
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
|
||||
LightClientHeaderDeneb finalized_header = 4;
|
||||
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 6;
|
||||
uint64 signature_slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientFinalityUpdateAltair {
|
||||
LightClientHeaderAltair attested_header = 1;
|
||||
LightClientHeaderAltair finalized_header = 2;
|
||||
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 4;
|
||||
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientFinalityUpdateCapella {
|
||||
LightClientHeaderCapella attested_header = 1;
|
||||
LightClientHeaderCapella finalized_header = 2;
|
||||
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 4;
|
||||
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientFinalityUpdateDeneb {
|
||||
LightClientHeaderDeneb attested_header = 1;
|
||||
LightClientHeaderDeneb finalized_header = 2;
|
||||
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
|
||||
SyncAggregate sync_aggregate = 4;
|
||||
uint64 signature_slot = 5 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientOptimisticUpdateAltair {
|
||||
LightClientHeaderAltair attested_header = 1;
|
||||
SyncAggregate sync_aggregate = 2;
|
||||
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientOptimisticUpdateCapella {
|
||||
LightClientHeaderCapella attested_header = 1;
|
||||
SyncAggregate sync_aggregate = 2;
|
||||
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
|
||||
message LightClientOptimisticUpdateDeneb {
|
||||
LightClientHeaderDeneb attested_header = 1;
|
||||
SyncAggregate sync_aggregate = 2;
|
||||
uint64 signature_slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 4cb7a5705004491db2ef29a5080a4cc56a1b618de948a86f9e5275858b48e6c4
|
||||
// Hash: bfd7d6b556134c3bd236b880245717aa01ae79573b33f2746a08c165ba5dcedb
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 0afa289ce68dc2913d8000d495c6069832f35b66a6c0cf1bb0d1299fcad7047a
|
||||
// Hash: 5797213d138ec1a089f9dae2198cab6f4f829ac0cc1f0bda2633fff544db4e68
|
||||
package eth
|
||||
|
||||
import (
|
||||
@@ -3979,7 +3979,10 @@ func (v *Validator) UnmarshalSSZ(buf []byte) error {
|
||||
v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88])
|
||||
|
||||
// Field (3) 'Slashed'
|
||||
v.Slashed = ssz.UnmarshalBool(buf[88:89])
|
||||
v.Slashed, err = ssz.DecodeBool(buf[88:89])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (4) 'ActivationEligibilityEpoch'
|
||||
v.ActivationEligibilityEpoch = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(ssz.UnmarshallUint64(buf[89:97]))
|
||||
|
||||
@@ -456,6 +456,118 @@ func (l *TestLightClient) SetupTestDeneb(blinded bool) *TestLightClient {
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *TestLightClient) SetupTestElectra(blinded bool) *TestLightClient {
|
||||
ctx := context.Background()
|
||||
|
||||
slot := primitives.Slot(params.BeaconConfig().ElectraForkEpoch * primitives.Epoch(params.BeaconConfig().SlotsPerEpoch)).Add(1)
|
||||
|
||||
attestedState, err := NewBeaconStateElectra()
|
||||
require.NoError(l.T, err)
|
||||
err = attestedState.SetSlot(slot)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
finalizedBlock, err := blocks.NewSignedBeaconBlock(NewBeaconBlockElectra())
|
||||
require.NoError(l.T, err)
|
||||
finalizedBlock.SetSlot(1)
|
||||
finalizedHeader, err := finalizedBlock.Header()
|
||||
require.NoError(l.T, err)
|
||||
finalizedRoot, err := finalizedHeader.Header.HashTreeRoot()
|
||||
require.NoError(l.T, err)
|
||||
|
||||
require.NoError(l.T, attestedState.SetFinalizedCheckpoint(ðpb.Checkpoint{
|
||||
Epoch: params.BeaconConfig().ElectraForkEpoch - 10,
|
||||
Root: finalizedRoot[:],
|
||||
}))
|
||||
|
||||
parent := NewBeaconBlockElectra()
|
||||
parent.Block.Slot = slot
|
||||
|
||||
signedParent, err := blocks.NewSignedBeaconBlock(parent)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
parentHeader, err := signedParent.Header()
|
||||
require.NoError(l.T, err)
|
||||
attestedHeader := parentHeader.Header
|
||||
|
||||
err = attestedState.SetLatestBlockHeader(attestedHeader)
|
||||
require.NoError(l.T, err)
|
||||
attestedStateRoot, err := attestedState.HashTreeRoot(ctx)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
// get a new signed block so the root is updated with the new state root
|
||||
parent.Block.StateRoot = attestedStateRoot[:]
|
||||
signedParent, err = blocks.NewSignedBeaconBlock(parent)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
state, err := NewBeaconStateElectra()
|
||||
require.NoError(l.T, err)
|
||||
err = state.SetSlot(slot)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
parentRoot, err := signedParent.Block().HashTreeRoot()
|
||||
require.NoError(l.T, err)
|
||||
|
||||
var signedBlock interfaces.SignedBeaconBlock
|
||||
if blinded {
|
||||
block := NewBlindedBeaconBlockElectra()
|
||||
block.Message.Slot = slot
|
||||
block.Message.ParentRoot = parentRoot[:]
|
||||
|
||||
for i := uint64(0); i < params.BeaconConfig().MinSyncCommitteeParticipants; i++ {
|
||||
block.Message.Body.SyncAggregate.SyncCommitteeBits.SetBitAt(i, true)
|
||||
}
|
||||
|
||||
signedBlock, err = blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
h, err := signedBlock.Header()
|
||||
require.NoError(l.T, err)
|
||||
|
||||
err = state.SetLatestBlockHeader(h.Header)
|
||||
require.NoError(l.T, err)
|
||||
stateRoot, err := state.HashTreeRoot(ctx)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
// get a new signed block so the root is updated with the new state root
|
||||
block.Message.StateRoot = stateRoot[:]
|
||||
signedBlock, err = blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(l.T, err)
|
||||
} else {
|
||||
block := NewBeaconBlockElectra()
|
||||
block.Block.Slot = slot
|
||||
block.Block.ParentRoot = parentRoot[:]
|
||||
|
||||
for i := uint64(0); i < params.BeaconConfig().MinSyncCommitteeParticipants; i++ {
|
||||
block.Block.Body.SyncAggregate.SyncCommitteeBits.SetBitAt(i, true)
|
||||
}
|
||||
|
||||
signedBlock, err = blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
h, err := signedBlock.Header()
|
||||
require.NoError(l.T, err)
|
||||
|
||||
err = state.SetLatestBlockHeader(h.Header)
|
||||
require.NoError(l.T, err)
|
||||
stateRoot, err := state.HashTreeRoot(ctx)
|
||||
require.NoError(l.T, err)
|
||||
|
||||
// get a new signed block so the root is updated with the new state root
|
||||
block.Block.StateRoot = stateRoot[:]
|
||||
signedBlock, err = blocks.NewSignedBeaconBlock(block)
|
||||
require.NoError(l.T, err)
|
||||
}
|
||||
|
||||
l.State = state
|
||||
l.AttestedState = attestedState
|
||||
l.AttestedBlock = signedParent
|
||||
l.Block = signedBlock
|
||||
l.Ctx = ctx
|
||||
l.FinalizedBlock = finalizedBlock
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *TestLightClient) SetupTestDenebFinalizedBlockCapella(blinded bool) *TestLightClient {
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
@@ -1262,13 +1262,16 @@ func (v *validator) updateValidatorStatusCache(ctx context.Context, pubkeys [][f
|
||||
if len(resp.Statuses) != len(resp.Indices) {
|
||||
return fmt.Errorf("expected %d indices in status, received %d", len(resp.Statuses), len(resp.Indices))
|
||||
}
|
||||
pubkeyToStatus := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorStatus, len(resp.Statuses))
|
||||
for i, s := range resp.Statuses {
|
||||
v.pubkeyToStatus[bytesutil.ToBytes48(resp.PublicKeys[i])] = &validatorStatus{
|
||||
pubkeyToStatus[bytesutil.ToBytes48(resp.PublicKeys[i])] = &validatorStatus{
|
||||
publicKey: resp.PublicKeys[i],
|
||||
status: s,
|
||||
index: resp.Indices[i],
|
||||
}
|
||||
}
|
||||
v.pubkeyToStatus = pubkeyToStatus
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2908,3 +2908,63 @@ func TestValidator_ChangeHost(t *testing.T) {
|
||||
v.ChangeHost()
|
||||
assert.Equal(t, uint64(0), v.currentHostIndex)
|
||||
}
|
||||
|
||||
func TestUpdateValidatorStatusCache(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
pubkeys := [][fieldparams.BLSPubkeyLength]byte{
|
||||
{0x01},
|
||||
{0x02},
|
||||
}
|
||||
statusRequestKeys := [][]byte{
|
||||
pubkeys[0][:],
|
||||
pubkeys[1][:],
|
||||
}
|
||||
|
||||
client := validatormock.NewMockValidatorClient(ctrl)
|
||||
mockResponse := ðpb.MultipleValidatorStatusResponse{
|
||||
PublicKeys: statusRequestKeys,
|
||||
Statuses: []*ethpb.ValidatorStatusResponse{
|
||||
{
|
||||
Status: ethpb.ValidatorStatus_ACTIVE,
|
||||
}, {
|
||||
Status: ethpb.ValidatorStatus_EXITING,
|
||||
}},
|
||||
Indices: []primitives.ValidatorIndex{1, 2},
|
||||
}
|
||||
client.EXPECT().MultipleValidatorStatus(
|
||||
gomock.Any(),
|
||||
gomock.Any()).Return(mockResponse, nil)
|
||||
|
||||
v := &validator{
|
||||
validatorClient: client,
|
||||
beaconNodeHosts: []string{"http://localhost:8080", "http://localhost:8081"},
|
||||
currentHostIndex: 0,
|
||||
pubkeyToStatus: map[[fieldparams.BLSPubkeyLength]byte]*validatorStatus{
|
||||
[fieldparams.BLSPubkeyLength]byte{0x03}: &validatorStatus{ // add non existant key and status to cache, should be fully removed on update
|
||||
publicKey: []byte{0x03},
|
||||
status: ðpb.ValidatorStatusResponse{
|
||||
Status: ethpb.ValidatorStatus_ACTIVE,
|
||||
},
|
||||
index: 3,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := v.updateValidatorStatusCache(ctx, pubkeys)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// make sure the nonexistant key is fully removed
|
||||
_, ok := v.pubkeyToStatus[[fieldparams.BLSPubkeyLength]byte{0x03}]
|
||||
require.Equal(t, false, ok)
|
||||
// make sure we only have the added values
|
||||
assert.Equal(t, 2, len(v.pubkeyToStatus))
|
||||
for i, pk := range pubkeys {
|
||||
status, exists := v.pubkeyToStatus[pk]
|
||||
require.Equal(t, true, exists)
|
||||
require.DeepEqual(t, pk[:], status.publicKey)
|
||||
require.Equal(t, mockResponse.Statuses[i], status.status)
|
||||
require.Equal(t, mockResponse.Indices[i], status.index)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user