mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Compare commits
13 Commits
patchRelea
...
error-free
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdab4ef997 | ||
|
|
e18b767ebb | ||
|
|
da5ff38d81 | ||
|
|
c13e5089b3 | ||
|
|
84ab470c12 | ||
|
|
eee47fea84 | ||
|
|
8df62a537b | ||
|
|
bf5e667351 | ||
|
|
0e5c2bd18e | ||
|
|
3233e64ace | ||
|
|
751117a308 | ||
|
|
8d9024f01f | ||
|
|
a9862f32f3 |
21
MODULE.bazel.lock
generated
21
MODULE.bazel.lock
generated
@@ -1123,6 +1123,27 @@
|
||||
"recordedRepoMappingEntries": []
|
||||
}
|
||||
},
|
||||
"@@bazel_tools//tools/test:extensions.bzl%remote_coverage_tools_extension": {
|
||||
"general": {
|
||||
"bzlTransitiveDigest": "l5mcjH2gWmbmIycx97bzI2stD0Q0M5gpDc0aLOHKIm8=",
|
||||
"recordedFileInputs": {},
|
||||
"recordedDirentsInputs": {},
|
||||
"envVariables": {},
|
||||
"generatedRepoSpecs": {
|
||||
"remote_coverage_tools": {
|
||||
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
|
||||
"ruleClassName": "http_archive",
|
||||
"attributes": {
|
||||
"sha256": "7006375f6756819b7013ca875eab70a541cf7d89142d9c511ed78ea4fefa38af",
|
||||
"urls": [
|
||||
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.6.zip"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"recordedRepoMappingEntries": []
|
||||
}
|
||||
},
|
||||
"@@rules_java~//java:extensions.bzl%toolchains": {
|
||||
"general": {
|
||||
"bzlTransitiveDigest": "tJHbmWnq7m+9eUBnUdv7jZziQ26FmcGL9C5/hU3Q9UQ=",
|
||||
|
||||
3
beacon-chain/cache/BUILD.bazel
vendored
3
beacon-chain/cache/BUILD.bazel
vendored
@@ -6,6 +6,7 @@ go_library(
|
||||
"active_balance.go",
|
||||
"active_balance_disabled.go", # keep
|
||||
"attestation_data.go",
|
||||
"balance_cache_key.go",
|
||||
"checkpoint_state.go",
|
||||
"committee.go",
|
||||
"committee_disabled.go", # keep
|
||||
@@ -70,6 +71,7 @@ go_test(
|
||||
"committee_fuzz_test.go",
|
||||
"committee_test.go",
|
||||
"payload_id_test.go",
|
||||
"private_access_test.go",
|
||||
"proposer_indices_test.go",
|
||||
"registration_test.go",
|
||||
"skip_slot_cache_test.go",
|
||||
@@ -93,6 +95,7 @@ go_test(
|
||||
"//testing/util:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_google_gofuzz//:go_default_library",
|
||||
"@com_github_hashicorp_golang_lru//:go_default_library",
|
||||
"@com_github_stretchr_testify//require:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
|
||||
37
beacon-chain/cache/active_balance.go
vendored
37
beacon-chain/cache/active_balance.go
vendored
@@ -3,17 +3,13 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"sync"
|
||||
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
||||
lruwrpr "github.com/prysmaticlabs/prysm/v5/cache/lru"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -86,36 +82,3 @@ func (c *BalanceCache) Get(st state.ReadOnlyBeaconState) (uint64, error) {
|
||||
balanceCacheHit.Inc()
|
||||
return value.(uint64), nil
|
||||
}
|
||||
|
||||
// Given input state `st`, balance key is constructed as:
|
||||
// (block_root in `st` at epoch_start_slot - 1) + current_epoch + validator_count
|
||||
func balanceCacheKey(st state.ReadOnlyBeaconState) (string, error) {
|
||||
slotsPerEpoch := params.BeaconConfig().SlotsPerEpoch
|
||||
currentEpoch := st.Slot().DivSlot(slotsPerEpoch)
|
||||
epochStartSlot, err := slotsPerEpoch.SafeMul(uint64(currentEpoch))
|
||||
if err != nil {
|
||||
// impossible condition due to early division
|
||||
return "", errors.Errorf("start slot calculation overflows: %v", err)
|
||||
}
|
||||
prevSlot := primitives.Slot(0)
|
||||
if epochStartSlot > 1 {
|
||||
prevSlot = epochStartSlot - 1
|
||||
}
|
||||
r, err := st.BlockRootAtIndex(uint64(prevSlot % params.BeaconConfig().SlotsPerHistoricalRoot))
|
||||
if err != nil {
|
||||
// impossible condition because index is always constrained within state
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Mix in current epoch
|
||||
b := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(b, uint64(currentEpoch))
|
||||
key := append(r, b...)
|
||||
|
||||
// Mix in validator count
|
||||
b = make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(b, uint64(st.NumValidators()))
|
||||
key = append(key, b...)
|
||||
|
||||
return string(key), nil
|
||||
}
|
||||
|
||||
31
beacon-chain/cache/active_balance_test.go
vendored
31
beacon-chain/cache/active_balance_test.go
vendored
@@ -1,12 +1,13 @@
|
||||
//go:build !fuzz
|
||||
|
||||
package cache
|
||||
package cache_test
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
|
||||
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
@@ -27,33 +28,33 @@ func TestBalanceCache_AddGetBalance(t *testing.T) {
|
||||
st, err := state_native.InitializeFromProtoPhase0(raw)
|
||||
require.NoError(t, err)
|
||||
|
||||
cache := NewEffectiveBalanceCache()
|
||||
_, err = cache.Get(st)
|
||||
require.ErrorContains(t, ErrNotFound.Error(), err)
|
||||
cc := cache.NewEffectiveBalanceCache()
|
||||
_, err = cc.Get(st)
|
||||
require.ErrorContains(t, cache.ErrNotFound.Error(), err)
|
||||
|
||||
b := uint64(100)
|
||||
require.NoError(t, cache.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err := cache.Get(st)
|
||||
require.NoError(t, cc.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err := cc.Get(st)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, b, cachedB)
|
||||
|
||||
require.NoError(t, st.SetSlot(1000))
|
||||
_, err = cache.Get(st)
|
||||
require.ErrorContains(t, ErrNotFound.Error(), err)
|
||||
_, err = cc.Get(st)
|
||||
require.ErrorContains(t, cache.ErrNotFound.Error(), err)
|
||||
|
||||
b = uint64(200)
|
||||
require.NoError(t, cache.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err = cache.Get(st)
|
||||
require.NoError(t, cc.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err = cc.Get(st)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, b, cachedB)
|
||||
|
||||
require.NoError(t, st.SetSlot(1000+params.BeaconConfig().SlotsPerHistoricalRoot))
|
||||
_, err = cache.Get(st)
|
||||
require.ErrorContains(t, ErrNotFound.Error(), err)
|
||||
_, err = cc.Get(st)
|
||||
require.ErrorContains(t, cache.ErrNotFound.Error(), err)
|
||||
|
||||
b = uint64(300)
|
||||
require.NoError(t, cache.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err = cache.Get(st)
|
||||
require.NoError(t, cc.AddTotalEffectiveBalance(st, b))
|
||||
cachedB, err = cc.Get(st)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, b, cachedB)
|
||||
}
|
||||
@@ -72,6 +73,6 @@ func TestBalanceCache_BalanceKey(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, st.SetSlot(primitives.Slot(math.MaxUint64)))
|
||||
|
||||
_, err = balanceCacheKey(st)
|
||||
_, err = cache.BalanceCacheKey(st)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
43
beacon-chain/cache/balance_cache_key.go
vendored
Normal file
43
beacon-chain/cache/balance_cache_key.go
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
)
|
||||
|
||||
// Given input state `st`, balance key is constructed as:
|
||||
// (block_root in `st` at epoch_start_slot - 1) + current_epoch + validator_count
|
||||
func balanceCacheKey(st state.ReadOnlyBeaconState) (string, error) {
|
||||
slotsPerEpoch := params.BeaconConfig().SlotsPerEpoch
|
||||
currentEpoch := st.Slot().DivSlot(slotsPerEpoch)
|
||||
epochStartSlot, err := slotsPerEpoch.SafeMul(uint64(currentEpoch))
|
||||
if err != nil {
|
||||
// impossible condition due to early division
|
||||
return "", fmt.Errorf("start slot calculation overflows: %w", err)
|
||||
}
|
||||
prevSlot := primitives.Slot(0)
|
||||
if epochStartSlot > 1 {
|
||||
prevSlot = epochStartSlot - 1
|
||||
}
|
||||
r, err := st.BlockRootAtIndex(uint64(prevSlot % params.BeaconConfig().SlotsPerHistoricalRoot))
|
||||
if err != nil {
|
||||
// impossible condition because index is always constrained within state
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Mix in current epoch
|
||||
b := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(b, uint64(currentEpoch))
|
||||
key := append(r, b...)
|
||||
|
||||
// Mix in validator count
|
||||
b = make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(b, uint64(st.NumValidators()))
|
||||
key = append(key, b...)
|
||||
|
||||
return string(key), nil
|
||||
}
|
||||
11
beacon-chain/cache/checkpoint_state_test.go
vendored
11
beacon-chain/cache/checkpoint_state_test.go
vendored
@@ -1,8 +1,9 @@
|
||||
package cache
|
||||
package cache_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
||||
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCheckpointStateCache_StateByCheckpoint(t *testing.T) {
|
||||
cache := NewCheckpointStateCache()
|
||||
cache := cache.NewCheckpointStateCache()
|
||||
|
||||
cp1 := ðpb.Checkpoint{Epoch: 1, Root: bytesutil.PadTo([]byte{'A'}, 32)}
|
||||
st, err := state_native.InitializeFromProtoPhase0(ðpb.BeaconState{
|
||||
@@ -58,16 +59,16 @@ func TestCheckpointStateCache_StateByCheckpoint(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckpointStateCache_MaxSize(t *testing.T) {
|
||||
c := NewCheckpointStateCache()
|
||||
c := cache.NewCheckpointStateCache()
|
||||
st, err := state_native.InitializeFromProtoPhase0(ðpb.BeaconState{
|
||||
Slot: 0,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := uint64(0); i < uint64(maxCheckpointStateSize+100); i++ {
|
||||
for i := uint64(0); i < uint64(cache.MaxCheckpointStateSize()+100); i++ {
|
||||
require.NoError(t, st.SetSlot(primitives.Slot(i)))
|
||||
require.NoError(t, c.AddCheckpointState(ðpb.Checkpoint{Epoch: primitives.Epoch(i), Root: make([]byte, 32)}, st))
|
||||
}
|
||||
|
||||
assert.Equal(t, maxCheckpointStateSize, len(c.cache.Keys()))
|
||||
assert.Equal(t, cache.MaxCheckpointStateSize(), len(c.Cache().Keys()))
|
||||
}
|
||||
|
||||
18
beacon-chain/cache/private_access_test.go
vendored
Normal file
18
beacon-chain/cache/private_access_test.go
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
||||
)
|
||||
|
||||
func BalanceCacheKey(st state.ReadOnlyBeaconState) (string, error) {
|
||||
return balanceCacheKey(st)
|
||||
}
|
||||
|
||||
func MaxCheckpointStateSize() int {
|
||||
return maxCheckpointStateSize
|
||||
}
|
||||
|
||||
func (c *CheckpointStateCache) Cache() *lru.Cache {
|
||||
return c.cache
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package cache
|
||||
package cache_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
||||
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
@@ -125,7 +126,7 @@ func TestSyncCommitteeHeadState(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := NewSyncCommitteeHeadState()
|
||||
c := cache.NewSyncCommitteeHeadState()
|
||||
if tt.put != nil {
|
||||
err := c.Put(tt.put.slot, tt.put.state)
|
||||
if (err != nil) != tt.wantPutErr {
|
||||
|
||||
@@ -250,12 +250,12 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
maxEffectiveBalance := params.BeaconConfig().MaxEffectiveBalance
|
||||
|
||||
type args struct {
|
||||
Name string
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
NextWithdrawalIndex uint64
|
||||
FullWithdrawalIndices []primitives.ValidatorIndex
|
||||
PartialWithdrawalIndices []primitives.ValidatorIndex
|
||||
Withdrawals []*enginev1.Withdrawal
|
||||
Name string
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
NextWithdrawalIndex uint64
|
||||
FullWithdrawalIndices []primitives.ValidatorIndex
|
||||
PendingPartialWithdrawalIndices []primitives.ValidatorIndex
|
||||
Withdrawals []*enginev1.Withdrawal
|
||||
}
|
||||
type control struct {
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
@@ -283,7 +283,7 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
Amount: withdrawalAmount(i),
|
||||
}
|
||||
}
|
||||
partialWithdrawal := func(i primitives.ValidatorIndex, idx uint64) *enginev1.Withdrawal {
|
||||
PendingPartialWithdrawal := func(i primitives.ValidatorIndex, idx uint64) *enginev1.Withdrawal {
|
||||
return &enginev1.Withdrawal{
|
||||
Index: idx,
|
||||
ValidatorIndex: i,
|
||||
@@ -321,12 +321,12 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success one partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 120,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Name: "success one partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 120,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 21),
|
||||
PendingPartialWithdrawal(7, 21),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -386,12 +386,12 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success many partial withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
Name: "success many partial withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 22), partialWithdrawal(19, 23), partialWithdrawal(28, 24),
|
||||
PendingPartialWithdrawal(7, 22), PendingPartialWithdrawal(19, 23), PendingPartialWithdrawal(28, 24),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -406,14 +406,14 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success many withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 88,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{2, 1, 89, 15},
|
||||
Name: "success many withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 88,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{2, 1, 89, 15},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(89, 22), partialWithdrawal(1, 23), partialWithdrawal(2, 24),
|
||||
fullWithdrawal(7, 25), partialWithdrawal(15, 26), fullWithdrawal(19, 27),
|
||||
PendingPartialWithdrawal(89, 22), PendingPartialWithdrawal(1, 23), PendingPartialWithdrawal(2, 24),
|
||||
fullWithdrawal(7, 25), PendingPartialWithdrawal(15, 26), fullWithdrawal(19, 27),
|
||||
fullWithdrawal(28, 28),
|
||||
},
|
||||
},
|
||||
@@ -453,17 +453,17 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success more than max partially withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 0,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89},
|
||||
Name: "success more than max partially withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 0,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(1, 22), partialWithdrawal(2, 23), partialWithdrawal(3, 24),
|
||||
partialWithdrawal(4, 25), partialWithdrawal(5, 26), partialWithdrawal(6, 27),
|
||||
partialWithdrawal(7, 28), partialWithdrawal(8, 29), partialWithdrawal(9, 30),
|
||||
partialWithdrawal(21, 31), partialWithdrawal(22, 32), partialWithdrawal(23, 33),
|
||||
partialWithdrawal(24, 34), partialWithdrawal(25, 35), partialWithdrawal(26, 36),
|
||||
partialWithdrawal(27, 37),
|
||||
PendingPartialWithdrawal(1, 22), PendingPartialWithdrawal(2, 23), PendingPartialWithdrawal(3, 24),
|
||||
PendingPartialWithdrawal(4, 25), PendingPartialWithdrawal(5, 26), PendingPartialWithdrawal(6, 27),
|
||||
PendingPartialWithdrawal(7, 28), PendingPartialWithdrawal(8, 29), PendingPartialWithdrawal(9, 30),
|
||||
PendingPartialWithdrawal(21, 31), PendingPartialWithdrawal(22, 32), PendingPartialWithdrawal(23, 33),
|
||||
PendingPartialWithdrawal(24, 34), PendingPartialWithdrawal(25, 35), PendingPartialWithdrawal(26, 36),
|
||||
PendingPartialWithdrawal(27, 37),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -491,12 +491,12 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "failure wrong number of partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 37,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Name: "failure wrong number of partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 37,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 21), partialWithdrawal(9, 22),
|
||||
PendingPartialWithdrawal(7, 21), PendingPartialWithdrawal(9, 22),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -540,7 +540,7 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28, 1},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
fullWithdrawal(7, 22), fullWithdrawal(19, 23), partialWithdrawal(28, 24),
|
||||
fullWithdrawal(7, 22), fullWithdrawal(19, 23), PendingPartialWithdrawal(28, 24),
|
||||
fullWithdrawal(1, 25),
|
||||
},
|
||||
},
|
||||
@@ -564,10 +564,10 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "failure validator not partially withdrawable",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{notPartiallyWithdrawable},
|
||||
Name: "failure validator not partially withdrawable",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{notPartiallyWithdrawable},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
fullWithdrawal(notPartiallyWithdrawable, 22),
|
||||
},
|
||||
@@ -611,7 +611,7 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
st.Balances[idx] = withdrawalAmount(idx)
|
||||
validators[idx].WithdrawalCredentials[0] = params.BeaconConfig().ETH1AddressWithdrawalPrefixByte
|
||||
}
|
||||
for _, idx := range arguments.PartialWithdrawalIndices {
|
||||
for _, idx := range arguments.PendingPartialWithdrawalIndices {
|
||||
validators[idx].WithdrawalCredentials[0] = params.BeaconConfig().ETH1AddressWithdrawalPrefixByte
|
||||
st.Balances[idx] = withdrawalAmount(idx)
|
||||
}
|
||||
@@ -629,8 +629,8 @@ func TestProcessBlindWithdrawals(t *testing.T) {
|
||||
if test.Args.FullWithdrawalIndices == nil {
|
||||
test.Args.FullWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
}
|
||||
if test.Args.PartialWithdrawalIndices == nil {
|
||||
test.Args.PartialWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
if test.Args.PendingPartialWithdrawalIndices == nil {
|
||||
test.Args.PendingPartialWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
}
|
||||
slot, err := slots.EpochStart(currentEpoch)
|
||||
require.NoError(t, err)
|
||||
@@ -673,12 +673,12 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
maxEffectiveBalance := params.BeaconConfig().MaxEffectiveBalance
|
||||
|
||||
type args struct {
|
||||
Name string
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
NextWithdrawalIndex uint64
|
||||
FullWithdrawalIndices []primitives.ValidatorIndex
|
||||
PartialWithdrawalIndices []primitives.ValidatorIndex
|
||||
Withdrawals []*enginev1.Withdrawal
|
||||
Name string
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
NextWithdrawalIndex uint64
|
||||
FullWithdrawalIndices []primitives.ValidatorIndex
|
||||
PendingPartialWithdrawalIndices []primitives.ValidatorIndex
|
||||
Withdrawals []*enginev1.Withdrawal
|
||||
}
|
||||
type control struct {
|
||||
NextWithdrawalValidatorIndex primitives.ValidatorIndex
|
||||
@@ -706,7 +706,7 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
Amount: withdrawalAmount(i),
|
||||
}
|
||||
}
|
||||
partialWithdrawal := func(i primitives.ValidatorIndex, idx uint64) *enginev1.Withdrawal {
|
||||
PendingPartialWithdrawal := func(i primitives.ValidatorIndex, idx uint64) *enginev1.Withdrawal {
|
||||
return &enginev1.Withdrawal{
|
||||
Index: idx,
|
||||
ValidatorIndex: i,
|
||||
@@ -744,12 +744,12 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success one partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 120,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Name: "success one partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 120,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 21),
|
||||
PendingPartialWithdrawal(7, 21),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -809,12 +809,12 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success many partial withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
Name: "success many partial withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 22), partialWithdrawal(19, 23), partialWithdrawal(28, 24),
|
||||
PendingPartialWithdrawal(7, 22), PendingPartialWithdrawal(19, 23), PendingPartialWithdrawal(28, 24),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -829,14 +829,14 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success many withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 88,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{2, 1, 89, 15},
|
||||
Name: "success many withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 88,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28},
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{2, 1, 89, 15},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(89, 22), partialWithdrawal(1, 23), partialWithdrawal(2, 24),
|
||||
fullWithdrawal(7, 25), partialWithdrawal(15, 26), fullWithdrawal(19, 27),
|
||||
PendingPartialWithdrawal(89, 22), PendingPartialWithdrawal(1, 23), PendingPartialWithdrawal(2, 24),
|
||||
fullWithdrawal(7, 25), PendingPartialWithdrawal(15, 26), fullWithdrawal(19, 27),
|
||||
fullWithdrawal(28, 28),
|
||||
},
|
||||
},
|
||||
@@ -876,17 +876,17 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "success more than max partially withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 0,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89},
|
||||
Name: "success more than max partially withdrawals",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 0,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 22, 23, 24, 25, 26, 27, 29, 35, 89},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(1, 22), partialWithdrawal(2, 23), partialWithdrawal(3, 24),
|
||||
partialWithdrawal(4, 25), partialWithdrawal(5, 26), partialWithdrawal(6, 27),
|
||||
partialWithdrawal(7, 28), partialWithdrawal(8, 29), partialWithdrawal(9, 30),
|
||||
partialWithdrawal(21, 31), partialWithdrawal(22, 32), partialWithdrawal(23, 33),
|
||||
partialWithdrawal(24, 34), partialWithdrawal(25, 35), partialWithdrawal(26, 36),
|
||||
partialWithdrawal(27, 37),
|
||||
PendingPartialWithdrawal(1, 22), PendingPartialWithdrawal(2, 23), PendingPartialWithdrawal(3, 24),
|
||||
PendingPartialWithdrawal(4, 25), PendingPartialWithdrawal(5, 26), PendingPartialWithdrawal(6, 27),
|
||||
PendingPartialWithdrawal(7, 28), PendingPartialWithdrawal(8, 29), PendingPartialWithdrawal(9, 30),
|
||||
PendingPartialWithdrawal(21, 31), PendingPartialWithdrawal(22, 32), PendingPartialWithdrawal(23, 33),
|
||||
PendingPartialWithdrawal(24, 34), PendingPartialWithdrawal(25, 35), PendingPartialWithdrawal(26, 36),
|
||||
PendingPartialWithdrawal(27, 37),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -914,12 +914,12 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "failure wrong number of partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 37,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Name: "failure wrong number of partial withdrawal",
|
||||
NextWithdrawalIndex: 21,
|
||||
NextWithdrawalValidatorIndex: 37,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{7},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
partialWithdrawal(7, 21), partialWithdrawal(9, 22),
|
||||
PendingPartialWithdrawal(7, 21), PendingPartialWithdrawal(9, 22),
|
||||
},
|
||||
},
|
||||
Control: control{
|
||||
@@ -963,7 +963,7 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
FullWithdrawalIndices: []primitives.ValidatorIndex{7, 19, 28, 1},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
fullWithdrawal(7, 22), fullWithdrawal(19, 23), partialWithdrawal(28, 24),
|
||||
fullWithdrawal(7, 22), fullWithdrawal(19, 23), PendingPartialWithdrawal(28, 24),
|
||||
fullWithdrawal(1, 25),
|
||||
},
|
||||
},
|
||||
@@ -987,10 +987,10 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: args{
|
||||
Name: "failure validator not partially withdrawable",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PartialWithdrawalIndices: []primitives.ValidatorIndex{notPartiallyWithdrawable},
|
||||
Name: "failure validator not partially withdrawable",
|
||||
NextWithdrawalIndex: 22,
|
||||
NextWithdrawalValidatorIndex: 4,
|
||||
PendingPartialWithdrawalIndices: []primitives.ValidatorIndex{notPartiallyWithdrawable},
|
||||
Withdrawals: []*enginev1.Withdrawal{
|
||||
fullWithdrawal(notPartiallyWithdrawable, 22),
|
||||
},
|
||||
@@ -1034,7 +1034,7 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
st.Balances[idx] = withdrawalAmount(idx)
|
||||
validators[idx].WithdrawalCredentials[0] = params.BeaconConfig().ETH1AddressWithdrawalPrefixByte
|
||||
}
|
||||
for _, idx := range arguments.PartialWithdrawalIndices {
|
||||
for _, idx := range arguments.PendingPartialWithdrawalIndices {
|
||||
validators[idx].WithdrawalCredentials[0] = params.BeaconConfig().ETH1AddressWithdrawalPrefixByte
|
||||
st.Balances[idx] = withdrawalAmount(idx)
|
||||
}
|
||||
@@ -1052,8 +1052,8 @@ func TestProcessWithdrawals(t *testing.T) {
|
||||
if test.Args.FullWithdrawalIndices == nil {
|
||||
test.Args.FullWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
}
|
||||
if test.Args.PartialWithdrawalIndices == nil {
|
||||
test.Args.PartialWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
if test.Args.PendingPartialWithdrawalIndices == nil {
|
||||
test.Args.PendingPartialWithdrawalIndices = make([]primitives.ValidatorIndex, 0)
|
||||
}
|
||||
slot, err := slots.EpochStart(currentEpoch)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -99,7 +99,7 @@ func ProcessRegistryUpdates(ctx context.Context, state state.BeaconState) (state
|
||||
activationEligibilityEpoch := time.CurrentEpoch(state) + 1
|
||||
for idx, validator := range vals {
|
||||
// Process the validators for activation eligibility.
|
||||
if helpers.IsEligibleForActivationQueue(validator) {
|
||||
if helpers.IsEligibleForActivationQueue(validator, currentEpoch) {
|
||||
validator.ActivationEligibilityEpoch = activationEligibilityEpoch
|
||||
if err := state.UpdateValidatorAtIndex(primitives.ValidatorIndex(idx), validator); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -12,6 +12,7 @@ go_library(
|
||||
"rewards_penalties.go",
|
||||
"shuffle.go",
|
||||
"sync_committee.go",
|
||||
"validator_churn.go",
|
||||
"validators.go",
|
||||
"weak_subjectivity.go",
|
||||
],
|
||||
@@ -56,6 +57,7 @@ go_test(
|
||||
"rewards_penalties_test.go",
|
||||
"shuffle_test.go",
|
||||
"sync_committee_test.go",
|
||||
"validator_churn_test.go",
|
||||
"validators_test.go",
|
||||
"weak_subjectivity_test.go",
|
||||
],
|
||||
|
||||
52
beacon-chain/core/helpers/validator_churn.go
Normal file
52
beacon-chain/core/helpers/validator_churn.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
)
|
||||
|
||||
// BalanceChurnLimit for the current active balance, in gwei.
|
||||
// New in Electra EIP-7251: https://eips.ethereum.org/EIPS/eip-7251
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def get_balance_churn_limit(state: BeaconState) -> Gwei:
|
||||
// """
|
||||
// Return the churn limit for the current epoch.
|
||||
// """
|
||||
// churn = max(
|
||||
// MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA,
|
||||
// get_total_active_balance(state) // CHURN_LIMIT_QUOTIENT
|
||||
// )
|
||||
// return churn - churn % EFFECTIVE_BALANCE_INCREMENT
|
||||
func BalanceChurnLimit(activeBalanceGwei uint64) uint64 {
|
||||
churn := max(
|
||||
params.BeaconConfig().MinPerEpochChurnLimitElectra,
|
||||
(activeBalanceGwei / params.BeaconConfig().ChurnLimitQuotient),
|
||||
)
|
||||
return churn - churn%params.BeaconConfig().EffectiveBalanceIncrement
|
||||
}
|
||||
|
||||
// ActivationExitChurnLimit for the current active balance, in gwei.
|
||||
// New in Electra EIP-7251: https://eips.ethereum.org/EIPS/eip-7251
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def get_activation_exit_churn_limit(state: BeaconState) -> Gwei:
|
||||
// """
|
||||
// Return the churn limit for the current epoch dedicated to activations and exits.
|
||||
// """
|
||||
// return min(MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT, get_balance_churn_limit(state))
|
||||
func ActivationExitChurnLimit(activeBalanceGwei uint64) uint64 {
|
||||
return min(params.BeaconConfig().MaxPerEpochActivationExitChurnLimit, BalanceChurnLimit(activeBalanceGwei))
|
||||
}
|
||||
|
||||
// ConsolidationChurnLimit for the current active balance, in gwei.
|
||||
// New in EIP-7251: https://eips.ethereum.org/EIPS/eip-7251
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def get_consolidation_churn_limit(state: BeaconState) -> Gwei:
|
||||
// return get_balance_churn_limit(state) - get_activation_exit_churn_limit(state)
|
||||
func ConsolidationChurnLimit(activeBalanceGwei uint64) uint64 {
|
||||
return BalanceChurnLimit(activeBalanceGwei) - ActivationExitChurnLimit(activeBalanceGwei)
|
||||
}
|
||||
71
beacon-chain/core/helpers/validator_churn_test.go
Normal file
71
beacon-chain/core/helpers/validator_churn_test.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package helpers_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
)
|
||||
|
||||
func TestBalanceChurnLimit(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
activeBalance uint64
|
||||
expected uint64
|
||||
}{
|
||||
{
|
||||
name: "less than MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA",
|
||||
activeBalance: 111,
|
||||
expected: params.BeaconConfig().MinPerEpochChurnLimitElectra,
|
||||
},
|
||||
{
|
||||
name: "modulo EFFECTIVE_BALANCE_INCREMENT",
|
||||
activeBalance: 111 + params.BeaconConfig().MinPerEpochChurnLimitElectra*params.BeaconConfig().ChurnLimitQuotient,
|
||||
expected: params.BeaconConfig().MinPerEpochChurnLimitElectra,
|
||||
},
|
||||
{
|
||||
name: "more than MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA",
|
||||
activeBalance: 2000 * params.BeaconConfig().EffectiveBalanceIncrement * params.BeaconConfig().ChurnLimitQuotient,
|
||||
expected: 2000 * params.BeaconConfig().EffectiveBalanceIncrement,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, helpers.BalanceChurnLimit(tt.activeBalance))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestActivationExitChurnLimit(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
activeBalance uint64
|
||||
expected uint64
|
||||
}{
|
||||
{
|
||||
name: "less than MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT",
|
||||
activeBalance: 1,
|
||||
expected: params.BeaconConfig().MinPerEpochChurnLimitElectra,
|
||||
},
|
||||
{
|
||||
name: "more than MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT",
|
||||
activeBalance: 2000 * params.BeaconConfig().EffectiveBalanceIncrement * params.BeaconConfig().ChurnLimitQuotient,
|
||||
expected: params.BeaconConfig().MaxPerEpochActivationExitChurnLimit,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.expected, helpers.ActivationExitChurnLimit(tt.activeBalance))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// FuzzConsolidationChurnLimit exercises BalanceChurnLimit and ActivationExitChurnLimit
|
||||
func FuzzConsolidationChurnLimit(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, activeBalance uint64) {
|
||||
helpers.ConsolidationChurnLimit(activeBalance)
|
||||
})
|
||||
}
|
||||
@@ -393,6 +393,24 @@ func ComputeProposerIndex(bState state.ReadOnlyValidators, activeIndices []primi
|
||||
// IsEligibleForActivationQueue checks if the validator is eligible to
|
||||
// be placed into the activation queue.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_eligible_for_activation_queue(validator: Validator) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` is eligible to be placed into the activation queue.
|
||||
// """
|
||||
// return (
|
||||
// validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||
// and validator.effective_balance >= MIN_ACTIVATION_BALANCE # [Modified in Electra:EIP7251]
|
||||
// )
|
||||
func IsEligibleForActivationQueue(validator *ethpb.Validator, currentEpoch primitives.Epoch) bool {
|
||||
if currentEpoch >= params.BeaconConfig().ElectraForkEpoch {
|
||||
return isEligibileForActivationQueueElectra(validator.ActivationEligibilityEpoch, validator.EffectiveBalance)
|
||||
}
|
||||
return isEligibileForActivationQueue(validator.ActivationEligibilityEpoch, validator.EffectiveBalance)
|
||||
}
|
||||
|
||||
// isEligibleForActivationQueue carries out the logic for IsEligibleForActivationQueue
|
||||
// Spec pseudocode definition:
|
||||
//
|
||||
// def is_eligible_for_activation_queue(validator: Validator) -> bool:
|
||||
@@ -403,22 +421,29 @@ func ComputeProposerIndex(bState state.ReadOnlyValidators, activeIndices []primi
|
||||
// validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||
// and validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||
// )
|
||||
func IsEligibleForActivationQueue(validator *ethpb.Validator) bool {
|
||||
return isEligibileForActivationQueue(validator.ActivationEligibilityEpoch, validator.EffectiveBalance)
|
||||
}
|
||||
|
||||
// IsEligibleForActivationQueueUsingTrie checks if the read-only validator is eligible to
|
||||
// be placed into the activation queue.
|
||||
func IsEligibleForActivationQueueUsingTrie(validator state.ReadOnlyValidator) bool {
|
||||
return isEligibileForActivationQueue(validator.ActivationEligibilityEpoch(), validator.EffectiveBalance())
|
||||
}
|
||||
|
||||
// isEligibleForActivationQueue carries out the logic for IsEligibleForActivationQueue*
|
||||
func isEligibileForActivationQueue(activationEligibilityEpoch primitives.Epoch, effectiveBalance uint64) bool {
|
||||
return activationEligibilityEpoch == params.BeaconConfig().FarFutureEpoch &&
|
||||
effectiveBalance == params.BeaconConfig().MaxEffectiveBalance
|
||||
}
|
||||
|
||||
// IsEligibleForActivationQueue checks if the validator is eligible to
|
||||
// be placed into the activation queue.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_eligible_for_activation_queue(validator: Validator) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` is eligible to be placed into the activation queue.
|
||||
// """
|
||||
// return (
|
||||
// validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH
|
||||
// and validator.effective_balance >= MIN_ACTIVATION_BALANCE # [Modified in Electra:EIP7251]
|
||||
// )
|
||||
func isEligibileForActivationQueueElectra(activationEligibilityEpoch primitives.Epoch, effectiveBalance uint64) bool {
|
||||
return activationEligibilityEpoch == params.BeaconConfig().FarFutureEpoch &&
|
||||
effectiveBalance >= params.BeaconConfig().MinActivationBalance
|
||||
}
|
||||
|
||||
// IsEligibleForActivation checks if the validator is eligible for activation.
|
||||
//
|
||||
// Spec pseudocode definition:
|
||||
@@ -471,3 +496,180 @@ func LastActivatedValidatorIndex(ctx context.Context, st state.ReadOnlyBeaconSta
|
||||
}
|
||||
return lastActivatedvalidatorIndex, nil
|
||||
}
|
||||
|
||||
// hasETH1WithdrawalCredential returns whether the validator has an ETH1
|
||||
// Withdrawal prefix. It assumes that the caller has a lock on the state
|
||||
func HasETH1WithdrawalCredential(val *ethpb.Validator) bool {
|
||||
if val == nil {
|
||||
return false
|
||||
}
|
||||
return isETH1WithdrawalCredential(val.WithdrawalCredentials)
|
||||
}
|
||||
|
||||
func isETH1WithdrawalCredential(creds []byte) bool {
|
||||
return bytes.HasPrefix(creds, []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte})
|
||||
}
|
||||
|
||||
// HasCompoundingWithdrawalCredential checks if the validator has a compounding withdrawal credential.
|
||||
// New in Electra EIP-7251: https://eips.ethereum.org/EIPS/eip-7251
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def has_compounding_withdrawal_credential(validator: Validator) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` has an 0x02 prefixed "compounding" withdrawal credential.
|
||||
// """
|
||||
// return is_compounding_withdrawal_credential(validator.withdrawal_credentials)
|
||||
func HasCompoundingWithdrawalCredential(v *ethpb.Validator) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
return isCompoundingWithdrawalCredential(v.WithdrawalCredentials)
|
||||
}
|
||||
|
||||
// isCompoundingWithdrawalCredential checks if the credentials are a compounding withdrawal credential.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_compounding_withdrawal_credential(withdrawal_credentials: Bytes32) -> bool:
|
||||
// return withdrawal_credentials[:1] == COMPOUNDING_WITHDRAWAL_PREFIX
|
||||
func isCompoundingWithdrawalCredential(creds []byte) bool {
|
||||
return bytes.HasPrefix(creds, []byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte})
|
||||
}
|
||||
|
||||
// HasExecutionWithdrawalCredentials checks if the validator has an execution withdrawal credential or compounding credential.
|
||||
// New in Electra EIP-7251: https://eips.ethereum.org/EIPS/eip-7251
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def has_execution_withdrawal_credential(validator: Validator) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` has a 0x01 or 0x02 prefixed withdrawal credential.
|
||||
// """
|
||||
// return has_compounding_withdrawal_credential(validator) or has_eth1_withdrawal_credential(validator)
|
||||
func HasExecutionWithdrawalCredentials(v *ethpb.Validator) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
return HasCompoundingWithdrawalCredential(v) || HasETH1WithdrawalCredential(v)
|
||||
}
|
||||
|
||||
// IsSameWithdrawalCredentials returns true if both validators have the same withdrawal credentials.
|
||||
//
|
||||
// return a.withdrawal_credentials[12:] == b.withdrawal_credentials[12:]
|
||||
func IsSameWithdrawalCredentials(a, b *ethpb.Validator) bool {
|
||||
if a == nil || b == nil {
|
||||
return false
|
||||
}
|
||||
if len(a.WithdrawalCredentials) <= 12 || len(b.WithdrawalCredentials) <= 12 {
|
||||
return false
|
||||
}
|
||||
return bytes.Equal(a.WithdrawalCredentials[12:], b.WithdrawalCredentials[12:])
|
||||
}
|
||||
|
||||
// IsFullyWithdrawableValidator returns whether the validator is able to perform a full
|
||||
// withdrawal. This function assumes that the caller holds a lock on the state.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_fully_withdrawable_validator(validator: Validator, balance: Gwei, epoch: Epoch) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` is fully withdrawable.
|
||||
// """
|
||||
// return (
|
||||
// has_execution_withdrawal_credential(validator) # [Modified in Electra:EIP7251]
|
||||
// and validator.withdrawable_epoch <= epoch
|
||||
// and balance > 0
|
||||
// )
|
||||
func IsFullyWithdrawableValidator(val *ethpb.Validator, balance uint64, epoch primitives.Epoch) bool {
|
||||
if val == nil || balance <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
// Electra / EIP-7251 logic
|
||||
if epoch >= params.BeaconConfig().ElectraForkEpoch {
|
||||
return HasExecutionWithdrawalCredentials(val) && val.WithdrawableEpoch <= epoch
|
||||
}
|
||||
|
||||
return HasETH1WithdrawalCredential(val) && val.WithdrawableEpoch <= epoch
|
||||
}
|
||||
|
||||
// IsPartiallyWithdrawableValidator returns whether the validator is able to perform a
|
||||
// partial withdrawal. This function assumes that the caller has a lock on the state.
|
||||
// This method conditionally calls the fork appropriate implementation based on the epoch argument.
|
||||
func IsPartiallyWithdrawableValidator(val *ethpb.Validator, balance uint64, epoch primitives.Epoch) bool {
|
||||
if val == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if epoch < params.BeaconConfig().ElectraForkEpoch {
|
||||
return isPartiallyWithdrawableValidatorCapella(val, balance, epoch)
|
||||
}
|
||||
|
||||
return isPartiallyWithdrawableValidatorElectra(val, balance, epoch)
|
||||
}
|
||||
|
||||
// isPartiallyWithdrawableValidatorElectra implements is_partially_withdrawable_validator in the
|
||||
// electra fork.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_partially_withdrawable_validator(validator: Validator, balance: Gwei) -> bool:
|
||||
//
|
||||
// """
|
||||
// Check if ``validator`` is partially withdrawable.
|
||||
// """
|
||||
// max_effective_balance = get_validator_max_effective_balance(validator)
|
||||
// has_max_effective_balance = validator.effective_balance == max_effective_balance # [Modified in Electra:EIP7251]
|
||||
// has_excess_balance = balance > max_effective_balance # [Modified in Electra:EIP7251]
|
||||
// return (
|
||||
// has_execution_withdrawal_credential(validator) # [Modified in Electra:EIP7251]
|
||||
// and has_max_effective_balance
|
||||
// and has_excess_balance
|
||||
// )
|
||||
func isPartiallyWithdrawableValidatorElectra(val *ethpb.Validator, balance uint64, epoch primitives.Epoch) bool {
|
||||
maxEB := ValidatorMaxEffectiveBalance(val)
|
||||
hasMaxBalance := val.EffectiveBalance == maxEB
|
||||
hasExcessBalance := balance > maxEB
|
||||
|
||||
return HasExecutionWithdrawalCredentials(val) &&
|
||||
hasMaxBalance &&
|
||||
hasExcessBalance
|
||||
}
|
||||
|
||||
// isPartiallyWithdrawableValidatorCapella implements is_partially_withdrawable_validator in the
|
||||
// capella fork.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def is_partially_withdrawable_validator(validator: Validator, balance: Gwei) -> bool:
|
||||
// """
|
||||
// Check if ``validator`` is partially withdrawable.
|
||||
// """
|
||||
// has_max_effective_balance = validator.effective_balance == MAX_EFFECTIVE_BALANCE
|
||||
// has_excess_balance = balance > MAX_EFFECTIVE_BALANCE
|
||||
// return has_eth1_withdrawal_credential(validator) and has_max_effective_balance and has_excess_balance
|
||||
func isPartiallyWithdrawableValidatorCapella(val *ethpb.Validator, balance uint64, epoch primitives.Epoch) bool {
|
||||
hasMaxBalance := val.EffectiveBalance == params.BeaconConfig().MaxEffectiveBalance
|
||||
hasExcessBalance := balance > params.BeaconConfig().MaxEffectiveBalance
|
||||
return HasETH1WithdrawalCredential(val) && hasExcessBalance && hasMaxBalance
|
||||
}
|
||||
|
||||
// ValidatorMaxEffectiveBalance returns the maximum effective balance for a validator.
|
||||
//
|
||||
// Spec definition:
|
||||
//
|
||||
// def get_validator_max_effective_balance(validator: Validator) -> Gwei:
|
||||
// """
|
||||
// Get max effective balance for ``validator``.
|
||||
// """
|
||||
// if has_compounding_withdrawal_credential(validator):
|
||||
// return MAX_EFFECTIVE_BALANCE_ELECTRA
|
||||
// else:
|
||||
// return MIN_ACTIVATION_BALANCE
|
||||
func ValidatorMaxEffectiveBalance(val *ethpb.Validator) uint64 {
|
||||
if HasCompoundingWithdrawalCredential(val) {
|
||||
return params.BeaconConfig().MaxEffectiveBalanceElectra
|
||||
}
|
||||
return params.BeaconConfig().MinActivationBalance
|
||||
}
|
||||
|
||||
@@ -703,25 +703,47 @@ func TestComputeProposerIndex(t *testing.T) {
|
||||
|
||||
func TestIsEligibleForActivationQueue(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
want bool
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
currentEpoch primitives.Epoch
|
||||
want bool
|
||||
}{
|
||||
{"Eligible",
|
||||
ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance},
|
||||
true},
|
||||
{"Incorrect activation eligibility epoch",
|
||||
ðpb.Validator{ActivationEligibilityEpoch: 1, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance},
|
||||
false},
|
||||
{"Not enough balance",
|
||||
ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: 1},
|
||||
false},
|
||||
{
|
||||
name: "Eligible",
|
||||
validator: ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance},
|
||||
currentEpoch: primitives.Epoch(params.BeaconConfig().ElectraForkEpoch - 1),
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Incorrect activation eligibility epoch",
|
||||
validator: ðpb.Validator{ActivationEligibilityEpoch: 1, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance},
|
||||
currentEpoch: primitives.Epoch(params.BeaconConfig().ElectraForkEpoch - 1),
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Not enough balance",
|
||||
validator: ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: 1},
|
||||
currentEpoch: primitives.Epoch(params.BeaconConfig().ElectraForkEpoch - 1),
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "More than max effective balance before electra",
|
||||
validator: ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance + 1},
|
||||
currentEpoch: primitives.Epoch(params.BeaconConfig().ElectraForkEpoch - 1),
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "More than min activation balance after electra",
|
||||
validator: ðpb.Validator{ActivationEligibilityEpoch: params.BeaconConfig().FarFutureEpoch, EffectiveBalance: params.BeaconConfig().MinActivationBalance + 1},
|
||||
currentEpoch: primitives.Epoch(params.BeaconConfig().ElectraForkEpoch),
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
helpers.ClearCache()
|
||||
|
||||
assert.Equal(t, tt.want, helpers.IsEligibleForActivationQueue(tt.validator), "IsEligibleForActivationQueue()")
|
||||
assert.Equal(t, tt.want, helpers.IsEligibleForActivationQueue(tt.validator, tt.currentEpoch), "IsEligibleForActivationQueue()")
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -828,3 +850,272 @@ func TestProposerIndexFromCheckpoint(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ids[5], id)
|
||||
}
|
||||
|
||||
func TestHasETH1WithdrawalCredentials(t *testing.T) {
|
||||
creds := []byte{0xFA, 0xCC}
|
||||
v := ðpb.Validator{WithdrawalCredentials: creds}
|
||||
require.Equal(t, false, helpers.HasETH1WithdrawalCredential(v))
|
||||
creds = []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC}
|
||||
v = ðpb.Validator{WithdrawalCredentials: creds}
|
||||
require.Equal(t, true, helpers.HasETH1WithdrawalCredential(v))
|
||||
// No Withdrawal cred
|
||||
v = ðpb.Validator{}
|
||||
require.Equal(t, false, helpers.HasETH1WithdrawalCredential(v))
|
||||
}
|
||||
|
||||
func TestHasCompoundingWithdrawalCredential(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
want bool
|
||||
}{
|
||||
{"Has compounding withdrawal credential",
|
||||
ðpb.Validator{WithdrawalCredentials: bytesutil.PadTo([]byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte}, 32)},
|
||||
true},
|
||||
{"Does not have compounding withdrawal credential",
|
||||
ðpb.Validator{WithdrawalCredentials: bytesutil.PadTo([]byte{0x00}, 32)},
|
||||
false},
|
||||
{"Handles nil case", nil, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.HasCompoundingWithdrawalCredential(tt.validator))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHasExecutionWithdrawalCredentials(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
want bool
|
||||
}{
|
||||
{"Has compounding withdrawal credential",
|
||||
ðpb.Validator{WithdrawalCredentials: bytesutil.PadTo([]byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte}, 32)},
|
||||
true},
|
||||
{"Has eth1 withdrawal credential",
|
||||
ðpb.Validator{WithdrawalCredentials: bytesutil.PadTo([]byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte}, 32)},
|
||||
true},
|
||||
{"Does not have compounding withdrawal credential or eth1 withdrawal credential",
|
||||
ðpb.Validator{WithdrawalCredentials: bytesutil.PadTo([]byte{0x00}, 32)},
|
||||
false},
|
||||
{"Handles nil case", nil, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.HasExecutionWithdrawalCredentials(tt.validator))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsFullyWithdrawableValidator(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
balance uint64
|
||||
epoch primitives.Epoch
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "Handles nil case",
|
||||
validator: nil,
|
||||
balance: 0,
|
||||
epoch: 0,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "No ETH1 prefix",
|
||||
validator: ðpb.Validator{
|
||||
WithdrawalCredentials: []byte{0xFA, 0xCC},
|
||||
WithdrawableEpoch: 2,
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
epoch: 3,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Wrong withdrawable epoch",
|
||||
validator: ðpb.Validator{
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
WithdrawableEpoch: 2,
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
epoch: 1,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "No balance",
|
||||
validator: ðpb.Validator{
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
WithdrawableEpoch: 2,
|
||||
},
|
||||
balance: 0,
|
||||
epoch: 3,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Fully withdrawable",
|
||||
validator: ðpb.Validator{
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
WithdrawableEpoch: 2,
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
epoch: 3,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Fully withdrawable compounding validator electra",
|
||||
validator: ðpb.Validator{
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte, 0xCC},
|
||||
WithdrawableEpoch: 2,
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
epoch: params.BeaconConfig().ElectraForkEpoch,
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.IsFullyWithdrawableValidator(tt.validator, tt.balance, tt.epoch))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsPartiallyWithdrawableValidator(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
balance uint64
|
||||
epoch primitives.Epoch
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "Handles nil case",
|
||||
validator: nil,
|
||||
balance: 0,
|
||||
epoch: 0,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "No ETH1 prefix",
|
||||
validator: ðpb.Validator{
|
||||
EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
WithdrawalCredentials: []byte{0xFA, 0xCC},
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
epoch: 3,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "No balance",
|
||||
validator: ðpb.Validator{
|
||||
EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
},
|
||||
balance: 0,
|
||||
epoch: 3,
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Partially withdrawable",
|
||||
validator: ðpb.Validator{
|
||||
EffectiveBalance: params.BeaconConfig().MaxEffectiveBalance,
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalance * 2,
|
||||
epoch: 3,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Fully withdrawable vanilla validator electra",
|
||||
validator: ðpb.Validator{
|
||||
EffectiveBalance: params.BeaconConfig().MinActivationBalance,
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC},
|
||||
},
|
||||
balance: params.BeaconConfig().MinActivationBalance * 2,
|
||||
epoch: params.BeaconConfig().ElectraForkEpoch,
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Fully withdrawable compounding validator electra",
|
||||
validator: ðpb.Validator{
|
||||
EffectiveBalance: params.BeaconConfig().MaxEffectiveBalanceElectra,
|
||||
WithdrawalCredentials: []byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte, 0xCC},
|
||||
},
|
||||
balance: params.BeaconConfig().MaxEffectiveBalanceElectra * 2,
|
||||
epoch: params.BeaconConfig().ElectraForkEpoch,
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.IsPartiallyWithdrawableValidator(tt.validator, tt.balance, tt.epoch))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSameWithdrawalCredentials(t *testing.T) {
|
||||
makeWithdrawalCredentials := func(address []byte) []byte {
|
||||
b := make([]byte, 12)
|
||||
return append(b, address...)
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
a *ethpb.Validator
|
||||
b *ethpb.Validator
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
"Same credentials",
|
||||
ðpb.Validator{WithdrawalCredentials: makeWithdrawalCredentials([]byte("same"))},
|
||||
ðpb.Validator{WithdrawalCredentials: makeWithdrawalCredentials([]byte("same"))},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"Different credentials",
|
||||
ðpb.Validator{WithdrawalCredentials: makeWithdrawalCredentials([]byte("foo"))},
|
||||
ðpb.Validator{WithdrawalCredentials: makeWithdrawalCredentials([]byte("bar"))},
|
||||
false,
|
||||
},
|
||||
{"Handles nil case", nil, nil, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.IsSameWithdrawalCredentials(tt.a, tt.b))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidatorMaxEffectiveBalance(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
validator *ethpb.Validator
|
||||
want uint64
|
||||
}{
|
||||
{
|
||||
name: "Compounding withdrawal credential",
|
||||
validator: ðpb.Validator{WithdrawalCredentials: []byte{params.BeaconConfig().CompoundingWithdrawalPrefixByte, 0xCC}},
|
||||
want: params.BeaconConfig().MaxEffectiveBalanceElectra,
|
||||
},
|
||||
{
|
||||
name: "Vanilla credentials",
|
||||
validator: ðpb.Validator{WithdrawalCredentials: []byte{params.BeaconConfig().ETH1AddressWithdrawalPrefixByte, 0xCC}},
|
||||
want: params.BeaconConfig().MinActivationBalance,
|
||||
},
|
||||
{
|
||||
"Handles nil case",
|
||||
nil,
|
||||
params.BeaconConfig().MinActivationBalance,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert.Equal(t, tt.want, helpers.ValidatorMaxEffectiveBalance(tt.validator))
|
||||
})
|
||||
}
|
||||
// Sanity check that MinActivationBalance equals (pre-electra) MaxEffectiveBalance
|
||||
assert.Equal(t, params.BeaconConfig().MinActivationBalance, params.BeaconConfig().MaxEffectiveBalance)
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ go_library(
|
||||
"//config/params:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//io/file:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/logging:go_default_library",
|
||||
"//time/slots:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
|
||||
@@ -10,11 +10,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/verification"
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/io/file"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/logging"
|
||||
@@ -27,6 +29,7 @@ var (
|
||||
errEmptyBlobWritten = errors.New("zero bytes written to disk when saving blob sidecar")
|
||||
errSidecarEmptySSZData = errors.New("sidecar marshalled to an empty ssz byte slice")
|
||||
errNoBasePath = errors.New("BlobStorage base path not specified in init")
|
||||
errInvalidRootString = errors.New("Could not parse hex string as a [32]byte")
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -333,3 +336,11 @@ func (p blobNamer) path() string {
|
||||
func rootString(root [32]byte) string {
|
||||
return fmt.Sprintf("%#x", root)
|
||||
}
|
||||
|
||||
func stringToRoot(str string) ([32]byte, error) {
|
||||
slice, err := hexutil.Decode(str)
|
||||
if err != nil {
|
||||
return [32]byte{}, errors.Wrapf(errInvalidRootString, "input=%s", str)
|
||||
}
|
||||
return bytesutil.ToBytes32(slice), nil
|
||||
}
|
||||
|
||||
@@ -48,27 +48,26 @@ type BlobStorageSummarizer interface {
|
||||
type blobStorageCache struct {
|
||||
mu sync.RWMutex
|
||||
nBlobs float64
|
||||
cache map[string]BlobStorageSummary
|
||||
cache map[[32]byte]BlobStorageSummary
|
||||
}
|
||||
|
||||
var _ BlobStorageSummarizer = &blobStorageCache{}
|
||||
|
||||
func newBlobStorageCache() *blobStorageCache {
|
||||
return &blobStorageCache{
|
||||
cache: make(map[string]BlobStorageSummary, params.BeaconConfig().MinEpochsForBlobsSidecarsRequest*fieldparams.SlotsPerEpoch),
|
||||
cache: make(map[[32]byte]BlobStorageSummary, params.BeaconConfig().MinEpochsForBlobsSidecarsRequest*fieldparams.SlotsPerEpoch),
|
||||
}
|
||||
}
|
||||
|
||||
// Summary returns the BlobStorageSummary for `root`. The BlobStorageSummary can be used to check for the presence of
|
||||
// BlobSidecars based on Index.
|
||||
func (s *blobStorageCache) Summary(root [32]byte) BlobStorageSummary {
|
||||
k := rootString(root)
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
return s.cache[k]
|
||||
return s.cache[root]
|
||||
}
|
||||
|
||||
func (s *blobStorageCache) ensure(key string, slot primitives.Slot, idx uint64) error {
|
||||
func (s *blobStorageCache) ensure(key [32]byte, slot primitives.Slot, idx uint64) error {
|
||||
if idx >= fieldparams.MaxBlobsPerBlock {
|
||||
return errIndexOutOfBounds
|
||||
}
|
||||
@@ -84,7 +83,7 @@ func (s *blobStorageCache) ensure(key string, slot primitives.Slot, idx uint64)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *blobStorageCache) slot(key string) (primitives.Slot, bool) {
|
||||
func (s *blobStorageCache) slot(key [32]byte) (primitives.Slot, bool) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
v, ok := s.cache[key]
|
||||
@@ -94,7 +93,7 @@ func (s *blobStorageCache) slot(key string) (primitives.Slot, bool) {
|
||||
return v.slot, ok
|
||||
}
|
||||
|
||||
func (s *blobStorageCache) evict(key string) {
|
||||
func (s *blobStorageCache) evict(key [32]byte) {
|
||||
var deleted float64
|
||||
s.mu.Lock()
|
||||
v, ok := s.cache[key]
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestSlotByRoot_Summary(t *testing.T) {
|
||||
sc := newBlobStorageCache()
|
||||
for _, c := range cases {
|
||||
if c.expected != nil {
|
||||
key := rootString(bytesutil.ToBytes32([]byte(c.name)))
|
||||
key := bytesutil.ToBytes32([]byte(c.name))
|
||||
sc.cache[key] = BlobStorageSummary{slot: 0, mask: *c.expected}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func NewMockBlobStorageSummarizer(t *testing.T, set map[[32]byte][]int) BlobStor
|
||||
c := newBlobStorageCache()
|
||||
for k, v := range set {
|
||||
for i := range v {
|
||||
if err := c.ensure(rootString(k), 0, uint64(v[i])); err != nil {
|
||||
if err := c.ensure(k, 0, uint64(v[i])); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func newBlobPruner(fs afero.Fs, retain primitives.Epoch, opts ...prunerOpt) (*bl
|
||||
// notify updates the pruner's view of root->blob mappings. This allows the pruner to build a cache
|
||||
// of root->slot mappings and decide when to evict old blobs based on the age of present blobs.
|
||||
func (p *blobPruner) notify(root [32]byte, latest primitives.Slot, idx uint64) error {
|
||||
if err := p.cache.ensure(rootString(root), latest, idx); err != nil {
|
||||
if err := p.cache.ensure(root, latest, idx); err != nil {
|
||||
return err
|
||||
}
|
||||
pruned := uint64(windowMin(latest, p.windowSize))
|
||||
@@ -160,7 +160,10 @@ func shouldRetain(slot, pruneBefore primitives.Slot) bool {
|
||||
}
|
||||
|
||||
func (p *blobPruner) tryPruneDir(dir string, pruneBefore primitives.Slot) (int, error) {
|
||||
root := rootFromDir(dir)
|
||||
root, err := rootFromDir(dir)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "invalid directory, could not parse subdir as root %s", dir)
|
||||
}
|
||||
slot, slotCached := p.cache.slot(root)
|
||||
// Return early if the slot is cached and doesn't need pruning.
|
||||
if slotCached && shouldRetain(slot, pruneBefore) {
|
||||
@@ -218,7 +221,7 @@ func (p *blobPruner) tryPruneDir(dir string, pruneBefore primitives.Slot) (int,
|
||||
return removed, errors.Wrapf(err, "unable to remove blob directory %s", dir)
|
||||
}
|
||||
|
||||
p.cache.evict(rootFromDir(dir))
|
||||
p.cache.evict(root)
|
||||
return len(scFiles), nil
|
||||
}
|
||||
|
||||
@@ -235,8 +238,13 @@ func idxFromPath(fname string) (uint64, error) {
|
||||
return strconv.ParseUint(parts[0], 10, 64)
|
||||
}
|
||||
|
||||
func rootFromDir(dir string) string {
|
||||
return filepath.Base(dir) // end of the path should be the blob directory, named by hex encoding of root
|
||||
func rootFromDir(dir string) ([32]byte, error) {
|
||||
subdir := filepath.Base(dir) // end of the path should be the blob directory, named by hex encoding of root
|
||||
root, err := stringToRoot(subdir)
|
||||
if err != nil {
|
||||
return root, errors.Wrapf(err, "invalid directory, could not parse subdir as root %s", dir)
|
||||
}
|
||||
return root, nil
|
||||
}
|
||||
|
||||
// Read slot from marshaled BlobSidecar data in the given file. See slotFromBlob for details.
|
||||
|
||||
@@ -25,11 +25,11 @@ func TestTryPruneDir_CachedNotExpired(t *testing.T) {
|
||||
_, sidecars := util.GenerateTestDenebBlockWithSidecar(t, [32]byte{}, slot, fieldparams.MaxBlobsPerBlock)
|
||||
sc, err := verification.BlobSidecarNoop(sidecars[0])
|
||||
require.NoError(t, err)
|
||||
root := fmt.Sprintf("%#x", sc.BlockRoot())
|
||||
rootStr := rootString(sc.BlockRoot())
|
||||
// This slot is right on the edge of what would need to be pruned, so by adding it to the cache and
|
||||
// skipping any other test setup, we can be certain the hot cache path never touches the filesystem.
|
||||
require.NoError(t, pr.cache.ensure(root, sc.Slot(), 0))
|
||||
pruned, err := pr.tryPruneDir(root, pr.windowSize)
|
||||
require.NoError(t, pr.cache.ensure(sc.BlockRoot(), sc.Slot(), 0))
|
||||
pruned, err := pr.tryPruneDir(rootStr, pr.windowSize)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 0, pruned)
|
||||
}
|
||||
@@ -43,10 +43,10 @@ func TestTryPruneDir_CachedExpired(t *testing.T) {
|
||||
_, sidecars := util.GenerateTestDenebBlockWithSidecar(t, [32]byte{}, slot, 1)
|
||||
sc, err := verification.BlobSidecarNoop(sidecars[0])
|
||||
require.NoError(t, err)
|
||||
root := fmt.Sprintf("%#x", sc.BlockRoot())
|
||||
require.NoError(t, fs.Mkdir(root, directoryPermissions)) // make empty directory
|
||||
require.NoError(t, pr.cache.ensure(root, sc.Slot(), 0))
|
||||
pruned, err := pr.tryPruneDir(root, slot+1)
|
||||
rootStr := rootString(sc.BlockRoot())
|
||||
require.NoError(t, fs.Mkdir(rootStr, directoryPermissions)) // make empty directory
|
||||
require.NoError(t, pr.cache.ensure(sc.BlockRoot(), sc.Slot(), 0))
|
||||
pruned, err := pr.tryPruneDir(rootStr, slot+1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 0, pruned)
|
||||
})
|
||||
@@ -61,20 +61,21 @@ func TestTryPruneDir_CachedExpired(t *testing.T) {
|
||||
require.NoError(t, bs.Save(scs[1]))
|
||||
|
||||
// check that the root->slot is cached
|
||||
root := fmt.Sprintf("%#x", scs[0].BlockRoot())
|
||||
cs, cok := bs.pruner.cache.slot(root)
|
||||
root := scs[0].BlockRoot()
|
||||
rootStr := rootString(root)
|
||||
cs, cok := bs.pruner.cache.slot(scs[0].BlockRoot())
|
||||
require.Equal(t, true, cok)
|
||||
require.Equal(t, slot, cs)
|
||||
|
||||
// ensure that we see the saved files in the filesystem
|
||||
files, err := listDir(fs, root)
|
||||
files, err := listDir(fs, rootStr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(files))
|
||||
|
||||
pruned, err := bs.pruner.tryPruneDir(root, slot+1)
|
||||
pruned, err := bs.pruner.tryPruneDir(rootStr, slot+1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, pruned)
|
||||
files, err = listDir(fs, root)
|
||||
files, err = listDir(fs, rootStr)
|
||||
require.ErrorIs(t, err, os.ErrNotExist)
|
||||
require.Equal(t, 0, len(files))
|
||||
})
|
||||
@@ -92,7 +93,8 @@ func TestTryPruneDir_SlotFromFile(t *testing.T) {
|
||||
require.NoError(t, bs.Save(scs[1]))
|
||||
|
||||
// check that the root->slot is cached
|
||||
root := fmt.Sprintf("%#x", scs[0].BlockRoot())
|
||||
root := scs[0].BlockRoot()
|
||||
rootStr := rootString(root)
|
||||
cs, ok := bs.pruner.cache.slot(root)
|
||||
require.Equal(t, true, ok)
|
||||
require.Equal(t, slot, cs)
|
||||
@@ -102,14 +104,14 @@ func TestTryPruneDir_SlotFromFile(t *testing.T) {
|
||||
require.Equal(t, false, ok)
|
||||
|
||||
// ensure that we see the saved files in the filesystem
|
||||
files, err := listDir(fs, root)
|
||||
files, err := listDir(fs, rootStr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(files))
|
||||
|
||||
pruned, err := bs.pruner.tryPruneDir(root, slot+1)
|
||||
pruned, err := bs.pruner.tryPruneDir(rootStr, slot+1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, pruned)
|
||||
files, err = listDir(fs, root)
|
||||
files, err = listDir(fs, rootStr)
|
||||
require.ErrorIs(t, err, os.ErrNotExist)
|
||||
require.Equal(t, 0, len(files))
|
||||
})
|
||||
@@ -125,24 +127,25 @@ func TestTryPruneDir_SlotFromFile(t *testing.T) {
|
||||
require.NoError(t, bs.Save(scs[1]))
|
||||
|
||||
// Evict slot mapping from the cache so that we trigger the file read path.
|
||||
root := fmt.Sprintf("%#x", scs[0].BlockRoot())
|
||||
root := scs[0].BlockRoot()
|
||||
rootStr := rootString(root)
|
||||
bs.pruner.cache.evict(root)
|
||||
_, ok := bs.pruner.cache.slot(root)
|
||||
require.Equal(t, false, ok)
|
||||
|
||||
// Ensure that we see the saved files in the filesystem.
|
||||
files, err := listDir(fs, root)
|
||||
files, err := listDir(fs, rootStr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(files))
|
||||
|
||||
// This should use the slotFromFile code (simulating restart).
|
||||
// Setting pruneBefore == slot, so that the slot will be outside the window (at the boundary).
|
||||
pruned, err := bs.pruner.tryPruneDir(root, slot)
|
||||
pruned, err := bs.pruner.tryPruneDir(rootStr, slot)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 0, pruned)
|
||||
|
||||
// Ensure files are still present.
|
||||
files, err = listDir(fs, root)
|
||||
files, err = listDir(fs, rootStr)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(files))
|
||||
})
|
||||
@@ -316,3 +319,45 @@ func TestListDir(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootFromDir(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
dir string
|
||||
err error
|
||||
root [32]byte
|
||||
}{
|
||||
{
|
||||
name: "happy path",
|
||||
dir: "0xffff875e1d985c5ccb214894983f2428edb271f0f87b68ba7010e4a99df3b5cb",
|
||||
root: [32]byte{255, 255, 135, 94, 29, 152, 92, 92, 203, 33, 72, 148, 152, 63, 36, 40,
|
||||
237, 178, 113, 240, 248, 123, 104, 186, 112, 16, 228, 169, 157, 243, 181, 203},
|
||||
},
|
||||
{
|
||||
name: "too short",
|
||||
dir: "0xffff875e1d985c5ccb214894983f2428edb271f0f87b68ba7010e4a99df3b5c",
|
||||
err: errInvalidRootString,
|
||||
},
|
||||
{
|
||||
name: "too log",
|
||||
dir: "0xffff875e1d985c5ccb214894983f2428edb271f0f87b68ba7010e4a99df3b5cbb",
|
||||
err: errInvalidRootString,
|
||||
},
|
||||
{
|
||||
name: "missing prefix",
|
||||
dir: "ffff875e1d985c5ccb214894983f2428edb271f0f87b68ba7010e4a99df3b5cb",
|
||||
err: errInvalidRootString,
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
root, err := stringToRoot(c.dir)
|
||||
if c.err != nil {
|
||||
require.ErrorIs(t, err, c.err)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, c.root, root)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ go_library(
|
||||
"@com_github_ethereum_go_ethereum//common/hexutil:go_default_library",
|
||||
"@com_github_gorilla_mux//:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
],
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
ssz "github.com/prysmaticlabs/fastssz"
|
||||
"github.com/prysmaticlabs/prysm/v5/api"
|
||||
"github.com/prysmaticlabs/prysm/v5/api/server/structs"
|
||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache/depositsnapshot"
|
||||
@@ -46,6 +47,7 @@ const (
|
||||
var (
|
||||
errNilBlock = errors.New("nil block")
|
||||
errEquivocatedBlock = errors.New("block is equivocated")
|
||||
errMarshalSSZ = errors.New("could not marshal block into SSZ")
|
||||
)
|
||||
|
||||
type handled bool
|
||||
@@ -117,37 +119,28 @@ func (s *Server) getBlockV2(ctx context.Context, w http.ResponseWriter, blk inte
|
||||
|
||||
// getBlockSSZV2 returns the SSZ-serialized version of the beacon block for given block ID.
|
||||
func (s *Server) getBlockSSZV2(ctx context.Context, w http.ResponseWriter, blk interfaces.ReadOnlySignedBeaconBlock) {
|
||||
getBlockHandler := func(get func(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) ([]byte, error), ver string) handled {
|
||||
result, err := get(ctx, blk)
|
||||
if result != nil {
|
||||
w.Header().Set(api.VersionHeader, ver)
|
||||
httputil.WriteSsz(w, result, "beacon_block.ssz")
|
||||
return true
|
||||
}
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if !errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
httputil.HandleError(w, "Could not get signed beacon block: "+err.Error(), http.StatusInternalServerError)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
result, err := s.getUnblindedBlockRespSSZ(ctx, blk)
|
||||
if err != nil {
|
||||
httputil.HandleError(w, "Could not get signed beacon block: "+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
if result == nil {
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown block type %T", blk), http.StatusInternalServerError)
|
||||
}
|
||||
w.Header().Set(api.VersionHeader, version.String(blk.Version()))
|
||||
httputil.WriteSsz(w, result, "beacon_block.ssz")
|
||||
}
|
||||
|
||||
if getBlockHandler(s.getBlockDenebSSZ, version.String(version.Deneb)) {
|
||||
return
|
||||
// getBlindedBlockSSZ returns the SSZ-serialized version of the blinded beacon block for given block id.
|
||||
func (s *Server) getBlindedBlockSSZ(w http.ResponseWriter, blk interfaces.ReadOnlySignedBeaconBlock) {
|
||||
result, err := s.getBlindedBlockRespSSZ(blk)
|
||||
if err != nil {
|
||||
httputil.HandleError(w, "Could not get signed beacon block: "+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
if getBlockHandler(s.getBlockCapellaSSZ, version.String(version.Capella)) {
|
||||
return
|
||||
if result == nil {
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown block type %T", blk), http.StatusInternalServerError)
|
||||
}
|
||||
if getBlockHandler(s.getBlockBellatrixSSZ, version.String(version.Bellatrix)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlockAltairSSZ, version.String(version.Altair)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlockPhase0SSZ, version.String(version.Phase0)) {
|
||||
return
|
||||
}
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown block type %T", blk), http.StatusInternalServerError)
|
||||
w.Header().Set(api.VersionHeader, version.String(blk.Version()))
|
||||
httputil.WriteSsz(w, result, "beacon_block.ssz")
|
||||
}
|
||||
|
||||
// GetBlindedBlock retrieves blinded block for given block id.
|
||||
@@ -166,7 +159,7 @@ func (s *Server) GetBlindedBlock(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if httputil.RespondWithSsz(r) {
|
||||
s.getBlindedBlockSSZ(ctx, w, blk)
|
||||
s.getBlindedBlockSSZ(w, blk)
|
||||
} else {
|
||||
s.getBlindedBlock(ctx, w, blk)
|
||||
}
|
||||
@@ -215,41 +208,6 @@ func (s *Server) getBlindedBlock(ctx context.Context, w http.ResponseWriter, blk
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown block type %T", blk), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// getBlindedBlockSSZ returns the SSZ-serialized version of the blinded beacon block for given block id.
|
||||
func (s *Server) getBlindedBlockSSZ(ctx context.Context, w http.ResponseWriter, blk interfaces.ReadOnlySignedBeaconBlock) {
|
||||
getBlockHandler := func(get func(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) ([]byte, error), ver string) handled {
|
||||
result, err := get(ctx, blk)
|
||||
if result != nil {
|
||||
w.Header().Set(api.VersionHeader, ver)
|
||||
httputil.WriteSsz(w, result, "beacon_block.ssz")
|
||||
return true
|
||||
}
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if !errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
httputil.HandleError(w, "Could not get signed beacon block: "+err.Error(), http.StatusInternalServerError)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if getBlockHandler(s.getBlockPhase0SSZ, version.String(version.Phase0)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlockAltairSSZ, version.String(version.Altair)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlindedBlockBellatrixSSZ, version.String(version.Bellatrix)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlindedBlockCapellaSSZ, version.String(version.Capella)) {
|
||||
return
|
||||
}
|
||||
if getBlockHandler(s.getBlindedBlockDenebSSZ, version.String(version.Deneb)) {
|
||||
return
|
||||
}
|
||||
httputil.HandleError(w, fmt.Sprintf("Unknown block type %T", blk), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func (*Server) getBlockPhase0(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) (*structs.GetBlockV2Response, error) {
|
||||
consensusBlk, err := blk.PbPhase0Block()
|
||||
if err != nil {
|
||||
@@ -458,135 +416,50 @@ func (s *Server) getBlockDeneb(ctx context.Context, blk interfaces.ReadOnlySigne
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (*Server) getBlockPhase0SSZ(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
consensusBlk, err := blk.PbPhase0Block()
|
||||
// getUnblindedBlockRespSSZ attempts to reconstruct the full block before calling getBlockRespSSZ to finish the job.
|
||||
func (s *Server) getUnblindedBlockRespSSZ(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
err := blocks.BeaconBlockIsNil(blk)
|
||||
if err != nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
if blk.Version() >= version.Bellatrix && blk.IsBlinded() {
|
||||
blk, err = s.ExecutionPayloadReconstructor.ReconstructFullBlock(ctx, blk)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not reconstruct full execution payload to create signed beacon block")
|
||||
}
|
||||
}
|
||||
return s.getBlockRespSSZ(blk)
|
||||
}
|
||||
|
||||
// getUnblindedBlockRespSSZ attempts to reconstruct the full block before calling getBlockRespSSZ to finish the job.
|
||||
func (s *Server) getBlindedBlockRespSSZ(blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
err := blocks.BeaconBlockIsNil(blk)
|
||||
if err != nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
if blk.Version() >= version.Bellatrix && !blk.IsBlinded() {
|
||||
blk, err = blk.ToBlinded()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not convert block to blinded block")
|
||||
}
|
||||
}
|
||||
return s.getBlockRespSSZ(blk)
|
||||
}
|
||||
|
||||
func (s *Server) getBlockRespSSZ(blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
err := blocks.BeaconBlockIsNil(blk)
|
||||
if err != nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
pb, err := blk.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
marshaler, ok := pb.(ssz.Marshaler)
|
||||
if !ok {
|
||||
return nil, errMarshalSSZ
|
||||
}
|
||||
sszData, err := consensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (*Server) getBlockAltairSSZ(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
consensusBlk, err := blk.PbAltairBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := consensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (s *Server) getBlockBellatrixSSZ(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
consensusBlk, err := blk.PbBellatrixBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
fullBlk, err := s.ExecutionPayloadReconstructor.ReconstructFullBlock(ctx, blk)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not reconstruct full execution payload to create signed beacon block")
|
||||
}
|
||||
consensusBlk, err = fullBlk.PbBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := consensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (s *Server) getBlockCapellaSSZ(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
consensusBlk, err := blk.PbCapellaBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
fullBlk, err := s.ExecutionPayloadReconstructor.ReconstructFullBlock(ctx, blk)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not reconstruct full execution payload to create signed beacon block")
|
||||
}
|
||||
consensusBlk, err = fullBlk.PbCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := consensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (s *Server) getBlockDenebSSZ(ctx context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
consensusBlk, err := blk.PbDenebBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedGetter means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedDenebBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
fullBlk, err := s.ExecutionPayloadReconstructor.ReconstructFullBlock(ctx, blk)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not reconstruct full execution payload to create signed beacon block")
|
||||
}
|
||||
consensusBlk, err = fullBlk.PbDenebBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := consensusBlk.MarshalSSZ()
|
||||
sszData, err := marshaler.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
@@ -755,111 +628,6 @@ func (s *Server) getBlindedBlockDeneb(ctx context.Context, blk interfaces.ReadOn
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (*Server) getBlindedBlockBellatrixSSZ(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedBellatrixBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
consensusBlk, err := blk.PbBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
blkInterface, err := blk.ToBlinded()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not convert block to blinded block")
|
||||
}
|
||||
blindedConsensusBlk, err = blkInterface.PbBlindedBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := blindedConsensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (*Server) getBlindedBlockCapellaSSZ(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedCapellaBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedField means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
consensusBlk, err := blk.PbCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
blkInterface, err := blk.ToBlinded()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not convert block to blinded block")
|
||||
}
|
||||
blindedConsensusBlk, err = blkInterface.PbBlindedCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := blindedConsensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
func (*Server) getBlindedBlockDenebSSZ(_ context.Context, blk interfaces.ReadOnlySignedBeaconBlock) ([]byte, error) {
|
||||
blindedConsensusBlk, err := blk.PbBlindedDenebBlock()
|
||||
if err != nil {
|
||||
// ErrUnsupportedGetter means that we have another block type
|
||||
if errors.Is(err, consensus_types.ErrUnsupportedField) {
|
||||
consensusBlk, err := blk.PbDenebBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
blkInterface, err := blk.ToBlinded()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not convert block to blinded block")
|
||||
}
|
||||
blindedConsensusBlk, err = blkInterface.PbBlindedDenebBlock()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not get signed beacon block")
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if blindedConsensusBlk == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
sszData, err := blindedConsensusBlk.MarshalSSZ()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not marshal block into SSZ")
|
||||
}
|
||||
return sszData, nil
|
||||
}
|
||||
|
||||
// GetBlockAttestations retrieves attestation included in requested block.
|
||||
func (s *Server) GetBlockAttestations(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, span := trace.StartSpan(r.Context(), "beacon.GetBlockAttestations")
|
||||
|
||||
@@ -133,6 +133,21 @@ func TestGetSpec(t *testing.T) {
|
||||
config.MaxWithdrawalsPerPayload = 74
|
||||
config.MaxBlsToExecutionChanges = 75
|
||||
config.MaxValidatorsPerWithdrawalsSweep = 76
|
||||
config.MinSlashingPenaltyQuotientElectra = 77
|
||||
config.MaxEffectiveBalanceElectra = 78
|
||||
config.CompoundingWithdrawalPrefixByte = byte('d')
|
||||
config.WhistleBlowerRewardQuotientElectra = 79
|
||||
config.PendingPartialWithdrawalsLimit = 80
|
||||
config.MinActivationBalance = 81
|
||||
config.PendingBalanceDepositLimit = 82
|
||||
config.MaxPendingPartialsPerWithdrawalSweep = 83
|
||||
config.PendingConsolidationsLimit = 84
|
||||
config.MaxPartialWithdrawalsPerPayload = 85
|
||||
config.FullExitRequestAmount = 86
|
||||
config.MaxConsolidations = 87
|
||||
config.MaxAttesterSlashingsElectra = 88
|
||||
config.MaxAttestationsElectra = 89
|
||||
config.MaxWithdrawalRequestsPerPayload = 90
|
||||
|
||||
var dbp [4]byte
|
||||
copy(dbp[:], []byte{'0', '0', '0', '1'})
|
||||
@@ -158,6 +173,9 @@ func TestGetSpec(t *testing.T) {
|
||||
var dam [4]byte
|
||||
copy(dam[:], []byte{'1', '0', '0', '0'})
|
||||
config.DomainApplicationMask = dam
|
||||
var dc [4]byte
|
||||
copy(dc[:], []byte{'1', '1', '0', '0'})
|
||||
config.DomainConsolidation = dc
|
||||
|
||||
params.OverrideBeaconConfig(config)
|
||||
|
||||
@@ -172,7 +190,7 @@ func TestGetSpec(t *testing.T) {
|
||||
data, ok := resp.Data.(map[string]interface{})
|
||||
require.Equal(t, true, ok)
|
||||
|
||||
assert.Equal(t, 136, len(data))
|
||||
assert.Equal(t, 152, len(data))
|
||||
for k, v := range data {
|
||||
t.Run(k, func(t *testing.T) {
|
||||
switch k {
|
||||
@@ -471,6 +489,38 @@ func TestGetSpec(t *testing.T) {
|
||||
assert.Equal(t, "32", v)
|
||||
case "MAX_REQUEST_DATA_COLUMN_SIDECARS":
|
||||
assert.Equal(t, "16384", v)
|
||||
case "MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA":
|
||||
assert.Equal(t, "77", v)
|
||||
case "MAX_EFFECTIVE_BALANCE_ELECTRA":
|
||||
assert.Equal(t, "78", v)
|
||||
case "COMPOUNDING_WITHDRAWAL_PREFIX":
|
||||
assert.Equal(t, "0x64", v)
|
||||
case "WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA":
|
||||
assert.Equal(t, "79", v)
|
||||
case "PENDING_PARTIAL_WITHDRAWALS_LIMIT":
|
||||
assert.Equal(t, "80", v)
|
||||
case "MIN_ACTIVATION_BALANCE":
|
||||
assert.Equal(t, "81", v)
|
||||
case "PENDING_BALANCE_DEPOSITS_LIMIT":
|
||||
assert.Equal(t, "82", v)
|
||||
case "MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP":
|
||||
assert.Equal(t, "83", v)
|
||||
case "PENDING_CONSOLIDATIONS_LIMIT":
|
||||
assert.Equal(t, "84", v)
|
||||
case "MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD":
|
||||
assert.Equal(t, "85", v)
|
||||
case "FULL_EXIT_REQUEST_AMOUNT":
|
||||
assert.Equal(t, "86", v)
|
||||
case "MAX_CONSOLIDATIONS":
|
||||
assert.Equal(t, "87", v)
|
||||
case "DOMAIN_CONSOLIDATION":
|
||||
assert.Equal(t, "0x31313030", v)
|
||||
case "MAX_ATTESTER_SLASHINGS_ELECTRA":
|
||||
assert.Equal(t, "88", v)
|
||||
case "MAX_ATTESTATIONS_ELECTRA":
|
||||
assert.Equal(t, "89", v)
|
||||
case "MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD":
|
||||
assert.Equal(t, "90", v)
|
||||
default:
|
||||
t.Errorf("Incorrect key: %s", k)
|
||||
}
|
||||
|
||||
@@ -146,8 +146,10 @@ func TestGetBlock(t *testing.T) {
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
pbBlock, err := result.PbPhase0Block()
|
||||
pb, err := result.Proto()
|
||||
require.NoError(t, err)
|
||||
pbBlock, ok := pb.(*ethpbalpha.SignedBeaconBlock)
|
||||
require.Equal(t, true, ok)
|
||||
if !reflect.DeepEqual(pbBlock, tt.want) {
|
||||
t.Error("Expected blocks to equal")
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v5/time/slots"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -90,64 +89,32 @@ func convertToBlockContainer(blk interfaces.ReadOnlySignedBeaconBlock, root [32]
|
||||
Canonical: isCanonical,
|
||||
}
|
||||
|
||||
switch blk.Version() {
|
||||
case version.Phase0:
|
||||
rBlk, err := blk.PbPhase0Block()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_Phase0Block{Phase0Block: rBlk}
|
||||
case version.Altair:
|
||||
rBlk, err := blk.PbAltairBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_AltairBlock{AltairBlock: rBlk}
|
||||
case version.Bellatrix:
|
||||
if blk.IsBlinded() {
|
||||
rBlk, err := blk.PbBlindedBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedBellatrixBlock{BlindedBellatrixBlock: rBlk}
|
||||
} else {
|
||||
rBlk, err := blk.PbBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BellatrixBlock{BellatrixBlock: rBlk}
|
||||
}
|
||||
case version.Capella:
|
||||
if blk.IsBlinded() {
|
||||
rBlk, err := blk.PbBlindedCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedCapellaBlock{BlindedCapellaBlock: rBlk}
|
||||
} else {
|
||||
rBlk, err := blk.PbCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_CapellaBlock{CapellaBlock: rBlk}
|
||||
}
|
||||
case version.Deneb:
|
||||
if blk.IsBlinded() {
|
||||
rBlk, err := blk.PbBlindedDenebBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedDenebBlock{BlindedDenebBlock: rBlk}
|
||||
} else {
|
||||
rBlk, err := blk.PbDenebBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctr.Block = ðpb.BeaconBlockContainer_DenebBlock{DenebBlock: rBlk}
|
||||
}
|
||||
pb, err := blk.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch pbStruct := pb.(type) {
|
||||
case *ethpb.SignedBeaconBlock:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_Phase0Block{Phase0Block: pbStruct}
|
||||
case *ethpb.SignedBeaconBlockAltair:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_AltairBlock{AltairBlock: pbStruct}
|
||||
case *ethpb.SignedBlindedBeaconBlockBellatrix:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedBellatrixBlock{BlindedBellatrixBlock: pbStruct}
|
||||
case *ethpb.SignedBeaconBlockBellatrix:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BellatrixBlock{BellatrixBlock: pbStruct}
|
||||
case *ethpb.SignedBlindedBeaconBlockCapella:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedCapellaBlock{BlindedCapellaBlock: pbStruct}
|
||||
case *ethpb.SignedBeaconBlockCapella:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_CapellaBlock{CapellaBlock: pbStruct}
|
||||
case *ethpb.SignedBlindedBeaconBlockDeneb:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_BlindedDenebBlock{BlindedDenebBlock: pbStruct}
|
||||
case *ethpb.SignedBeaconBlockDeneb:
|
||||
ctr.Block = ðpb.BeaconBlockContainer_DenebBlock{DenebBlock: pbStruct}
|
||||
default:
|
||||
return nil, errors.Errorf("block type is not recognized: %d", blk.Version())
|
||||
}
|
||||
|
||||
return ctr, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -33,4 +33,9 @@ const (
|
||||
BlobSize = 131072 // defined to match blob.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.
|
||||
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.
|
||||
MaxDepositReceiptsPerPayload = 8192 // Maximum number of deposit receipts in an execution payload.
|
||||
MaxWithdrawalRequestsPerPayload = 16 // Maximum number of execution layer withdrawal requests in an execution payload.
|
||||
)
|
||||
|
||||
@@ -33,4 +33,9 @@ const (
|
||||
BlobSize = 131072 // defined to match blob.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.
|
||||
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.
|
||||
MaxDepositReceiptsPerPayload = 4 // Maximum number of deposit receipts in an execution payload.
|
||||
MaxWithdrawalRequestsPerPayload = 2 // Maximum number of execution layer withdrawal requests in an execution payload.
|
||||
)
|
||||
|
||||
@@ -41,6 +41,7 @@ type BeaconChainConfig struct {
|
||||
|
||||
// Gwei value constants.
|
||||
MinDepositAmount uint64 `yaml:"MIN_DEPOSIT_AMOUNT" spec:"true"` // MinDepositAmount is the minimum amount of Gwei a validator can send to the deposit contract at once (lower amounts will be reverted).
|
||||
MinActivationBalance uint64 `yaml:"MIN_ACTIVATION_BALANCE" spec:"true"` // MinActivationBalance is the minimum amount of Gwei a validator must have to be activated in the beacon state.
|
||||
MaxEffectiveBalance uint64 `yaml:"MAX_EFFECTIVE_BALANCE" spec:"true"` // MaxEffectiveBalance is the maximal amount of Gwei that is effective for staking.
|
||||
EjectionBalance uint64 `yaml:"EJECTION_BALANCE" spec:"true"` // EjectionBalance is the minimal GWei a validator needs to have before ejected.
|
||||
EffectiveBalanceIncrement uint64 `yaml:"EFFECTIVE_BALANCE_INCREMENT" spec:"true"` // EffectiveBalanceIncrement is used for converting the high balance into the low balance for validators.
|
||||
@@ -48,6 +49,7 @@ type BeaconChainConfig struct {
|
||||
// Initial value constants.
|
||||
BLSWithdrawalPrefixByte byte `yaml:"BLS_WITHDRAWAL_PREFIX" spec:"true"` // BLSWithdrawalPrefixByte is used for BLS withdrawal and it's the first byte.
|
||||
ETH1AddressWithdrawalPrefixByte byte `yaml:"ETH1_ADDRESS_WITHDRAWAL_PREFIX" spec:"true"` // ETH1AddressWithdrawalPrefixByte is used for withdrawals and it's the first byte.
|
||||
CompoundingWithdrawalPrefixByte byte `yaml:"COMPOUNDING_WITHDRAWAL_PREFIX" spec:"true"` // CompoundingWithdrawalPrefixByteByte is used for compounding withdrawals and it's the first byte.
|
||||
ZeroHash [32]byte // ZeroHash is used to represent a zeroed out 32 byte array.
|
||||
|
||||
// Time parameters constants.
|
||||
@@ -97,12 +99,15 @@ type BeaconChainConfig struct {
|
||||
ProportionalSlashingMultiplier uint64 `yaml:"PROPORTIONAL_SLASHING_MULTIPLIER" spec:"true"` // ProportionalSlashingMultiplier is used as a multiplier on slashed penalties.
|
||||
|
||||
// Max operations per block constants.
|
||||
MaxProposerSlashings uint64 `yaml:"MAX_PROPOSER_SLASHINGS" spec:"true"` // MaxProposerSlashings defines the maximum number of slashings of proposers possible in a block.
|
||||
MaxAttesterSlashings uint64 `yaml:"MAX_ATTESTER_SLASHINGS" spec:"true"` // MaxAttesterSlashings defines the maximum number of casper FFG slashings possible in a block.
|
||||
MaxAttestations uint64 `yaml:"MAX_ATTESTATIONS" spec:"true"` // MaxAttestations defines the maximum allowed attestations in a beacon block.
|
||||
MaxDeposits uint64 `yaml:"MAX_DEPOSITS" spec:"true"` // MaxDeposits defines the maximum number of validator deposits in a block.
|
||||
MaxVoluntaryExits uint64 `yaml:"MAX_VOLUNTARY_EXITS" spec:"true"` // MaxVoluntaryExits defines the maximum number of validator exits in a block.
|
||||
MaxWithdrawalsPerPayload uint64 `yaml:"MAX_WITHDRAWALS_PER_PAYLOAD" spec:"true"` // MaxWithdrawalsPerPayload defines the maximum number of withdrawals in a block.
|
||||
MaxProposerSlashings uint64 `yaml:"MAX_PROPOSER_SLASHINGS" spec:"true"` // MaxProposerSlashings defines the maximum number of slashings of proposers possible in a block.
|
||||
MaxAttesterSlashings uint64 `yaml:"MAX_ATTESTER_SLASHINGS" spec:"true"` // MaxAttesterSlashings defines the maximum number of casper FFG slashings possible in a block.
|
||||
MaxAttesterSlashingsElectra uint64 `yaml:"MAX_ATTESTER_SLASHINGS_ELECTRA" spec:"true"` // MaxAttesterSlashingsElectra defines the maximum number of casper FFG slashings possible in a block post Electra hard fork.
|
||||
MaxAttestations uint64 `yaml:"MAX_ATTESTATIONS" spec:"true"` // MaxAttestations defines the maximum allowed attestations in a beacon block.
|
||||
MaxAttestationsElectra uint64 `yaml:"MAX_ATTESTATIONS_ELECTRA" spec:"true"` // MaxAttestationsElectra defines the maximum allowed attestations in a beacon block post Electra hard fork.
|
||||
MaxDeposits uint64 `yaml:"MAX_DEPOSITS" spec:"true"` // MaxDeposits defines the maximum number of validator deposits in a block.
|
||||
MaxVoluntaryExits uint64 `yaml:"MAX_VOLUNTARY_EXITS" spec:"true"` // MaxVoluntaryExits defines the maximum number of validator exits in a block.
|
||||
MaxWithdrawalsPerPayload uint64 `yaml:"MAX_WITHDRAWALS_PER_PAYLOAD" spec:"true"` // MaxWithdrawalsPerPayload defines the maximum number of withdrawals in a block.
|
||||
MaxPartialWithdrawalsPerPayload uint64 `yaml:"MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD" spec:"true"`
|
||||
MaxBlsToExecutionChanges uint64 `yaml:"MAX_BLS_TO_EXECUTION_CHANGES" spec:"true"` // MaxBlsToExecutionChanges defines the maximum number of BLS-to-execution-change objects in a block.
|
||||
MaxValidatorsPerWithdrawalsSweep uint64 `yaml:"MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP" spec:"true"` // MaxValidatorsPerWithdrawalsSweep bounds the size of the sweep searching for withdrawals per slot.
|
||||
|
||||
@@ -120,6 +125,7 @@ type BeaconChainConfig struct {
|
||||
DomainApplicationMask [4]byte `yaml:"DOMAIN_APPLICATION_MASK" spec:"true"` // DomainApplicationMask defines the BLS signature domain for application mask.
|
||||
DomainApplicationBuilder [4]byte `yaml:"DOMAIN_APPLICATION_BUILDER" spec:"true"` // DomainApplicationBuilder defines the BLS signature domain for application builder.
|
||||
DomainBLSToExecutionChange [4]byte `yaml:"DOMAIN_BLS_TO_EXECUTION_CHANGE" spec:"true"` // DomainBLSToExecutionChange defines the BLS signature domain to change withdrawal addresses to ETH1 prefix
|
||||
DomainConsolidation [4]byte `yaml:"DOMAIN_CONSOLIDATION" spec:"true"`
|
||||
|
||||
// Prysm constants.
|
||||
GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth.
|
||||
@@ -139,6 +145,7 @@ type BeaconChainConfig struct {
|
||||
BeaconStateBellatrixFieldCount int // BeaconStateBellatrixFieldCount defines how many fields are in beacon state post upgrade to Bellatrix.
|
||||
BeaconStateCapellaFieldCount int // BeaconStateCapellaFieldCount defines how many fields are in beacon state post upgrade to Capella.
|
||||
BeaconStateDenebFieldCount int // BeaconStateDenebFieldCount defines how many fields are in beacon state post upgrade to Deneb.
|
||||
BeaconStateElectraFieldCount int // BeaconStateElectraFieldCount defines how many fields are in beacon state post upgrade to Electra.
|
||||
|
||||
// Slasher constants.
|
||||
WeakSubjectivityPeriod primitives.Epoch // WeakSubjectivityPeriod defines the time period expressed in number of epochs were proof of stake network should validate block headers and attestations for slashable events.
|
||||
@@ -229,11 +236,20 @@ type BeaconChainConfig struct {
|
||||
MaxRequestBlocksDeneb uint64 `yaml:"MAX_REQUEST_BLOCKS_DENEB" spec:"true"` // MaxRequestBlocksDeneb is the maximum number of blocks in a single request after the deneb epoch.
|
||||
|
||||
// Values introduce in Electra upgrade
|
||||
NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix.
|
||||
DataColumnSidecarSubnetCount uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" spec:"true"` // DataColumnSidecarSubnetCount is the number of data column sidecar subnets used in the gossipsub protocol
|
||||
MaxPerEpochActivationExitChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT" spec:"true"` // MaxPerEpochActivationExitChurnLimit represents the maximum combined activation and exit churn.
|
||||
MinPerEpochChurnLimitElectra uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA" spec:"true"` // MinPerEpochChurnLimitElectra is the minimum amount of churn allotted for validator rotations for electra.
|
||||
MaxRequestDataColumnSidecars uint64 `yaml:"MAX_REQUEST_DATA_COLUMN_SIDECARS" spec:"true"` // MaxRequestDataColumnSidecars is the maximum number of data column sidecars in a single request
|
||||
DataColumnSidecarSubnetCount uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" spec:"true"` // DataColumnSidecarSubnetCount is the number of data column sidecar subnets used in the gossipsub protocol
|
||||
MaxPerEpochActivationExitChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT" spec:"true"` // MaxPerEpochActivationExitChurnLimit represents the maximum combined activation and exit churn.
|
||||
MinPerEpochChurnLimitElectra uint64 `yaml:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA" spec:"true"` // MinPerEpochChurnLimitElectra is the minimum amount of churn allotted for validator rotations for electra.
|
||||
MaxRequestDataColumnSidecars uint64 `yaml:"MAX_REQUEST_DATA_COLUMN_SIDECARS" spec:"true"` // MaxRequestDataColumnSidecars is the maximum number of data column sidecars in a single request
|
||||
MaxEffectiveBalanceElectra uint64 `yaml:"MAX_EFFECTIVE_BALANCE_ELECTRA" spec:"true"` // MaxEffectiveBalanceElectra is the maximal amount of Gwei that is effective for staking, increased in electra.
|
||||
MinSlashingPenaltyQuotientElectra uint64 `yaml:"MIN_SLASHING_PENALTY_QUOTIENT_ELECTRA" spec:"true"` // MinSlashingPenaltyQuotientElectra is used to calculate the minimum penalty to prevent DoS attacks, modified for electra.
|
||||
WhistleBlowerRewardQuotientElectra uint64 `yaml:"WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA" spec:"true"` // WhistleBlowerRewardQuotientElectra is used to calculate whistle blower reward, modified in electra.
|
||||
PendingBalanceDepositLimit uint64 `yaml:"PENDING_BALANCE_DEPOSITS_LIMIT" spec:"true"` // PendingBalanceDepositLimit is the maximum number of pending balance deposits allowed in the beacon state.
|
||||
PendingPartialWithdrawalsLimit uint64 `yaml:"PENDING_PARTIAL_WITHDRAWALS_LIMIT" spec:"true"` // PendingPartialWithdrawalsLimit is the maximum number of pending partial withdrawals allowed in the beacon state.
|
||||
PendingConsolidationsLimit uint64 `yaml:"PENDING_CONSOLIDATIONS_LIMIT" spec:"true"` // PendingConsolidationsLimit is the maximum number of pending validator consolidations allowed in the beacon state.
|
||||
MaxConsolidations uint64 `yaml:"MAX_CONSOLIDATIONS" spec:"true"` // MaxConsolidations is the maximum number of consolidations in a block.
|
||||
MaxPendingPartialsPerWithdrawalSweep uint64 `yaml:"MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP" spec:"true"` // MaxPendingPartialsPerWithdrawalSweep is the maximum number of pending partial withdrawals to process per payload.
|
||||
FullExitRequestAmount uint64 `yaml:"FULL_EXIT_REQUEST_AMOUNT" spec:"true"` // FullExitRequestAmount is the amount of Gwei required to request a full exit.
|
||||
MaxWithdrawalRequestsPerPayload uint64 `yaml:"MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD" spec:"true"` // MaxWithdrawalRequestsPerPayload is the maximum number of execution layer withdrawal requests in each payload.
|
||||
|
||||
// Networking Specific Parameters
|
||||
GossipMaxSize uint64 `yaml:"GOSSIP_MAX_SIZE" spec:"true"` // GossipMaxSize is the maximum allowed size of uncompressed gossip messages.
|
||||
@@ -252,6 +268,9 @@ type BeaconChainConfig struct {
|
||||
AttestationSubnetPrefixBits uint64 `yaml:"ATTESTATION_SUBNET_PREFIX_BITS" spec:"true"` // AttestationSubnetPrefixBits is defined as (ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS).
|
||||
SubnetsPerNode uint64 `yaml:"SUBNETS_PER_NODE" spec:"true"` // SubnetsPerNode is the number of long-lived subnets a beacon node should be subscribed to.
|
||||
NodeIdBits uint64 `yaml:"NODE_ID_BITS" spec:"true"` // NodeIdBits defines the bit length of a node id.
|
||||
|
||||
// PeerDAS
|
||||
NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix.
|
||||
}
|
||||
|
||||
// InitializeForkSchedule initializes the schedules forks baked into the config.
|
||||
|
||||
@@ -24,13 +24,21 @@ import (
|
||||
// These are variables that we don't use in Prysm. (i.e. future hardfork, light client... etc)
|
||||
// IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts.
|
||||
var placeholderFields = []string{
|
||||
"BYTES_PER_LOGS_BLOOM", // Compile time constant on ExecutionPayload.logs_bloom.
|
||||
"EIP6110_FORK_EPOCH",
|
||||
"EIP6110_FORK_VERSION",
|
||||
"EIP7002_FORK_EPOCH",
|
||||
"EIP7002_FORK_VERSION",
|
||||
"EIP7594_FORK_EPOCH",
|
||||
"EIP7594_FORK_VERSION",
|
||||
"FIELD_ELEMENTS_PER_BLOB", // Compile time constant.
|
||||
"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH", // Compile time constant on BlobSidecar.commitment_inclusion_proof.
|
||||
"MAX_BLOBS_PER_BLOCK",
|
||||
"MAX_BLOB_COMMITMENTS_PER_BLOCK", // Compile time constant on BeaconBlockBodyDeneb.blob_kzg_commitments.
|
||||
"MAX_BYTES_PER_TRANSACTION", // Used for ssz of EL transactions. Unused in Prysm.
|
||||
"MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD", // Compile time constant on ExecutionPayload.deposit_receipts.
|
||||
"MAX_EXTRA_DATA_BYTES", // Compile time constant on ExecutionPayload.extra_data.
|
||||
"MAX_TRANSACTIONS_PER_PAYLOAD", // Compile time constant on ExecutionPayload.transactions.
|
||||
"REORG_HEAD_WEIGHT_THRESHOLD",
|
||||
"UPDATE_TIMEOUT",
|
||||
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",
|
||||
@@ -342,9 +350,14 @@ func configFilePath(t *testing.T, config string) string {
|
||||
func presetsFilePath(t *testing.T, config string) []string {
|
||||
fPath, err := bazel.Runfile("external/consensus_spec")
|
||||
require.NoError(t, err)
|
||||
|
||||
return []string{
|
||||
path.Join(fPath, "presets", config, "phase0.yaml"),
|
||||
path.Join(fPath, "presets", config, "altair.yaml"),
|
||||
path.Join(fPath, "presets", config, "bellatrix.yaml"),
|
||||
path.Join(fPath, "presets", config, "capella.yaml"),
|
||||
path.Join(fPath, "presets", config, "deneb.yaml"),
|
||||
path.Join(fPath, "presets", config, "electra.yaml"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
// Initial value constants.
|
||||
BLSWithdrawalPrefixByte: byte(0),
|
||||
ETH1AddressWithdrawalPrefixByte: byte(1),
|
||||
CompoundingWithdrawalPrefixByte: byte(2),
|
||||
ZeroHash: [32]byte{},
|
||||
|
||||
// Time parameter constants.
|
||||
@@ -147,7 +148,9 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
// Max operations per block constants.
|
||||
MaxProposerSlashings: 16,
|
||||
MaxAttesterSlashings: 2,
|
||||
MaxAttesterSlashingsElectra: 1,
|
||||
MaxAttestations: 128,
|
||||
MaxAttestationsElectra: 8,
|
||||
MaxDeposits: 16,
|
||||
MaxVoluntaryExits: 16,
|
||||
MaxWithdrawalsPerPayload: 16,
|
||||
@@ -168,6 +171,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
DomainApplicationMask: bytesutil.Uint32ToBytes4(0x00000001),
|
||||
DomainApplicationBuilder: bytesutil.Uint32ToBytes4(0x00000001),
|
||||
DomainBLSToExecutionChange: bytesutil.Uint32ToBytes4(0x0A000000),
|
||||
DomainConsolidation: bytesutil.Uint32ToBytes4(0x0B000000),
|
||||
|
||||
// Prysm constants.
|
||||
GweiPerEth: 1000000000,
|
||||
@@ -189,6 +193,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
BeaconStateBellatrixFieldCount: 25,
|
||||
BeaconStateCapellaFieldCount: 28,
|
||||
BeaconStateDenebFieldCount: 28,
|
||||
BeaconStateElectraFieldCount: 37,
|
||||
|
||||
// Slasher related values.
|
||||
WeakSubjectivityPeriod: 54000,
|
||||
@@ -270,11 +275,21 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
MaxRequestBlocksDeneb: 128,
|
||||
|
||||
// Values related to electra
|
||||
NumberOfColumns: 128,
|
||||
MaxRequestDataColumnSidecars: 16384,
|
||||
DataColumnSidecarSubnetCount: 32,
|
||||
MinPerEpochChurnLimitElectra: 128000000000,
|
||||
MaxPerEpochActivationExitChurnLimit: 256000000000,
|
||||
MaxRequestDataColumnSidecars: 16384,
|
||||
DataColumnSidecarSubnetCount: 32,
|
||||
MinPerEpochChurnLimitElectra: 128_000_000_000,
|
||||
MaxPerEpochActivationExitChurnLimit: 256_000_000_000,
|
||||
MaxEffectiveBalanceElectra: 2048_000_000_000,
|
||||
MinSlashingPenaltyQuotientElectra: 4096,
|
||||
WhistleBlowerRewardQuotientElectra: 4096,
|
||||
PendingBalanceDepositLimit: 134_217_728,
|
||||
PendingPartialWithdrawalsLimit: 134_217_728,
|
||||
PendingConsolidationsLimit: 262_144,
|
||||
MinActivationBalance: 32_000_000_000,
|
||||
MaxConsolidations: 1,
|
||||
MaxPendingPartialsPerWithdrawalSweep: 8,
|
||||
FullExitRequestAmount: 0,
|
||||
MaxWithdrawalRequestsPerPayload: 16,
|
||||
|
||||
// Values related to networking parameters.
|
||||
GossipMaxSize: 10 * 1 << 20, // 10 MiB
|
||||
@@ -293,6 +308,9 @@ var mainnetBeaconConfig = &BeaconChainConfig{
|
||||
AttestationSubnetPrefixBits: 6,
|
||||
SubnetsPerNode: 2,
|
||||
NodeIdBits: 256,
|
||||
|
||||
// PeerDAS
|
||||
NumberOfColumns: 128,
|
||||
}
|
||||
|
||||
// MainnetTestConfig provides a version of the mainnet config that has a different name
|
||||
|
||||
@@ -64,7 +64,9 @@ func MinimalSpecConfig() *BeaconChainConfig {
|
||||
// Max operations per block
|
||||
minimalConfig.MaxProposerSlashings = 16
|
||||
minimalConfig.MaxAttesterSlashings = 2
|
||||
minimalConfig.MaxAttesterSlashingsElectra = 1
|
||||
minimalConfig.MaxAttestations = 128
|
||||
minimalConfig.MaxAttestationsElectra = 8
|
||||
minimalConfig.MaxDeposits = 16
|
||||
minimalConfig.MaxVoluntaryExits = 16
|
||||
minimalConfig.MaxWithdrawalsPerPayload = 4
|
||||
@@ -92,7 +94,7 @@ func MinimalSpecConfig() *BeaconChainConfig {
|
||||
minimalConfig.DenebForkVersion = []byte{4, 0, 0, 1}
|
||||
minimalConfig.DenebForkEpoch = math.MaxUint64
|
||||
minimalConfig.ElectraForkVersion = []byte{5, 0, 0, 1}
|
||||
minimalConfig.AltairForkEpoch = math.MaxUint64
|
||||
minimalConfig.ElectraForkEpoch = math.MaxUint64
|
||||
|
||||
minimalConfig.SyncCommitteeSize = 32
|
||||
minimalConfig.InactivityScoreBias = 4
|
||||
@@ -102,6 +104,11 @@ func MinimalSpecConfig() *BeaconChainConfig {
|
||||
// New Electra params
|
||||
minimalConfig.MinPerEpochChurnLimitElectra = 64000000000
|
||||
minimalConfig.MaxPerEpochActivationExitChurnLimit = 128000000000
|
||||
minimalConfig.PendingConsolidationsLimit = 64
|
||||
minimalConfig.MaxPartialWithdrawalsPerPayload = 1
|
||||
minimalConfig.MaxWithdrawalRequestsPerPayload = 2
|
||||
minimalConfig.PendingPartialWithdrawalsLimit = 64
|
||||
minimalConfig.MaxPendingPartialsPerWithdrawalSweep = 1
|
||||
|
||||
// Ethereum PoW parameters.
|
||||
minimalConfig.DepositChainID = 5 // Chain ID of eth1 goerli.
|
||||
|
||||
@@ -23,6 +23,8 @@ type executionPayload struct {
|
||||
p *enginev1.ExecutionPayload
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayload{}
|
||||
|
||||
// WrappedExecutionPayload is a constructor which wraps a protobuf execution payload into an interface.
|
||||
func WrappedExecutionPayload(p *enginev1.ExecutionPayload) (interfaces.ExecutionData, error) {
|
||||
w := executionPayload{p: p}
|
||||
@@ -187,6 +189,11 @@ func (executionPayload) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (executionPayload) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// ValueInWei --
|
||||
func (executionPayload) ValueInWei() (math.Wei, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
@@ -204,6 +211,8 @@ type executionPayloadHeader struct {
|
||||
p *enginev1.ExecutionPayloadHeader
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadHeader{}
|
||||
|
||||
// WrappedExecutionPayloadHeader is a constructor which wraps a protobuf execution header into an interface.
|
||||
func WrappedExecutionPayloadHeader(p *enginev1.ExecutionPayloadHeader) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadHeader{p: p}
|
||||
@@ -353,6 +362,11 @@ func (e executionPayloadHeader) ExcessBlobGas() (uint64, error) {
|
||||
return 0, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (e executionPayloadHeader) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (executionPayloadHeader) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
@@ -415,6 +429,8 @@ type executionPayloadCapella struct {
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadCapella{}
|
||||
|
||||
// WrappedExecutionPayloadCapella is a constructor which wraps a protobuf execution payload into an interface.
|
||||
func WrappedExecutionPayloadCapella(p *enginev1.ExecutionPayloadCapella, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadCapella{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
@@ -564,6 +580,11 @@ func (e executionPayloadCapella) ExcessBlobGas() (uint64, error) {
|
||||
return 0, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (executionPayloadCapella) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (executionPayloadCapella) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
@@ -598,6 +619,8 @@ type executionPayloadHeaderCapella struct {
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadHeaderCapella{}
|
||||
|
||||
// WrappedExecutionPayloadHeaderCapella is a constructor which wraps a protobuf execution header into an interface.
|
||||
func WrappedExecutionPayloadHeaderCapella(p *enginev1.ExecutionPayloadHeaderCapella, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadHeaderCapella{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
@@ -747,6 +770,11 @@ func (e executionPayloadHeaderCapella) ExcessBlobGas() (uint64, error) {
|
||||
return 0, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (executionPayloadHeaderCapella) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (executionPayloadHeaderCapella) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
@@ -858,6 +886,68 @@ func PayloadToHeaderDeneb(payload interfaces.ExecutionData) (*enginev1.Execution
|
||||
}, nil
|
||||
}
|
||||
|
||||
// PayloadToHeaderElectra converts `payload` into execution payload header format.
|
||||
func PayloadToHeaderElectra(payload interfaces.ExecutionDataElectra) (*enginev1.ExecutionPayloadHeaderElectra, error) {
|
||||
txs, err := payload.Transactions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
txRoot, err := ssz.TransactionsRoot(txs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
withdrawals, err := payload.Withdrawals()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
withdrawalsRoot, err := ssz.WithdrawalSliceRoot(withdrawals, fieldparams.MaxWithdrawalsPerPayload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blobGasUsed, err := payload.BlobGasUsed()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
excessBlobGas, err := payload.ExcessBlobGas()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
depositReceipts := payload.DepositReceipts()
|
||||
depositReceiptsRoot, err := ssz.DepositReceiptSliceRoot(depositReceipts, fieldparams.MaxDepositReceiptsPerPayload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
withdrawalRequests := payload.WithdrawalRequests()
|
||||
withdrawalRequestsRoot, err := ssz.WithdrawalRequestSliceRoot(withdrawalRequests, fieldparams.MaxWithdrawalRequestsPerPayload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &enginev1.ExecutionPayloadHeaderElectra{
|
||||
ParentHash: bytesutil.SafeCopyBytes(payload.ParentHash()),
|
||||
FeeRecipient: bytesutil.SafeCopyBytes(payload.FeeRecipient()),
|
||||
StateRoot: bytesutil.SafeCopyBytes(payload.StateRoot()),
|
||||
ReceiptsRoot: bytesutil.SafeCopyBytes(payload.ReceiptsRoot()),
|
||||
LogsBloom: bytesutil.SafeCopyBytes(payload.LogsBloom()),
|
||||
PrevRandao: bytesutil.SafeCopyBytes(payload.PrevRandao()),
|
||||
BlockNumber: payload.BlockNumber(),
|
||||
GasLimit: payload.GasLimit(),
|
||||
GasUsed: payload.GasUsed(),
|
||||
Timestamp: payload.Timestamp(),
|
||||
ExtraData: bytesutil.SafeCopyBytes(payload.ExtraData()),
|
||||
BaseFeePerGas: bytesutil.SafeCopyBytes(payload.BaseFeePerGas()),
|
||||
BlockHash: bytesutil.SafeCopyBytes(payload.BlockHash()),
|
||||
TransactionsRoot: txRoot[:],
|
||||
WithdrawalsRoot: withdrawalsRoot[:],
|
||||
BlobGasUsed: blobGasUsed,
|
||||
ExcessBlobGas: excessBlobGas,
|
||||
DepositReceiptsRoot: depositReceiptsRoot[:],
|
||||
WithdrawalRequestsRoot: withdrawalRequestsRoot[:],
|
||||
}, nil
|
||||
}
|
||||
|
||||
// IsEmptyExecutionData checks if an execution data is empty underneath. If a single field has
|
||||
// a non-zero value, this function will return false.
|
||||
func IsEmptyExecutionData(data interfaces.ExecutionData) (bool, error) {
|
||||
@@ -915,6 +1005,20 @@ func IsEmptyExecutionData(data interfaces.ExecutionData) (bool, error) {
|
||||
if data.Timestamp() != 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
epe, postElectra := data.(interfaces.ExecutionDataElectra)
|
||||
if postElectra {
|
||||
drs := epe.DepositReceipts()
|
||||
if len(drs) != 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
wrs := epe.WithdrawalRequests()
|
||||
if len(wrs) != 0 {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@@ -927,6 +1031,8 @@ type executionPayloadHeaderDeneb struct {
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadHeaderDeneb{}
|
||||
|
||||
// WrappedExecutionPayloadHeaderDeneb is a constructor which wraps a protobuf execution header into an interface.
|
||||
func WrappedExecutionPayloadHeaderDeneb(p *enginev1.ExecutionPayloadHeaderDeneb, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadHeaderDeneb{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
@@ -1071,6 +1177,11 @@ func (e executionPayloadHeaderDeneb) ExcessBlobGas() (uint64, error) {
|
||||
return e.p.ExcessBlobGas, nil
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (executionPayloadHeaderDeneb) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (executionPayloadHeaderDeneb) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
@@ -1110,6 +1221,8 @@ type executionPayloadDeneb struct {
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadDeneb{}
|
||||
|
||||
// WrappedExecutionPayloadDeneb is a constructor which wraps a protobuf execution payload into an interface.
|
||||
func WrappedExecutionPayloadDeneb(p *enginev1.ExecutionPayloadDeneb, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadDeneb{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
@@ -1267,6 +1380,11 @@ func (e executionPayloadDeneb) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error
|
||||
return e.p, nil
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (e executionPayloadDeneb) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// ValueInWei --
|
||||
func (e executionPayloadDeneb) ValueInWei() (math.Wei, error) {
|
||||
return e.weiValue, nil
|
||||
@@ -1282,6 +1400,406 @@ func (e executionPayloadDeneb) IsBlinded() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// executionPayloadHeaderElectra is a convenience wrapper around a blinded beacon block body's execution header data structure.
|
||||
// This wrapper allows us to conform to a common interface so that beacon
|
||||
// blocks for future forks can also be applied across Prysm without issues.
|
||||
type executionPayloadHeaderElectra struct {
|
||||
p *enginev1.ExecutionPayloadHeaderElectra
|
||||
weiValue math.Wei
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadElectra{}
|
||||
var _ interfaces.ExecutionDataElectra = &executionPayloadElectra{}
|
||||
|
||||
// WrappedExecutionPayloadHeaderElectra is a constructor which wraps a protobuf execution header into an interface.
|
||||
func WrappedExecutionPayloadHeaderElectra(p *enginev1.ExecutionPayloadHeaderElectra, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadHeaderElectra{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
if w.IsNil() {
|
||||
return nil, consensus_types.ErrNilObjectWrapped
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// IsNil checks if the underlying data is nil.
|
||||
func (e executionPayloadHeaderElectra) IsNil() bool {
|
||||
return e.p == nil
|
||||
}
|
||||
|
||||
// MarshalSSZ --
|
||||
func (e executionPayloadHeaderElectra) MarshalSSZ() ([]byte, error) {
|
||||
return e.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo --
|
||||
func (e executionPayloadHeaderElectra) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return e.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ --
|
||||
func (e executionPayloadHeaderElectra) SizeSSZ() int {
|
||||
return e.p.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ --
|
||||
func (e executionPayloadHeaderElectra) UnmarshalSSZ(buf []byte) error {
|
||||
return e.p.UnmarshalSSZ(buf)
|
||||
}
|
||||
|
||||
// HashTreeRoot --
|
||||
func (e executionPayloadHeaderElectra) HashTreeRoot() ([32]byte, error) {
|
||||
return e.p.HashTreeRoot()
|
||||
}
|
||||
|
||||
// HashTreeRootWith --
|
||||
func (e executionPayloadHeaderElectra) HashTreeRootWith(hh *fastssz.Hasher) error {
|
||||
return e.p.HashTreeRootWith(hh)
|
||||
}
|
||||
|
||||
// Proto --
|
||||
func (e executionPayloadHeaderElectra) Proto() proto.Message {
|
||||
return e.p
|
||||
}
|
||||
|
||||
// ParentHash --
|
||||
func (e executionPayloadHeaderElectra) ParentHash() []byte {
|
||||
return e.p.ParentHash
|
||||
}
|
||||
|
||||
// FeeRecipient --
|
||||
func (e executionPayloadHeaderElectra) FeeRecipient() []byte {
|
||||
return e.p.FeeRecipient
|
||||
}
|
||||
|
||||
// StateRoot --
|
||||
func (e executionPayloadHeaderElectra) StateRoot() []byte {
|
||||
return e.p.StateRoot
|
||||
}
|
||||
|
||||
// ReceiptsRoot --
|
||||
func (e executionPayloadHeaderElectra) ReceiptsRoot() []byte {
|
||||
return e.p.ReceiptsRoot
|
||||
}
|
||||
|
||||
// LogsBloom --
|
||||
func (e executionPayloadHeaderElectra) LogsBloom() []byte {
|
||||
return e.p.LogsBloom
|
||||
}
|
||||
|
||||
// PrevRandao --
|
||||
func (e executionPayloadHeaderElectra) PrevRandao() []byte {
|
||||
return e.p.PrevRandao
|
||||
}
|
||||
|
||||
// BlockNumber --
|
||||
func (e executionPayloadHeaderElectra) BlockNumber() uint64 {
|
||||
return e.p.BlockNumber
|
||||
}
|
||||
|
||||
// GasLimit --
|
||||
func (e executionPayloadHeaderElectra) GasLimit() uint64 {
|
||||
return e.p.GasLimit
|
||||
}
|
||||
|
||||
// GasUsed --
|
||||
func (e executionPayloadHeaderElectra) GasUsed() uint64 {
|
||||
return e.p.GasUsed
|
||||
}
|
||||
|
||||
// Timestamp --
|
||||
func (e executionPayloadHeaderElectra) Timestamp() uint64 {
|
||||
return e.p.Timestamp
|
||||
}
|
||||
|
||||
// ExtraData --
|
||||
func (e executionPayloadHeaderElectra) ExtraData() []byte {
|
||||
return e.p.ExtraData
|
||||
}
|
||||
|
||||
// BaseFeePerGas --
|
||||
func (e executionPayloadHeaderElectra) BaseFeePerGas() []byte {
|
||||
return e.p.BaseFeePerGas
|
||||
}
|
||||
|
||||
// BlockHash --
|
||||
func (e executionPayloadHeaderElectra) BlockHash() []byte {
|
||||
return e.p.BlockHash
|
||||
}
|
||||
|
||||
// Transactions --
|
||||
func (executionPayloadHeaderElectra) Transactions() ([][]byte, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// TransactionsRoot --
|
||||
func (e executionPayloadHeaderElectra) TransactionsRoot() ([]byte, error) {
|
||||
return e.p.TransactionsRoot, nil
|
||||
}
|
||||
|
||||
// Withdrawals --
|
||||
func (e executionPayloadHeaderElectra) Withdrawals() ([]*enginev1.Withdrawal, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// WithdrawalsRoot --
|
||||
func (e executionPayloadHeaderElectra) WithdrawalsRoot() ([]byte, error) {
|
||||
return e.p.WithdrawalsRoot, nil
|
||||
}
|
||||
|
||||
// BlobGasUsed --
|
||||
func (e executionPayloadHeaderElectra) BlobGasUsed() (uint64, error) {
|
||||
return e.p.BlobGasUsed, nil
|
||||
}
|
||||
|
||||
// ExcessBlobGas --
|
||||
func (e executionPayloadHeaderElectra) ExcessBlobGas() (uint64, error) {
|
||||
return e.p.ExcessBlobGas, nil
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (e executionPayloadHeaderElectra) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (executionPayloadHeaderElectra) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbBellatrix --
|
||||
func (executionPayloadHeaderElectra) PbBellatrix() (*enginev1.ExecutionPayload, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbCapella --
|
||||
func (executionPayloadHeaderElectra) PbCapella() (*enginev1.ExecutionPayloadCapella, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// ValueInWei --
|
||||
func (e executionPayloadHeaderElectra) ValueInWei() (math.Wei, error) {
|
||||
return e.weiValue, nil
|
||||
}
|
||||
|
||||
// ValueInGwei --
|
||||
func (e executionPayloadHeaderElectra) ValueInGwei() (uint64, error) {
|
||||
return e.gweiValue, nil
|
||||
}
|
||||
|
||||
// DepositReceipts --
|
||||
func (e executionPayloadHeaderElectra) DepositReceipts() ([]*enginev1.DepositReceipt, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// WithdrawalRequests --
|
||||
func (e executionPayloadHeaderElectra) WithdrawalRequests() ([]*enginev1.ExecutionLayerWithdrawalRequest, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// IsBlinded returns true if the underlying data is blinded.
|
||||
func (e executionPayloadHeaderElectra) IsBlinded() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// executionPayloadElectra is a convenience wrapper around a beacon block body's execution payload data structure
|
||||
// This wrapper allows us to conform to a common interface so that beacon
|
||||
// blocks for future forks can also be applied across Prysm without issues.
|
||||
type executionPayloadElectra struct {
|
||||
p *enginev1.ExecutionPayloadElectra
|
||||
weiValue math.Wei
|
||||
gweiValue uint64
|
||||
}
|
||||
|
||||
// WrappedExecutionPayloadElectra is a constructor which wraps a protobuf execution payload into an interface.
|
||||
func WrappedExecutionPayloadElectra(p *enginev1.ExecutionPayloadElectra, value math.Wei) (interfaces.ExecutionData, error) {
|
||||
w := executionPayloadElectra{p: p, weiValue: value, gweiValue: uint64(math.WeiToGwei(value))}
|
||||
if w.IsNil() {
|
||||
return nil, consensus_types.ErrNilObjectWrapped
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
var _ interfaces.ExecutionData = &executionPayloadElectra{}
|
||||
var _ interfaces.ExecutionDataElectra = &executionPayloadElectra{}
|
||||
|
||||
// IsNil checks if the underlying data is nil.
|
||||
func (e executionPayloadElectra) IsNil() bool {
|
||||
return e.p == nil
|
||||
}
|
||||
|
||||
// MarshalSSZ --
|
||||
func (e executionPayloadElectra) MarshalSSZ() ([]byte, error) {
|
||||
return e.p.MarshalSSZ()
|
||||
}
|
||||
|
||||
// MarshalSSZTo --
|
||||
func (e executionPayloadElectra) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return e.p.MarshalSSZTo(dst)
|
||||
}
|
||||
|
||||
// SizeSSZ --
|
||||
func (e executionPayloadElectra) SizeSSZ() int {
|
||||
return e.p.SizeSSZ()
|
||||
}
|
||||
|
||||
// UnmarshalSSZ --
|
||||
func (e executionPayloadElectra) UnmarshalSSZ(buf []byte) error {
|
||||
return e.p.UnmarshalSSZ(buf)
|
||||
}
|
||||
|
||||
// HashTreeRoot --
|
||||
func (e executionPayloadElectra) HashTreeRoot() ([32]byte, error) {
|
||||
return e.p.HashTreeRoot()
|
||||
}
|
||||
|
||||
// HashTreeRootWith --
|
||||
func (e executionPayloadElectra) HashTreeRootWith(hh *fastssz.Hasher) error {
|
||||
return e.p.HashTreeRootWith(hh)
|
||||
}
|
||||
|
||||
// Proto --
|
||||
func (e executionPayloadElectra) Proto() proto.Message {
|
||||
return e.p
|
||||
}
|
||||
|
||||
// ParentHash --
|
||||
func (e executionPayloadElectra) ParentHash() []byte {
|
||||
return e.p.ParentHash
|
||||
}
|
||||
|
||||
// FeeRecipient --
|
||||
func (e executionPayloadElectra) FeeRecipient() []byte {
|
||||
return e.p.FeeRecipient
|
||||
}
|
||||
|
||||
// StateRoot --
|
||||
func (e executionPayloadElectra) StateRoot() []byte {
|
||||
return e.p.StateRoot
|
||||
}
|
||||
|
||||
// ReceiptsRoot --
|
||||
func (e executionPayloadElectra) ReceiptsRoot() []byte {
|
||||
return e.p.ReceiptsRoot
|
||||
}
|
||||
|
||||
// LogsBloom --
|
||||
func (e executionPayloadElectra) LogsBloom() []byte {
|
||||
return e.p.LogsBloom
|
||||
}
|
||||
|
||||
// PrevRandao --
|
||||
func (e executionPayloadElectra) PrevRandao() []byte {
|
||||
return e.p.PrevRandao
|
||||
}
|
||||
|
||||
// BlockNumber --
|
||||
func (e executionPayloadElectra) BlockNumber() uint64 {
|
||||
return e.p.BlockNumber
|
||||
}
|
||||
|
||||
// GasLimit --
|
||||
func (e executionPayloadElectra) GasLimit() uint64 {
|
||||
return e.p.GasLimit
|
||||
}
|
||||
|
||||
// GasUsed --
|
||||
func (e executionPayloadElectra) GasUsed() uint64 {
|
||||
return e.p.GasUsed
|
||||
}
|
||||
|
||||
// Timestamp --
|
||||
func (e executionPayloadElectra) Timestamp() uint64 {
|
||||
return e.p.Timestamp
|
||||
}
|
||||
|
||||
// ExtraData --
|
||||
func (e executionPayloadElectra) ExtraData() []byte {
|
||||
return e.p.ExtraData
|
||||
}
|
||||
|
||||
// BaseFeePerGas --
|
||||
func (e executionPayloadElectra) BaseFeePerGas() []byte {
|
||||
return e.p.BaseFeePerGas
|
||||
}
|
||||
|
||||
// BlockHash --
|
||||
func (e executionPayloadElectra) BlockHash() []byte {
|
||||
return e.p.BlockHash
|
||||
}
|
||||
|
||||
// Transactions --
|
||||
func (e executionPayloadElectra) Transactions() ([][]byte, error) {
|
||||
return e.p.Transactions, nil
|
||||
}
|
||||
|
||||
// TransactionsRoot --
|
||||
func (e executionPayloadElectra) TransactionsRoot() ([]byte, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// Withdrawals --
|
||||
func (e executionPayloadElectra) Withdrawals() ([]*enginev1.Withdrawal, error) {
|
||||
return e.p.Withdrawals, nil
|
||||
}
|
||||
|
||||
// WithdrawalsRoot --
|
||||
func (e executionPayloadElectra) WithdrawalsRoot() ([]byte, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
func (e executionPayloadElectra) BlobGasUsed() (uint64, error) {
|
||||
return e.p.BlobGasUsed, nil
|
||||
}
|
||||
|
||||
func (e executionPayloadElectra) ExcessBlobGas() (uint64, error) {
|
||||
return e.p.ExcessBlobGas, nil
|
||||
}
|
||||
|
||||
// PbBellatrix --
|
||||
func (e executionPayloadElectra) PbBellatrix() (*enginev1.ExecutionPayload, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbCapella --
|
||||
func (e executionPayloadElectra) PbCapella() (*enginev1.ExecutionPayloadCapella, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbDeneb --
|
||||
func (e executionPayloadElectra) PbDeneb() (*enginev1.ExecutionPayloadDeneb, error) {
|
||||
return nil, consensus_types.ErrUnsupportedField
|
||||
}
|
||||
|
||||
// PbElectra --
|
||||
func (e executionPayloadElectra) PbElectra() (*enginev1.ExecutionPayloadElectra, error) {
|
||||
return e.p, nil
|
||||
}
|
||||
|
||||
// ValueInWei --
|
||||
func (e executionPayloadElectra) ValueInWei() (math.Wei, error) {
|
||||
return e.weiValue, nil
|
||||
}
|
||||
|
||||
// ValueInGwei --
|
||||
func (e executionPayloadElectra) ValueInGwei() (uint64, error) {
|
||||
return e.gweiValue, nil
|
||||
}
|
||||
|
||||
// DepositReceipts --
|
||||
func (e executionPayloadElectra) DepositReceipts() []*enginev1.DepositReceipt {
|
||||
return e.p.DepositReceipts
|
||||
}
|
||||
|
||||
// WithdrawalRequests --
|
||||
func (e executionPayloadElectra) WithdrawalRequests() []*enginev1.ExecutionLayerWithdrawalRequest {
|
||||
return e.p.WithdrawalRequests
|
||||
}
|
||||
|
||||
// IsBlinded returns true if the underlying data is blinded.
|
||||
func (e executionPayloadElectra) IsBlinded() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// PayloadValueToWei returns a Wei value given the payload's value
|
||||
func PayloadValueToWei(value []byte) math.Wei {
|
||||
// We have to convert big endian to little endian because the value is coming from the execution layer.
|
||||
|
||||
@@ -67,6 +67,14 @@ func NewSignedBeaconBlock(i interface{}) (interfaces.SignedBeaconBlock, error) {
|
||||
return initBlindedSignedBlockFromProtoDeneb(b)
|
||||
case *eth.GenericSignedBeaconBlock_BlindedDeneb:
|
||||
return initBlindedSignedBlockFromProtoDeneb(b.BlindedDeneb)
|
||||
case *eth.GenericSignedBeaconBlock_Electra:
|
||||
return initSignedBlockFromProtoElectra(b.Electra.Block)
|
||||
case *eth.SignedBeaconBlockElectra:
|
||||
return initSignedBlockFromProtoElectra(b)
|
||||
case *eth.SignedBlindedBeaconBlockElectra:
|
||||
return initBlindedSignedBlockFromProtoElectra(b)
|
||||
case *eth.GenericSignedBeaconBlock_BlindedElectra:
|
||||
return initBlindedSignedBlockFromProtoElectra(b.BlindedElectra)
|
||||
default:
|
||||
return nil, errors.Wrapf(ErrUnsupportedSignedBeaconBlock, "unable to create block from type %T", i)
|
||||
}
|
||||
@@ -109,6 +117,14 @@ func NewBeaconBlock(i interface{}) (interfaces.ReadOnlyBeaconBlock, error) {
|
||||
return initBlindedBlockFromProtoDeneb(b)
|
||||
case *eth.GenericBeaconBlock_BlindedDeneb:
|
||||
return initBlindedBlockFromProtoDeneb(b.BlindedDeneb)
|
||||
case *eth.GenericBeaconBlock_Electra:
|
||||
return initBlockFromProtoElectra(b.Electra.Block)
|
||||
case *eth.BeaconBlockElectra:
|
||||
return initBlockFromProtoElectra(b)
|
||||
case *eth.BlindedBeaconBlockElectra:
|
||||
return initBlindedBlockFromProtoElectra(b)
|
||||
case *eth.GenericBeaconBlock_BlindedElectra:
|
||||
return initBlindedBlockFromProtoElectra(b.BlindedElectra)
|
||||
default:
|
||||
return nil, errors.Wrapf(errUnsupportedBeaconBlock, "unable to create block from type %T", i)
|
||||
}
|
||||
@@ -135,6 +151,10 @@ func NewBeaconBlockBody(i interface{}) (interfaces.ReadOnlyBeaconBlockBody, erro
|
||||
return initBlockBodyFromProtoDeneb(b)
|
||||
case *eth.BlindedBeaconBlockBodyDeneb:
|
||||
return initBlindedBlockBodyFromProtoDeneb(b)
|
||||
case *eth.BeaconBlockBodyElectra:
|
||||
return initBlockBodyFromProtoElectra(b)
|
||||
case *eth.BlindedBeaconBlockBodyElectra:
|
||||
return initBlindedBlockBodyFromProtoElectra(b)
|
||||
default:
|
||||
return nil, errors.Wrapf(errUnsupportedBeaconBlockBody, "unable to create block body from type %T", i)
|
||||
}
|
||||
@@ -201,6 +221,19 @@ func BuildSignedBeaconBlock(blk interfaces.ReadOnlyBeaconBlock, signature []byte
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
return NewSignedBeaconBlock(ð.SignedBeaconBlockDeneb{Block: pb, Signature: signature})
|
||||
case version.Electra:
|
||||
if blk.IsBlinded() {
|
||||
pb, ok := pb.(*eth.BlindedBeaconBlockElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
return NewSignedBeaconBlock(ð.SignedBlindedBeaconBlockElectra{Message: pb, Signature: signature})
|
||||
}
|
||||
pb, ok := pb.(*eth.BeaconBlockElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
return NewSignedBeaconBlock(ð.SignedBeaconBlockElectra{Block: pb, Signature: signature})
|
||||
default:
|
||||
return nil, errUnsupportedBeaconBlock
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -537,3 +538,26 @@ func TestBuildSignedBeaconBlockFromExecutionPayload(t *testing.T) {
|
||||
require.DeepEqual(t, uint64(321), payload.BlobGasUsed)
|
||||
})
|
||||
}
|
||||
|
||||
func TestElectraBlockBodyCast(t *testing.T) {
|
||||
t.Run("deneb cast fails", func(t *testing.T) {
|
||||
pb := ð.BeaconBlockBodyDeneb{}
|
||||
i, err := NewBeaconBlockBody(pb)
|
||||
require.NoError(t, err)
|
||||
b, ok := i.(*BeaconBlockBody)
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, version.Deneb, b.version)
|
||||
_, err = interfaces.AsROBlockBodyElectra(b)
|
||||
require.ErrorIs(t, err, interfaces.ErrInvalidCast)
|
||||
})
|
||||
t.Run("electra cast succeeds", func(t *testing.T) {
|
||||
pb := ð.BeaconBlockBodyElectra{}
|
||||
i, err := NewBeaconBlockBody(pb)
|
||||
require.NoError(t, err)
|
||||
b, ok := i.(*BeaconBlockBody)
|
||||
require.Equal(t, true, ok)
|
||||
assert.Equal(t, version.Electra, b.version)
|
||||
_, err = interfaces.AsROBlockBodyElectra(b)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -81,6 +81,14 @@ func (b *SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) {
|
||||
}
|
||||
cp := eth.CopySignedBeaconBlockDeneb(pb.(*eth.SignedBeaconBlockDeneb))
|
||||
return initSignedBlockFromProtoDeneb(cp)
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
cp := eth.CopySignedBlindedBeaconBlockElectra(pb.(*eth.SignedBlindedBeaconBlockElectra))
|
||||
return initBlindedSignedBlockFromProtoElectra(cp)
|
||||
}
|
||||
cp := eth.CopySignedBeaconBlockElectra(pb.(*eth.SignedBeaconBlockElectra))
|
||||
return initSignedBlockFromProtoElectra(cp)
|
||||
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -128,6 +136,15 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_Deneb{Deneb: pb.(*eth.SignedBeaconBlockContentsDeneb)},
|
||||
}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_BlindedElectra{BlindedElectra: pb.(*eth.SignedBlindedBeaconBlockElectra)},
|
||||
}, nil
|
||||
}
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_Electra{Electra: pb.(*eth.SignedBeaconBlockContentsElectra)},
|
||||
}, nil
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -330,6 +347,40 @@ func (b *SignedBeaconBlock) ToBlinded() (interfaces.ReadOnlySignedBeaconBlock, e
|
||||
},
|
||||
Signature: b.signature[:],
|
||||
})
|
||||
case *enginev1.ExecutionPayloadElectra:
|
||||
pe, ok := payload.(interfaces.ExecutionDataElectra)
|
||||
if !ok {
|
||||
return nil, interfaces.ErrIncompatibleFork
|
||||
}
|
||||
header, err := PayloadToHeaderElectra(pe)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return initBlindedSignedBlockFromProtoElectra(
|
||||
ð.SignedBlindedBeaconBlockElectra{
|
||||
Message: ð.BlindedBeaconBlockElectra{
|
||||
Slot: b.block.slot,
|
||||
ProposerIndex: b.block.proposerIndex,
|
||||
ParentRoot: b.block.parentRoot[:],
|
||||
StateRoot: b.block.stateRoot[:],
|
||||
Body: ð.BlindedBeaconBlockBodyElectra{
|
||||
RandaoReveal: b.block.body.randaoReveal[:],
|
||||
Eth1Data: b.block.body.eth1Data,
|
||||
Graffiti: b.block.body.graffiti[:],
|
||||
ProposerSlashings: b.block.body.proposerSlashings,
|
||||
AttesterSlashings: b.block.body.attesterSlashingsElectra,
|
||||
Attestations: b.block.body.attestationsElectra,
|
||||
Deposits: b.block.body.deposits,
|
||||
VoluntaryExits: b.block.body.voluntaryExits,
|
||||
SyncAggregate: b.block.body.syncAggregate,
|
||||
ExecutionPayloadHeader: header,
|
||||
BlsToExecutionChanges: b.block.body.blsToExecutionChanges,
|
||||
BlobKzgCommitments: b.block.body.blobKzgCommitments,
|
||||
Consolidations: b.block.body.signedConsolidations,
|
||||
},
|
||||
},
|
||||
Signature: b.signature[:],
|
||||
})
|
||||
default:
|
||||
return nil, fmt.Errorf("%T is not an execution payload header", p)
|
||||
}
|
||||
@@ -459,6 +510,11 @@ func (b *SignedBeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockDeneb).MarshalSSZ()
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockDeneb).MarshalSSZ()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockElectra).MarshalSSZ()
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockElectra).MarshalSSZ()
|
||||
default:
|
||||
return []byte{}, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -491,6 +547,11 @@ func (b *SignedBeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockDeneb).MarshalSSZTo(dst)
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockDeneb).MarshalSSZTo(dst)
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockElectra).MarshalSSZTo(dst)
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockElectra).MarshalSSZTo(dst)
|
||||
default:
|
||||
return []byte{}, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -527,6 +588,11 @@ func (b *SignedBeaconBlock) SizeSSZ() int {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockDeneb).SizeSSZ()
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockDeneb).SizeSSZ()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.SignedBlindedBeaconBlockElectra).SizeSSZ()
|
||||
}
|
||||
return pb.(*eth.SignedBeaconBlockElectra).SizeSSZ()
|
||||
default:
|
||||
panic(incorrectBlockVersion)
|
||||
}
|
||||
@@ -622,6 +688,28 @@ func (b *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
pb := ð.SignedBlindedBeaconBlockElectra{}
|
||||
if err := pb.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
var err error
|
||||
newBlock, err = initBlindedSignedBlockFromProtoElectra(pb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
pb := ð.SignedBeaconBlockElectra{}
|
||||
if err := pb.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
var err error
|
||||
newBlock, err = initSignedBlockFromProtoElectra(pb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
return errIncorrectBlockVersion
|
||||
}
|
||||
@@ -695,6 +783,11 @@ func (b *BeaconBlock) HashTreeRoot() ([field_params.RootLength]byte, error) {
|
||||
return pb.(*eth.BlindedBeaconBlockDeneb).HashTreeRoot()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockDeneb).HashTreeRoot()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockElectra).HashTreeRoot()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockElectra).HashTreeRoot()
|
||||
default:
|
||||
return [field_params.RootLength]byte{}, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -726,6 +819,11 @@ func (b *BeaconBlock) HashTreeRootWith(h *ssz.Hasher) error {
|
||||
return pb.(*eth.BlindedBeaconBlockDeneb).HashTreeRootWith(h)
|
||||
}
|
||||
return pb.(*eth.BeaconBlockDeneb).HashTreeRootWith(h)
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockElectra).HashTreeRootWith(h)
|
||||
}
|
||||
return pb.(*eth.BeaconBlockElectra).HashTreeRootWith(h)
|
||||
default:
|
||||
return errIncorrectBlockVersion
|
||||
}
|
||||
@@ -758,6 +856,11 @@ func (b *BeaconBlock) MarshalSSZ() ([]byte, error) {
|
||||
return pb.(*eth.BlindedBeaconBlockDeneb).MarshalSSZ()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockDeneb).MarshalSSZ()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockElectra).MarshalSSZ()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockElectra).MarshalSSZ()
|
||||
default:
|
||||
return []byte{}, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -790,6 +893,11 @@ func (b *BeaconBlock) MarshalSSZTo(dst []byte) ([]byte, error) {
|
||||
return pb.(*eth.BlindedBeaconBlockDeneb).MarshalSSZTo(dst)
|
||||
}
|
||||
return pb.(*eth.BeaconBlockDeneb).MarshalSSZTo(dst)
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockElectra).MarshalSSZTo(dst)
|
||||
}
|
||||
return pb.(*eth.BeaconBlockElectra).MarshalSSZTo(dst)
|
||||
default:
|
||||
return []byte{}, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -826,6 +934,11 @@ func (b *BeaconBlock) SizeSSZ() int {
|
||||
return pb.(*eth.BlindedBeaconBlockDeneb).SizeSSZ()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockDeneb).SizeSSZ()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockElectra).SizeSSZ()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockElectra).SizeSSZ()
|
||||
default:
|
||||
panic(incorrectBodyVersion)
|
||||
}
|
||||
@@ -921,6 +1034,28 @@ func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
pb := ð.BlindedBeaconBlockElectra{}
|
||||
if err := pb.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
var err error
|
||||
newBlock, err = initBlindedBlockFromProtoElectra(pb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
pb := ð.BeaconBlockElectra{}
|
||||
if err := pb.UnmarshalSSZ(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
var err error
|
||||
newBlock, err = initBlockFromProtoElectra(pb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
return errIncorrectBlockVersion
|
||||
}
|
||||
@@ -954,6 +1089,11 @@ func (b *BeaconBlock) AsSignRequestObject() (validatorpb.SignRequestObject, erro
|
||||
return &validatorpb.SignRequest_BlindedBlockDeneb{BlindedBlockDeneb: pb.(*eth.BlindedBeaconBlockDeneb)}, nil
|
||||
}
|
||||
return &validatorpb.SignRequest_BlockDeneb{BlockDeneb: pb.(*eth.BeaconBlockDeneb)}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return &validatorpb.SignRequest_BlindedBlockElectra{BlindedBlockElectra: pb.(*eth.BlindedBeaconBlockElectra)}, nil
|
||||
}
|
||||
return &validatorpb.SignRequest_BlockElectra{BlockElectra: pb.(*eth.BeaconBlockElectra)}, nil
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -996,6 +1136,13 @@ func (b *BeaconBlock) Copy() (interfaces.ReadOnlyBeaconBlock, error) {
|
||||
}
|
||||
cp := eth.CopyBeaconBlockDeneb(pb.(*eth.BeaconBlockDeneb))
|
||||
return initBlockFromProtoDeneb(cp)
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
cp := eth.CopyBlindedBeaconBlockElectra(pb.(*eth.BlindedBeaconBlockElectra))
|
||||
return initBlindedBlockFromProtoElectra(cp)
|
||||
}
|
||||
cp := eth.CopyBeaconBlockElectra(pb.(*eth.BeaconBlockElectra))
|
||||
return initBlockFromProtoElectra(cp)
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
@@ -1079,13 +1226,17 @@ func (b *BeaconBlockBody) BlobKzgCommitments() ([][]byte, error) {
|
||||
switch b.version {
|
||||
case version.Phase0, version.Altair, version.Bellatrix, version.Capella:
|
||||
return nil, consensus_types.ErrNotSupported("BlobKzgCommitments", b.version)
|
||||
case version.Deneb:
|
||||
case version.Deneb, version.Electra:
|
||||
return b.blobKzgCommitments, nil
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) Consolidations() []*eth.SignedConsolidation {
|
||||
return b.signedConsolidations
|
||||
}
|
||||
|
||||
// Version returns the version of the beacon block body
|
||||
func (b *BeaconBlockBody) Version() int {
|
||||
return b.version
|
||||
@@ -1117,6 +1268,11 @@ func (b *BeaconBlockBody) HashTreeRoot() ([field_params.RootLength]byte, error)
|
||||
return pb.(*eth.BlindedBeaconBlockBodyDeneb).HashTreeRoot()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockBodyDeneb).HashTreeRoot()
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
return pb.(*eth.BlindedBeaconBlockBodyElectra).HashTreeRoot()
|
||||
}
|
||||
return pb.(*eth.BeaconBlockBodyElectra).HashTreeRoot()
|
||||
default:
|
||||
return [field_params.RootLength]byte{}, errIncorrectBodyVersion
|
||||
}
|
||||
|
||||
@@ -490,3 +490,9 @@ func hydrateBeaconBlockBody() *eth.BeaconBlockBody {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreElectraFailsInterfaceAssertion(t *testing.T) {
|
||||
var epd interfaces.ExecutionData = &executionPayloadDeneb{}
|
||||
_, ok := epd.(interfaces.ExecutionDataElectra)
|
||||
require.Equal(t, false, ok)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// Proto converts the signed beacon block to a protobuf object.
|
||||
func (b *SignedBeaconBlock) Proto() (proto.Message, error) {
|
||||
func (b *SignedBeaconBlock) Proto() (proto.Message, error) { // nolint:gocognit
|
||||
if b == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
@@ -131,13 +131,40 @@ func (b *SignedBeaconBlock) Proto() (proto.Message, error) {
|
||||
Block: block,
|
||||
Signature: b.signature[:],
|
||||
}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
var block *eth.BlindedBeaconBlockElectra
|
||||
if blockMessage != nil {
|
||||
var ok bool
|
||||
block, ok = blockMessage.(*eth.BlindedBeaconBlockElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
}
|
||||
return ð.SignedBlindedBeaconBlockElectra{
|
||||
Message: block,
|
||||
Signature: b.signature[:],
|
||||
}, nil
|
||||
}
|
||||
var block *eth.BeaconBlockElectra
|
||||
if blockMessage != nil {
|
||||
var ok bool
|
||||
block, ok = blockMessage.(*eth.BeaconBlockElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBlockVersion
|
||||
}
|
||||
}
|
||||
return ð.SignedBeaconBlockElectra{
|
||||
Block: block,
|
||||
Signature: b.signature[:],
|
||||
}, nil
|
||||
default:
|
||||
return nil, errors.New("unsupported signed beacon block version")
|
||||
}
|
||||
}
|
||||
|
||||
// Proto converts the beacon block to a protobuf object.
|
||||
func (b *BeaconBlock) Proto() (proto.Message, error) {
|
||||
func (b *BeaconBlock) Proto() (proto.Message, error) { // nolint:gocognit
|
||||
if b == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -279,6 +306,40 @@ func (b *BeaconBlock) Proto() (proto.Message, error) {
|
||||
StateRoot: b.stateRoot[:],
|
||||
Body: body,
|
||||
}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
var body *eth.BlindedBeaconBlockBodyElectra
|
||||
if bodyMessage != nil {
|
||||
var ok bool
|
||||
body, ok = bodyMessage.(*eth.BlindedBeaconBlockBodyElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBodyVersion
|
||||
}
|
||||
}
|
||||
return ð.BlindedBeaconBlockElectra{
|
||||
Slot: b.slot,
|
||||
ProposerIndex: b.proposerIndex,
|
||||
ParentRoot: b.parentRoot[:],
|
||||
StateRoot: b.stateRoot[:],
|
||||
Body: body,
|
||||
}, nil
|
||||
}
|
||||
var body *eth.BeaconBlockBodyElectra
|
||||
if bodyMessage != nil {
|
||||
var ok bool
|
||||
body, ok = bodyMessage.(*eth.BeaconBlockBodyElectra)
|
||||
if !ok {
|
||||
return nil, errIncorrectBodyVersion
|
||||
}
|
||||
}
|
||||
return ð.BeaconBlockElectra{
|
||||
Slot: b.slot,
|
||||
ProposerIndex: b.proposerIndex,
|
||||
ParentRoot: b.parentRoot[:],
|
||||
StateRoot: b.stateRoot[:],
|
||||
Body: body,
|
||||
}, nil
|
||||
|
||||
default:
|
||||
return nil, errors.New("unsupported beacon block version")
|
||||
}
|
||||
@@ -449,6 +510,56 @@ func (b *BeaconBlockBody) Proto() (proto.Message, error) {
|
||||
BlsToExecutionChanges: b.blsToExecutionChanges,
|
||||
BlobKzgCommitments: b.blobKzgCommitments,
|
||||
}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
var ph *enginev1.ExecutionPayloadHeaderElectra
|
||||
var ok bool
|
||||
if b.executionPayloadHeader != nil {
|
||||
ph, ok = b.executionPayloadHeader.Proto().(*enginev1.ExecutionPayloadHeaderElectra)
|
||||
if !ok {
|
||||
return nil, errPayloadHeaderWrongType
|
||||
}
|
||||
}
|
||||
return ð.BlindedBeaconBlockBodyElectra{
|
||||
RandaoReveal: b.randaoReveal[:],
|
||||
Eth1Data: b.eth1Data,
|
||||
Graffiti: b.graffiti[:],
|
||||
ProposerSlashings: b.proposerSlashings,
|
||||
AttesterSlashings: b.attesterSlashingsElectra,
|
||||
Attestations: b.attestationsElectra,
|
||||
Deposits: b.deposits,
|
||||
VoluntaryExits: b.voluntaryExits,
|
||||
SyncAggregate: b.syncAggregate,
|
||||
ExecutionPayloadHeader: ph,
|
||||
BlsToExecutionChanges: b.blsToExecutionChanges,
|
||||
BlobKzgCommitments: b.blobKzgCommitments,
|
||||
Consolidations: b.signedConsolidations,
|
||||
}, nil
|
||||
}
|
||||
var p *enginev1.ExecutionPayloadElectra
|
||||
var ok bool
|
||||
if b.executionPayload != nil {
|
||||
p, ok = b.executionPayload.Proto().(*enginev1.ExecutionPayloadElectra)
|
||||
if !ok {
|
||||
return nil, errPayloadWrongType
|
||||
}
|
||||
}
|
||||
return ð.BeaconBlockBodyElectra{
|
||||
RandaoReveal: b.randaoReveal[:],
|
||||
Eth1Data: b.eth1Data,
|
||||
Graffiti: b.graffiti[:],
|
||||
ProposerSlashings: b.proposerSlashings,
|
||||
AttesterSlashings: b.attesterSlashingsElectra,
|
||||
Attestations: b.attestationsElectra,
|
||||
Deposits: b.deposits,
|
||||
VoluntaryExits: b.voluntaryExits,
|
||||
SyncAggregate: b.syncAggregate,
|
||||
ExecutionPayload: p,
|
||||
BlsToExecutionChanges: b.blsToExecutionChanges,
|
||||
BlobKzgCommitments: b.blobKzgCommitments,
|
||||
Consolidations: b.signedConsolidations,
|
||||
}, nil
|
||||
|
||||
default:
|
||||
return nil, errors.New("unsupported beacon block body version")
|
||||
}
|
||||
@@ -539,6 +650,23 @@ func initSignedBlockFromProtoDeneb(pb *eth.SignedBeaconBlockDeneb) (*SignedBeaco
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initSignedBlockFromProtoElectra(pb *eth.SignedBeaconBlockElectra) (*SignedBeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
|
||||
block, err := initBlockFromProtoElectra(pb.Block)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := &SignedBeaconBlock{
|
||||
version: version.Electra,
|
||||
block: block,
|
||||
signature: bytesutil.ToBytes96(pb.Signature),
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedSignedBlockFromProtoBellatrix(pb *eth.SignedBlindedBeaconBlockBellatrix) (*SignedBeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
@@ -590,6 +718,23 @@ func initBlindedSignedBlockFromProtoDeneb(pb *eth.SignedBlindedBeaconBlockDeneb)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedSignedBlockFromProtoElectra(pb *eth.SignedBlindedBeaconBlockElectra) (*SignedBeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
|
||||
block, err := initBlindedBlockFromProtoElectra(pb.Message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := &SignedBeaconBlock{
|
||||
version: version.Electra,
|
||||
block: block,
|
||||
signature: bytesutil.ToBytes96(pb.Signature),
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlockFromProtoPhase0(pb *eth.BeaconBlock) (*BeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
@@ -710,6 +855,26 @@ func initBlockFromProtoDeneb(pb *eth.BeaconBlockDeneb) (*BeaconBlock, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlockFromProtoElectra(pb *eth.BeaconBlockElectra) (*BeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
|
||||
body, err := initBlockBodyFromProtoElectra(pb.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := &BeaconBlock{
|
||||
version: version.Electra,
|
||||
slot: pb.Slot,
|
||||
proposerIndex: pb.ProposerIndex,
|
||||
parentRoot: bytesutil.ToBytes32(pb.ParentRoot),
|
||||
stateRoot: bytesutil.ToBytes32(pb.StateRoot),
|
||||
body: body,
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedBlockFromProtoCapella(pb *eth.BlindedBeaconBlockCapella) (*BeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
@@ -750,6 +915,26 @@ func initBlindedBlockFromProtoDeneb(pb *eth.BlindedBeaconBlockDeneb) (*BeaconBlo
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedBlockFromProtoElectra(pb *eth.BlindedBeaconBlockElectra) (*BeaconBlock, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlock
|
||||
}
|
||||
|
||||
body, err := initBlindedBlockBodyFromProtoElectra(pb.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := &BeaconBlock{
|
||||
version: version.Electra,
|
||||
slot: pb.Slot,
|
||||
proposerIndex: pb.ProposerIndex,
|
||||
parentRoot: bytesutil.ToBytes32(pb.ParentRoot),
|
||||
stateRoot: bytesutil.ToBytes32(pb.StateRoot),
|
||||
body: body,
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlockBodyFromProtoPhase0(pb *eth.BeaconBlockBody) (*BeaconBlockBody, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlockBody
|
||||
@@ -923,6 +1108,35 @@ func initBlockBodyFromProtoDeneb(pb *eth.BeaconBlockBodyDeneb) (*BeaconBlockBody
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlockBodyFromProtoElectra(pb *eth.BeaconBlockBodyElectra) (*BeaconBlockBody, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlockBody
|
||||
}
|
||||
|
||||
p, err := WrappedExecutionPayloadElectra(pb.ExecutionPayload, big.NewInt(0))
|
||||
// We allow the payload to be nil
|
||||
if err != nil && err != consensus_types.ErrNilObjectWrapped {
|
||||
return nil, err
|
||||
}
|
||||
b := &BeaconBlockBody{
|
||||
version: version.Electra,
|
||||
randaoReveal: bytesutil.ToBytes96(pb.RandaoReveal),
|
||||
eth1Data: pb.Eth1Data,
|
||||
graffiti: bytesutil.ToBytes32(pb.Graffiti),
|
||||
proposerSlashings: pb.ProposerSlashings,
|
||||
attesterSlashingsElectra: pb.AttesterSlashings,
|
||||
attestationsElectra: pb.Attestations,
|
||||
deposits: pb.Deposits,
|
||||
voluntaryExits: pb.VoluntaryExits,
|
||||
syncAggregate: pb.SyncAggregate,
|
||||
executionPayload: p,
|
||||
blsToExecutionChanges: pb.BlsToExecutionChanges,
|
||||
blobKzgCommitments: pb.BlobKzgCommitments,
|
||||
signedConsolidations: pb.Consolidations,
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedBlockBodyFromProtoDeneb(pb *eth.BlindedBeaconBlockBodyDeneb) (*BeaconBlockBody, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlockBody
|
||||
@@ -950,3 +1164,32 @@ func initBlindedBlockBodyFromProtoDeneb(pb *eth.BlindedBeaconBlockBodyDeneb) (*B
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func initBlindedBlockBodyFromProtoElectra(pb *eth.BlindedBeaconBlockBodyElectra) (*BeaconBlockBody, error) {
|
||||
if pb == nil {
|
||||
return nil, errNilBlockBody
|
||||
}
|
||||
|
||||
ph, err := WrappedExecutionPayloadHeaderElectra(pb.ExecutionPayloadHeader, big.NewInt(0))
|
||||
// We allow the payload to be nil
|
||||
if err != nil && err != consensus_types.ErrNilObjectWrapped {
|
||||
return nil, err
|
||||
}
|
||||
b := &BeaconBlockBody{
|
||||
version: version.Electra,
|
||||
randaoReveal: bytesutil.ToBytes96(pb.RandaoReveal),
|
||||
eth1Data: pb.Eth1Data,
|
||||
graffiti: bytesutil.ToBytes32(pb.Graffiti),
|
||||
proposerSlashings: pb.ProposerSlashings,
|
||||
attesterSlashingsElectra: pb.AttesterSlashings,
|
||||
attestationsElectra: pb.Attestations,
|
||||
deposits: pb.Deposits,
|
||||
voluntaryExits: pb.VoluntaryExits,
|
||||
syncAggregate: pb.SyncAggregate,
|
||||
executionPayloadHeader: ph,
|
||||
blsToExecutionChanges: pb.BlsToExecutionChanges,
|
||||
blobKzgCommitments: pb.BlobKzgCommitments,
|
||||
signedConsolidations: pb.Consolidations,
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func (b *SignedBeaconBlock) SetBlobKzgCommitments(c [][]byte) error {
|
||||
switch b.version {
|
||||
case version.Phase0, version.Altair, version.Bellatrix, version.Capella:
|
||||
return consensus_types.ErrNotSupported("SetBlobKzgCommitments", b.version)
|
||||
case version.Deneb:
|
||||
case version.Deneb, version.Electra:
|
||||
b.block.body.blobKzgCommitments = c
|
||||
return nil
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,6 @@ go_library(
|
||||
"//consensus-types/interfaces:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
)
|
||||
|
||||
type blockMutator struct {
|
||||
@@ -16,38 +15,23 @@ type blockMutator struct {
|
||||
}
|
||||
|
||||
func (m blockMutator) apply(b interfaces.SignedBeaconBlock) (interfaces.SignedBeaconBlock, error) {
|
||||
switch b.Version() {
|
||||
case version.Phase0:
|
||||
bb, err := b.PbPhase0Block()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.Phase0(bb)
|
||||
return blocks.NewSignedBeaconBlock(bb)
|
||||
case version.Altair:
|
||||
bb, err := b.PbAltairBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.Altair(bb)
|
||||
return blocks.NewSignedBeaconBlock(bb)
|
||||
case version.Bellatrix:
|
||||
bb, err := b.PbBellatrixBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.Bellatrix(bb)
|
||||
return blocks.NewSignedBeaconBlock(bb)
|
||||
case version.Capella:
|
||||
bb, err := b.PbCapellaBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.Capella(bb)
|
||||
return blocks.NewSignedBeaconBlock(bb)
|
||||
pb, err := b.Proto()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch pbStruct := pb.(type) {
|
||||
case *eth.SignedBeaconBlock:
|
||||
m.Phase0(pbStruct)
|
||||
case *eth.SignedBeaconBlockAltair:
|
||||
m.Altair(pbStruct)
|
||||
case *eth.SignedBeaconBlockBellatrix:
|
||||
m.Bellatrix(pbStruct)
|
||||
case *eth.SignedBeaconBlockCapella:
|
||||
m.Capella(pbStruct)
|
||||
default:
|
||||
return nil, blocks.ErrUnsupportedSignedBeaconBlock
|
||||
}
|
||||
return blocks.NewSignedBeaconBlock(pb)
|
||||
}
|
||||
|
||||
// SetBlockStateRoot modifies the block's state root.
|
||||
|
||||
@@ -38,22 +38,28 @@ var (
|
||||
|
||||
// BeaconBlockBody is the main beacon block body structure. It can represent any block type.
|
||||
type BeaconBlockBody struct {
|
||||
version int
|
||||
randaoReveal [field_params.BLSSignatureLength]byte
|
||||
eth1Data *eth.Eth1Data
|
||||
graffiti [field_params.RootLength]byte
|
||||
proposerSlashings []*eth.ProposerSlashing
|
||||
attesterSlashings []*eth.AttesterSlashing
|
||||
attestations []*eth.Attestation
|
||||
deposits []*eth.Deposit
|
||||
voluntaryExits []*eth.SignedVoluntaryExit
|
||||
syncAggregate *eth.SyncAggregate
|
||||
executionPayload interfaces.ExecutionData
|
||||
executionPayloadHeader interfaces.ExecutionData
|
||||
blsToExecutionChanges []*eth.SignedBLSToExecutionChange
|
||||
blobKzgCommitments [][]byte
|
||||
version int
|
||||
randaoReveal [field_params.BLSSignatureLength]byte
|
||||
eth1Data *eth.Eth1Data
|
||||
graffiti [field_params.RootLength]byte
|
||||
proposerSlashings []*eth.ProposerSlashing
|
||||
attesterSlashings []*eth.AttesterSlashing
|
||||
attesterSlashingsElectra []*eth.AttesterSlashingElectra
|
||||
attestations []*eth.Attestation
|
||||
attestationsElectra []*eth.AttestationElectra
|
||||
deposits []*eth.Deposit
|
||||
voluntaryExits []*eth.SignedVoluntaryExit
|
||||
syncAggregate *eth.SyncAggregate
|
||||
executionPayload interfaces.ExecutionData
|
||||
executionPayloadHeader interfaces.ExecutionData
|
||||
blsToExecutionChanges []*eth.SignedBLSToExecutionChange
|
||||
blobKzgCommitments [][]byte
|
||||
signedConsolidations []*eth.SignedConsolidation
|
||||
}
|
||||
|
||||
var _ interfaces.ReadOnlyBeaconBlockBody = &BeaconBlockBody{}
|
||||
var _ interfaces.ROBlockBodyElectra = &BeaconBlockBody{}
|
||||
|
||||
// BeaconBlock is the main beacon block structure. It can represent any block type.
|
||||
type BeaconBlock struct {
|
||||
version int
|
||||
|
||||
@@ -4,6 +4,8 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"beacon_block.go",
|
||||
"cast.go",
|
||||
"error.go",
|
||||
"utils.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces",
|
||||
@@ -15,6 +17,7 @@ go_library(
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
@@ -23,14 +26,19 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["utils_test.go"],
|
||||
srcs = [
|
||||
"error_test.go",
|
||||
"utils_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
":go_default_library",
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
ssz "github.com/prysmaticlabs/fastssz"
|
||||
field_params "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
@@ -11,6 +12,8 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var ErrIncompatibleFork = errors.New("Can't convert to fork-specific interface")
|
||||
|
||||
// ReadOnlySignedBeaconBlock is an interface describing the method set of
|
||||
// a signed beacon block.
|
||||
type ReadOnlySignedBeaconBlock interface {
|
||||
@@ -79,6 +82,11 @@ type ReadOnlyBeaconBlockBody interface {
|
||||
BlobKzgCommitments() ([][]byte, error)
|
||||
}
|
||||
|
||||
type ROBlockBodyElectra interface {
|
||||
ReadOnlyBeaconBlockBody
|
||||
Consolidations() []*ethpb.SignedConsolidation
|
||||
}
|
||||
|
||||
type SignedBeaconBlock interface {
|
||||
ReadOnlySignedBeaconBlock
|
||||
SetExecution(ExecutionData) error
|
||||
@@ -132,6 +140,13 @@ type ExecutionData interface {
|
||||
PbCapella() (*enginev1.ExecutionPayloadCapella, error)
|
||||
PbBellatrix() (*enginev1.ExecutionPayload, error)
|
||||
PbDeneb() (*enginev1.ExecutionPayloadDeneb, error)
|
||||
PbElectra() (*enginev1.ExecutionPayloadElectra, error)
|
||||
ValueInWei() (math.Wei, error)
|
||||
ValueInGwei() (uint64, error)
|
||||
}
|
||||
|
||||
type ExecutionDataElectra interface {
|
||||
ExecutionData
|
||||
DepositReceipts() []*enginev1.DepositReceipt
|
||||
WithdrawalRequests() []*enginev1.ExecutionLayerWithdrawalRequest
|
||||
}
|
||||
|
||||
15
consensus-types/interfaces/cast.go
Normal file
15
consensus-types/interfaces/cast.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package interfaces
|
||||
|
||||
import "github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
|
||||
// AsROBlockBodyElectra safely asserts the ReadOnlyBeaconBlockBody to a ROBlockBodyElectra.
|
||||
// This allows the caller to access methods on the block body which are only available on values after
|
||||
// the Electra hard fork. If the value is for an earlier fork (based on comparing its Version() to the electra version)
|
||||
// an error will be returned. Callers that want to conditionally process electra data can check for this condition
|
||||
// and safely ignore it like `if err != nil && errors.Is(interfaces.ErrInvalidCast) {`
|
||||
func AsROBlockBodyElectra(in ReadOnlyBeaconBlockBody) (ROBlockBodyElectra, error) {
|
||||
if in.Version() >= version.Electra {
|
||||
return in.(ROBlockBodyElectra), nil
|
||||
}
|
||||
return nil, NewInvalidCastError(in.Version(), version.Electra)
|
||||
}
|
||||
27
consensus-types/interfaces/error.go
Normal file
27
consensus-types/interfaces/error.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
)
|
||||
|
||||
var ErrInvalidCast = errors.New("unable to cast between types")
|
||||
|
||||
type InvalidCastError struct {
|
||||
from int
|
||||
to int
|
||||
}
|
||||
|
||||
func (e *InvalidCastError) Error() string {
|
||||
return errors.Wrapf(ErrInvalidCast,
|
||||
"from=%s(%d), to=%s(%d)", version.String(e.from), e.from, version.String(e.to), e.to).
|
||||
Error()
|
||||
}
|
||||
|
||||
func (e *InvalidCastError) Is(err error) bool {
|
||||
return errors.Is(err, ErrInvalidCast)
|
||||
}
|
||||
|
||||
func NewInvalidCastError(from, to int) *InvalidCastError {
|
||||
return &InvalidCastError{from: from, to: to}
|
||||
}
|
||||
14
consensus-types/interfaces/error_test.go
Normal file
14
consensus-types/interfaces/error_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||
)
|
||||
|
||||
func TestNewInvalidCastError(t *testing.T) {
|
||||
err := NewInvalidCastError(version.Phase0, version.Electra)
|
||||
require.Equal(t, true, errors.Is(err, ErrInvalidCast))
|
||||
}
|
||||
@@ -313,6 +313,10 @@ func (b *BeaconBlockBody) BlobKzgCommitments() ([][]byte, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) Consolidations() []*eth.SignedConsolidation {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (b *BeaconBlockBody) Attestations() []*eth.Attestation {
|
||||
panic("implement me")
|
||||
}
|
||||
@@ -324,3 +328,4 @@ func (b *BeaconBlockBody) Version() int {
|
||||
var _ interfaces.ReadOnlySignedBeaconBlock = &SignedBeaconBlock{}
|
||||
var _ interfaces.ReadOnlyBeaconBlock = &BeaconBlock{}
|
||||
var _ interfaces.ReadOnlyBeaconBlockBody = &BeaconBlockBody{}
|
||||
var _ interfaces.ROBlockBodyElectra = &BeaconBlockBody{}
|
||||
|
||||
@@ -40,6 +40,7 @@ go_test(
|
||||
"//config/fieldparams:go_default_library",
|
||||
"//config/params:go_default_library",
|
||||
"//crypto/hash:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
|
||||
@@ -141,6 +141,56 @@ func WithdrawalSliceRoot(withdrawals []*enginev1.Withdrawal, limit uint64) ([32]
|
||||
return MixInLength(bytesRoot, bytesRootBufRoot), nil
|
||||
}
|
||||
|
||||
// DepositReceiptSliceRoot computes the HTR of a slice of deposit receipts.
|
||||
// The limit parameter is used as input to the bitwise merkleization algorithm.
|
||||
func DepositReceiptSliceRoot(depositReceipts []*enginev1.DepositReceipt, limit uint64) ([32]byte, error) {
|
||||
roots := make([][32]byte, len(depositReceipts))
|
||||
for i := 0; i < len(depositReceipts); i++ {
|
||||
r, err := depositReceipts[i].HashTreeRoot()
|
||||
if err != nil {
|
||||
return [32]byte{}, err
|
||||
}
|
||||
roots[i] = r
|
||||
}
|
||||
|
||||
bytesRoot, err := BitwiseMerkleize(roots, uint64(len(roots)), limit)
|
||||
if err != nil {
|
||||
return [32]byte{}, errors.Wrap(err, "could not compute merkleization")
|
||||
}
|
||||
bytesRootBuf := new(bytes.Buffer)
|
||||
if err := binary.Write(bytesRootBuf, binary.LittleEndian, uint64(len(depositReceipts))); err != nil {
|
||||
return [32]byte{}, errors.Wrap(err, "could not marshal length")
|
||||
}
|
||||
bytesRootBufRoot := make([]byte, 32)
|
||||
copy(bytesRootBufRoot, bytesRootBuf.Bytes())
|
||||
return MixInLength(bytesRoot, bytesRootBufRoot), nil
|
||||
}
|
||||
|
||||
// WithdrawalRequestSliceRoot computes the HTR of a slice of withdrawal requests from the EL.
|
||||
// The limit parameter is used as input to the bitwise merkleization algorithm.
|
||||
func WithdrawalRequestSliceRoot(withdrawalRequests []*enginev1.ExecutionLayerWithdrawalRequest, limit uint64) ([32]byte, error) {
|
||||
roots := make([][32]byte, len(withdrawalRequests))
|
||||
for i := 0; i < len(withdrawalRequests); i++ {
|
||||
r, err := withdrawalRequests[i].HashTreeRoot()
|
||||
if err != nil {
|
||||
return [32]byte{}, err
|
||||
}
|
||||
roots[i] = r
|
||||
}
|
||||
|
||||
bytesRoot, err := BitwiseMerkleize(roots, uint64(len(roots)), limit)
|
||||
if err != nil {
|
||||
return [32]byte{}, errors.Wrap(err, "could not compute merkleization")
|
||||
}
|
||||
bytesRootBuf := new(bytes.Buffer)
|
||||
if err := binary.Write(bytesRootBuf, binary.LittleEndian, uint64(len(withdrawalRequests))); err != nil {
|
||||
return [32]byte{}, errors.Wrap(err, "could not marshal length")
|
||||
}
|
||||
bytesRootBufRoot := make([]byte, 32)
|
||||
copy(bytesRootBufRoot, bytesRootBuf.Bytes())
|
||||
return MixInLength(bytesRoot, bytesRootBufRoot), nil
|
||||
}
|
||||
|
||||
// ByteSliceRoot is a helper func to merkleize an arbitrary List[Byte, N]
|
||||
// this func runs Chunkify + MerkleizeVector
|
||||
// max length is dividable by 32 ( root length )
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/ssz"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
@@ -279,3 +280,75 @@ func TestWithrawalSliceRoot(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDepositReceiptSliceRoot(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input []*enginev1.DepositReceipt
|
||||
limit uint64
|
||||
want [32]byte
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
input: make([]*enginev1.DepositReceipt, 0),
|
||||
want: [32]byte{0xf5, 0xa5, 0xfd, 0x42, 0xd1, 0x6a, 0x20, 0x30, 0x27, 0x98, 0xef, 0x6e, 0xd3, 0x9, 0x97, 0x9b, 0x43, 0x0, 0x3d, 0x23, 0x20, 0xd9, 0xf0, 0xe8, 0xea, 0x98, 0x31, 0xa9, 0x27, 0x59, 0xfb, 0x4b},
|
||||
},
|
||||
{
|
||||
name: "non-empty",
|
||||
input: []*enginev1.DepositReceipt{
|
||||
{
|
||||
Pubkey: bytesutil.PadTo([]byte{0x01, 0x02}, 48),
|
||||
WithdrawalCredentials: bytesutil.PadTo([]byte{0x03, 0x04}, 32),
|
||||
Amount: 5,
|
||||
Signature: bytesutil.PadTo([]byte{0x06, 0x07}, 96),
|
||||
Index: 8,
|
||||
},
|
||||
},
|
||||
limit: 16,
|
||||
want: [32]byte{0x34, 0xe3, 0x76, 0x5, 0xe5, 0x12, 0xe4, 0x75, 0x14, 0xf6, 0x72, 0x1c, 0x56, 0x5a, 0xa7, 0xf8, 0x8d, 0xaf, 0x84, 0xb7, 0xd7, 0x3e, 0xe6, 0x5f, 0x3f, 0xb1, 0x9f, 0x41, 0xf0, 0x10, 0x2b, 0xe6},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := ssz.DepositReceiptSliceRoot(tt.input, tt.limit)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawalRequestSliceRoot(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input []*enginev1.ExecutionLayerWithdrawalRequest
|
||||
limit uint64
|
||||
want [32]byte
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
input: make([]*enginev1.ExecutionLayerWithdrawalRequest, 0),
|
||||
want: [32]byte{0xf5, 0xa5, 0xfd, 0x42, 0xd1, 0x6a, 0x20, 0x30, 0x27, 0x98, 0xef, 0x6e, 0xd3, 0x9, 0x97, 0x9b, 0x43, 0x0, 0x3d, 0x23, 0x20, 0xd9, 0xf0, 0xe8, 0xea, 0x98, 0x31, 0xa9, 0x27, 0x59, 0xfb, 0x4b},
|
||||
},
|
||||
{
|
||||
name: "non-empty",
|
||||
input: []*enginev1.ExecutionLayerWithdrawalRequest{
|
||||
{
|
||||
SourceAddress: bytesutil.PadTo([]byte{0x01, 0x02}, 20),
|
||||
ValidatorPubkey: bytesutil.PadTo([]byte{0x03, 0x04}, 48),
|
||||
Amount: 5,
|
||||
},
|
||||
},
|
||||
limit: 16,
|
||||
want: [32]byte{0xa8, 0xab, 0xb2, 0x20, 0xe6, 0xd6, 0x5a, 0x7e, 0x56, 0x60, 0xe4, 0x9d, 0xae, 0x36, 0x17, 0x3d, 0x8b, 0xd, 0xde, 0x28, 0x96, 0x5, 0x82, 0x72, 0x18, 0xda, 0xc7, 0x5a, 0x53, 0xe0, 0x35, 0xf7},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := ssz.WithdrawalRequestSliceRoot(tt.input, tt.limit)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,13 @@ ssz_gen_marshal(
|
||||
"ExecutionPayloadHeaderCapella",
|
||||
"ExecutionPayloadHeaderDeneb",
|
||||
"ExecutionPayloadDeneb",
|
||||
"ExecutionPayloadHeaderElectra",
|
||||
"ExecutionPayloadElectra",
|
||||
"BlindedBlobsBundle",
|
||||
"BlobsBundle",
|
||||
"Withdrawal",
|
||||
"ExecutionLayerWithdrawalRequest",
|
||||
"DepositReceipt",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
1398
proto/engine/v1/execution_engine.pb.go
generated
1398
proto/engine/v1/execution_engine.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -86,6 +86,29 @@ message ExecutionPayloadDeneb {
|
||||
uint64 excess_blob_gas = 17;
|
||||
}
|
||||
|
||||
message ExecutionPayloadElectra {
|
||||
bytes parent_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes fee_recipient = 2 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
bytes state_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes receipts_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "logs_bloom.size"];
|
||||
bytes prev_randao = 6 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 block_number = 7;
|
||||
uint64 gas_limit = 8;
|
||||
uint64 gas_used = 9;
|
||||
uint64 timestamp = 10;
|
||||
bytes extra_data = 11 [(ethereum.eth.ext.ssz_max) = "extra_data.size"];
|
||||
bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
repeated bytes transactions = 14 [(ethereum.eth.ext.ssz_size) = "?,?", (ethereum.eth.ext.ssz_max) = "1048576,1073741824"];
|
||||
// MAX_WITHDRAWALS_PER_PAYLOAD
|
||||
repeated Withdrawal withdrawals = 15 [(ethereum.eth.ext.ssz_max) = "withdrawal.size"];
|
||||
uint64 blob_gas_used = 16;
|
||||
uint64 excess_blob_gas = 17;
|
||||
repeated DepositReceipt deposit_receipts = 18 [(ethereum.eth.ext.ssz_max) = "max_deposit_receipts"]; // new in electra, eip6110
|
||||
repeated ExecutionLayerWithdrawalRequest withdrawal_requests = 19 [(ethereum.eth.ext.ssz_max) = "max_withdrawal_requests_per_payload.size"]; // new in electra, eip7002, eip7251
|
||||
}
|
||||
|
||||
message ExecutionPayloadCapellaWithValue {
|
||||
ExecutionPayloadCapella payload = 1;
|
||||
bytes value = 2;
|
||||
@@ -154,6 +177,28 @@ message ExecutionPayloadHeaderDeneb {
|
||||
uint64 excess_blob_gas = 17;
|
||||
}
|
||||
|
||||
message ExecutionPayloadHeaderElectra {
|
||||
bytes parent_hash = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes fee_recipient = 2 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
bytes state_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes receipts_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes logs_bloom = 5 [(ethereum.eth.ext.ssz_size) = "logs_bloom.size"];
|
||||
bytes prev_randao = 6 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 block_number = 7;
|
||||
uint64 gas_limit = 8;
|
||||
uint64 gas_used = 9;
|
||||
uint64 timestamp = 10;
|
||||
bytes extra_data = 11 [(ethereum.eth.ext.ssz_max) = "extra_data.size"];
|
||||
bytes base_fee_per_gas = 12 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes block_hash = 13 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes transactions_root = 14 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes withdrawals_root = 15 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 blob_gas_used = 16;
|
||||
uint64 excess_blob_gas = 17;
|
||||
bytes deposit_receipts_root = 18 [(ethereum.eth.ext.ssz_size) = "32"]; // new in electra, eip6110
|
||||
bytes withdrawal_requests_root = 19 [(ethereum.eth.ext.ssz_size) = "32"]; // new in electra, eip7002, eip7251
|
||||
}
|
||||
|
||||
message PayloadAttributes {
|
||||
uint64 timestamp = 1;
|
||||
bytes prev_randao = 2 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
@@ -232,3 +277,26 @@ message Blob {
|
||||
message ExchangeCapabilities {
|
||||
repeated string supported_methods = 1;
|
||||
}
|
||||
|
||||
// ExecutionLayerWithdrawalRequest is the message from the execution layer to trigger the withdrawal of a validator's balance to its withdrawal address
|
||||
// new in Electra
|
||||
message ExecutionLayerWithdrawalRequest {
|
||||
// The execution address receiving the funds
|
||||
bytes source_address = 1 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
|
||||
// 48 byte BLS public key of the validator.
|
||||
bytes validator_pubkey = 2 [(ethereum.eth.ext.ssz_size) = "48"];
|
||||
|
||||
// Deposit amount in gwei.
|
||||
uint64 amount = 3;
|
||||
}
|
||||
|
||||
// DepositReceipt is the message from the execution layer to trigger the deposit of a validator's balance to its balance
|
||||
// new in Electra
|
||||
message DepositReceipt {
|
||||
bytes pubkey = 1 [(ethereum.eth.ext.ssz_size) = "48"];
|
||||
bytes withdrawal_credentials = 2 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 amount = 3;
|
||||
bytes signature = 4 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
uint64 index = 5;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 5890b3492dbdff08d332879e83ae45e7bd9f94da0716b1b0517f1766028a8d67
|
||||
// Hash: 13c946aa898cca1afa84687b619bc5a10fc79a46340e98dcfb07dde835d39a0c
|
||||
package v1
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by fastssz. DO NOT EDIT.
|
||||
// Hash: 2ed480e3c144fb091e0aa2757a79e78da573f90b18d0d8acd35fa9705f6c1b08
|
||||
// Hash: 6b214399116c0ca31026da23db2b85fccd78e16d7b9113c83b4a9ee4e60977f6
|
||||
package eth
|
||||
|
||||
import (
|
||||
|
||||
@@ -18,6 +18,7 @@ proto_library(
|
||||
srcs = [
|
||||
"beacon_chain.proto",
|
||||
"debug.proto",
|
||||
"eip_7251.proto",
|
||||
"finalized_block_root_container.proto",
|
||||
"health.proto",
|
||||
"node.proto",
|
||||
@@ -67,6 +68,9 @@ ssz_gen_marshal(
|
||||
"BeaconBlockDeneb",
|
||||
"BeaconBlockBodyDeneb",
|
||||
"SignedBeaconBlockDeneb",
|
||||
"BeaconBlockElectra",
|
||||
"BeaconBlockElectra",
|
||||
"SignedBeaconBlockElectra",
|
||||
"SignedBlindedBeaconBlockCapella",
|
||||
"BlindedBeaconBlockCapella",
|
||||
"BlindedBeaconBlockBodyCapella",
|
||||
@@ -75,6 +79,9 @@ ssz_gen_marshal(
|
||||
"SignedBeaconBlockContentsDeneb",
|
||||
"BlindedBeaconBlockDeneb",
|
||||
"BlindedBeaconBlockBodyDeneb",
|
||||
"SignedBlindedBeaconBlockElectra",
|
||||
"BlindedBeaconBlockElectra",
|
||||
"BlindedBeaconBlockBodyElectra",
|
||||
"SyncAggregate",
|
||||
"SyncCommitteeMessage",
|
||||
"SyncCommitteeContribution",
|
||||
@@ -87,17 +94,22 @@ ssz_gen_marshal(
|
||||
"MetaDataV1",
|
||||
"Status",
|
||||
"AggregateAttestationAndProof",
|
||||
"AggregateAttestationAndProofElectra",
|
||||
"Attestation",
|
||||
"AttestationElectra",
|
||||
"AttestationData",
|
||||
"AttesterSlashing",
|
||||
"AttesterSlashingElectra",
|
||||
"BeaconBlock",
|
||||
"BeaconBlockHeader",
|
||||
"Checkpoint",
|
||||
"Deposit",
|
||||
"Eth1Data",
|
||||
"IndexedAttestation",
|
||||
"IndexedAttestationElectra",
|
||||
"ProposerSlashing",
|
||||
"SignedAggregateAttestationAndProof",
|
||||
"SignedAggregateAttestationAndProofElectra",
|
||||
"SignedBeaconBlock",
|
||||
"SignedBeaconBlockHeader",
|
||||
"SignedVoluntaryExit",
|
||||
@@ -115,6 +127,7 @@ ssz_gen_marshal(
|
||||
"BeaconStateBellatrix",
|
||||
"BeaconStateCapella",
|
||||
"BeaconStateDeneb",
|
||||
"BeaconStateElectra",
|
||||
"SigningData",
|
||||
"SyncCommittee",
|
||||
"SyncAggregatorSelectionData",
|
||||
@@ -131,6 +144,11 @@ ssz_gen_marshal(
|
||||
"BlobSidecars",
|
||||
"BlobIdentifier",
|
||||
"DepositSnapshot",
|
||||
"PendingBalanceDeposit",
|
||||
"PendingPartialWithdrawal",
|
||||
"Consolidation",
|
||||
"SignedConsolidation",
|
||||
"PendingConsolidation",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -188,6 +206,7 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"cloners.go",
|
||||
"eip_7251.go",
|
||||
"sync_committee_mainnet.go",
|
||||
"sync_committee_minimal.go", # keep
|
||||
":ssz_generated_files", # keep
|
||||
@@ -241,7 +260,10 @@ ssz_proto_files(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["cloners_test.go"],
|
||||
srcs = [
|
||||
"cloners_test.go",
|
||||
"eip_7251_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//testing/assert:go_default_library",
|
||||
|
||||
1
proto/prysm/v1alpha1/attestation.go
Normal file
1
proto/prysm/v1alpha1/attestation.go
Normal file
@@ -0,0 +1 @@
|
||||
package eth
|
||||
455
proto/prysm/v1alpha1/attestation.pb.go
generated
455
proto/prysm/v1alpha1/attestation.pb.go
generated
@@ -87,6 +87,77 @@ func (x *Attestation) GetSignature() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AttestationElectra struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AggregationBits github_com_prysmaticlabs_go_bitfield.Bitlist `protobuf:"bytes,1,opt,name=aggregation_bits,json=aggregationBits,proto3" json:"aggregation_bits,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitlist" ssz-max:"131072"`
|
||||
Data *AttestationData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
CommitteeBits github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,4,opt,name=committee_bits,json=committeeBits,proto3" json:"committee_bits,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector64" ssz-size:"8"`
|
||||
Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) Reset() {
|
||||
*x = AttestationElectra{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AttestationElectra) ProtoMessage() {}
|
||||
|
||||
func (x *AttestationElectra) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AttestationElectra.ProtoReflect.Descriptor instead.
|
||||
func (*AttestationElectra) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) GetAggregationBits() github_com_prysmaticlabs_go_bitfield.Bitlist {
|
||||
if x != nil {
|
||||
return x.AggregationBits
|
||||
}
|
||||
return github_com_prysmaticlabs_go_bitfield.Bitlist(nil)
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) GetData() *AttestationData {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) GetCommitteeBits() github_com_prysmaticlabs_go_bitfield.Bitvector64 {
|
||||
if x != nil {
|
||||
return x.CommitteeBits
|
||||
}
|
||||
return github_com_prysmaticlabs_go_bitfield.Bitvector64(nil)
|
||||
}
|
||||
|
||||
func (x *AttestationElectra) GetSignature() []byte {
|
||||
if x != nil {
|
||||
return x.Signature
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AggregateAttestationAndProof struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -100,7 +171,7 @@ type AggregateAttestationAndProof struct {
|
||||
func (x *AggregateAttestationAndProof) Reset() {
|
||||
*x = AggregateAttestationAndProof{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[1]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -113,7 +184,7 @@ func (x *AggregateAttestationAndProof) String() string {
|
||||
func (*AggregateAttestationAndProof) ProtoMessage() {}
|
||||
|
||||
func (x *AggregateAttestationAndProof) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[1]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -126,7 +197,7 @@ func (x *AggregateAttestationAndProof) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AggregateAttestationAndProof.ProtoReflect.Descriptor instead.
|
||||
func (*AggregateAttestationAndProof) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{1}
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProof) GetAggregatorIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
@@ -150,6 +221,69 @@ func (x *AggregateAttestationAndProof) GetSelectionProof() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AggregateAttestationAndProofElectra struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AggregatorIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,1,opt,name=aggregator_index,json=aggregatorIndex,proto3" json:"aggregator_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
Aggregate *AttestationElectra `protobuf:"bytes,3,opt,name=aggregate,proto3" json:"aggregate,omitempty"`
|
||||
SelectionProof []byte `protobuf:"bytes,2,opt,name=selection_proof,json=selectionProof,proto3" json:"selection_proof,omitempty" ssz-size:"96"`
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) Reset() {
|
||||
*x = AggregateAttestationAndProofElectra{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AggregateAttestationAndProofElectra) ProtoMessage() {}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AggregateAttestationAndProofElectra.ProtoReflect.Descriptor instead.
|
||||
func (*AggregateAttestationAndProofElectra) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) GetAggregatorIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.AggregatorIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) GetAggregate() *AttestationElectra {
|
||||
if x != nil {
|
||||
return x.Aggregate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *AggregateAttestationAndProofElectra) GetSelectionProof() []byte {
|
||||
if x != nil {
|
||||
return x.SelectionProof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SignedAggregateAttestationAndProof struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -162,7 +296,7 @@ type SignedAggregateAttestationAndProof struct {
|
||||
func (x *SignedAggregateAttestationAndProof) Reset() {
|
||||
*x = SignedAggregateAttestationAndProof{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[2]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -175,7 +309,7 @@ func (x *SignedAggregateAttestationAndProof) String() string {
|
||||
func (*SignedAggregateAttestationAndProof) ProtoMessage() {}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProof) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[2]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -188,7 +322,7 @@ func (x *SignedAggregateAttestationAndProof) ProtoReflect() protoreflect.Message
|
||||
|
||||
// Deprecated: Use SignedAggregateAttestationAndProof.ProtoReflect.Descriptor instead.
|
||||
func (*SignedAggregateAttestationAndProof) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{2}
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProof) GetMessage() *AggregateAttestationAndProof {
|
||||
@@ -205,6 +339,61 @@ func (x *SignedAggregateAttestationAndProof) GetSignature() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type SignedAggregateAttestationAndProofElectra struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Message *AggregateAttestationAndProofElectra `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
|
||||
}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProofElectra) Reset() {
|
||||
*x = SignedAggregateAttestationAndProofElectra{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProofElectra) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignedAggregateAttestationAndProofElectra) ProtoMessage() {}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProofElectra) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignedAggregateAttestationAndProofElectra.ProtoReflect.Descriptor instead.
|
||||
func (*SignedAggregateAttestationAndProofElectra) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProofElectra) GetMessage() *AggregateAttestationAndProofElectra {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignedAggregateAttestationAndProofElectra) GetSignature() []byte {
|
||||
if x != nil {
|
||||
return x.Signature
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AttestationData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -220,7 +409,7 @@ type AttestationData struct {
|
||||
func (x *AttestationData) Reset() {
|
||||
*x = AttestationData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[3]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -233,7 +422,7 @@ func (x *AttestationData) String() string {
|
||||
func (*AttestationData) ProtoMessage() {}
|
||||
|
||||
func (x *AttestationData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[3]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -246,7 +435,7 @@ func (x *AttestationData) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AttestationData.ProtoReflect.Descriptor instead.
|
||||
func (*AttestationData) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{3}
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *AttestationData) GetSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot {
|
||||
@@ -296,7 +485,7 @@ type Checkpoint struct {
|
||||
func (x *Checkpoint) Reset() {
|
||||
*x = Checkpoint{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[4]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -309,7 +498,7 @@ func (x *Checkpoint) String() string {
|
||||
func (*Checkpoint) ProtoMessage() {}
|
||||
|
||||
func (x *Checkpoint) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[4]
|
||||
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -322,7 +511,7 @@ func (x *Checkpoint) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Checkpoint.ProtoReflect.Descriptor instead.
|
||||
func (*Checkpoint) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{4}
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *Checkpoint) GetEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch {
|
||||
@@ -361,20 +550,58 @@ var file_proto_prysm_v1alpha1_attestation_proto_rawDesc = []byte{
|
||||
0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x24, 0x0a,
|
||||
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x22, 0x8d, 0x02, 0x0a, 0x1c, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
|
||||
0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50,
|
||||
0x72, 0x6f, 0x6f, 0x66, 0x12, 0x7a, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f,
|
||||
0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
|
||||
0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52,
|
||||
0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x12, 0x40, 0x0a, 0x09, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65,
|
||||
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x75, 0x72, 0x65, 0x22, 0xbf, 0x02, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x65, 0x0a, 0x10, 0x61, 0x67,
|
||||
0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x69, 0x74, 0x73, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x42, 0x3a, 0x82, 0xb5, 0x18, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61,
|
||||
0x62, 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42,
|
||||
0x69, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x92, 0xb5, 0x18, 0x06, 0x31, 0x33, 0x31, 0x30, 0x37, 0x32,
|
||||
0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x74,
|
||||
0x73, 0x12, 0x3a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x26, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76,
|
||||
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x60, 0x0a,
|
||||
0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x62, 0x69, 0x74, 0x73, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x39, 0x82, 0xb5, 0x18, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c,
|
||||
0x61, 0x62, 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e,
|
||||
0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x8a, 0xb5, 0x18, 0x01, 0x38,
|
||||
0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x42, 0x69, 0x74, 0x73, 0x12,
|
||||
0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x8d, 0x02, 0x0a, 0x1c, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
|
||||
0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x7a, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
|
||||
0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75,
|
||||
0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76,
|
||||
0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x12, 0x40, 0x0a, 0x09, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x61, 0x67, 0x67, 0x72, 0x65,
|
||||
0x67, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a,
|
||||
0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x0e, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x9b, 0x02, 0x0a, 0x23, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
|
||||
0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x7a, 0x0a,
|
||||
0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69,
|
||||
0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x47, 0x0a, 0x09, 0x61, 0x67, 0x67,
|
||||
0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c,
|
||||
0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x52, 0x09, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x74, 0x65, 0x12, 0x2f, 0x0a, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
||||
0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18,
|
||||
0x02, 0x39, 0x36, 0x52, 0x0e, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72,
|
||||
@@ -388,51 +615,61 @@ var file_proto_prysm_v1alpha1_attestation_proto_rawDesc = []byte{
|
||||
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5,
|
||||
0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22,
|
||||
0x90, 0x03, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44,
|
||||
0x61, 0x74, 0x61, 0x12, 0x59, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0xa7, 0x01, 0x0a, 0x29, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67,
|
||||
0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
|
||||
0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x54, 0x0a,
|
||||
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65,
|
||||
0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72,
|
||||
0x6f, 0x6f, 0x66, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09,
|
||||
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x90, 0x03, 0x0a, 0x0f, 0x41, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x59, 0x0a,
|
||||
0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18,
|
||||
0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f,
|
||||
0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70,
|
||||
0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c,
|
||||
0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x78, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73,
|
||||
0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69,
|
||||
0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x78,
|
||||
0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69,
|
||||
0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
|
||||
0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
|
||||
0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x32, 0x0a, 0x11, 0x62, 0x65, 0x61, 0x63,
|
||||
0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x62, 0x65, 0x61,
|
||||
0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x39, 0x0a, 0x06,
|
||||
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c,
|
||||
0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52,
|
||||
0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e,
|
||||
0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67,
|
||||
0x65, 0x74, 0x22, 0x86, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x12, 0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
|
||||
0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75,
|
||||
0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76,
|
||||
0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12,
|
||||
0x1a, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a,
|
||||
0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19,
|
||||
0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x41, 0x74, 0x74, 0x65, 0x73,
|
||||
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61,
|
||||
0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61,
|
||||
0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0xca, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68,
|
||||
0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x76, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x12, 0x32, 0x0a, 0x11, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a,
|
||||
0xb5, 0x18, 0x02, 0x33, 0x32, 0x52, 0x0f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x39, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x12, 0x39, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70,
|
||||
0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x86, 0x01, 0x0a,
|
||||
0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x05, 0x65,
|
||||
0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76,
|
||||
0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65,
|
||||
0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f,
|
||||
0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x1a, 0x0a, 0x04, 0x72, 0x6f, 0x6f,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52,
|
||||
0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70,
|
||||
0x68, 0x61, 0x31, 0x42, 0x10, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62,
|
||||
0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b,
|
||||
0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74,
|
||||
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70,
|
||||
0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -447,25 +684,31 @@ func file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP() []byte {
|
||||
return file_proto_prysm_v1alpha1_attestation_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_prysm_v1alpha1_attestation_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_proto_prysm_v1alpha1_attestation_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_proto_prysm_v1alpha1_attestation_proto_goTypes = []interface{}{
|
||||
(*Attestation)(nil), // 0: ethereum.eth.v1alpha1.Attestation
|
||||
(*AggregateAttestationAndProof)(nil), // 1: ethereum.eth.v1alpha1.AggregateAttestationAndProof
|
||||
(*SignedAggregateAttestationAndProof)(nil), // 2: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProof
|
||||
(*AttestationData)(nil), // 3: ethereum.eth.v1alpha1.AttestationData
|
||||
(*Checkpoint)(nil), // 4: ethereum.eth.v1alpha1.Checkpoint
|
||||
(*Attestation)(nil), // 0: ethereum.eth.v1alpha1.Attestation
|
||||
(*AttestationElectra)(nil), // 1: ethereum.eth.v1alpha1.AttestationElectra
|
||||
(*AggregateAttestationAndProof)(nil), // 2: ethereum.eth.v1alpha1.AggregateAttestationAndProof
|
||||
(*AggregateAttestationAndProofElectra)(nil), // 3: ethereum.eth.v1alpha1.AggregateAttestationAndProofElectra
|
||||
(*SignedAggregateAttestationAndProof)(nil), // 4: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProof
|
||||
(*SignedAggregateAttestationAndProofElectra)(nil), // 5: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProofElectra
|
||||
(*AttestationData)(nil), // 6: ethereum.eth.v1alpha1.AttestationData
|
||||
(*Checkpoint)(nil), // 7: ethereum.eth.v1alpha1.Checkpoint
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_attestation_proto_depIdxs = []int32{
|
||||
3, // 0: ethereum.eth.v1alpha1.Attestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
|
||||
0, // 1: ethereum.eth.v1alpha1.AggregateAttestationAndProof.aggregate:type_name -> ethereum.eth.v1alpha1.Attestation
|
||||
1, // 2: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProof.message:type_name -> ethereum.eth.v1alpha1.AggregateAttestationAndProof
|
||||
4, // 3: ethereum.eth.v1alpha1.AttestationData.source:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
4, // 4: ethereum.eth.v1alpha1.AttestationData.target:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
6, // 0: ethereum.eth.v1alpha1.Attestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
|
||||
6, // 1: ethereum.eth.v1alpha1.AttestationElectra.data:type_name -> ethereum.eth.v1alpha1.AttestationData
|
||||
0, // 2: ethereum.eth.v1alpha1.AggregateAttestationAndProof.aggregate:type_name -> ethereum.eth.v1alpha1.Attestation
|
||||
1, // 3: ethereum.eth.v1alpha1.AggregateAttestationAndProofElectra.aggregate:type_name -> ethereum.eth.v1alpha1.AttestationElectra
|
||||
2, // 4: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProof.message:type_name -> ethereum.eth.v1alpha1.AggregateAttestationAndProof
|
||||
3, // 5: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProofElectra.message:type_name -> ethereum.eth.v1alpha1.AggregateAttestationAndProofElectra
|
||||
7, // 6: ethereum.eth.v1alpha1.AttestationData.source:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
7, // 7: ethereum.eth.v1alpha1.AttestationData.target:type_name -> ethereum.eth.v1alpha1.Checkpoint
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_prysm_v1alpha1_attestation_proto_init() }
|
||||
@@ -487,7 +730,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AggregateAttestationAndProof); i {
|
||||
switch v := v.(*AttestationElectra); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -499,7 +742,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignedAggregateAttestationAndProof); i {
|
||||
switch v := v.(*AggregateAttestationAndProof); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -511,7 +754,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AttestationData); i {
|
||||
switch v := v.(*AggregateAttestationAndProofElectra); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -523,6 +766,42 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignedAggregateAttestationAndProof); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignedAggregateAttestationAndProofElectra); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*AttestationData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Checkpoint); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -541,7 +820,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_prysm_v1alpha1_attestation_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -35,6 +35,20 @@ message Attestation {
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message AttestationElectra {
|
||||
// A bitfield representation of validator indices that have voted exactly
|
||||
// the same vote and have been aggregated into this attestation.
|
||||
bytes aggregation_bits = 1 [(ethereum.eth.ext.ssz_max) = "max_attesting_indices.size", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
|
||||
|
||||
AttestationData data = 2;
|
||||
|
||||
// TODO: doc
|
||||
bytes committee_bits = 4 [(ethereum.eth.ext.ssz_size) = "committee_bits.size", (ethereum.eth.ext.cast_type) = "committee_bits.type"];
|
||||
|
||||
// 96 byte BLS aggregate signature.
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message AggregateAttestationAndProof {
|
||||
// The aggregator index that submitted this aggregated attestation and proof.
|
||||
uint64 aggregator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
@@ -46,6 +60,17 @@ message AggregateAttestationAndProof {
|
||||
bytes selection_proof = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message AggregateAttestationAndProofElectra {
|
||||
// The aggregator index that submitted this aggregated attestation and proof.
|
||||
uint64 aggregator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
|
||||
// The aggregated attestation that was submitted.
|
||||
AttestationElectra aggregate = 3;
|
||||
|
||||
// 96 byte selection proof signed by the aggregator, which is the signature of the slot to aggregate.
|
||||
bytes selection_proof = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message SignedAggregateAttestationAndProof {
|
||||
// The aggregated attestation and selection proof itself.
|
||||
AggregateAttestationAndProof message = 1;
|
||||
@@ -54,6 +79,14 @@ message SignedAggregateAttestationAndProof {
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message SignedAggregateAttestationAndProofElectra {
|
||||
// The aggregated attestation and selection proof itself.
|
||||
AggregateAttestationAndProofElectra message = 1;
|
||||
|
||||
// 96 byte BLS aggregate signature signed by the aggregator over the message.
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message AttestationData {
|
||||
// Attestation data includes information on Casper the Friendly Finality Gadget's votes
|
||||
// See: https://arxiv.org/pdf/1710.09437.pdf
|
||||
|
||||
3629
proto/prysm/v1alpha1/beacon_block.pb.go
generated
3629
proto/prysm/v1alpha1/beacon_block.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@ import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/attestation.proto";
|
||||
import "proto/prysm/v1alpha1/withdrawals.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
import "proto/prysm/v1alpha1/eip_7251.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.v1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1;eth";
|
||||
@@ -50,7 +51,14 @@ message GenericSignedBeaconBlock {
|
||||
// Representing a signed, post-Deneb fork beacon block content.
|
||||
SignedBeaconBlockContentsDeneb deneb = 7;
|
||||
|
||||
// Representing a signed, post-Deneb fork blinded beacon block.
|
||||
SignedBlindedBeaconBlockDeneb blinded_deneb = 8;
|
||||
|
||||
// Representing a signed, post-Electra fork beacon block content.
|
||||
SignedBeaconBlockContentsElectra electra = 9;
|
||||
|
||||
// Representing a signed, post-Electra fork blinded beacon block.
|
||||
SignedBlindedBeaconBlockElectra blinded_electra = 10;
|
||||
}
|
||||
bool is_blinded = 100;
|
||||
reserved 101; // Deprecated fields
|
||||
@@ -79,7 +87,14 @@ message GenericBeaconBlock {
|
||||
// Representing a signed, post-Deneb fork beacon block content.
|
||||
BeaconBlockContentsDeneb deneb = 7;
|
||||
|
||||
// Representing a post-Deneb fork blinded beacon block.
|
||||
BlindedBeaconBlockDeneb blinded_deneb = 8;
|
||||
|
||||
// Representing a signed, post-Electra fork beacon block content.
|
||||
BeaconBlockContentsElectra electra = 9;
|
||||
|
||||
// Representing a post-Electra fork blinded beacon block.
|
||||
BlindedBeaconBlockElectra blinded_electra = 10;
|
||||
}
|
||||
bool is_blinded = 100;
|
||||
string payload_value = 101;
|
||||
@@ -226,6 +241,14 @@ message AttesterSlashing {
|
||||
IndexedAttestation attestation_2 = 2;
|
||||
}
|
||||
|
||||
message AttesterSlashingElectra {
|
||||
// First conflicting attestation.
|
||||
IndexedAttestationElectra attestation_1 = 1;
|
||||
|
||||
// Second conflicting attestation.
|
||||
IndexedAttestationElectra attestation_2 = 2;
|
||||
}
|
||||
|
||||
// Deposit into the Ethereum consensus from the Ethereum 1.x deposit contract.
|
||||
message Deposit {
|
||||
// DepositData that is encoded into a deposit signature.
|
||||
@@ -321,6 +344,15 @@ message IndexedAttestation {
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message IndexedAttestationElectra {
|
||||
repeated uint64 attesting_indices = 1 [(ethereum.eth.ext.ssz_max) = "max_attesting_indices.size"];
|
||||
|
||||
AttestationData data = 2;
|
||||
|
||||
// 96 bytes aggregate signature.
|
||||
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
// The sync aggregate object for the beacon chain to track sync committee votes and to
|
||||
// support light client infra.
|
||||
message SyncAggregate {
|
||||
@@ -716,6 +748,151 @@ message BlindedBeaconBlockBodyDeneb {
|
||||
repeated bytes blob_kzg_commitments = 12 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"];
|
||||
}
|
||||
|
||||
message SignedBeaconBlockContentsElectra {
|
||||
SignedBeaconBlockElectra block = 1;
|
||||
repeated bytes kzg_proofs = 2 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "4096"];
|
||||
repeated bytes blobs = 3 [(ethereum.eth.ext.ssz_size) = "?,blob.size", (ethereum.eth.ext.ssz_max) = "4096"];
|
||||
}
|
||||
|
||||
message BeaconBlockContentsElectra {
|
||||
BeaconBlockElectra block = 1;
|
||||
repeated bytes kzg_proofs = 2 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "4096"];
|
||||
repeated bytes blobs = 3 [(ethereum.eth.ext.ssz_size) = "?,blob.size", (ethereum.eth.ext.ssz_max) = "4096"];
|
||||
}
|
||||
|
||||
message SignedBeaconBlockElectra {
|
||||
// The unsigned beacon block itself.
|
||||
BeaconBlockElectra block = 1;
|
||||
|
||||
// 96 byte BLS signature from the validator that produced this block.
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message BeaconBlockElectra {
|
||||
// Beacon chain slot that this block represents.
|
||||
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
|
||||
// Validator index of the validator that proposed the block header.
|
||||
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
|
||||
// 32 byte root of the parent block.
|
||||
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// 32 byte root of the resulting state after processing this block.
|
||||
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// The beacon block body.
|
||||
BeaconBlockBodyElectra body = 5;
|
||||
}
|
||||
|
||||
message BeaconBlockBodyElectra {
|
||||
// The validators RANDAO reveal 96 byte value.
|
||||
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
|
||||
// A reference to the Ethereum 1.x chain.
|
||||
Eth1Data eth1_data = 2;
|
||||
|
||||
// 32 byte field of arbitrary data. This field may contain any data and
|
||||
// is not used for anything other than a fun message.
|
||||
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// Block operations
|
||||
// Refer to spec constants at https://github.com/ethereum/consensus-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
|
||||
|
||||
// At most MAX_PROPOSER_SLASHINGS.
|
||||
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_ATTESTER_SLASHINGS_ELECTRA.
|
||||
repeated AttesterSlashingElectra attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "1"];
|
||||
|
||||
// At most MAX_ATTESTATIONS_ELECTRA.
|
||||
repeated AttestationElectra attestations = 6 [(ethereum.eth.ext.ssz_max) = "8"];
|
||||
|
||||
// At most MAX_DEPOSITS.
|
||||
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_VOLUNTARY_EXITS.
|
||||
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// Sync aggregate object for the beacon chain to track sync committee votes. New in Altair network upgrade.
|
||||
SyncAggregate sync_aggregate = 9;
|
||||
|
||||
// Execution payload from the execution chain. New in Bellatrix network upgrade.
|
||||
ethereum.engine.v1.ExecutionPayloadElectra execution_payload = 10;
|
||||
|
||||
// At most MAX_BLS_TO_EXECUTION_CHANGES. New in Capella network upgrade.
|
||||
repeated SignedBLSToExecutionChange bls_to_execution_changes = 11 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
repeated bytes blob_kzg_commitments = 12 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"];
|
||||
|
||||
repeated SignedConsolidation consolidations = 13 [(ethereum.eth.ext.ssz_max) = "1"]; // New in Electra EIP-7251.
|
||||
}
|
||||
|
||||
message SignedBlindedBeaconBlockElectra {
|
||||
// The unsigned blinded beacon block itself.
|
||||
BlindedBeaconBlockElectra message = 1;
|
||||
|
||||
// 96 byte BLS signature from the validator that produced this blinded block.
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message BlindedBeaconBlockElectra {
|
||||
// Beacon chain slot that this blinded block represents.
|
||||
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
|
||||
// Validator index of the validator that proposed the block header.
|
||||
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
|
||||
// 32 byte root of the parent block.
|
||||
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// 32 byte root of the resulting state after processing this blinded block.
|
||||
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// The blinded beacon block body.
|
||||
BlindedBeaconBlockBodyElectra body = 5;
|
||||
}
|
||||
|
||||
message BlindedBeaconBlockBodyElectra {
|
||||
// The validators RANDAO reveal 96 byte value.
|
||||
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
|
||||
// A reference to the Ethereum 1.x chain.
|
||||
Eth1Data eth1_data = 2;
|
||||
|
||||
// 32 byte field of arbitrary data. This field may contain any data and
|
||||
// is not used for anything other than a fun message.
|
||||
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
|
||||
// At most MAX_PROPOSER_SLASHINGS.
|
||||
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_ATTESTER_SLASHINGS_ELECTRA.
|
||||
repeated AttesterSlashingElectra attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "1"];
|
||||
|
||||
// At most MAX_ATTESTATIONS_ELECTRA.
|
||||
repeated AttestationElectra attestations = 6 [(ethereum.eth.ext.ssz_max) = "8"];
|
||||
|
||||
// At most MAX_DEPOSITS.
|
||||
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// At most MAX_VOLUNTARY_EXITS.
|
||||
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
// Sync aggregate object for the beacon chain to track sync committee votes. New in Altair network upgrade.
|
||||
SyncAggregate sync_aggregate = 9;
|
||||
|
||||
// Execution payload header from the execution chain. New in Bellatrix network upgrade to accommodate MEV interaction.
|
||||
ethereum.engine.v1.ExecutionPayloadHeaderElectra execution_payload_header = 10;
|
||||
|
||||
// At most MAX_BLS_TO_EXECUTION_CHANGES. New in Capella network upgrade.
|
||||
repeated SignedBLSToExecutionChange bls_to_execution_changes = 11 [(ethereum.eth.ext.ssz_max) = "16"];
|
||||
|
||||
repeated bytes blob_kzg_commitments = 12 [(ethereum.eth.ext.ssz_size) = "?,48", (ethereum.eth.ext.ssz_max) = "max_blob_commitments.size"];
|
||||
|
||||
repeated SignedConsolidation consolidations = 13 [(ethereum.eth.ext.ssz_max) = "1"]; // New in Electra EIP-7251.
|
||||
}
|
||||
|
||||
message ValidatorRegistrationV1 {
|
||||
bytes fee_recipient = 1 [(ethereum.eth.ext.ssz_size) = "20"];
|
||||
uint64 gas_limit = 2;
|
||||
@@ -777,4 +954,4 @@ message BlobSidecar {
|
||||
|
||||
message BlobSidecars {
|
||||
repeated BlobSidecar sidecars = 1 [(ethereum.eth.ext.ssz_max) = "max_blobs_per_block.size"];
|
||||
}
|
||||
}
|
||||
|
||||
2102
proto/prysm/v1alpha1/beacon_state.pb.go
generated
2102
proto/prysm/v1alpha1/beacon_state.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ import "proto/prysm/v1alpha1/beacon_block.proto";
|
||||
import "proto/prysm/v1alpha1/validator.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/eip_7251.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.V1Alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1;eth";
|
||||
@@ -342,6 +343,70 @@ message BeaconStateDeneb {
|
||||
repeated HistoricalSummary historical_summaries = 11003 [(ethereum.eth.ext.ssz_max) = "16777216"];
|
||||
}
|
||||
|
||||
message BeaconStateElectra {
|
||||
// Versioning [1001-2000]
|
||||
uint64 genesis_time = 1001;
|
||||
bytes genesis_validators_root = 1002 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
uint64 slot = 1003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
Fork fork = 1004;
|
||||
|
||||
// History [2001-3000]
|
||||
BeaconBlockHeader latest_block_header = 2001;
|
||||
repeated bytes block_roots = 2002 [(ethereum.eth.ext.ssz_size) = "block_roots.size"];
|
||||
repeated bytes state_roots = 2003 [(ethereum.eth.ext.ssz_size) = "state_roots.size"];
|
||||
repeated bytes historical_roots = 2004 [(ethereum.eth.ext.ssz_size) = "?,32", (ethereum.eth.ext.ssz_max) = "16777216"];
|
||||
|
||||
// Eth1 [3001-4000]
|
||||
Eth1Data eth1_data = 3001;
|
||||
repeated Eth1Data eth1_data_votes = 3002 [(ethereum.eth.ext.ssz_max) = "eth1_data_votes.size"];
|
||||
uint64 eth1_deposit_index = 3003;
|
||||
|
||||
// Registry [4001-5000]
|
||||
repeated Validator validators = 4001 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
|
||||
repeated uint64 balances = 4002 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
|
||||
|
||||
// Randomness [5001-6000]
|
||||
repeated bytes randao_mixes = 5001 [(ethereum.eth.ext.ssz_size) = "randao_mixes.size"];
|
||||
|
||||
// Slashings [6001-7000]
|
||||
repeated uint64 slashings = 6001 [(ethereum.eth.ext.ssz_size) = "slashings.size"];
|
||||
|
||||
// Participation [7001-8000]
|
||||
bytes previous_epoch_participation = 7001 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
|
||||
bytes current_epoch_participation = 7002 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
|
||||
|
||||
// Finality [8001-9000]
|
||||
// Spec type [4]Bitvector which means this would be a fixed size of 4 bits.
|
||||
bytes justification_bits = 8001 [(ethereum.eth.ext.ssz_size) = "1", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector4"];
|
||||
Checkpoint previous_justified_checkpoint = 8002;
|
||||
Checkpoint current_justified_checkpoint = 8003;
|
||||
Checkpoint finalized_checkpoint = 8004;
|
||||
|
||||
// Fields introduced in Altair fork [9001-10000]
|
||||
repeated uint64 inactivity_scores = 9001 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
|
||||
SyncCommittee current_sync_committee = 9002;
|
||||
SyncCommittee next_sync_committee = 9003;
|
||||
|
||||
// Fields introduced in Bellatrix fork [10001-11000]
|
||||
ethereum.engine.v1.ExecutionPayloadHeaderElectra latest_execution_payload_header = 10001; // [New in Electra]
|
||||
|
||||
// Fields introduced in Capella fork [11001-12000]
|
||||
uint64 next_withdrawal_index = 11001;
|
||||
uint64 next_withdrawal_validator_index = 11002 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
repeated HistoricalSummary historical_summaries = 11003 [(ethereum.eth.ext.ssz_max) = "16777216"];
|
||||
|
||||
// Fields introduced in EIP-7251 fork [12001-13000]
|
||||
uint64 deposit_receipts_start_index = 12001;
|
||||
uint64 deposit_balance_to_consume = 12002;
|
||||
uint64 exit_balance_to_consume = 12003;
|
||||
uint64 earliest_exit_epoch = 12004 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
|
||||
uint64 consolidation_balance_to_consume = 12005;
|
||||
uint64 earliest_consolidation_epoch = 12006 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
|
||||
repeated PendingBalanceDeposit pending_balance_deposits = 12007 [(ethereum.eth.ext.ssz_max) = "pending_balance_deposits_limit"];
|
||||
repeated PendingPartialWithdrawal pending_partial_withdrawals = 12008 [(ethereum.eth.ext.ssz_max) = "pending_partial_withdrawals_limit"];
|
||||
repeated PendingConsolidation pending_consolidations = 12009 [(ethereum.eth.ext.ssz_max) = "pending_consolidations_limit"];
|
||||
}
|
||||
|
||||
// PowBlock is a definition from Bellatrix fork choice spec to represent a block with total difficulty in the PoW chain.
|
||||
// Spec:
|
||||
// class PowBlock(Container):
|
||||
@@ -358,4 +423,4 @@ message PowBlock {
|
||||
message HistoricalSummary {
|
||||
bytes block_summary_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes state_summary_root = 2 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,19 @@ func CopyAttestation(att *Attestation) *Attestation {
|
||||
}
|
||||
}
|
||||
|
||||
// CopyAttestationElectra copies the provided attestation object.
|
||||
func CopyAttestationElectra(att *AttestationElectra) *AttestationElectra {
|
||||
if att == nil {
|
||||
return nil
|
||||
}
|
||||
return &AttestationElectra{
|
||||
AggregationBits: bytesutil.SafeCopyBytes(att.AggregationBits),
|
||||
CommitteeBits: bytesutil.SafeCopyBytes(att.CommitteeBits),
|
||||
Data: CopyAttestationData(att.Data),
|
||||
Signature: bytesutil.SafeCopyBytes(att.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyAttestationData copies the provided AttestationData object.
|
||||
func CopyAttestationData(attData *AttestationData) *AttestationData {
|
||||
if attData == nil {
|
||||
@@ -232,6 +245,21 @@ func CopyAttesterSlashings(slashings []*AttesterSlashing) []*AttesterSlashing {
|
||||
return newSlashings
|
||||
}
|
||||
|
||||
// CopyAttesterSlashingsElectra copies the provided AttesterSlashings array.
|
||||
func CopyAttesterSlashingsElectra(slashings []*AttesterSlashingElectra) []*AttesterSlashingElectra {
|
||||
if slashings == nil {
|
||||
return nil
|
||||
}
|
||||
newSlashings := make([]*AttesterSlashingElectra, len(slashings))
|
||||
for i, slashing := range slashings {
|
||||
newSlashings[i] = &AttesterSlashingElectra{
|
||||
Attestation_1: CopyIndexedAttestationElectra(slashing.Attestation_1),
|
||||
Attestation_2: CopyIndexedAttestationElectra(slashing.Attestation_2),
|
||||
}
|
||||
}
|
||||
return newSlashings
|
||||
}
|
||||
|
||||
// CopyIndexedAttestation copies the provided IndexedAttestation.
|
||||
func CopyIndexedAttestation(indexedAtt *IndexedAttestation) *IndexedAttestation {
|
||||
var indices []uint64
|
||||
@@ -248,6 +276,22 @@ func CopyIndexedAttestation(indexedAtt *IndexedAttestation) *IndexedAttestation
|
||||
}
|
||||
}
|
||||
|
||||
// CopyIndexedAttestationElectra copies the provided IndexedAttestation.
|
||||
func CopyIndexedAttestationElectra(indexedAtt *IndexedAttestationElectra) *IndexedAttestationElectra {
|
||||
var indices []uint64
|
||||
if indexedAtt == nil {
|
||||
return nil
|
||||
} else if indexedAtt.AttestingIndices != nil {
|
||||
indices = make([]uint64, len(indexedAtt.AttestingIndices))
|
||||
copy(indices, indexedAtt.AttestingIndices)
|
||||
}
|
||||
return &IndexedAttestationElectra{
|
||||
AttestingIndices: indices,
|
||||
Data: CopyAttestationData(indexedAtt.Data),
|
||||
Signature: bytesutil.SafeCopyBytes(indexedAtt.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyAttestations copies the provided Attestation array.
|
||||
func CopyAttestations(attestations []*Attestation) []*Attestation {
|
||||
if attestations == nil {
|
||||
@@ -260,6 +304,18 @@ func CopyAttestations(attestations []*Attestation) []*Attestation {
|
||||
return newAttestations
|
||||
}
|
||||
|
||||
// CopyAttestations copies the provided AttestationElectra array.
|
||||
func CopyAttestationsElectra(attestations []*AttestationElectra) []*AttestationElectra {
|
||||
if attestations == nil {
|
||||
return nil
|
||||
}
|
||||
newAttestations := make([]*AttestationElectra, len(attestations))
|
||||
for i, att := range attestations {
|
||||
newAttestations[i] = CopyAttestationElectra(att)
|
||||
}
|
||||
return newAttestations
|
||||
}
|
||||
|
||||
// CopyDeposits copies the provided deposit array.
|
||||
func CopyDeposits(deposits []*Deposit) []*Deposit {
|
||||
if deposits == nil {
|
||||
@@ -558,6 +614,78 @@ func CopyBlindedBeaconBlockBodyDeneb(body *BlindedBeaconBlockBodyDeneb) *Blinded
|
||||
}
|
||||
}
|
||||
|
||||
// CopySignedBlindedBeaconBlockElectra copies the provided SignedBlindedBeaconBlockElectra.
|
||||
func CopySignedBlindedBeaconBlockElectra(sigBlock *SignedBlindedBeaconBlockElectra) *SignedBlindedBeaconBlockElectra {
|
||||
if sigBlock == nil {
|
||||
return nil
|
||||
}
|
||||
return &SignedBlindedBeaconBlockElectra{
|
||||
Message: CopyBlindedBeaconBlockElectra(sigBlock.Message),
|
||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBlindedBeaconBlockElectra copies the provided BlindedBeaconBlockElectra.
|
||||
func CopyBlindedBeaconBlockElectra(block *BlindedBeaconBlockElectra) *BlindedBeaconBlockElectra {
|
||||
if block == nil {
|
||||
return nil
|
||||
}
|
||||
return &BlindedBeaconBlockElectra{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||
Body: CopyBlindedBeaconBlockBodyElectra(block.Body),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBlindedBeaconBlockBodyElectra copies the provided BlindedBeaconBlockBodyElectra.
|
||||
func CopyBlindedBeaconBlockBodyElectra(body *BlindedBeaconBlockBodyElectra) *BlindedBeaconBlockBodyElectra {
|
||||
if body == nil {
|
||||
return nil
|
||||
}
|
||||
return &BlindedBeaconBlockBodyElectra{
|
||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||
Eth1Data: CopyETH1Data(body.Eth1Data),
|
||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||
ProposerSlashings: CopyProposerSlashings(body.ProposerSlashings),
|
||||
AttesterSlashings: CopyAttesterSlashingsElectra(body.AttesterSlashings),
|
||||
Attestations: CopyAttestationsElectra(body.Attestations),
|
||||
Deposits: CopyDeposits(body.Deposits),
|
||||
VoluntaryExits: CopySignedVoluntaryExits(body.VoluntaryExits),
|
||||
SyncAggregate: CopySyncAggregate(body.SyncAggregate),
|
||||
ExecutionPayloadHeader: CopyExecutionPayloadHeaderElectra(body.ExecutionPayloadHeader),
|
||||
BlsToExecutionChanges: CopyBLSToExecutionChanges(body.BlsToExecutionChanges),
|
||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||
Consolidations: CopySignedConsolidations(body.Consolidations),
|
||||
}
|
||||
}
|
||||
|
||||
func CopySignedConsolidations(c []*SignedConsolidation) []*SignedConsolidation {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
newC := make([]*SignedConsolidation, len(c))
|
||||
for i, cc := range c {
|
||||
newC[i] = CopySignedConsolidation(cc)
|
||||
}
|
||||
return newC
|
||||
}
|
||||
|
||||
func CopySignedConsolidation(c *SignedConsolidation) *SignedConsolidation {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return &SignedConsolidation{
|
||||
Message: &Consolidation{
|
||||
SourceIndex: c.Message.SourceIndex,
|
||||
TargetIndex: c.Message.TargetIndex,
|
||||
Epoch: c.Message.Epoch,
|
||||
},
|
||||
Signature: bytesutil.SafeCopyBytes(c.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyExecutionPayload copies the provided execution payload.
|
||||
func CopyExecutionPayload(payload *enginev1.ExecutionPayload) *enginev1.ExecutionPayload {
|
||||
if payload == nil {
|
||||
@@ -848,6 +976,142 @@ func CopyExecutionPayloadDeneb(payload *enginev1.ExecutionPayloadDeneb) *enginev
|
||||
}
|
||||
}
|
||||
|
||||
// CopySignedBeaconBlockElectra copies the provided SignedBeaconBlockElectra.
|
||||
func CopySignedBeaconBlockElectra(sigBlock *SignedBeaconBlockElectra) *SignedBeaconBlockElectra {
|
||||
if sigBlock == nil {
|
||||
return nil
|
||||
}
|
||||
return &SignedBeaconBlockElectra{
|
||||
Block: CopyBeaconBlockElectra(sigBlock.Block),
|
||||
Signature: bytesutil.SafeCopyBytes(sigBlock.Signature),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBeaconBlockElectra copies the provided BeaconBlockElectra.
|
||||
func CopyBeaconBlockElectra(block *BeaconBlockElectra) *BeaconBlockElectra {
|
||||
if block == nil {
|
||||
return nil
|
||||
}
|
||||
return &BeaconBlockElectra{
|
||||
Slot: block.Slot,
|
||||
ProposerIndex: block.ProposerIndex,
|
||||
ParentRoot: bytesutil.SafeCopyBytes(block.ParentRoot),
|
||||
StateRoot: bytesutil.SafeCopyBytes(block.StateRoot),
|
||||
Body: CopyBeaconBlockBodyElectra(block.Body),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyBeaconBlockBodyElectra copies the provided BeaconBlockBodyElectra.
|
||||
func CopyBeaconBlockBodyElectra(body *BeaconBlockBodyElectra) *BeaconBlockBodyElectra {
|
||||
if body == nil {
|
||||
return nil
|
||||
}
|
||||
return &BeaconBlockBodyElectra{
|
||||
RandaoReveal: bytesutil.SafeCopyBytes(body.RandaoReveal),
|
||||
Eth1Data: CopyETH1Data(body.Eth1Data),
|
||||
Graffiti: bytesutil.SafeCopyBytes(body.Graffiti),
|
||||
ProposerSlashings: CopyProposerSlashings(body.ProposerSlashings),
|
||||
AttesterSlashings: CopyAttesterSlashingsElectra(body.AttesterSlashings),
|
||||
Attestations: CopyAttestationsElectra(body.Attestations),
|
||||
Deposits: CopyDeposits(body.Deposits),
|
||||
VoluntaryExits: CopySignedVoluntaryExits(body.VoluntaryExits),
|
||||
SyncAggregate: CopySyncAggregate(body.SyncAggregate),
|
||||
ExecutionPayload: CopyExecutionPayloadElectra(body.ExecutionPayload),
|
||||
BlsToExecutionChanges: CopyBLSToExecutionChanges(body.BlsToExecutionChanges),
|
||||
BlobKzgCommitments: CopyBlobKZGs(body.BlobKzgCommitments),
|
||||
Consolidations: CopySignedConsolidations(body.Consolidations),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyExecutionPayloadElectra copies the provided execution payload.
|
||||
func CopyExecutionPayloadElectra(payload *enginev1.ExecutionPayloadElectra) *enginev1.ExecutionPayloadElectra {
|
||||
if payload == nil {
|
||||
return nil
|
||||
}
|
||||
return &enginev1.ExecutionPayloadElectra{
|
||||
ParentHash: bytesutil.SafeCopyBytes(payload.ParentHash),
|
||||
FeeRecipient: bytesutil.SafeCopyBytes(payload.FeeRecipient),
|
||||
StateRoot: bytesutil.SafeCopyBytes(payload.StateRoot),
|
||||
ReceiptsRoot: bytesutil.SafeCopyBytes(payload.ReceiptsRoot),
|
||||
LogsBloom: bytesutil.SafeCopyBytes(payload.LogsBloom),
|
||||
PrevRandao: bytesutil.SafeCopyBytes(payload.PrevRandao),
|
||||
BlockNumber: payload.BlockNumber,
|
||||
GasLimit: payload.GasLimit,
|
||||
GasUsed: payload.GasUsed,
|
||||
Timestamp: payload.Timestamp,
|
||||
ExtraData: bytesutil.SafeCopyBytes(payload.ExtraData),
|
||||
BaseFeePerGas: bytesutil.SafeCopyBytes(payload.BaseFeePerGas),
|
||||
BlockHash: bytesutil.SafeCopyBytes(payload.BlockHash),
|
||||
Transactions: bytesutil.SafeCopy2dBytes(payload.Transactions),
|
||||
Withdrawals: CopyWithdrawalSlice(payload.Withdrawals),
|
||||
BlobGasUsed: payload.BlobGasUsed,
|
||||
ExcessBlobGas: payload.ExcessBlobGas,
|
||||
DepositReceipts: CopyDepositReceipts(payload.DepositReceipts),
|
||||
WithdrawalRequests: CopyWithdrawalRequests(payload.WithdrawalRequests),
|
||||
}
|
||||
}
|
||||
|
||||
func CopyDepositReceipts(dr []*enginev1.DepositReceipt) []*enginev1.DepositReceipt {
|
||||
if dr == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
newDr := make([]*enginev1.DepositReceipt, len(dr))
|
||||
for i, d := range dr {
|
||||
newDr[i] = &enginev1.DepositReceipt{
|
||||
Pubkey: bytesutil.SafeCopyBytes(d.Pubkey),
|
||||
WithdrawalCredentials: bytesutil.SafeCopyBytes(d.WithdrawalCredentials),
|
||||
Amount: d.Amount,
|
||||
Signature: bytesutil.SafeCopyBytes(d.Signature),
|
||||
Index: d.Index,
|
||||
}
|
||||
}
|
||||
return newDr
|
||||
}
|
||||
|
||||
func CopyWithdrawalRequests(wr []*enginev1.ExecutionLayerWithdrawalRequest) []*enginev1.ExecutionLayerWithdrawalRequest {
|
||||
if wr == nil {
|
||||
return nil
|
||||
}
|
||||
newWr := make([]*enginev1.ExecutionLayerWithdrawalRequest, len(wr))
|
||||
for i, w := range wr {
|
||||
newWr[i] = &enginev1.ExecutionLayerWithdrawalRequest{
|
||||
SourceAddress: bytesutil.SafeCopyBytes(w.SourceAddress),
|
||||
ValidatorPubkey: bytesutil.SafeCopyBytes(w.ValidatorPubkey),
|
||||
Amount: w.Amount,
|
||||
}
|
||||
}
|
||||
|
||||
return newWr
|
||||
}
|
||||
|
||||
func CopyExecutionPayloadHeaderElectra(payload *enginev1.ExecutionPayloadHeaderElectra) *enginev1.ExecutionPayloadHeaderElectra {
|
||||
if payload == nil {
|
||||
return nil
|
||||
}
|
||||
return &enginev1.ExecutionPayloadHeaderElectra{
|
||||
ParentHash: bytesutil.SafeCopyBytes(payload.ParentHash),
|
||||
FeeRecipient: bytesutil.SafeCopyBytes(payload.FeeRecipient),
|
||||
StateRoot: bytesutil.SafeCopyBytes(payload.StateRoot),
|
||||
ReceiptsRoot: bytesutil.SafeCopyBytes(payload.ReceiptsRoot),
|
||||
LogsBloom: bytesutil.SafeCopyBytes(payload.LogsBloom),
|
||||
PrevRandao: bytesutil.SafeCopyBytes(payload.PrevRandao),
|
||||
BlockNumber: payload.BlockNumber,
|
||||
GasLimit: payload.GasLimit,
|
||||
GasUsed: payload.GasUsed,
|
||||
Timestamp: payload.Timestamp,
|
||||
ExtraData: bytesutil.SafeCopyBytes(payload.ExtraData),
|
||||
BaseFeePerGas: bytesutil.SafeCopyBytes(payload.BaseFeePerGas),
|
||||
BlockHash: bytesutil.SafeCopyBytes(payload.BlockHash),
|
||||
TransactionsRoot: bytesutil.SafeCopyBytes(payload.TransactionsRoot),
|
||||
WithdrawalsRoot: bytesutil.SafeCopyBytes(payload.WithdrawalsRoot),
|
||||
BlobGasUsed: payload.BlobGasUsed,
|
||||
ExcessBlobGas: payload.ExcessBlobGas,
|
||||
DepositReceiptsRoot: bytesutil.SafeCopyBytes(payload.DepositReceiptsRoot),
|
||||
WithdrawalRequestsRoot: bytesutil.SafeCopyBytes(payload.WithdrawalRequestsRoot),
|
||||
}
|
||||
}
|
||||
|
||||
// CopyHistoricalSummaries copies the historical summaries.
|
||||
func CopyHistoricalSummaries(summaries []*HistoricalSummary) []*HistoricalSummary {
|
||||
if summaries == nil {
|
||||
@@ -862,3 +1126,47 @@ func CopyHistoricalSummaries(summaries []*HistoricalSummary) []*HistoricalSummar
|
||||
}
|
||||
return newSummaries
|
||||
}
|
||||
|
||||
// CopyPartialWithdrawals copies the provided partial withdrawals.
|
||||
func CopyPendingPartialWithdrawals(pws []*PendingPartialWithdrawal) []*PendingPartialWithdrawal {
|
||||
if pws == nil {
|
||||
return nil
|
||||
}
|
||||
newPws := make([]*PendingPartialWithdrawal, len(pws))
|
||||
for i, pw := range pws {
|
||||
newPws[i] = &PendingPartialWithdrawal{
|
||||
Index: pw.Index,
|
||||
Amount: pw.Amount,
|
||||
WithdrawableEpoch: pw.WithdrawableEpoch,
|
||||
}
|
||||
}
|
||||
return newPws
|
||||
}
|
||||
|
||||
func CopyPendingConsolidations(pcs []*PendingConsolidation) []*PendingConsolidation {
|
||||
if pcs == nil {
|
||||
return nil
|
||||
}
|
||||
newPcs := make([]*PendingConsolidation, len(pcs))
|
||||
for i, pc := range pcs {
|
||||
newPcs[i] = &PendingConsolidation{
|
||||
SourceIndex: pc.SourceIndex,
|
||||
TargetIndex: pc.TargetIndex,
|
||||
}
|
||||
}
|
||||
return newPcs
|
||||
}
|
||||
|
||||
func CopyPendingBalanceDeposits(pbd []*PendingBalanceDeposit) []*PendingBalanceDeposit {
|
||||
if pbd == nil {
|
||||
return nil
|
||||
}
|
||||
newPbd := make([]*PendingBalanceDeposit, len(pbd))
|
||||
for i, pb := range pbd {
|
||||
newPbd[i] = &PendingBalanceDeposit{
|
||||
Index: pb.Index,
|
||||
Amount: pb.Amount,
|
||||
}
|
||||
}
|
||||
return newPbd
|
||||
}
|
||||
|
||||
@@ -568,6 +568,177 @@ func TestCopyHistoricalSummaries(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyAttestationElectra(t *testing.T) {
|
||||
att := genAttestationElectra()
|
||||
|
||||
got := v1alpha1.CopyAttestationElectra(att)
|
||||
if !reflect.DeepEqual(got, att) {
|
||||
t.Errorf("TestCopyAttestationElectra() = %v, want %v", got, att)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyAttesterSlashingsElectra(t *testing.T) {
|
||||
as := genAttesterSlashingsElectra(10)
|
||||
|
||||
got := v1alpha1.CopyAttesterSlashingsElectra(as)
|
||||
if !reflect.DeepEqual(got, as) {
|
||||
t.Errorf("TestCopyAttesterSlashingsElectra() = %v, want %v", got, as)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyIndexedAttestationElectra(t *testing.T) {
|
||||
ia := genIndexedAttestationElectra()
|
||||
|
||||
got := v1alpha1.CopyIndexedAttestationElectra(ia)
|
||||
if !reflect.DeepEqual(got, ia) {
|
||||
t.Errorf("TestCopyIndexedAttestationElectra() = %v, want %v", got, ia)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyAttestationsElectra(t *testing.T) {
|
||||
atts := genAttestationsElectra(10)
|
||||
|
||||
got := v1alpha1.CopyAttestationsElectra(atts)
|
||||
if !reflect.DeepEqual(got, atts) {
|
||||
t.Errorf("TestCopyAttestationsElectra() = %v, want %v", got, atts)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopySignedBlindedBeaconBlockElectra(t *testing.T) {
|
||||
sbb := genSignedBlindedBeaconBlockElectra()
|
||||
|
||||
got := v1alpha1.CopySignedBlindedBeaconBlockElectra(sbb)
|
||||
if !reflect.DeepEqual(got, sbb) {
|
||||
t.Errorf("TestCopySignedBlindedBeaconBlockElectra() = %v, want %v", got, sbb)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyBlindedBeaconBlockElectra(t *testing.T) {
|
||||
b := genBlindedBeaconBlockElectra()
|
||||
|
||||
got := v1alpha1.CopyBlindedBeaconBlockElectra(b)
|
||||
if !reflect.DeepEqual(got, b) {
|
||||
t.Errorf("TestCopyBlindedBeaconBlockElectra() = %v, want %v", got, b)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyBlindedBeaconBlockBodyElectra(t *testing.T) {
|
||||
bb := genBlindedBeaconBlockBodyElectra()
|
||||
|
||||
got := v1alpha1.CopyBlindedBeaconBlockBodyElectra(bb)
|
||||
if !reflect.DeepEqual(got, bb) {
|
||||
t.Errorf("TestCopyBlindedBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopySignedConsolidations(t *testing.T) {
|
||||
cs := genSignedConsolidations(10)
|
||||
|
||||
got := v1alpha1.CopySignedConsolidations(cs)
|
||||
if !reflect.DeepEqual(got, cs) {
|
||||
t.Errorf("TestCopySignedConsolidations() = %v, want %v", got, cs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopySignedConsolidation(t *testing.T) {
|
||||
c := genSignedConsolidation()
|
||||
|
||||
got := v1alpha1.CopySignedConsolidation(c)
|
||||
if !reflect.DeepEqual(got, c) {
|
||||
t.Errorf("TestCopySignedConsolidation() = %v, want %v", got, c)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopySignedBeaconBlockElectra(t *testing.T) {
|
||||
sbb := genSignedBeaconBlockElectra()
|
||||
|
||||
got := v1alpha1.CopySignedBeaconBlockElectra(sbb)
|
||||
if !reflect.DeepEqual(got, sbb) {
|
||||
t.Errorf("TestCopySignedBeaconBlockElectra() = %v, want %v", got, sbb)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyBeaconBlockElectra(t *testing.T) {
|
||||
b := genBeaconBlockElectra()
|
||||
|
||||
got := v1alpha1.CopyBeaconBlockElectra(b)
|
||||
if !reflect.DeepEqual(got, b) {
|
||||
t.Errorf("TestCopyBeaconBlockElectra() = %v, want %v", got, b)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyBeaconBlockBodyElectra(t *testing.T) {
|
||||
bb := genBeaconBlockBodyElectra()
|
||||
|
||||
got := v1alpha1.CopyBeaconBlockBodyElectra(bb)
|
||||
if !reflect.DeepEqual(got, bb) {
|
||||
t.Errorf("TestCopyBeaconBlockBodyElectra() = %v, want %v", got, bb)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyExecutionPayloadElectra(t *testing.T) {
|
||||
p := genExecutionPayloadElectra()
|
||||
|
||||
got := v1alpha1.CopyExecutionPayloadElectra(p)
|
||||
if !reflect.DeepEqual(got, p) {
|
||||
t.Errorf("TestCopyExecutionPayloadElectra() = %v, want %v", got, p)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyDepositReceipts(t *testing.T) {
|
||||
drs := genDepositReceipts(10)
|
||||
|
||||
got := v1alpha1.CopyDepositReceipts(drs)
|
||||
if !reflect.DeepEqual(got, drs) {
|
||||
t.Errorf("TestCopyDepositReceipts() = %v, want %v", got, drs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyWithdrawalRequests(t *testing.T) {
|
||||
wrs := genWithdrawalRequests(10)
|
||||
|
||||
got := v1alpha1.CopyWithdrawalRequests(wrs)
|
||||
if !reflect.DeepEqual(got, wrs) {
|
||||
t.Errorf("TestCopyWithdrawalRequests() = %v, want %v", got, wrs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyExecutionPayloadHeaderElectra(t *testing.T) {
|
||||
p := genExecutionPayloadHeaderElectra()
|
||||
|
||||
got := v1alpha1.CopyExecutionPayloadHeaderElectra(p)
|
||||
if !reflect.DeepEqual(got, p) {
|
||||
t.Errorf("TestCopyExecutionPayloadHeaderElectra() = %v, want %v", got, p)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyPendingPartialWithdrawals(t *testing.T) {
|
||||
ppws := genPendingPartialWithdrawals(10)
|
||||
|
||||
got := v1alpha1.CopyPendingPartialWithdrawals(ppws)
|
||||
if !reflect.DeepEqual(got, ppws) {
|
||||
t.Errorf("TestCopyPendingPartialWithdrawals() = %v, want %v", got, ppws)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyPendingConsolidations(t *testing.T) {
|
||||
pcs := genPendingConsolidations(10)
|
||||
|
||||
got := v1alpha1.CopyPendingConsolidations(pcs)
|
||||
if !reflect.DeepEqual(got, pcs) {
|
||||
t.Errorf("TestCopyPendingConsolidations() = %v, want %v", got, pcs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyPendingBalanceDeposits(t *testing.T) {
|
||||
pbds := genPendingBalanceDeposits(10)
|
||||
|
||||
got := v1alpha1.CopyPendingBalanceDeposits(pbds)
|
||||
if !reflect.DeepEqual(got, pbds) {
|
||||
t.Errorf("TestCopyPendingBalanceDeposits() = %v, want %v", got, pbds)
|
||||
}
|
||||
}
|
||||
|
||||
func genAttestation() *v1alpha1.Attestation {
|
||||
return &v1alpha1.Attestation{
|
||||
AggregationBits: bytes(32),
|
||||
@@ -1176,3 +1347,264 @@ func genBLSToExecutionChange() *v1alpha1.SignedBLSToExecutionChange {
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genAttestationElectra() *v1alpha1.AttestationElectra {
|
||||
return &v1alpha1.AttestationElectra{
|
||||
AggregationBits: bytes(32),
|
||||
CommitteeBits: bytes(8),
|
||||
Data: genAttData(),
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genAttesterSlashingsElectra(num int) []*v1alpha1.AttesterSlashingElectra {
|
||||
as := make([]*v1alpha1.AttesterSlashingElectra, num)
|
||||
for i := 0; i < num; i++ {
|
||||
as[i] = genAttesterSlashingElectra()
|
||||
}
|
||||
return as
|
||||
}
|
||||
|
||||
func genAttesterSlashingElectra() *v1alpha1.AttesterSlashingElectra {
|
||||
return &v1alpha1.AttesterSlashingElectra{
|
||||
Attestation_1: genIndexedAttestationElectra(),
|
||||
Attestation_2: genIndexedAttestationElectra(),
|
||||
}
|
||||
}
|
||||
|
||||
func genIndexedAttestationElectra() *v1alpha1.IndexedAttestationElectra {
|
||||
return &v1alpha1.IndexedAttestationElectra{
|
||||
AttestingIndices: []uint64{1, 2, 3},
|
||||
Data: genAttData(),
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genAttestationsElectra(num int) []*v1alpha1.AttestationElectra {
|
||||
atts := make([]*v1alpha1.AttestationElectra, num)
|
||||
for i := 0; i < num; i++ {
|
||||
atts[i] = genAttestationElectra()
|
||||
}
|
||||
return atts
|
||||
}
|
||||
|
||||
func genSignedBlindedBeaconBlockElectra() *v1alpha1.SignedBlindedBeaconBlockElectra {
|
||||
return &v1alpha1.SignedBlindedBeaconBlockElectra{
|
||||
Message: genBlindedBeaconBlockElectra(),
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genBlindedBeaconBlockElectra() *v1alpha1.BlindedBeaconBlockElectra {
|
||||
return &v1alpha1.BlindedBeaconBlockElectra{
|
||||
Slot: 123455,
|
||||
ProposerIndex: 55433,
|
||||
ParentRoot: bytes(32),
|
||||
StateRoot: bytes(32),
|
||||
Body: genBlindedBeaconBlockBodyElectra(),
|
||||
}
|
||||
}
|
||||
|
||||
func genBlindedBeaconBlockBodyElectra() *v1alpha1.BlindedBeaconBlockBodyElectra {
|
||||
return &v1alpha1.BlindedBeaconBlockBodyElectra{
|
||||
RandaoReveal: bytes(96),
|
||||
Eth1Data: genEth1Data(),
|
||||
Graffiti: bytes(32),
|
||||
ProposerSlashings: genProposerSlashings(5),
|
||||
AttesterSlashings: genAttesterSlashingsElectra(5),
|
||||
Attestations: genAttestationsElectra(10),
|
||||
Deposits: genDeposits(5),
|
||||
VoluntaryExits: genSignedVoluntaryExits(12),
|
||||
SyncAggregate: genSyncAggregate(),
|
||||
ExecutionPayloadHeader: genExecutionPayloadHeaderElectra(),
|
||||
BlsToExecutionChanges: genBLSToExecutionChanges(10),
|
||||
BlobKzgCommitments: getKZGCommitments(4),
|
||||
Consolidations: genSignedConsolidations(5),
|
||||
}
|
||||
}
|
||||
|
||||
func genExecutionPayloadHeaderElectra() *enginev1.ExecutionPayloadHeaderElectra {
|
||||
return &enginev1.ExecutionPayloadHeaderElectra{
|
||||
ParentHash: bytes(32),
|
||||
FeeRecipient: bytes(20),
|
||||
StateRoot: bytes(32),
|
||||
ReceiptsRoot: bytes(32),
|
||||
LogsBloom: bytes(256),
|
||||
PrevRandao: bytes(32),
|
||||
BlockNumber: 1,
|
||||
GasLimit: 2,
|
||||
GasUsed: 3,
|
||||
Timestamp: 4,
|
||||
ExtraData: bytes(32),
|
||||
BaseFeePerGas: bytes(32),
|
||||
BlockHash: bytes(32),
|
||||
TransactionsRoot: bytes(32),
|
||||
WithdrawalsRoot: bytes(32),
|
||||
BlobGasUsed: 5,
|
||||
ExcessBlobGas: 6,
|
||||
DepositReceiptsRoot: bytes(32),
|
||||
WithdrawalRequestsRoot: bytes(32),
|
||||
}
|
||||
}
|
||||
|
||||
func genSignedConsolidations(num int) []*v1alpha1.SignedConsolidation {
|
||||
cs := make([]*v1alpha1.SignedConsolidation, num)
|
||||
for i := 0; i < num; i++ {
|
||||
cs[i] = genSignedConsolidation()
|
||||
}
|
||||
return cs
|
||||
}
|
||||
|
||||
func genSignedConsolidation() *v1alpha1.SignedConsolidation {
|
||||
return &v1alpha1.SignedConsolidation{
|
||||
Message: genConsolidation(),
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genConsolidation() *v1alpha1.Consolidation {
|
||||
return &v1alpha1.Consolidation{
|
||||
SourceIndex: 1,
|
||||
TargetIndex: 2,
|
||||
Epoch: 3,
|
||||
}
|
||||
}
|
||||
|
||||
func genSignedBeaconBlockElectra() *v1alpha1.SignedBeaconBlockElectra {
|
||||
return &v1alpha1.SignedBeaconBlockElectra{
|
||||
Block: genBeaconBlockElectra(),
|
||||
Signature: bytes(96),
|
||||
}
|
||||
}
|
||||
|
||||
func genBeaconBlockElectra() *v1alpha1.BeaconBlockElectra {
|
||||
return &v1alpha1.BeaconBlockElectra{
|
||||
Slot: 123455,
|
||||
ProposerIndex: 55433,
|
||||
ParentRoot: bytes(32),
|
||||
StateRoot: bytes(32),
|
||||
Body: genBeaconBlockBodyElectra(),
|
||||
}
|
||||
}
|
||||
|
||||
func genBeaconBlockBodyElectra() *v1alpha1.BeaconBlockBodyElectra {
|
||||
return &v1alpha1.BeaconBlockBodyElectra{
|
||||
RandaoReveal: bytes(96),
|
||||
Eth1Data: genEth1Data(),
|
||||
Graffiti: bytes(32),
|
||||
ProposerSlashings: genProposerSlashings(5),
|
||||
AttesterSlashings: genAttesterSlashingsElectra(5),
|
||||
Attestations: genAttestationsElectra(10),
|
||||
Deposits: genDeposits(5),
|
||||
VoluntaryExits: genSignedVoluntaryExits(12),
|
||||
SyncAggregate: genSyncAggregate(),
|
||||
ExecutionPayload: genExecutionPayloadElectra(),
|
||||
BlsToExecutionChanges: genBLSToExecutionChanges(10),
|
||||
BlobKzgCommitments: getKZGCommitments(4),
|
||||
Consolidations: genSignedConsolidations(5),
|
||||
}
|
||||
}
|
||||
|
||||
func genExecutionPayloadElectra() *enginev1.ExecutionPayloadElectra {
|
||||
return &enginev1.ExecutionPayloadElectra{
|
||||
ParentHash: bytes(32),
|
||||
FeeRecipient: bytes(20),
|
||||
StateRoot: bytes(32),
|
||||
ReceiptsRoot: bytes(32),
|
||||
LogsBloom: bytes(256),
|
||||
PrevRandao: bytes(32),
|
||||
BlockNumber: 1,
|
||||
GasLimit: 2,
|
||||
GasUsed: 3,
|
||||
Timestamp: 4,
|
||||
ExtraData: bytes(32),
|
||||
BaseFeePerGas: bytes(32),
|
||||
BlockHash: bytes(32),
|
||||
Transactions: [][]byte{{'a'}, {'b'}, {'c'}},
|
||||
Withdrawals: genWithdrawals(10),
|
||||
BlobGasUsed: 5,
|
||||
ExcessBlobGas: 6,
|
||||
DepositReceipts: genDepositReceipts(10),
|
||||
WithdrawalRequests: genWithdrawalRequests(10),
|
||||
}
|
||||
}
|
||||
|
||||
func genDepositReceipts(num int) []*enginev1.DepositReceipt {
|
||||
drs := make([]*enginev1.DepositReceipt, num)
|
||||
for i := 0; i < num; i++ {
|
||||
drs[i] = genDepositReceipt()
|
||||
}
|
||||
return drs
|
||||
}
|
||||
|
||||
func genDepositReceipt() *enginev1.DepositReceipt {
|
||||
return &enginev1.DepositReceipt{
|
||||
Pubkey: bytes(48),
|
||||
WithdrawalCredentials: bytes(32),
|
||||
Amount: 55555,
|
||||
Signature: bytes(96),
|
||||
Index: 123444,
|
||||
}
|
||||
}
|
||||
|
||||
func genWithdrawalRequests(num int) []*enginev1.ExecutionLayerWithdrawalRequest {
|
||||
wrs := make([]*enginev1.ExecutionLayerWithdrawalRequest, num)
|
||||
for i := 0; i < num; i++ {
|
||||
wrs[i] = genWithdrawalRequest()
|
||||
}
|
||||
return wrs
|
||||
}
|
||||
|
||||
func genWithdrawalRequest() *enginev1.ExecutionLayerWithdrawalRequest {
|
||||
return &enginev1.ExecutionLayerWithdrawalRequest{
|
||||
SourceAddress: bytes(20),
|
||||
ValidatorPubkey: bytes(48),
|
||||
Amount: 55555,
|
||||
}
|
||||
}
|
||||
|
||||
func genPendingPartialWithdrawals(num int) []*v1alpha1.PendingPartialWithdrawal {
|
||||
ppws := make([]*v1alpha1.PendingPartialWithdrawal, num)
|
||||
for i := 0; i < num; i++ {
|
||||
ppws[i] = genPendingPartialWithdrawal()
|
||||
}
|
||||
return ppws
|
||||
}
|
||||
|
||||
func genPendingPartialWithdrawal() *v1alpha1.PendingPartialWithdrawal {
|
||||
return &v1alpha1.PendingPartialWithdrawal{
|
||||
Index: 123456,
|
||||
Amount: 55555,
|
||||
WithdrawableEpoch: 444444,
|
||||
}
|
||||
}
|
||||
|
||||
func genPendingConsolidations(num int) []*v1alpha1.PendingConsolidation {
|
||||
pcs := make([]*v1alpha1.PendingConsolidation, num)
|
||||
for i := 0; i < num; i++ {
|
||||
pcs[i] = genPendingConsolidation()
|
||||
}
|
||||
return pcs
|
||||
}
|
||||
|
||||
func genPendingConsolidation() *v1alpha1.PendingConsolidation {
|
||||
return &v1alpha1.PendingConsolidation{
|
||||
SourceIndex: 1,
|
||||
TargetIndex: 2,
|
||||
}
|
||||
}
|
||||
|
||||
func genPendingBalanceDeposits(num int) []*v1alpha1.PendingBalanceDeposit {
|
||||
pbds := make([]*v1alpha1.PendingBalanceDeposit, num)
|
||||
for i := 0; i < num; i++ {
|
||||
pbds[i] = genPendingBalanceDeposit()
|
||||
}
|
||||
return pbds
|
||||
}
|
||||
|
||||
func genPendingBalanceDeposit() *v1alpha1.PendingBalanceDeposit {
|
||||
return &v1alpha1.PendingBalanceDeposit{
|
||||
Index: 123456,
|
||||
Amount: 55555,
|
||||
}
|
||||
}
|
||||
|
||||
12
proto/prysm/v1alpha1/eip_7251.go
Normal file
12
proto/prysm/v1alpha1/eip_7251.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package eth
|
||||
|
||||
func (c *Consolidation) ToPendingConsolidation() *PendingConsolidation {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
p := &PendingConsolidation{
|
||||
SourceIndex: c.SourceIndex,
|
||||
TargetIndex: c.TargetIndex,
|
||||
}
|
||||
return p
|
||||
}
|
||||
524
proto/prysm/v1alpha1/eip_7251.pb.go
generated
Executable file
524
proto/prysm/v1alpha1/eip_7251.pb.go
generated
Executable file
@@ -0,0 +1,524 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.25.1
|
||||
// source: proto/prysm/v1alpha1/eip_7251.proto
|
||||
|
||||
package eth
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
_ "github.com/prysmaticlabs/prysm/v5/proto/eth/ext"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type PendingBalanceDeposit struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Index github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PendingBalanceDeposit) Reset() {
|
||||
*x = PendingBalanceDeposit{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PendingBalanceDeposit) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PendingBalanceDeposit) ProtoMessage() {}
|
||||
|
||||
func (x *PendingBalanceDeposit) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PendingBalanceDeposit.ProtoReflect.Descriptor instead.
|
||||
func (*PendingBalanceDeposit) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PendingBalanceDeposit) GetIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.Index
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *PendingBalanceDeposit) GetAmount() uint64 {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PendingPartialWithdrawal struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Index github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
WithdrawableEpoch github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch `protobuf:"varint,3,opt,name=withdrawable_epoch,json=withdrawableEpoch,proto3" json:"withdrawable_epoch,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"`
|
||||
}
|
||||
|
||||
func (x *PendingPartialWithdrawal) Reset() {
|
||||
*x = PendingPartialWithdrawal{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PendingPartialWithdrawal) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PendingPartialWithdrawal) ProtoMessage() {}
|
||||
|
||||
func (x *PendingPartialWithdrawal) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PendingPartialWithdrawal.ProtoReflect.Descriptor instead.
|
||||
func (*PendingPartialWithdrawal) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PendingPartialWithdrawal) GetIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.Index
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *PendingPartialWithdrawal) GetAmount() uint64 {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PendingPartialWithdrawal) GetWithdrawableEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch {
|
||||
if x != nil {
|
||||
return x.WithdrawableEpoch
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(0)
|
||||
}
|
||||
|
||||
type Consolidation struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SourceIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,1,opt,name=source_index,json=sourceIndex,proto3" json:"source_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
TargetIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,2,opt,name=target_index,json=targetIndex,proto3" json:"target_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
Epoch github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"`
|
||||
}
|
||||
|
||||
func (x *Consolidation) Reset() {
|
||||
*x = Consolidation{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Consolidation) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Consolidation) ProtoMessage() {}
|
||||
|
||||
func (x *Consolidation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Consolidation.ProtoReflect.Descriptor instead.
|
||||
func (*Consolidation) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Consolidation) GetSourceIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.SourceIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *Consolidation) GetTargetIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.TargetIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *Consolidation) GetEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch {
|
||||
if x != nil {
|
||||
return x.Epoch
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(0)
|
||||
}
|
||||
|
||||
type SignedConsolidation struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Message *Consolidation `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
|
||||
}
|
||||
|
||||
func (x *SignedConsolidation) Reset() {
|
||||
*x = SignedConsolidation{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignedConsolidation) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignedConsolidation) ProtoMessage() {}
|
||||
|
||||
func (x *SignedConsolidation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignedConsolidation.ProtoReflect.Descriptor instead.
|
||||
func (*SignedConsolidation) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SignedConsolidation) GetMessage() *Consolidation {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignedConsolidation) GetSignature() []byte {
|
||||
if x != nil {
|
||||
return x.Signature
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PendingConsolidation struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SourceIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,1,opt,name=source_index,json=sourceIndex,proto3" json:"source_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
TargetIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,2,opt,name=target_index,json=targetIndex,proto3" json:"target_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
|
||||
}
|
||||
|
||||
func (x *PendingConsolidation) Reset() {
|
||||
*x = PendingConsolidation{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PendingConsolidation) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PendingConsolidation) ProtoMessage() {}
|
||||
|
||||
func (x *PendingConsolidation) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PendingConsolidation.ProtoReflect.Descriptor instead.
|
||||
func (*PendingConsolidation) Descriptor() ([]byte, []int) {
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *PendingConsolidation) GetSourceIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.SourceIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
func (x *PendingConsolidation) GetTargetIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
|
||||
if x != nil {
|
||||
return x.TargetIndex
|
||||
}
|
||||
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
|
||||
}
|
||||
|
||||
var File_proto_prysm_v1alpha1_eip_7251_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_prysm_v1alpha1_eip_7251_proto_rawDesc = []byte{
|
||||
0x0a, 0x23, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x65, 0x69, 0x70, 0x5f, 0x37, 0x32, 0x35, 0x31, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x1b, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x65, 0x78, 0x74, 0x2f, 0x6f, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x01, 0x0a, 0x15, 0x50, 0x65,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x44, 0x65, 0x70, 0x6f,
|
||||
0x73, 0x69, 0x74, 0x12, 0x65, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73,
|
||||
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e,
|
||||
0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74,
|
||||
0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x22, 0x90, 0x02, 0x0a, 0x18, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61,
|
||||
0x72, 0x74, 0x69, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x12,
|
||||
0x65, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f,
|
||||
0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
|
||||
0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52,
|
||||
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x75,
|
||||
0x0a, 0x12, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x65,
|
||||
0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76,
|
||||
0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65,
|
||||
0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f,
|
||||
0x63, 0x68, 0x52, 0x11, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x45, 0x70, 0x6f, 0x63, 0x68, 0x22, 0xd5, 0x02, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c,
|
||||
0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x72, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82,
|
||||
0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72,
|
||||
0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74,
|
||||
0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e,
|
||||
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0b,
|
||||
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x72, 0x0a, 0x0c, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73,
|
||||
0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69,
|
||||
0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x52, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12,
|
||||
0x5c, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46,
|
||||
0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
|
||||
0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x22, 0x7b, 0x0a,
|
||||
0x13, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f,
|
||||
0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52,
|
||||
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xfe, 0x01, 0x0a, 0x14, 0x50,
|
||||
0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x72, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61,
|
||||
0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73,
|
||||
0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72,
|
||||
0x63, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x72, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82,
|
||||
0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72,
|
||||
0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74,
|
||||
0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e,
|
||||
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0b,
|
||||
0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x97, 0x01, 0x0a, 0x19,
|
||||
0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0c, 0x45, 0x49, 0x50, 0x37, 0x32,
|
||||
0x35, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c,
|
||||
0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15,
|
||||
0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61,
|
||||
0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_rawDescOnce sync.Once
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_rawDescData = file_proto_prysm_v1alpha1_eip_7251_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_proto_prysm_v1alpha1_eip_7251_proto_rawDescGZIP() []byte {
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_rawDescOnce.Do(func() {
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_prysm_v1alpha1_eip_7251_proto_rawDescData)
|
||||
})
|
||||
return file_proto_prysm_v1alpha1_eip_7251_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_proto_prysm_v1alpha1_eip_7251_proto_goTypes = []interface{}{
|
||||
(*PendingBalanceDeposit)(nil), // 0: ethereum.eth.v1alpha1.PendingBalanceDeposit
|
||||
(*PendingPartialWithdrawal)(nil), // 1: ethereum.eth.v1alpha1.PendingPartialWithdrawal
|
||||
(*Consolidation)(nil), // 2: ethereum.eth.v1alpha1.Consolidation
|
||||
(*SignedConsolidation)(nil), // 3: ethereum.eth.v1alpha1.SignedConsolidation
|
||||
(*PendingConsolidation)(nil), // 4: ethereum.eth.v1alpha1.PendingConsolidation
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_eip_7251_proto_depIdxs = []int32{
|
||||
2, // 0: ethereum.eth.v1alpha1.SignedConsolidation.message:type_name -> ethereum.eth.v1alpha1.Consolidation
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_prysm_v1alpha1_eip_7251_proto_init() }
|
||||
func file_proto_prysm_v1alpha1_eip_7251_proto_init() {
|
||||
if File_proto_prysm_v1alpha1_eip_7251_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PendingBalanceDeposit); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PendingPartialWithdrawal); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Consolidation); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignedConsolidation); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PendingConsolidation); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_prysm_v1alpha1_eip_7251_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_proto_prysm_v1alpha1_eip_7251_proto_goTypes,
|
||||
DependencyIndexes: file_proto_prysm_v1alpha1_eip_7251_proto_depIdxs,
|
||||
MessageInfos: file_proto_prysm_v1alpha1_eip_7251_proto_msgTypes,
|
||||
}.Build()
|
||||
File_proto_prysm_v1alpha1_eip_7251_proto = out.File
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_rawDesc = nil
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_goTypes = nil
|
||||
file_proto_prysm_v1alpha1_eip_7251_proto_depIdxs = nil
|
||||
}
|
||||
4
proto/prysm/v1alpha1/eip_7251.pb.gw.go
Executable file
4
proto/prysm/v1alpha1/eip_7251.pb.gw.go
Executable file
@@ -0,0 +1,4 @@
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package ignore
|
||||
68
proto/prysm/v1alpha1/eip_7251.proto
Normal file
68
proto/prysm/v1alpha1/eip_7251.proto
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright 2020 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";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.v1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1;eth";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "EIP7251Proto";
|
||||
option java_package = "org.ethereum.eth.v1alpha1";
|
||||
option php_namespace = "Ethereum\\Eth\\v1alpha1";
|
||||
|
||||
message PendingBalanceDeposit {
|
||||
// Validator index for the deposit.
|
||||
uint64 index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
|
||||
// The amount of the deposit (gwei).
|
||||
uint64 amount = 2;
|
||||
}
|
||||
|
||||
message PendingPartialWithdrawal {
|
||||
// Validator index for the withdrawal.
|
||||
uint64 index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
|
||||
// The amount of the withdrawal (gwei).
|
||||
uint64 amount = 2;
|
||||
|
||||
// A partial withdrawal is valid at this epoch or later.
|
||||
uint64 withdrawable_epoch = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
|
||||
}
|
||||
|
||||
message Consolidation {
|
||||
// Validator from which the funds will be moved.
|
||||
uint64 source_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
// Validator to which the funds will be moved.
|
||||
uint64 target_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
// A consolidation is valid at this epoch or later.
|
||||
uint64 epoch = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"];
|
||||
}
|
||||
|
||||
message SignedConsolidation {
|
||||
// The unsigned consolidation itself.
|
||||
Consolidation message = 1;
|
||||
|
||||
// Validator's 96 byte signature
|
||||
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
}
|
||||
|
||||
message PendingConsolidation {
|
||||
// Validator from which the funds will be moved.
|
||||
uint64 source_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
// Validator to which the funds will be moved.
|
||||
uint64 target_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
|
||||
}
|
||||
21
proto/prysm/v1alpha1/eip_7251_test.go
Normal file
21
proto/prysm/v1alpha1/eip_7251_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package eth_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
v1alpha1 "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/assert"
|
||||
)
|
||||
|
||||
func TestConsolidation_ToPendingConsolidation(t *testing.T) {
|
||||
c := v1alpha1.Consolidation{
|
||||
SourceIndex: 1,
|
||||
TargetIndex: 2,
|
||||
Epoch: 3,
|
||||
}
|
||||
|
||||
pc := c.ToPendingConsolidation()
|
||||
|
||||
assert.Equal(t, c.SourceIndex, pc.SourceIndex)
|
||||
assert.Equal(t, c.TargetIndex, pc.TargetIndex)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
222
proto/prysm/v1alpha1/validator-client/keymanager.pb.go
generated
222
proto/prysm/v1alpha1/validator-client/keymanager.pb.go
generated
@@ -105,6 +105,8 @@ type SignRequest struct {
|
||||
// *SignRequest_BlindedBlockCapella
|
||||
// *SignRequest_BlockDeneb
|
||||
// *SignRequest_BlindedBlockDeneb
|
||||
// *SignRequest_BlockElectra
|
||||
// *SignRequest_BlindedBlockElectra
|
||||
Object isSignRequest_Object `protobuf_oneof:"object"`
|
||||
SigningSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,6,opt,name=signing_slot,json=signingSlot,proto3" json:"signing_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"`
|
||||
}
|
||||
@@ -288,6 +290,20 @@ func (x *SignRequest) GetBlindedBlockDeneb() *v1alpha1.BlindedBeaconBlockDeneb {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignRequest) GetBlockElectra() *v1alpha1.BeaconBlockElectra {
|
||||
if x, ok := x.GetObject().(*SignRequest_BlockElectra); ok {
|
||||
return x.BlockElectra
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignRequest) GetBlindedBlockElectra() *v1alpha1.BlindedBeaconBlockElectra {
|
||||
if x, ok := x.GetObject().(*SignRequest_BlindedBlockElectra); ok {
|
||||
return x.BlindedBlockElectra
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SignRequest) GetSigningSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot {
|
||||
if x != nil {
|
||||
return x.SigningSlot
|
||||
@@ -367,6 +383,14 @@ type SignRequest_BlindedBlockDeneb struct {
|
||||
BlindedBlockDeneb *v1alpha1.BlindedBeaconBlockDeneb `protobuf:"bytes,117,opt,name=blinded_block_deneb,json=blindedBlockDeneb,proto3,oneof"`
|
||||
}
|
||||
|
||||
type SignRequest_BlockElectra struct {
|
||||
BlockElectra *v1alpha1.BeaconBlockElectra `protobuf:"bytes,118,opt,name=block_electra,json=blockElectra,proto3,oneof"`
|
||||
}
|
||||
|
||||
type SignRequest_BlindedBlockElectra struct {
|
||||
BlindedBlockElectra *v1alpha1.BlindedBeaconBlockElectra `protobuf:"bytes,119,opt,name=blinded_block_electra,json=blindedBlockElectra,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*SignRequest_Block) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_AttestationData) isSignRequest_Object() {}
|
||||
@@ -401,6 +425,10 @@ func (*SignRequest_BlockDeneb) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_BlindedBlockDeneb) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_BlockElectra) isSignRequest_Object() {}
|
||||
|
||||
func (*SignRequest_BlindedBlockElectra) isSignRequest_Object() {}
|
||||
|
||||
type SignResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -659,7 +687,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte
|
||||
0x63, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x29, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61,
|
||||
0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x0d, 0x0a, 0x0b, 0x53,
|
||||
0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x0f, 0x0a, 0x0b, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09,
|
||||
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67,
|
||||
@@ -762,85 +790,97 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte
|
||||
0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42,
|
||||
0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x48, 0x00, 0x52, 0x11, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65,
|
||||
0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x12, 0x68, 0x0a, 0x0c, 0x73,
|
||||
0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f,
|
||||
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73,
|
||||
0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69,
|
||||
0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e,
|
||||
0x67, 0x53, 0x6c, 0x6f, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4a,
|
||||
0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xb7, 0x01, 0x0a, 0x0c,
|
||||
0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, 0x0a, 0x06, 0x73, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d,
|
||||
0x0a, 0x09, 0x53, 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a,
|
||||
0x06, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49,
|
||||
0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0xb3, 0x01, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
|
||||
0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12,
|
||||
0x23, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
|
||||
0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a,
|
||||
0x08, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48,
|
||||
0x00, 0x52, 0x08, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x88, 0x01, 0x01, 0x42, 0x0b,
|
||||
0x0a, 0x09, 0x5f, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x22, 0xa6, 0x01, 0x0a, 0x0d,
|
||||
0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
|
||||
0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x63, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d,
|
||||
0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76,
|
||||
0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65,
|
||||
0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, 0x6e, 0x74,
|
||||
0x36, 0x34, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65,
|
||||
0x6c, 0x61, 0x79, 0x73, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65,
|
||||
0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f,
|
||||
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
||||
0x61, 0x64, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
||||
0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
|
||||
0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61,
|
||||
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x1a, 0x78, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4b, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72,
|
||||
0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xce,
|
||||
0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x65, 0x6e, 0x65, 0x62, 0x12, 0x50, 0x0a, 0x0d, 0x62,
|
||||
0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x18, 0x76, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74,
|
||||
0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f,
|
||||
0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x48, 0x00, 0x52,
|
||||
0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x66, 0x0a,
|
||||
0x15, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x65,
|
||||
0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x18, 0x77, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65,
|
||||
0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c,
|
||||
0x70, 0x68, 0x61, 0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x65, 0x61, 0x63,
|
||||
0x6f, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x61, 0x48, 0x00,
|
||||
0x52, 0x13, 0x62, 0x6c, 0x69, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x72, 0x61, 0x12, 0x68, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67,
|
||||
0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18,
|
||||
0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f,
|
||||
0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70,
|
||||
0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c,
|
||||
0x6f, 0x74, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x42,
|
||||
0x08, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a,
|
||||
0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xb7, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e,
|
||||
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x73, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
||||
0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55,
|
||||
0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x43, 0x43,
|
||||
0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4e, 0x49, 0x45,
|
||||
0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22,
|
||||
0xb3, 0x01, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x65, 0x65,
|
||||
0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x47,
|
||||
0x0a, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32,
|
||||
0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07,
|
||||
0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x08, 0x67, 0x72, 0x61, 0x66, 0x66,
|
||||
0x69, 0x74, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x67, 0x72, 0x61,
|
||||
0x66, 0x66, 0x69, 0x74, 0x69, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x67, 0x72, 0x61,
|
||||
0x66, 0x66, 0x69, 0x74, 0x69, 0x22, 0xa6, 0x01, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65,
|
||||
0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x12, 0x63, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61,
|
||||
0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
|
||||
0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e,
|
||||
0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, 0x02, 0x1e,
|
||||
0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, 0xca, 0x02,
|
||||
0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x32, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x08, 0x67, 0x61,
|
||||
0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73,
|
||||
0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0xe7,
|
||||
0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69,
|
||||
0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72,
|
||||
0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76,
|
||||
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x50, 0x72, 0x6f,
|
||||
0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x52, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x12, 0x5c, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72,
|
||||
0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73,
|
||||
0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52,
|
||||
0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x78,
|
||||
0x0a, 0x13, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75,
|
||||
0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72,
|
||||
0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x05, 0x76,
|
||||
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xce, 0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x42,
|
||||
0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
|
||||
0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79,
|
||||
0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73,
|
||||
0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69,
|
||||
0x64, 0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65,
|
||||
0x75, 0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72,
|
||||
0x65, 0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -879,6 +919,8 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_goTypes = []inte
|
||||
(*v1alpha1.BlindedBeaconBlockCapella)(nil), // 18: ethereum.eth.v1alpha1.BlindedBeaconBlockCapella
|
||||
(*v1alpha1.BeaconBlockDeneb)(nil), // 19: ethereum.eth.v1alpha1.BeaconBlockDeneb
|
||||
(*v1alpha1.BlindedBeaconBlockDeneb)(nil), // 20: ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb
|
||||
(*v1alpha1.BeaconBlockElectra)(nil), // 21: ethereum.eth.v1alpha1.BeaconBlockElectra
|
||||
(*v1alpha1.BlindedBeaconBlockElectra)(nil), // 22: ethereum.eth.v1alpha1.BlindedBeaconBlockElectra
|
||||
}
|
||||
var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int32{
|
||||
7, // 0: ethereum.validator.accounts.v2.SignRequest.block:type_name -> ethereum.eth.v1alpha1.BeaconBlock
|
||||
@@ -895,16 +937,18 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int3
|
||||
18, // 11: ethereum.validator.accounts.v2.SignRequest.blinded_block_capella:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockCapella
|
||||
19, // 12: ethereum.validator.accounts.v2.SignRequest.block_deneb:type_name -> ethereum.eth.v1alpha1.BeaconBlockDeneb
|
||||
20, // 13: ethereum.validator.accounts.v2.SignRequest.blinded_block_deneb:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb
|
||||
0, // 14: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status
|
||||
4, // 15: ethereum.validator.accounts.v2.ProposerOptionPayload.builder:type_name -> ethereum.validator.accounts.v2.BuilderConfig
|
||||
6, // 16: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry
|
||||
3, // 17: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload
|
||||
3, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload
|
||||
19, // [19:19] is the sub-list for method output_type
|
||||
19, // [19:19] is the sub-list for method input_type
|
||||
19, // [19:19] is the sub-list for extension type_name
|
||||
19, // [19:19] is the sub-list for extension extendee
|
||||
0, // [0:19] is the sub-list for field type_name
|
||||
21, // 14: ethereum.validator.accounts.v2.SignRequest.block_electra:type_name -> ethereum.eth.v1alpha1.BeaconBlockElectra
|
||||
22, // 15: ethereum.validator.accounts.v2.SignRequest.blinded_block_electra:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockElectra
|
||||
0, // 16: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status
|
||||
4, // 17: ethereum.validator.accounts.v2.ProposerOptionPayload.builder:type_name -> ethereum.validator.accounts.v2.BuilderConfig
|
||||
6, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry
|
||||
3, // 19: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload
|
||||
3, // 20: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload
|
||||
21, // [21:21] is the sub-list for method output_type
|
||||
21, // [21:21] is the sub-list for method input_type
|
||||
21, // [21:21] is the sub-list for extension type_name
|
||||
21, // [21:21] is the sub-list for extension extendee
|
||||
0, // [0:21] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() }
|
||||
@@ -992,6 +1036,8 @@ func file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() {
|
||||
(*SignRequest_BlindedBlockCapella)(nil),
|
||||
(*SignRequest_BlockDeneb)(nil),
|
||||
(*SignRequest_BlindedBlockDeneb)(nil),
|
||||
(*SignRequest_BlockElectra)(nil),
|
||||
(*SignRequest_BlindedBlockElectra)(nil),
|
||||
}
|
||||
file_proto_prysm_v1alpha1_validator_client_keymanager_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
|
||||
@@ -61,6 +61,10 @@ message SignRequest {
|
||||
// Deneb objects.
|
||||
ethereum.eth.v1alpha1.BeaconBlockDeneb block_deneb = 116;
|
||||
ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb blinded_block_deneb = 117;
|
||||
|
||||
// Electra objects.
|
||||
ethereum.eth.v1alpha1.BeaconBlockElectra block_electra = 118;
|
||||
ethereum.eth.v1alpha1.BlindedBeaconBlockElectra blinded_block_electra = 119;
|
||||
}
|
||||
reserved 4, 5; // Reserving old, deleted fields.
|
||||
uint64 signing_slot = 6 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"];
|
||||
@@ -102,4 +106,4 @@ message BuilderConfig {
|
||||
message ProposerSettingsPayload {
|
||||
map<string, ProposerOptionPayload> proposer_config = 1;
|
||||
ProposerOptionPayload default_config = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ mainnet = {
|
||||
"max_blobs_per_block.size": "6",
|
||||
"max_blob_commitments.size": "4096",
|
||||
"kzg_commitment_inclusion_proof_depth.size": "17",
|
||||
"max_withdrawal_requests_per_payload.size":"16",
|
||||
"max_deposit_receipts": "8192",
|
||||
"max_attesting_indices.size": "131072",
|
||||
"max_committees_per_slot.size": "64",
|
||||
"committee_bits.size": "8",
|
||||
"committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector64",
|
||||
"pending_balance_deposits_limit": "134217728",
|
||||
"pending_partial_withdrawals_limit": "134217728",
|
||||
"pending_consolidations_limit": "262144",
|
||||
}
|
||||
|
||||
minimal = {
|
||||
@@ -48,6 +57,15 @@ minimal = {
|
||||
"max_blobs_per_block.size": "6",
|
||||
"max_blob_commitments.size": "16",
|
||||
"kzg_commitment_inclusion_proof_depth.size": "9",
|
||||
"max_withdrawal_requests_per_payload.size":"2",
|
||||
"max_deposit_receipts": "4",
|
||||
"max_attesting_indices.size": "8192",
|
||||
"max_committees_per_slot.size": "4",
|
||||
"committee_bits.size": "1",
|
||||
"committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector4",
|
||||
"pending_balance_deposits_limit": "134217728",
|
||||
"pending_partial_withdrawals_limit": "64",
|
||||
"pending_consolidations_limit": "64",
|
||||
}
|
||||
|
||||
###### Rules definitions #######
|
||||
|
||||
@@ -8,6 +8,7 @@ const (
|
||||
Bellatrix
|
||||
Capella
|
||||
Deneb
|
||||
Electra
|
||||
)
|
||||
|
||||
var versionToString = map[int]string{
|
||||
@@ -16,6 +17,7 @@ var versionToString = map[int]string{
|
||||
Bellatrix: "bellatrix",
|
||||
Capella: "capella",
|
||||
Deneb: "deneb",
|
||||
Electra: "electra",
|
||||
}
|
||||
|
||||
// stringToVersion and allVersions are populated in init()
|
||||
|
||||
12
testing/spectest/mainnet/electra/ssz_static/BUILD.bazel
Normal file
12
testing/spectest/mainnet/electra/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//testing/spectest/shared/electra/ssz_static:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/ssz_static"
|
||||
)
|
||||
|
||||
func TestMainnet_Electra_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "mainnet")
|
||||
}
|
||||
16
testing/spectest/minimal/electra/ssz_static/BUILD.bazel
Normal file
16
testing/spectest/minimal/electra/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,16 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
tags = [
|
||||
"minimal",
|
||||
"spectest",
|
||||
],
|
||||
deps = ["//testing/spectest/shared/electra/ssz_static:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/ssz_static"
|
||||
)
|
||||
|
||||
func TestMinimal_Electra_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "minimal")
|
||||
}
|
||||
15
testing/spectest/shared/electra/ssz_static/BUILD.bazel
Normal file
15
testing/spectest/shared/electra/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,15 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["ssz_static.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/ssz_static",
|
||||
visibility = ["//testing/spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/spectest/shared/common/ssz_static:go_default_library",
|
||||
"@com_github_prysmaticlabs_fastssz//:go_default_library",
|
||||
],
|
||||
)
|
||||
170
testing/spectest/shared/electra/ssz_static/ssz_static.go
Normal file
170
testing/spectest/shared/electra/ssz_static/ssz_static.go
Normal file
@@ -0,0 +1,170 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
fssz "github.com/prysmaticlabs/fastssz"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
common "github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/common/ssz_static"
|
||||
)
|
||||
|
||||
// RunSSZStaticTests executes "ssz_static" tests.
|
||||
func RunSSZStaticTests(t *testing.T, config string) {
|
||||
common.RunSSZStaticTests(t, config, "electra", UnmarshalledSSZ, customHtr)
|
||||
}
|
||||
|
||||
func customHtr(t *testing.T, htrs []common.HTR, object interface{}) []common.HTR {
|
||||
// TODO: Replace BeaconStateDeneb with BeaconStateElectra below and uncomment the code
|
||||
//_, ok := object.(*ethpb.BeaconStateDeneb)
|
||||
//if !ok {
|
||||
// return htrs
|
||||
//}
|
||||
//
|
||||
//htrs = append(htrs, func(s interface{}) ([32]byte, error) {
|
||||
// beaconState, err := state_native.InitializeFromProtoDeneb(s.(*ethpb.BeaconStateDeneb))
|
||||
// require.NoError(t, err)
|
||||
// return beaconState.HashTreeRoot(context.Background())
|
||||
//})
|
||||
return htrs
|
||||
}
|
||||
|
||||
// UnmarshalledSSZ unmarshalls serialized input.
|
||||
func UnmarshalledSSZ(t *testing.T, serializedBytes []byte, folderName string) (interface{}, error) {
|
||||
// TODO: Remove this check once BeaconState custom HTR function is ready
|
||||
if folderName == "BeaconState" {
|
||||
t.Skip("BeaconState is not ready")
|
||||
}
|
||||
var obj interface{}
|
||||
switch folderName {
|
||||
case "ExecutionPayload":
|
||||
obj = &enginev1.ExecutionPayloadElectra{}
|
||||
case "ExecutionPayloadHeader":
|
||||
obj = &enginev1.ExecutionPayloadHeaderElectra{}
|
||||
case "Attestation":
|
||||
obj = ðpb.AttestationElectra{}
|
||||
case "AttestationData":
|
||||
obj = ðpb.AttestationData{}
|
||||
case "AttesterSlashing":
|
||||
obj = ðpb.AttesterSlashingElectra{}
|
||||
case "AggregateAndProof":
|
||||
obj = ðpb.AggregateAttestationAndProofElectra{}
|
||||
case "BeaconBlock":
|
||||
obj = ðpb.BeaconBlockElectra{}
|
||||
case "BeaconBlockBody":
|
||||
obj = ðpb.BeaconBlockBodyElectra{}
|
||||
case "BeaconBlockHeader":
|
||||
obj = ðpb.BeaconBlockHeader{}
|
||||
case "BeaconState":
|
||||
obj = ðpb.BeaconStateElectra{}
|
||||
case "Checkpoint":
|
||||
obj = ðpb.Checkpoint{}
|
||||
case "Deposit":
|
||||
obj = ðpb.Deposit{}
|
||||
case "DepositMessage":
|
||||
obj = ðpb.DepositMessage{}
|
||||
case "DepositData":
|
||||
obj = ðpb.Deposit_Data{}
|
||||
case "Eth1Data":
|
||||
obj = ðpb.Eth1Data{}
|
||||
case "Eth1Block":
|
||||
t.Skip("Unused type")
|
||||
return nil, nil
|
||||
case "Fork":
|
||||
obj = ðpb.Fork{}
|
||||
case "ForkData":
|
||||
obj = ðpb.ForkData{}
|
||||
case "HistoricalBatch":
|
||||
obj = ðpb.HistoricalBatch{}
|
||||
case "IndexedAttestation":
|
||||
obj = ðpb.IndexedAttestationElectra{}
|
||||
case "PendingAttestation":
|
||||
obj = ðpb.PendingAttestation{}
|
||||
case "ProposerSlashing":
|
||||
obj = ðpb.ProposerSlashing{}
|
||||
case "SignedAggregateAndProof":
|
||||
obj = ðpb.SignedAggregateAttestationAndProofElectra{}
|
||||
case "SignedBeaconBlock":
|
||||
obj = ðpb.SignedBeaconBlockElectra{}
|
||||
case "SignedBeaconBlockHeader":
|
||||
obj = ðpb.SignedBeaconBlockHeader{}
|
||||
case "SignedVoluntaryExit":
|
||||
obj = ðpb.SignedVoluntaryExit{}
|
||||
case "SigningData":
|
||||
obj = ðpb.SigningData{}
|
||||
case "Validator":
|
||||
obj = ðpb.Validator{}
|
||||
case "VoluntaryExit":
|
||||
obj = ðpb.VoluntaryExit{}
|
||||
case "SyncCommitteeMessage":
|
||||
obj = ðpb.SyncCommitteeMessage{}
|
||||
case "SyncCommitteeContribution":
|
||||
obj = ðpb.SyncCommitteeContribution{}
|
||||
case "ContributionAndProof":
|
||||
obj = ðpb.ContributionAndProof{}
|
||||
case "SignedContributionAndProof":
|
||||
obj = ðpb.SignedContributionAndProof{}
|
||||
case "SyncAggregate":
|
||||
obj = ðpb.SyncAggregate{}
|
||||
case "SyncAggregatorSelectionData":
|
||||
obj = ðpb.SyncAggregatorSelectionData{}
|
||||
case "SyncCommittee":
|
||||
obj = ðpb.SyncCommittee{}
|
||||
case "LightClientOptimisticUpdate":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientFinalityUpdate":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientBootstrap":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientSnapshot":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientUpdate":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientHeader":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "BlobIdentifier":
|
||||
obj = ðpb.BlobIdentifier{}
|
||||
case "BlobSidecar":
|
||||
obj = ðpb.BlobSidecar{}
|
||||
case "PowBlock":
|
||||
obj = ðpb.PowBlock{}
|
||||
case "Withdrawal":
|
||||
obj = &enginev1.Withdrawal{}
|
||||
case "HistoricalSummary":
|
||||
obj = ðpb.HistoricalSummary{}
|
||||
case "BLSToExecutionChange":
|
||||
obj = ðpb.BLSToExecutionChange{}
|
||||
case "SignedBLSToExecutionChange":
|
||||
obj = ðpb.SignedBLSToExecutionChange{}
|
||||
case "PendingBalanceDeposit":
|
||||
obj = ðpb.PendingBalanceDeposit{}
|
||||
case "PendingPartialWithdrawal":
|
||||
obj = ðpb.PendingPartialWithdrawal{}
|
||||
case "Consolidation":
|
||||
obj = ðpb.Consolidation{}
|
||||
case "SignedConsolidation":
|
||||
obj = ðpb.SignedConsolidation{}
|
||||
case "PendingConsolidation":
|
||||
obj = ðpb.PendingConsolidation{}
|
||||
case "ExecutionLayerWithdrawalRequest":
|
||||
obj = &enginev1.ExecutionLayerWithdrawalRequest{}
|
||||
case "DepositReceipt":
|
||||
obj = &enginev1.DepositReceipt{}
|
||||
default:
|
||||
return nil, errors.New("type not found")
|
||||
}
|
||||
var err error
|
||||
if o, ok := obj.(fssz.Unmarshaler); ok {
|
||||
err = o.UnmarshalSSZ(serializedBytes)
|
||||
} else {
|
||||
err = errors.New("could not unmarshal object, not a fastssz compatible object")
|
||||
}
|
||||
return obj, err
|
||||
}
|
||||
Reference in New Issue
Block a user