Compare commits

...

54 Commits

Author SHA1 Message Date
Raul Jordan
b5bd461627 minimal node/tree backing implementation 2021-11-20 12:22:10 -05:00
Raul Jordan
8fecc5af7f builds 2021-11-20 01:44:35 -05:00
Raul Jordan
03e40edf2c refactor 2021-11-20 01:02:34 -05:00
Raul Jordan
7a2b8e4e6a Merge branch 'develop' into light 2021-11-01 22:14:13 -04:00
Raul Jordan
e13cdf493e empt 2021-10-31 13:25:14 -04:00
Raul Jordan
fdd9c535b4 viz 2021-10-31 13:20:46 -04:00
Raul Jordan
ba728d4929 gaz 2021-10-31 12:20:01 -05:00
Raul Jordan
cd5eb0a2ef light go 2021-10-31 13:19:18 -04:00
Raul Jordan
6d44428e9c build protos 2021-10-31 12:18:53 -05:00
Raul Jordan
cefb5cec55 dep 2021-10-31 12:06:51 -05:00
Raul Jordan
815debee38 p 2021-10-31 13:00:50 -04:00
Raul Jordan
fc6c17cc75 p 2021-10-31 13:00:18 -04:00
Raul Jordan
df0e9fa3d7 dep 2021-10-31 12:59:35 -04:00
Raul Jordan
0287bc65c7 add build files 2021-10-31 11:59:13 -05:00
Raul Jordan
35c3225579 rem build 2021-10-31 12:53:42 -04:00
Raul Jordan
f238f872a1 use les 2021-10-31 12:48:44 -04:00
Raul Jordan
24f105b804 light 2021-10-30 22:58:54 -04:00
Raul Jordan
f98354f59f handle public key 2021-10-30 22:52:34 -04:00
Raul Jordan
2aea4e49f4 gen 2021-10-30 22:41:33 -04:00
Raul Jordan
a8e8338973 add 2021-10-30 22:36:30 -04:00
Raul Jordan
ed78d15ed6 check nil 2021-10-30 22:20:48 -04:00
Raul Jordan
d5cf0a2e54 blk 2021-10-30 22:19:40 -04:00
Raul Jordan
b89bb3fa30 genesis 2021-10-30 22:15:07 -04:00
Raul Jordan
be722f2c5c compiles 2021-10-30 22:07:39 -04:00
Raul Jordan
09c99b25bc light server updates 2021-10-30 22:02:32 -04:00
Raul Jordan
24ff40fbf5 regen 2021-10-30 17:02:20 -05:00
Raul Jordan
d96491ffa9 service wait for sync 2021-10-30 17:59:23 -04:00
Raul Jordan
5121a50bb4 service definitions 2021-10-30 17:54:54 -04:00
Raul Jordan
1c6d914ea1 add in functional endpoints 2021-10-30 17:36:24 -04:00
Raul Jordan
71adada879 database additions 2021-10-30 17:30:28 -04:00
Raul Jordan
5790aa66e0 light updater builds 2021-10-30 17:06:37 -04:00
Raul Jordan
8e6bb39d2f add in generated 2021-10-30 15:58:39 -05:00
Raul Jordan
ad06914f45 no expr 2021-10-30 16:56:17 -04:00
Raul Jordan
259e07d5c9 Merge branch 'light' of github.com:prysmaticlabs/prysm into light 2021-10-30 16:55:31 -04:00
Raul Jordan
f6cf77acd8 fix 2021-10-30 16:55:27 -04:00
Raul Jordan
40a36fb02d workspace 2021-10-30 15:54:31 -05:00
Raul Jordan
2e65be12b8 protos 2021-10-30 16:48:22 -04:00
Raul Jordan
4a237e11bc sync dev 2021-10-30 16:28:10 -04:00
Raul Jordan
4d9eafe110 add proto 2021-10-24 22:28:16 -04:00
Raul Jordan
7b1b9a564b type align 2021-10-24 22:22:41 -04:00
Raul Jordan
341cced53f more changes to updater 2021-10-24 22:17:47 -04:00
Raul Jordan
a3ad254b78 updater changes 2021-10-21 09:57:40 -04:00
Raul Jordan
a7fc25f2e0 start les update 2021-10-18 23:00:03 -04:00
Raul Jordan
9551a6c4b8 begin updater server 2021-10-18 00:18:49 -04:00
Raul Jordan
d39113af60 add in generated ssz tree 2021-10-18 00:05:57 -04:00
Raul Jordan
d27334746b attempt 2021-10-11 00:28:24 -04:00
Raul Jordan
d00c7a0ce8 add in test 2021-10-11 00:23:29 -04:00
Raul Jordan
c7826856a5 check in ferran ssz 2021-10-11 00:15:24 -04:00
Raul Jordan
1bec9ae9e6 add in generated ssz 2021-10-11 00:11:39 -04:00
Raul Jordan
17ed9356ff client server files 2021-10-09 17:10:51 -04:00
Raul Jordan
c493290027 split up files 2021-10-09 17:08:16 -04:00
Raul Jordan
30c07a8a1a les server running 2021-10-08 17:33:26 -04:00
Raul Jordan
b7fb8a8dcd begin les 2021-10-06 13:07:52 -04:00
Raul Jordan
bd108c3244 start les 2021-10-04 09:36:41 -04:00
43 changed files with 3757 additions and 198 deletions

View File

@@ -160,7 +160,6 @@ type Database interface {
io.Closer
backup.BackupExporter
HeadAccessDatabase
DatabasePath() string
ClearDB() error
}

View File

@@ -13,6 +13,7 @@ go_library(
"finalized_block_roots.go",
"genesis.go",
"kv.go",
"light.go",
"log.go",
"migration.go",
"migration_archived_index.go",

View File

@@ -0,0 +1,32 @@
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"service.go",
"update_comparison.go",
"updater.go",
],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/light",
visibility = ["//visibility:public"],
deps = [
"//beacon-chain/blockchain:go_default_library",
"//beacon-chain/core/feed:go_default_library",
"//beacon-chain/core/feed/state:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/db/iface:go_default_library",
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//beacon-chain/sync:go_default_library",
"//config/params:go_default_library",
"//encoding/bytesutil:go_default_library",
"//network/forks:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//proto/prysm/v1alpha1/block:go_default_library",
"//time/slots:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)

View File

@@ -0,0 +1,178 @@
package light
import (
"context"
"sync"
"time"
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/beacon-chain/db/iface"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
syncSrv "github.com/prysmaticlabs/prysm/beacon-chain/sync"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
block2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/time/slots"
)
type Config struct {
StateGen stategen.StateManager
Database iface.Database
HeadFetcher blockchain.HeadFetcher
FinalizationFetcher blockchain.FinalizationFetcher
StateNotifier statefeed.Notifier
TimeFetcher blockchain.TimeFetcher
SyncChecker syncSrv.Checker
}
type Service struct {
cfg *Config
cancelFunc context.CancelFunc
prevHeadData map[[32]byte]*ethpb.SyncAttestedData
lock sync.RWMutex
genesisTime time.Time
finalizedByEpoch map[types.Epoch]*ethpb.LightClientFinalizedCheckpoint
bestUpdateByPeriod map[uint64]*ethpb.LightClientUpdate
latestFinalizedUpdate *ethpb.LightClientUpdate
latestNonFinalizedUpdate *ethpb.LightClientUpdate
}
// New --
func New(ctx context.Context, cfg *Config) *Service {
return &Service{
cfg: cfg,
prevHeadData: make(map[[32]byte]*ethpb.SyncAttestedData),
finalizedByEpoch: make(map[types.Epoch]*ethpb.LightClientFinalizedCheckpoint),
bestUpdateByPeriod: make(map[uint64]*ethpb.LightClientUpdate),
}
}
func (s *Service) Start() {
go s.run()
}
func (s *Service) Stop() error {
s.cancelFunc()
return nil
}
func (s *Service) Status() error {
return nil
}
func (s *Service) run() {
ctx, cancel := context.WithCancel(context.Background())
s.cancelFunc = cancel
s.waitForChainInitialization(ctx)
s.waitForSync(ctx)
// Initialize the service from finalized (state, block) data.
log.Info("Initializing from finalized data")
if err := s.initializeFromFinalizedData(ctx); err != nil {
log.Fatal(err)
}
log.Info("Beginning subscriptions")
// Begin listening for new chain head and finalized checkpoint events.
go s.subscribeHeadEvent(ctx)
go s.subscribeFinalizedEvent(ctx)
}
func (s *Service) waitForChainInitialization(ctx context.Context) {
stateChannel := make(chan *feed.Event, 1)
stateSub := s.cfg.StateNotifier.StateFeed().Subscribe(stateChannel)
defer stateSub.Unsubscribe()
defer close(stateChannel)
for {
select {
case stateEvent := <-stateChannel:
// Wait for us to receive the genesis time via a chain started notification.
if stateEvent.Type == statefeed.Initialized {
// Alternatively, if the chain has already started, we then read the genesis
// time value from this data.
data, ok := stateEvent.Data.(*statefeed.InitializedData)
if !ok {
log.Error(
"Could not receive chain start notification, want *statefeed.ChainStartedData",
)
return
}
s.genesisTime = data.StartTime
log.WithField("genesisTime", s.genesisTime).Info(
"Received chain initialization event",
)
return
}
case err := <-stateSub.Err():
log.WithError(err).Error(
"Could not subscribe to state events",
)
return
case <-ctx.Done():
return
}
}
}
func (s *Service) waitForSync(ctx context.Context) {
slotTicker := slots.NewSlotTicker(s.genesisTime, params.BeaconConfig().SecondsPerSlot)
defer slotTicker.Done()
for {
select {
case <-slotTicker.C():
if slots.ToEpoch(slots.SinceGenesis(s.genesisTime)) < 6 {
continue
}
return
case <-ctx.Done():
return
}
}
}
func (s *Service) finalizedBlockOrGenesis(ctx context.Context, cpt *ethpb.Checkpoint) (block2.SignedBeaconBlock, error) {
checkpointRoot := bytesutil.ToBytes32(cpt.Root)
block, err := s.cfg.Database.Block(ctx, checkpointRoot)
if err != nil {
return nil, err
}
if block == nil || block.IsNil() {
return s.cfg.Database.GenesisBlock(ctx)
}
return block, nil
}
func (s *Service) finalizedStateOrGenesis(ctx context.Context, cpt *ethpb.Checkpoint) (state.BeaconState, error) {
checkpointRoot := bytesutil.ToBytes32(cpt.Root)
st, err := s.cfg.StateGen.StateByRoot(ctx, checkpointRoot)
if err != nil {
return nil, err
}
if st == nil || st.IsNil() {
return s.cfg.Database.GenesisState(ctx)
}
return st, nil
}
func (s *Service) initializeFromFinalizedData(ctx context.Context) error {
log.Info("Getting finalized checkpoint")
cpt, err := s.cfg.Database.FinalizedCheckpoint(ctx)
if err != nil {
return err
}
log.Info("Getting finalized block or genesis")
finalizedBlock, err := s.finalizedBlockOrGenesis(ctx, cpt)
if err != nil {
return err
}
log.Info("Getting finalized state or genesis")
finalizedState, err := s.finalizedStateOrGenesis(ctx, cpt)
if err != nil {
return err
}
log.Info("Calling onFinalized")
return s.onFinalized(ctx, finalizedBlock, finalizedState)
}

View File

@@ -0,0 +1,103 @@
package light
import (
"context"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
v1 "github.com/prysmaticlabs/prysm/proto/eth/v1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/time/slots"
)
func (s *Service) subscribeFinalizedEvent(ctx context.Context) {
stateChan := make(chan *feed.Event, 1)
sub := s.cfg.StateNotifier.StateFeed().Subscribe(stateChan)
defer sub.Unsubscribe()
for {
select {
case ev := <-stateChan:
if ev.Type == statefeed.FinalizedCheckpoint {
blk, beaconState, err := s.parseFinalizedEvent(ctx, ev.Data)
if err != nil {
log.Error(err)
continue
}
if err := s.onFinalized(ctx, blk, beaconState); err != nil {
log.Error(err)
continue
}
}
}
}
}
func (s *Service) parseFinalizedEvent(
ctx context.Context, eventData interface{},
) (block.SignedBeaconBlock, state.BeaconState, error) {
finalizedCheckpoint, ok := eventData.(*v1.EventFinalizedCheckpoint)
if !ok {
return nil, nil, errors.New("expected finalized checkpoint event")
}
checkpointRoot := bytesutil.ToBytes32(finalizedCheckpoint.Block)
blk, err := s.cfg.Database.Block(ctx, checkpointRoot)
if err != nil {
return nil, nil, err
}
if blk == nil || blk.IsNil() {
return nil, nil, err
}
st, err := s.cfg.StateGen.StateByRoot(ctx, checkpointRoot)
if err != nil {
return nil, nil, err
}
if st == nil || st.IsNil() {
return nil, nil, err
}
return blk, st, nil
}
func (s *Service) onFinalized(
ctx context.Context, signedBlock block.SignedBeaconBlock, postState state.BeaconStateAltair,
) error {
log.Info("Getting beacon state")
innerState, ok := postState.InnerStateUnsafe().(*ethpb.BeaconStateAltair)
if !ok {
return errors.New("expected an Altair beacon state")
}
blk := signedBlock.Block()
log.Info("Getting beacon block header")
header, err := block.BeaconBlockHeaderFromBlockInterface(blk)
if err != nil {
return err
}
log.Info("Getting state tree")
tr, err := innerState.GetTree()
if err != nil {
return err
}
log.Info("Getting next sync committee proof")
nextSyncCommitteeBranch, err := tr.Prove(NextSyncCommitteeIndex)
if err != nil {
return err
}
log.Info("Getting next sync committee")
nextSyncCommittee, err := postState.NextSyncCommittee()
if err != nil {
return err
}
s.lock.Lock()
defer s.lock.Unlock()
log.Info("Writing finalized by epoch")
currentEpoch := slots.ToEpoch(blk.Slot())
s.finalizedByEpoch[currentEpoch] = &ethpb.LightClientFinalizedCheckpoint{
Header: header,
NextSyncCommittee: nextSyncCommittee,
NextSyncCommitteeBranch: nextSyncCommitteeBranch.Hashes,
}
return nil
}

View File

@@ -0,0 +1,143 @@
package light
import (
"context"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/core/feed"
statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/network/forks"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
"github.com/prysmaticlabs/prysm/time/slots"
)
func (s *Service) subscribeHeadEvent(ctx context.Context) {
stateChan := make(chan *feed.Event, 1)
sub := s.cfg.StateNotifier.StateFeed().Subscribe(stateChan)
defer sub.Unsubscribe()
for {
select {
case ev := <-stateChan:
if ev.Type == statefeed.NewHead {
head, beaconState, err := s.getChainHeadAndState(ctx)
if err != nil {
log.Error(err)
continue
}
if err := s.onHead(ctx, head, beaconState); err != nil {
log.Error(err)
continue
}
}
case <-sub.Err():
return
case <-ctx.Done():
return
}
}
}
func (s *Service) getChainHeadAndState(ctx context.Context) (block.SignedBeaconBlock, state.BeaconState, error) {
head, err := s.cfg.HeadFetcher.HeadBlock(ctx)
if err != nil {
return nil, nil, err
}
if head == nil || head.IsNil() {
return nil, nil, errors.New("head block is nil")
}
st, err := s.cfg.HeadFetcher.HeadState(ctx)
if err != nil {
return nil, nil, errors.New("head state is nil")
}
if st == nil || st.IsNil() {
return nil, nil, err
}
return head, st, nil
}
func (s *Service) onHead(ctx context.Context, head block.SignedBeaconBlock, postState state.BeaconStateAltair) error {
innerState, ok := postState.InnerStateUnsafe().(*ethpb.BeaconStateAltair)
if !ok {
return errors.New("expected an Altair beacon state")
}
blk := head.Block()
tr, err := innerState.GetTree()
if err != nil {
return err
}
header, err := block.BeaconBlockHeaderFromBlockInterface(blk)
if err != nil {
return err
}
finalityBranch, err := tr.Prove(FinalizedRootIndex)
if err != nil {
return err
}
nextSyncCommitteeBranch, err := tr.Prove(NextSyncCommitteeIndex)
if err != nil {
return err
}
blkRoot, err := blk.HashTreeRoot()
if err != nil {
return err
}
s.lock.Lock()
s.prevHeadData[blkRoot] = &ethpb.SyncAttestedData{
Header: header,
FinalityCheckpoint: innerState.FinalizedCheckpoint,
FinalityBranch: finalityBranch.Hashes,
NextSyncCommittee: innerState.NextSyncCommittee,
NextSyncCommitteeBranch: nextSyncCommitteeBranch.Hashes,
}
s.lock.Unlock()
syncAttestedBlockRoot, err := helpers.BlockRootAtSlot(postState, innerState.Slot-1)
if err != nil {
return err
}
fork, err := forks.Fork(slots.ToEpoch(blk.Slot()))
if err != nil {
return err
}
syncAggregate, err := blk.Body().SyncAggregate()
if err != nil {
return err
}
sigData := &signatureData{
slot: blk.Slot(),
forkVersion: fork.CurrentVersion,
syncAggregate: syncAggregate,
}
s.lock.Lock()
syncAttestedData, ok := s.prevHeadData[bytesutil.ToBytes32(syncAttestedBlockRoot)]
if !ok {
s.lock.Unlock()
return errors.New("useless")
}
s.lock.Unlock()
commmitteePeriodWithFinalized, err := s.persistBestFinalizedUpdate(ctx, syncAttestedData, sigData)
if err != nil {
return err
}
if err := s.persistBestNonFinalizedUpdate(ctx, syncAttestedData, sigData, commmitteePeriodWithFinalized); err != nil {
return err
}
s.lock.Lock()
if len(s.prevHeadData) > PrevDataMaxSize {
for k := range s.prevHeadData {
delete(s.prevHeadData, k)
if len(s.prevHeadData) <= PrevDataMaxSize {
break
}
}
}
s.lock.Unlock()
return nil
}

View File

@@ -0,0 +1,50 @@
package light
import (
"bytes"
"github.com/prysmaticlabs/prysm/config/params"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
)
func isBetterUpdate(prevUpdate *ethpb.LightClientUpdate, newUpdate *ethpb.LightClientUpdate) bool {
prevIsFinalized := isFinalizedUpdate(prevUpdate)
newIsFinalized := isFinalizedUpdate(newUpdate)
// newUpdate becomes finalized, it's better.
if newIsFinalized && !prevIsFinalized {
return true
}
// newUpdate is no longer finalized, it's worse.
if !newIsFinalized && prevIsFinalized {
return false
}
return hasMoreBits(newUpdate, prevUpdate)
}
func isLatestBestFinalizedUpdate(prevUpdate *ethpb.LightClientUpdate, newUpdate *ethpb.LightClientUpdate) bool {
if newUpdate.FinalityHeader.Slot > prevUpdate.FinalityHeader.Slot {
return true
}
if newUpdate.FinalityHeader.Slot < prevUpdate.FinalityHeader.Slot {
return false
}
return hasMoreBits(newUpdate, prevUpdate)
}
func isLatestBestNonFinalizedUpdate(prevUpdate *ethpb.LightClientUpdate, newUpdate *ethpb.LightClientUpdate) bool {
if newUpdate.Header.Slot > prevUpdate.Header.Slot {
return true
}
if newUpdate.Header.Slot < prevUpdate.Header.Slot {
return false
}
return hasMoreBits(newUpdate, prevUpdate)
}
func isFinalizedUpdate(update *ethpb.LightClientUpdate) bool {
return !bytes.Equal(params.BeaconConfig().ZeroHash[:], update.FinalityHeader.StateRoot)
}
func hasMoreBits(a *ethpb.LightClientUpdate, b *ethpb.LightClientUpdate) bool {
return a.SyncCommitteeBits.Count() > b.SyncCommitteeBits.Count()
}

View File

@@ -0,0 +1,120 @@
package light
import (
"context"
types "github.com/prysmaticlabs/eth2-types"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/time/slots"
"github.com/sirupsen/logrus"
)
// Precomputed values for generalized indices.
const (
FinalizedRootIndex = 105
NextSyncCommitteeIndex = 55
PrevDataMaxSize = 64
)
var log = logrus.WithField("prefix", "light")
type signatureData struct {
slot types.Slot
forkVersion []byte
syncAggregate *ethpb.SyncAggregate
}
func (s *Service) persistBestFinalizedUpdate(ctx context.Context, syncAttestedData *ethpb.SyncAttestedData, sigData *signatureData) (uint64, error) {
finalizedEpoch := syncAttestedData.FinalityCheckpoint.Epoch
s.lock.RLock()
finalizedData := s.finalizedByEpoch[finalizedEpoch]
s.lock.RUnlock()
if finalizedData == nil {
return 0, nil
}
committeePeriod := slots.SyncCommitteePeriod(slots.ToEpoch(syncAttestedData.Header.Slot))
signaturePeriod := slots.SyncCommitteePeriod(slots.ToEpoch(sigData.slot))
if committeePeriod != signaturePeriod {
return 0, nil
}
newUpdate := &ethpb.LightClientUpdate{
Header: finalizedData.Header,
NextSyncCommittee: finalizedData.NextSyncCommittee,
NextSyncCommitteeBranch: finalizedData.NextSyncCommitteeBranch,
FinalityHeader: syncAttestedData.Header,
FinalityBranch: syncAttestedData.FinalityBranch,
SyncCommitteeBits: sigData.syncAggregate.SyncCommitteeBits,
SyncCommitteeSignature: sigData.syncAggregate.SyncCommitteeSignature,
ForkVersion: sigData.forkVersion,
}
s.lock.RLock()
prevBestUpdate := s.bestUpdateByPeriod[committeePeriod]
s.lock.RUnlock()
if prevBestUpdate == nil || isBetterUpdate(prevBestUpdate, newUpdate) {
s.lock.Lock()
s.bestUpdateByPeriod[committeePeriod] = newUpdate
s.lock.Unlock()
}
s.lock.RLock()
prevLatestUpdate := s.latestFinalizedUpdate
s.lock.RUnlock()
if prevLatestUpdate == nil || isLatestBestFinalizedUpdate(prevLatestUpdate, newUpdate) {
s.lock.Lock()
s.latestFinalizedUpdate = newUpdate
s.lock.Unlock()
}
return committeePeriod, nil
}
func (s *Service) persistBestNonFinalizedUpdate(ctx context.Context, syncAttestedData *ethpb.SyncAttestedData, sigData *signatureData, period uint64) error {
committeePeriod := slots.SyncCommitteePeriod(slots.ToEpoch(syncAttestedData.Header.Slot))
signaturePeriod := slots.SyncCommitteePeriod(slots.ToEpoch(sigData.slot))
if committeePeriod != signaturePeriod {
return nil
}
newUpdate := &ethpb.LightClientUpdate{
Header: syncAttestedData.Header,
NextSyncCommittee: syncAttestedData.NextSyncCommittee,
NextSyncCommitteeBranch: syncAttestedData.NextSyncCommitteeBranch,
FinalityHeader: nil,
FinalityBranch: nil,
SyncCommitteeBits: sigData.syncAggregate.SyncCommitteeBits,
SyncCommitteeSignature: sigData.syncAggregate.SyncCommitteeSignature,
ForkVersion: sigData.forkVersion,
}
// Optimization: If there's already a finalized update for this committee period, no need to
// create a non-finalized update>
if committeePeriod != period {
s.lock.RLock()
prevBestUpdate := s.bestUpdateByPeriod[committeePeriod]
s.lock.RUnlock()
if prevBestUpdate == nil || isBetterUpdate(prevBestUpdate, newUpdate) {
s.lock.Lock()
s.bestUpdateByPeriod[committeePeriod] = newUpdate
s.lock.Unlock()
}
}
// Store the latest update here overall. Not checking it's the best
s.lock.RLock()
prevLatestUpdate := s.latestNonFinalizedUpdate
s.lock.RUnlock()
if prevLatestUpdate == nil || isLatestBestNonFinalizedUpdate(prevLatestUpdate, newUpdate) {
// TODO: Don't store nextCommittee, that can be fetched through getBestUpdates()
s.lock.Lock()
s.latestNonFinalizedUpdate = newUpdate
s.lock.Unlock()
}
return nil
}

View File

@@ -26,6 +26,7 @@ go_library(
"//beacon-chain/forkchoice/protoarray:go_default_library",
"//beacon-chain/gateway:go_default_library",
"//beacon-chain/interop-cold-start:go_default_library",
"//beacon-chain/light:go_default_library",
"//beacon-chain/node/registration:go_default_library",
"//beacon-chain/operations/attestations:go_default_library",
"//beacon-chain/operations/slashings:go_default_library",

View File

@@ -28,6 +28,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray"
"github.com/prysmaticlabs/prysm/beacon-chain/gateway"
interopcoldstart "github.com/prysmaticlabs/prysm/beacon-chain/interop-cold-start"
"github.com/prysmaticlabs/prysm/beacon-chain/light"
"github.com/prysmaticlabs/prysm/beacon-chain/node/registration"
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations"
"github.com/prysmaticlabs/prysm/beacon-chain/operations/slashings"
@@ -179,6 +180,10 @@ func New(cliCtx *cli.Context, opts ...Option) (*BeaconNode, error) {
return nil, err
}
if err := beacon.registerLightClientServer(); err != nil {
return nil, err
}
if err := beacon.registerSlasherService(); err != nil {
return nil, err
}
@@ -819,3 +824,25 @@ func (b *BeaconNode) registerInteropServices() error {
}
return nil
}
func (b *BeaconNode) registerLightClientServer() error {
var chainService *blockchain.Service
if err := b.services.FetchService(&chainService); err != nil {
return err
}
var syncService *initialsync.Service
if err := b.services.FetchService(&syncService); err != nil {
return err
}
svc := light.New(b.ctx, &light.Config{
Database: b.db,
StateGen: b.stateGen,
HeadFetcher: chainService,
FinalizationFetcher: chainService,
StateNotifier: b,
TimeFetcher: chainService,
SyncChecker: syncService,
})
return b.services.RegisterService(svc)
}

View File

@@ -29,6 +29,7 @@ go_library(
"//beacon-chain/rpc/eth/validator:go_default_library",
"//beacon-chain/rpc/prysm/v1alpha1/beacon:go_default_library",
"//beacon-chain/rpc/prysm/v1alpha1/debug:go_default_library",
"//beacon-chain/rpc/prysm/v1alpha1/light:go_default_library",
"//beacon-chain/rpc/prysm/v1alpha1/node:go_default_library",
"//beacon-chain/rpc/prysm/v1alpha1/validator:go_default_library",
"//beacon-chain/rpc/statefetcher:go_default_library",

View File

@@ -0,0 +1,17 @@
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["server.go"],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/rpc/prysm/v1alpha1/light",
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//beacon-chain/db/iface:go_default_library",
"//beacon-chain/db/kv:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
)

View File

@@ -0,0 +1,43 @@
package light
//
//type Server struct {
// Database iface.LightClientDatabase
//}
//// BestUpdates GET /eth/v1alpha1/lightclient/best_update/:periods.
//func (s *Server) BestUpdates(ctx context.Context, req *ethpb.BestUpdatesRequest) (*ethpb.BestUpdatesResponse, error) {
// updates := make([]*ethpb.LightClientUpdate, 0)
// for _, period := range req.SyncCommitteePeriods {
// update, err := s.Database.LightClientBestUpdateForPeriod(ctx, period)
// if errors.Is(err, kv.ErrNotFound) {
// continue
// } else if err != nil {
// return nil, status.Errorf(codes.Internal, "Could not retrieve best update for %d: %v", period, err)
// }
// updates = append(updates, update)
// }
// return &ethpb.BestUpdatesResponse{Updates: updates}, nil
//}
//
//// LatestUpdateFinalized GET /eth/v1alpha1/lightclient/latest_update_finalized/
//func (s *Server) LatestUpdateFinalized(ctx context.Context, _ *empty.Empty) (*ethpb.LightClientUpdate, error) {
// update, err := s.Database.LightClientLatestFinalizedUpdate(ctx)
// if errors.Is(err, kv.ErrNotFound) {
// return nil, status.Error(codes.Internal, "No latest finalized update found")
// } else if err != nil {
// return nil, status.Errorf(codes.Internal, "Could not retrieve latest finalized update: %v", err)
// }
// return update, nil
//}
//
//// LatestUpdateNonFinalized /eth/v1alpha1/lightclient/latest_update_nonfinalized/
//func (s *Server) LatestUpdateNonFinalized(ctx context.Context, _ *empty.Empty) (*ethpb.LightClientUpdate, error) {
// update, err := s.Database.LightClientLatestNonFinalizedUpdate(ctx)
// if errors.Is(err, kv.ErrNotFound) {
// return nil, status.Error(codes.Internal, "No latest non-finalized update found")
// } else if err != nil {
// return nil, status.Errorf(codes.Internal, "Could not retrieve latest non-finalized update: %v", err)
// }
// return update, nil
//}

View File

@@ -279,6 +279,10 @@ func (s *Service) Start() {
VoluntaryExitsPool: s.cfg.ExitPool,
V1Alpha1ValidatorServer: validatorServer,
}
//lightClientServer := &light.Server{
// Database: s.cfg.BeaconDB,
//}
//ethpbv1alpha1.RegisterLightClientServer(s.grpcServer, lightClientServer)
ethpbv1alpha1.RegisterNodeServer(s.grpcServer, nodeServer)
ethpbservice.RegisterBeaconNodeServer(s.grpcServer, nodeServerV1)
ethpbv1alpha1.RegisterHealthServer(s.grpcServer, nodeServer)

50
cmd/light/BUILD.bazel Normal file
View File

@@ -0,0 +1,50 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"client.go",
"main.go",
"process_update.go",
"server.go",
"validate_update.go",
],
importpath = "github.com/prysmaticlabs/prysm/cmd/light",
visibility = ["//visibility:private"],
deps = [
"//beacon-chain/core/signing:go_default_library",
"//config/params:go_default_library",
"//container/trie:go_default_library",
"//crypto/bls/blst:go_default_library",
"//crypto/bls/common:go_default_library",
"//encoding/bytesutil:go_default_library",
"//proto/eth/service:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/eth/v2:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//time/slots:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
],
)
go_binary(
name = "light",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
srcs = ["client_test.go"],
embed = [":go_default_library"],
deps = [
"//proto/prysm/v1alpha1:go_default_library",
"//testing/require:go_default_library",
],
)

3
cmd/light/client.go Normal file
View File

@@ -0,0 +1,3 @@
package main
type Client struct{}

25
cmd/light/client_test.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"fmt"
"testing"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/testing/require"
)
func TestProveCheckpoint(t *testing.T) {
root := [32]byte{1}
check := &ethpb.Checkpoint{
Epoch: 1,
Root: root[:],
}
tr, err := check.GetTree()
require.NoError(t, err)
a, err := tr.Get(0)
require.NoError(t, err)
b, err := tr.Get(1)
require.NoError(t, err)
fmt.Println(a.Hash())
fmt.Println(b.Hash())
}

110
cmd/light/main.go Normal file
View File

@@ -0,0 +1,110 @@
package main
import (
"context"
"fmt"
"log"
"github.com/prysmaticlabs/go-bitfield"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
eth "github.com/prysmaticlabs/prysm/proto/eth/service"
v1 "github.com/prysmaticlabs/prysm/proto/eth/v1"
v2 "github.com/prysmaticlabs/prysm/proto/eth/v2"
v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/time/slots"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)
// Precomputed values for generalized indices.
const (
FinalizedRootIndex = 105
FinalizedRootIndexFloorLog2 = 6
NextSyncCommitteeIndex = 55
NextSyncCommitteeIndexFloorLog2 = 5
)
type LightClientSnapshot struct {
Header *v1.BeaconBlockHeader
CurrentSyncCommittee *v2.SyncCommittee
NextSyncCommittee *v2.SyncCommittee
}
type LightClientUpdate struct {
Header *v1.BeaconBlockHeader
NextSyncCommittee *v2.SyncCommittee
NextSyncCommitteeBranch [NextSyncCommitteeIndexFloorLog2][32]byte
FinalityHeader *v1.BeaconBlockHeader
FinalityBranch [FinalizedRootIndexFloorLog2][32]byte
SyncCommitteeBits bitfield.Bitvector512
SyncCommitteeSignature [96]byte
ForkVersion *v1alpha1.Version
}
type Store struct {
Snapshot *LightClientSnapshot
ValidUpdates []*LightClientUpdate
}
func main() {
conn, err := grpc.Dial("localhost:4000", grpc.WithInsecure())
if err != nil {
log.Fatalf("fail to dial: %v", err)
}
beaconClient := eth.NewBeaconChainClient(conn)
eventsClient := eth.NewEventsClient(conn)
debugClient := eth.NewBeaconDebugClient(conn)
ctx := context.Background()
// Get basic information such as the genesis validators root.
genesis, err := beaconClient.GetGenesis(ctx, &emptypb.Empty{})
if err != nil {
panic(err)
}
genesisValidatorsRoot := genesis.Data.GenesisValidatorsRoot
genesisTime := uint64(genesis.Data.GenesisTime.AsTime().Unix())
fmt.Printf("%#v\n", genesisValidatorsRoot)
currentState, err := debugClient.GetBeaconStateV2(ctx, &v2.StateRequestV2{StateId: []byte("head")})
if err != nil {
panic(err)
}
altairState := currentState.Data.GetAltairState()
store := &Store{
Snapshot: &LightClientSnapshot{
Header: nil,
CurrentSyncCommittee: altairState.CurrentSyncCommittee,
NextSyncCommittee: altairState.NextSyncCommittee,
},
ValidUpdates: make([]*LightClientUpdate, 0),
}
events, err := eventsClient.StreamEvents(ctx, &v1.StreamEventsRequest{Topics: []string{"head"}})
if err != nil {
panic(err)
}
for {
item, err := events.Recv()
if err != nil {
panic(err)
}
evHeader := &v1.EventHead{}
if err := item.Data.UnmarshalTo(evHeader); err != nil {
panic(err)
}
blockHeader, err := beaconClient.GetBlockHeader(ctx, &v1.BlockRequest{BlockId: evHeader.Block})
if err != nil {
panic(err)
}
store.Snapshot.Header = blockHeader.Data.Header.Message
fmt.Println(store)
currentSlot := slots.CurrentSlot(genesisTime)
if err := processLightClientUpdate(
store,
&LightClientUpdate{},
currentSlot,
bytesutil.ToBytes32(genesisValidatorsRoot),
); err != nil {
panic(err)
}
}
}

View File

@@ -0,0 +1,54 @@
package main
import (
types "github.com/prysmaticlabs/eth2-types"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/time/slots"
)
func applyLightClientUpdate(snapshot *LightClientSnapshot, update *LightClientUpdate) {
snapshotPeriod := slots.ToEpoch(snapshot.Header.Slot) / params.BeaconConfig().EpochsPerSyncCommitteePeriod
updatePeriod := slots.ToEpoch(update.Header.Slot) / params.BeaconConfig().EpochsPerSyncCommitteePeriod
if updatePeriod == snapshotPeriod+1 {
snapshot.CurrentSyncCommittee = snapshot.NextSyncCommittee
} else {
snapshot.Header = update.Header
}
}
func processLightClientUpdate(
store *Store,
update *LightClientUpdate,
currentSlot types.Slot,
genesisValidatorsRoot [32]byte,
) error {
if err := validateLightClientUpdate(store.Snapshot, update, genesisValidatorsRoot); err != nil {
return err
}
store.ValidUpdates = append(store.ValidUpdates, update)
updateTimeout := uint64(params.BeaconConfig().SlotsPerEpoch) * uint64(params.BeaconConfig().EpochsPerSyncCommitteePeriod)
sumParticipantBits := update.SyncCommitteeBits.Count()
hasQuorum := sumParticipantBits*3 >= uint64(len(update.SyncCommitteeBits))*2
if hasQuorum && !isEmptyBlockHeader(update.FinalityHeader) {
// Apply update if (1) 2/3 quorum is reached and (2) we have a finality proof.
// Note that (2) means that the current light client design needs finality.
// It may be changed to re-organizable light client design. See the on-going issue consensus-specs#2182.
applyLightClientUpdate(store.Snapshot, update)
store.ValidUpdates = make([]*LightClientUpdate, 0)
} else if currentSlot > store.Snapshot.Header.Slot.Add(updateTimeout) {
// Forced best update when the update timeout has elapsed
// Use the update that has the highest sum of sync committee bits.
updateWithHighestSumBits := store.ValidUpdates[0]
highestSumBitsUpdate := updateWithHighestSumBits.SyncCommitteeBits.Count()
for _, validUpdate := range store.ValidUpdates {
sumUpdateBits := validUpdate.SyncCommitteeBits.Count()
if sumUpdateBits > highestSumBitsUpdate {
highestSumBitsUpdate = sumUpdateBits
updateWithHighestSumBits = validUpdate
}
}
applyLightClientUpdate(store.Snapshot, updateWithHighestSumBits)
store.ValidUpdates = make([]*LightClientUpdate, 0)
}
return nil
}

3
cmd/light/server.go Normal file
View File

@@ -0,0 +1,3 @@
package main
type Server struct{}

View File

@@ -0,0 +1,151 @@
package main
import (
"math"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/core/signing"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/container/trie"
"github.com/prysmaticlabs/prysm/crypto/bls/blst"
"github.com/prysmaticlabs/prysm/crypto/bls/common"
v1 "github.com/prysmaticlabs/prysm/proto/eth/v1"
v2 "github.com/prysmaticlabs/prysm/proto/eth/v2"
v1alpha1 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/time/slots"
"google.golang.org/protobuf/proto"
)
func validateLightClientUpdate(
snapshot *LightClientSnapshot,
update *LightClientUpdate,
genesisValidatorsRoot [32]byte,
) error {
if update.Header.Slot <= snapshot.Header.Slot {
return errors.New("wrong")
}
snapshotPeriod := slots.ToEpoch(snapshot.Header.Slot) / params.BeaconConfig().EpochsPerSyncCommitteePeriod
updatePeriod := slots.ToEpoch(update.Header.Slot) / params.BeaconConfig().EpochsPerSyncCommitteePeriod
if updatePeriod != snapshotPeriod || updatePeriod != snapshotPeriod+1 {
return errors.New("unwanted")
}
// Verify finality headers.
var signedHeader *v1.BeaconBlockHeader
if isEmptyBlockHeader(update.FinalityHeader) {
signedHeader = update.Header
// Check if branch is empty.
for _, elem := range update.FinalityBranch {
if elem != [32]byte{} {
return errors.New("branch not empty")
}
}
} else {
leaf, err := update.Header.HashTreeRoot()
if err != nil {
return err
}
depth := FinalizedRootIndexFloorLog2
index := getSubtreeIndex(FinalizedRootIndex)
root := update.FinalityHeader.StateRoot
merkleBranch := make([][]byte, len(update.FinalityBranch))
for i, item := range update.FinalityBranch {
merkleBranch[i] = item[:]
}
if !trie.VerifyMerkleBranch(root, leaf[:], int(index), merkleBranch, uint64(depth)) {
return errors.New("does not verify")
}
}
// Verify update next sync committee if the update period incremented.
var syncCommittee *v2.SyncCommittee
if updatePeriod == snapshotPeriod {
syncCommittee = snapshot.CurrentSyncCommittee
for _, elem := range update.NextSyncCommitteeBranch {
if elem != [32]byte{} {
return errors.New("branch not empty")
}
}
} else {
syncCommittee = snapshot.NextSyncCommittee
v1Sync := &v1alpha1.SyncCommittee{
Pubkeys: syncCommittee.Pubkeys,
AggregatePubkey: syncCommittee.AggregatePubkey,
}
leaf, err := v1Sync.HashTreeRoot()
if err != nil {
return err
}
depth := NextSyncCommitteeIndexFloorLog2
index := getSubtreeIndex(NextSyncCommitteeIndex)
root := update.Header.StateRoot
merkleBranch := make([][]byte, len(update.NextSyncCommitteeBranch))
for i, item := range update.NextSyncCommitteeBranch {
merkleBranch[i] = item[:]
}
if !trie.VerifyMerkleBranch(root, leaf[:], int(index), merkleBranch, uint64(depth)) {
return errors.New("does not verify")
}
}
// Verify sync committee has sufficient participants
if update.SyncCommitteeBits.Count() < params.BeaconConfig().MinSyncCommitteeParticipants {
return errors.New("insufficient participants")
}
// Verify sync committee aggregate signature
participantPubkeys := make([][]byte, 0)
for i, pubKey := range syncCommittee.Pubkeys {
bit := update.SyncCommitteeBits.BitAt(uint64(i))
if bit {
participantPubkeys = append(participantPubkeys, pubKey)
}
}
domain, err := signing.ComputeDomain(
params.BeaconConfig().DomainSyncCommittee,
[]byte(update.ForkVersion.Version),
genesisValidatorsRoot[:],
)
if err != nil {
return err
}
signingRoot, err := signing.ComputeSigningRoot(signedHeader, domain)
if err != nil {
return err
}
sig, err := blst.SignatureFromBytes(update.SyncCommitteeSignature[:])
if err != nil {
return err
}
pubKeys := make([]common.PublicKey, 0)
for _, pubkey := range participantPubkeys {
pk, err := blst.PublicKeyFromBytes(pubkey)
if err != nil {
return err
}
pubKeys = append(pubKeys, pk)
}
if !sig.FastAggregateVerify(pubKeys, signingRoot) {
return errors.New("failed to verify")
}
return nil
}
func isEmptyBlockHeader(header *v1.BeaconBlockHeader) bool {
emptyRoot := params.BeaconConfig().ZeroHash
return proto.Equal(header, &v1.BeaconBlockHeader{
Slot: 0,
ProposerIndex: 0,
ParentRoot: emptyRoot[:],
StateRoot: emptyRoot[:],
BodyRoot: emptyRoot[:],
})
}
func getSubtreeIndex(index uint64) uint64 {
return index % uint64(math.Pow(2, floorLog2(index)))
}
func floorLog2(x uint64) float64 {
return math.Floor(math.Log2(float64(x)))
}

View File

@@ -22,7 +22,7 @@ const (
// Genesis Fork Epoch for the mainnet config.
genesisForkEpoch = 0
// Altair Fork Epoch for mainnet config.
mainnetAltairForkEpoch = 74240 // Oct 27, 2021, 10:56:23am UTC
mainnetAltairForkEpoch = 1 // Oct 27, 2021, 10:56:23am UTC
)
var mainnetNetworkConfig = &NetworkConfig{
@@ -97,8 +97,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{
// Time parameter constants.
MinAttestationInclusionDelay: 1,
SecondsPerSlot: 12,
SlotsPerEpoch: 32,
SecondsPerSlot: 4,
SlotsPerEpoch: 4,
SqrRootSlotsPerEpoch: 5,
MinSeedLookahead: 1,
MaxSeedLookahead: 4,

View File

@@ -839,8 +839,8 @@ def prysm_deps():
name = "com_github_ferranbt_fastssz",
importpath = "github.com/ferranbt/fastssz",
nofuzz = True,
sum = "h1:6dVcS0LktRSyEEgldFY4N9J17WjUoiJStttH+RZj0Wo=",
version = "v0.0.0-20210905181407-59cf6761a7d5",
sum = "h1:g2euxxO1nhkAen3U3O/0nj1VyoxfkebVXJG4VAKWlMc=",
version = "v0.0.0-20211011041253-475a853ff68d",
)
go_repository(

View File

@@ -0,0 +1,99 @@
package tree
import (
"math/bits"
)
type Backing struct {
nodes []*Node
}
func (w *Backing) Indx() int {
return len(w.nodes)
}
func (w *Backing) Node() *Node {
if len(w.nodes) != 1 {
panic("can only return if root node")
}
return w.nodes[0]
}
func (w *Backing) AddEmpty() {
w.AddNode(EmptyLeaf())
}
func (w *Backing) AddNode(n *Node) {
if w.nodes == nil {
w.nodes = make([]*Node, 0)
}
w.nodes = append(w.nodes, n)
}
func (w *Backing) AddBytes(b []byte) {
w.AddNode(LeafFromBytes(b))
}
func (w *Backing) AddUint64(i uint64) {
w.AddNode(LeafFromUint64(i))
}
func (w *Backing) AddUint32(i uint32) {
w.AddNode(LeafFromUint32(i))
}
func (w *Backing) AddUint16(i uint16) {
w.AddNode(LeafFromUint16(i))
}
func (w *Backing) AddUint8(i uint8) {
w.AddNode(LeafFromUint8(i))
}
func (w *Backing) AddBitlist(blist []byte, maxSize int) {
tmp, size := parseBitlistForTree(blist)
subIdx := w.Indx()
w.AddBytes(tmp)
w.CommitWithMixin(subIdx, int(size), (maxSize+255)/256)
}
func (w *Backing) Commit(i int) {
res, err := FromNodes(w.nodes[i:])
if err != nil {
panic(err)
}
// remove the old nodes
w.nodes = w.nodes[:i]
// add the new node
w.AddNode(res)
}
func (w *Backing) CommitWithMixin(i, num, limit int) {
res, err := FromNodesWithMixin(w.nodes[i:], num, limit)
if err != nil {
panic(err)
}
// remove the old nodes
w.nodes = w.nodes[:i]
// add the new node
w.AddNode(res)
}
func parseBitlistForTree(buf []byte) ([]byte, uint64) {
dst := make([]byte, 0)
msb := uint8(bits.Len8(buf[len(buf)-1])) - 1
size := uint64(8*(len(buf)-1) + int(msb))
dst = append(dst, buf...)
dst[len(dst)-1] &^= uint8(1 << msb)
newLen := len(dst)
for i := len(dst) - 1; i >= 0; i-- {
if dst[i] != 0x00 {
break
}
newLen = i
}
res := dst[:newLen]
return res, size
}

View File

@@ -0,0 +1,77 @@
package tree
import "encoding/binary"
func EmptyLeaf() *Node {
return NewLeafWithValue(zeroBytes[:32])
}
func LeafFromUint64(i uint64) *Node {
buf := make([]byte, 32)
binary.LittleEndian.PutUint64(buf[:8], i)
return NewLeafWithValue(buf)
}
func LeafFromUint32(i uint32) *Node {
buf := make([]byte, 32)
binary.LittleEndian.PutUint32(buf[:4], i)
return NewLeafWithValue(buf)
}
func LeafFromUint16(i uint16) *Node {
buf := make([]byte, 32)
binary.LittleEndian.PutUint16(buf[:2], i)
return NewLeafWithValue(buf)
}
func LeafFromUint8(i uint8) *Node {
buf := make([]byte, 32)
buf[0] = i
return NewLeafWithValue(buf)
}
func LeafFromBytes(b []byte) *Node {
l := len(b)
if l > 32 {
panic("Unimplemented")
}
if l == 32 {
return NewLeafWithValue(b[:])
}
return NewLeafWithValue(append(b, zeroBytes[:32-l]...))
}
func LeavesFromBytes(items [][]byte) []*Node {
if len(items) == 0 {
return []*Node{}
}
numLeaves := (len(items)*8 + 31) / 32
leaves := make([]*Node, numLeaves)
for i := 0; i < numLeaves; i++ {
leaves[i] = NewLeafWithValue(items[i])
}
return leaves
}
func LeavesFromUint64(items []uint64) []*Node {
if len(items) == 0 {
return []*Node{}
}
numLeaves := (len(items)*8 + 31) / 32
buf := make([]byte, numLeaves*32)
for i, v := range items {
binary.LittleEndian.PutUint64(buf[i*8:(i+1)*8], v)
}
leaves := make([]*Node, numLeaves)
for i := 0; i < numLeaves; i++ {
v := buf[i*32 : (i+1)*32]
leaves[i] = NewLeafWithValue(v)
}
return leaves
}

160
encoding/ssz/tree/node.go Normal file
View File

@@ -0,0 +1,160 @@
package tree
import (
"errors"
)
var zeroBytes = make([]byte, 32)
// Proof represents a merkle proof against a general index.
type Proof struct {
Index int
Leaf []byte
Hashes [][]byte
}
// Node represents a node in the tree
// backing of a SSZ object.
type Node struct {
left *Node
right *Node
value []byte
}
// NewLeafWithValue initializes a leaf node.
func NewLeafWithValue(value []byte) *Node {
return &Node{left: nil, right: nil, value: value}
}
// NewNodeWithLR initializes a branch node.
func NewNodeWithLR(left, right *Node) *Node {
return &Node{left: left, right: right, value: nil}
}
// FromNodes constructs a tree from leaf nodes.
// This is useful for merging subtrees.
// The number of leaves should be a power of 2.
func FromNodes(leaves []*Node) (*Node, error) {
numLeaves := len(leaves)
if numLeaves == 1 {
return leaves[0], nil
}
if numLeaves == 2 {
return NewNodeWithLR(leaves[0], leaves[1]), nil
}
if !isPowerOfTwo(numLeaves) {
return nil, errors.New("Number of leaves should be a power of 2")
}
numNodes := numLeaves*2 - 1
nodes := make([]*Node, numNodes)
for i := numNodes; i > 0; i-- {
// Is a leaf
if i > numNodes-numLeaves {
nodes[i-1] = leaves[i-numLeaves]
} else {
// Is a branch node
nodes[i-1] = &Node{left: nodes[(i*2)-1], right: nodes[(i*2+1)-1], value: nil}
}
}
return nodes[0], nil
}
func FromNodesWithMixin(leaves []*Node, num, limit int) (*Node, error) {
numLeaves := len(leaves)
if !isPowerOfTwo(limit) {
return nil, errors.New("Size of tree should be a power of 2")
}
allLeaves := make([]*Node, limit)
emptyLeaf := NewLeafWithValue(make([]byte, 32))
for i := 0; i < limit; i++ {
if i < numLeaves {
allLeaves[i] = leaves[i]
} else {
allLeaves[i] = emptyLeaf
}
}
mainTree, err := FromNodes(allLeaves)
if err != nil {
return nil, err
}
// Mixin len
countLeaf := LeafFromUint64(uint64(num))
return NewNodeWithLR(mainTree, countLeaf), nil
}
// Get fetches a node in the tree with the given generalized index.
func (n *Node) Get(index int) (*Node, error) {
pathLen := getPathLength(index)
cur := n
for i := pathLen - 1; i >= 0; i-- {
if isRight := getPosAtLevel(index, i); isRight {
cur = cur.right
} else {
cur = cur.left
}
if cur == nil {
return nil, errors.New("Node not found in tree")
}
}
return cur, nil
}
// Hash returns the hash of the subtree with the given Node as its root.
// If root has no children, it returns root's value (not its hash).
func (n *Node) Hash() []byte {
return hashNode(n)
}
// Prove returns a list of sibling values and hashes needed
// to compute the root hash for a given general index.
// to compute the root hash for a given general index.
func (n *Node) Prove(index int) (*Proof, error) {
pathLen := getPathLength(index)
proof := &Proof{Index: index}
hashes := make([][]byte, 0, pathLen)
cur := n
for i := pathLen - 1; i >= 0; i-- {
var siblingHash []byte
if isRight := getPosAtLevel(index, i); isRight {
siblingHash = hashNode(cur.left)
cur = cur.right
} else {
siblingHash = hashNode(cur.right)
cur = cur.left
}
hashes = append([][]byte{siblingHash}, hashes...)
if cur == nil {
return nil, errors.New("Node not found in tree")
}
}
proof.Hashes = hashes
proof.Leaf = cur.value
return proof, nil
}
func hashNode(n *Node) []byte {
// Leaf
if n.left == nil && n.right == nil {
return n.value
}
// Only one child
if n.left == nil || n.right == nil {
panic("Tree incomplete")
}
return hashFn(append(hashNode(n.left), hashNode(n.right)...))
}
func isPowerOfTwo(n int) bool {
return (n & (n - 1)) == 0
}

View File

@@ -0,0 +1,51 @@
package tree
import (
"bytes"
"errors"
"math"
"github.com/minio/sha256-simd"
)
// VerifyProof verifies a single merkle branch. It's more
// efficient than VerifyMultiproof for proving one leaf.
func VerifyProof(root []byte, proof *Proof) (bool, error) {
if len(proof.Hashes) != getPathLength(proof.Index) {
return false, errors.New("Invalid proof length")
}
node := proof.Leaf[:]
tmp := make([]byte, 64)
for i, h := range proof.Hashes {
if getPosAtLevel(proof.Index, i) {
copy(tmp[:32], h[:])
copy(tmp[32:], node[:])
node = hashFn(tmp)
} else {
copy(tmp[:32], node[:])
copy(tmp[32:], h[:])
node = hashFn(tmp)
}
}
return bytes.Equal(root, node), nil
}
// Returns the position (i.e. false for left, true for right)
// of an index at a given level.
// Level 0 is the actual index's level, Level 1 is the position
// of the parent, etc.
func getPosAtLevel(index int, level int) bool {
return (index & (1 << level)) > 0
}
// Returns the length of the path to a node represented by its generalized index.
func getPathLength(index int) int {
return int(math.Log2(float64(index)))
}
func hashFn(data []byte) []byte {
res := sha256.Sum256(data)
return res[:]
}

213
encoding/ssz/tree/state.go Normal file
View File

@@ -0,0 +1,213 @@
package tree
//func (c *Checkpoint) GetTree() (*ssz.Node, error) {
// w := &ssz.Wrapper{}
// if err := c.GetTreeWithWrapper(w); err != nil {
// return nil, err
// }
// return w.Node(), nil
//}
//
//func (b *BeaconStateAltair) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
// indx := w.Indx()
//
// // Field (0) 'GenesisTime'
// w.AddUint64(b.GenesisTime)
//
// // Field (1) 'GenesisValidatorsRoot'
// if len(b.GenesisValidatorsRoot) != 32 {
// err = ssz.ErrBytesLength
// return
// }
// w.AddBytes(b.GenesisValidatorsRoot)
//
// // Field (2) 'Slot'
// w.AddUint64(uint64(b.Slot))
//
// // Field (3) 'Fork'
// if err := b.Fork.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (4) 'LatestBlockHeader'
// if err := b.LatestBlockHeader.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (5) 'BlockRoots'
// {
// subLeaves := ssz.LeavesFromBytes(b.BlockRoots)
// tmp, err := ssz.TreeFromNodes(subLeaves)
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (6) 'StateRoots'
// {
// subLeaves := ssz.LeavesFromBytes(b.StateRoots)
// tmp, err := ssz.TreeFromNodes(subLeaves)
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (7) 'HistoricalRoots'
// {
// subLeaves := ssz.LeavesFromBytes(b.HistoricalRoots)
// numItems := len(b.HistoricalRoots)
// tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(16777216, uint64(numItems), 8)))
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (8) 'Eth1Data'
// if err := b.Eth1Data.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (9) 'Eth1DataVotes'
// {
// subIdx := w.Indx()
// num := len(b.Eth1DataVotes)
// if num > 2048 {
// err = ssz.ErrIncorrectListSize
// return err
// }
// for i := 0; i < num; i++ {
// n, err := b.Eth1DataVotes[i].GetTree()
// if err != nil {
// return err
// }
// w.AddNode(n)
// }
// w.CommitWithMixin(subIdx, num, 2048)
// }
//
// // Field (10) 'Eth1DepositIndex'
// w.AddUint64(b.Eth1DepositIndex)
//
// // Field (11) 'Validators'
// {
// subIdx := w.Indx()
// num := len(b.Validators)
// if num > 1099511627776 {
// err = ssz.ErrIncorrectListSize
// return err
// }
// for i := 0; i < num; i++ {
// n, err := b.Validators[i].GetTree()
// if err != nil {
// return err
// }
// w.AddNode(n)
// }
// w.CommitWithMixin(subIdx, num, 1099511627776)
// }
//
// // Field (12) 'Balances'
// {
// subLeaves := ssz.LeavesFromUint64(b.Balances)
// numItems := len(b.Balances)
// tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(1099511627776, uint64(numItems), 8)))
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (13) 'RandaoMixes'
// {
// subLeaves := ssz.LeavesFromBytes(b.RandaoMixes)
// tmp, err := ssz.TreeFromNodes(subLeaves)
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (14) 'Slashings'
// {
// subLeaves := ssz.LeavesFromUint64(b.Slashings)
// tmp, err := ssz.TreeFromNodes(subLeaves)
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (15) 'PreviousEpochParticipation'
// if len(b.PreviousEpochParticipation) > 1099511627776 {
// err = ssz.ErrBytesLength
// return
// }
// w.AddBytes(b.PreviousEpochParticipation)
//
// // Field (16) 'CurrentEpochParticipation'
// if len(b.CurrentEpochParticipation) > 1099511627776 {
// err = ssz.ErrBytesLength
// return
// }
// w.AddBytes(b.CurrentEpochParticipation)
//
// // Field (17) 'JustificationBits'
// if len(b.JustificationBits) != 1 {
// err = ssz.ErrBytesLength
// return
// }
// w.AddBytes(b.JustificationBits)
//
// // Field (18) 'PreviousJustifiedCheckpoint'
// if err := b.PreviousJustifiedCheckpoint.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (19) 'CurrentJustifiedCheckpoint'
// if err := b.CurrentJustifiedCheckpoint.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (20) 'FinalizedCheckpoint'
// if err := b.FinalizedCheckpoint.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (21) 'InactivityScores'
// {
// subLeaves := ssz.LeavesFromUint64(b.InactivityScores)
// numItems := len(b.InactivityScores)
// tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(1099511627776, uint64(numItems), 8)))
// if err != nil {
// return err
// }
// w.AddNode(tmp)
//
// }
//
// // Field (22) 'CurrentSyncCommittee'
// if err := b.CurrentSyncCommittee.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// // Field (23) 'NextSyncCommittee'
// if err := b.NextSyncCommittee.GetTreeWithWrapper(w); err != nil {
// return err
// }
//
// for i := 0; i < 8; i++ {
// w.AddEmpty()
// }
//
// w.Commit(indx)
// return nil
//}

View File

@@ -0,0 +1,20 @@
package tree
import (
"fmt"
"testing"
"github.com/prysmaticlabs/prysm/io/file"
v2 "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/testing/require"
)
func TestStateTree(t *testing.T) {
enc, err := file.ReadFileAsBytes("/tmp/state.ssz")
require.NoError(t, err)
stateAltair := &v2.BeaconStateAltair{}
require.NoError(t, stateAltair.UnmarshalSSZ(enc))
fmt.Println(stateAltair.Slot)
_, err = stateAltair.GetTree()
require.NoError(t, err)
}

2
go.mod
View File

@@ -18,7 +18,7 @@ require (
github.com/emicklei/dot v0.11.0
github.com/ethereum/go-ethereum v1.10.10
github.com/fatih/color v1.9.0 // indirect
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5
github.com/ferranbt/fastssz v0.0.0-20211018035740-242d997118b9
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
github.com/fsnotify/fsnotify v1.4.9
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect

4
go.sum
View File

@@ -274,8 +274,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/ferranbt/fastssz v0.0.0-20210120143747-11b9eff30ea9/go.mod h1:DyEu2iuLBnb/T51BlsiO3yLYdJC6UbGMrIkqK1KmQxM=
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5 h1:6dVcS0LktRSyEEgldFY4N9J17WjUoiJStttH+RZj0Wo=
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5/go.mod h1:S8yiDeAXy8f88W4Ul+0dBMPx49S05byYbmZD6Uv94K4=
github.com/ferranbt/fastssz v0.0.0-20211018035740-242d997118b9 h1:IdaLEDYIaMUQ5YhxObJQHuFnWruTUORQQKGDGU05+0Q=
github.com/ferranbt/fastssz v0.0.0-20211018035740-242d997118b9/go.mod h1:S8yiDeAXy8f88W4Ul+0dBMPx49S05byYbmZD6Uv94K4=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: c73c221c909430e49bd5b4bc72e72ff54596cc34e5b869bda04c4adfa5884321
// Hash: 360f153586a98510952b3e58d20707a672f519aa0532f17e350dca2562c69784
package eth
import (

View File

@@ -1,204 +1,65 @@
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
##############################################################################
# Go
##############################################################################
# gazelle:ignore
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//proto:ssz_proto_library.bzl", "ssz_proto_files")
load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")
##############################################################################
# OpenAPI (Swagger) V2
##############################################################################
load("@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2")
proto_library(
name = "proto",
srcs = [
"node.proto",
"beacon_chain.proto",
"debug.proto",
"finalized_block_root_container.proto",
"health.proto",
"powchain.proto",
"slasher.proto",
"validator.proto",
"p2p_messages.proto",
":ssz_proto_files",
# ":generated_swagger_proto",
],
visibility = ["//visibility:public"],
deps = [
"//proto/eth/ext:proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@go_googleapis//google/api:annotations_proto",
],
)
##############################################################################
# Go
##############################################################################
ssz_gen_marshal(
name = "ssz_generated_files",
go_proto = ":go_proto",
includes = [
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],
objs = [
"BeaconBlockAltair",
"BeaconBlockBodyAltair",
"SignedBeaconBlockAltair",
"SyncAggregate",
"SyncCommitteeMessage",
"SyncCommitteeContribution",
"ContributionAndProof",
"SignedContributionAndProof",
"BeaconBlocksByRangeRequest",
"ENRForkID",
"MetaDataV0",
"MetaDataV1",
"Status",
"AggregateAttestationAndProof",
"Attestation",
"AttestationData",
"AttesterSlashing",
"BeaconBlock",
"BeaconBlockHeader",
"Checkpoint",
"Deposit",
"Eth1Data",
"IndexedAttestation",
"ProposerSlashing",
"SignedAggregateAttestationAndProof",
"SignedBeaconBlock",
"SignedBeaconBlockHeader",
"SignedVoluntaryExit",
"Validator",
"VoluntaryExit",
"ContributionAndProof",
"SignedContributionAndProof",
"DepositMessage",
"Fork",
"ForkData",
"HistoricalBatch",
"Status",
"BeaconState",
"BeaconStateAltair",
"SigningData",
"SyncCommittee",
"SyncAggregatorSelectionData",
],
)
go_proto_library(
name = "go_proto",
compilers = [
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
],
importpath = "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1",
proto = ":proto",
visibility = ["//visibility:public"],
deps = [
"//proto/eth/ext:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
],
)
go_proto_library(
name = "go_grpc_gateway_library",
compilers = [
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
],
embed = [":go_proto"],
importpath = "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1",
protos = [":proto"],
visibility = ["//visibility:private"],
deps = [
"//proto/eth/ext:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
],
)
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
# gazelle:ignore
go_library(
name = "go_default_library",
srcs = [
"attestation.pb.go",
"beacon_block.pb.go",
"beacon_chain.pb.go",
"beacon_chain.pb.gw.go",
"beacon_state.pb.go",
"finalized_block_root_container.pb.go",
"cloners.go",
"debug.pb.go",
"debug.pb.gw.go",
"generated.ssz.go",
"generated.ssz.tree.go",
"health.pb.go",
"health.pb.gw.go",
"light_client.pb.go",
"light_client.pb.gw.go",
"node.pb.go",
"node.pb.gw.go",
"p2p_messages.pb.go",
"powchain.pb.go",
"sync_committee.pb.go",
"slasher.pb.go",
"slasher.pb.gw.go",
"sync_committee_mainnet.go",
"sync_committee_minimal.go", # keep
":ssz_generated_files", # keep
],
embed = [
":go_grpc_gateway_library",
"validator.pb.go",
"validator.pb.gw.go",
],
importpath = "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1",
visibility = ["//visibility:public"],
deps = SSZ_DEPS + [
"//proto/eth/ext:go_default_library",
deps = [
"//encoding/bytesutil:go_default_library",
"//proto/eth/ext:go_default_library",
"@com_github_ferranbt_fastssz//:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep
"@go_googleapis//google/api:annotations_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
"@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
],
)
ssz_proto_files(
name = "ssz_proto_files",
srcs = [
"attestation.proto",
"beacon_block.proto",
"beacon_state.proto",
"sync_committee.proto",
],
config = select({
"//conditions:default": "mainnet",
"//proto:ssz_mainnet": "mainnet",
"//proto:ssz_minimal": "minimal",
}),
)
go_test(
name = "go_default_test",
srcs = ["cloners_test.go"],
embed = [":go_default_library"],
deps = [
"//testing/assert:go_default_library",
],
deps = ["//testing/assert:go_default_library"],
)

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
var (
filter_BeaconChain_ListAttestations_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
var (
filter_Debug_GetBeaconState_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}

View File

@@ -0,0 +1,671 @@
package eth
import (
ssz "github.com/ferranbt/fastssz"
)
// GetTree returns tree-backing for the Checkpoint object
func (c *Checkpoint) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Epoch'
w.AddUint64(uint64(c.Epoch))
// Field (1) 'Root'
if len(c.Root) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(c.Root)
w.Commit(indx)
return nil
}
func (c *Checkpoint) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := c.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the Eth1Data object
func (e *Eth1Data) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'DepositRoot'
if len(e.DepositRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(e.DepositRoot)
// Field (1) 'DepositCount'
w.AddUint64(e.DepositCount)
// Field (2) 'BlockHash'
if len(e.BlockHash) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(e.BlockHash)
for i := 0; i < 1; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (e *Eth1Data) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := e.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the BeaconBlockHeader object
func (b *BeaconBlockHeader) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Slot'
w.AddUint64(uint64(b.Slot))
// Field (1) 'ProposerIndex'
w.AddUint64(uint64(b.ProposerIndex))
// Field (2) 'ParentRoot'
if len(b.ParentRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.ParentRoot)
// Field (3) 'StateRoot'
if len(b.StateRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.StateRoot)
// Field (4) 'BodyRoot'
if len(b.BodyRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.BodyRoot)
for i := 0; i < 3; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (b *BeaconBlockHeader) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := b.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the SyncAggregate object
func (s *SyncAggregate) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'SyncCommitteeBits'
if len(s.SyncCommitteeBits) != 64 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.SyncCommitteeBits)
// Field (1) 'SyncCommitteeSignature'
if len(s.SyncCommitteeSignature) != 96 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.SyncCommitteeSignature)
w.Commit(indx)
return nil
}
func (s *SyncAggregate) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := s.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the BeaconStateAltair object
func (b *BeaconStateAltair) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'GenesisTime'
w.AddUint64(b.GenesisTime)
// Field (1) 'GenesisValidatorsRoot'
if len(b.GenesisValidatorsRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.GenesisValidatorsRoot)
// Field (2) 'Slot'
w.AddUint64(uint64(b.Slot))
// Field (3) 'Fork'
if err := b.Fork.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (4) 'LatestBlockHeader'
if err := b.LatestBlockHeader.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (5) 'BlockRoots'
{
subLeaves := ssz.LeavesFromBytes(b.BlockRoots)
tmp, err := ssz.TreeFromNodes(subLeaves)
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (6) 'StateRoots'
{
subLeaves := ssz.LeavesFromBytes(b.StateRoots)
tmp, err := ssz.TreeFromNodes(subLeaves)
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (7) 'HistoricalRoots'
{
subLeaves := ssz.LeavesFromBytes(b.HistoricalRoots)
numItems := len(b.HistoricalRoots)
tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(16777216, uint64(numItems), 8)))
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (8) 'Eth1Data'
if err := b.Eth1Data.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (9) 'Eth1DataVotes'
{
subIdx := w.Indx()
num := len(b.Eth1DataVotes)
if num > 2048 {
err = ssz.ErrIncorrectListSize
return err
}
for i := 0; i < num; i++ {
n, err := b.Eth1DataVotes[i].GetTree()
if err != nil {
return err
}
w.AddNode(n)
}
w.CommitWithMixin(subIdx, num, 2048)
}
// Field (10) 'Eth1DepositIndex'
w.AddUint64(b.Eth1DepositIndex)
// Field (11) 'Validators'
{
subIdx := w.Indx()
num := len(b.Validators)
if num > 1099511627776 {
err = ssz.ErrIncorrectListSize
return err
}
for i := 0; i < num; i++ {
n, err := b.Validators[i].GetTree()
if err != nil {
return err
}
w.AddNode(n)
}
w.CommitWithMixin(subIdx, num, 1099511627776)
}
// Field (12) 'Balances'
{
subLeaves := ssz.LeavesFromUint64(b.Balances)
numItems := len(b.Balances)
tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(1099511627776, uint64(numItems), 8)))
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (13) 'RandaoMixes'
{
subLeaves := ssz.LeavesFromBytes(b.RandaoMixes)
tmp, err := ssz.TreeFromNodes(subLeaves)
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (14) 'Slashings'
{
subLeaves := ssz.LeavesFromUint64(b.Slashings)
tmp, err := ssz.TreeFromNodes(subLeaves)
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (15) 'PreviousEpochParticipation'
if len(b.PreviousEpochParticipation) > 1099511627776 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.PreviousEpochParticipation)
// Field (16) 'CurrentEpochParticipation'
if len(b.CurrentEpochParticipation) > 1099511627776 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.CurrentEpochParticipation)
// Field (17) 'JustificationBits'
if len(b.JustificationBits) != 1 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(b.JustificationBits)
// Field (18) 'PreviousJustifiedCheckpoint'
if err := b.PreviousJustifiedCheckpoint.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (19) 'CurrentJustifiedCheckpoint'
if err := b.CurrentJustifiedCheckpoint.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (20) 'FinalizedCheckpoint'
if err := b.FinalizedCheckpoint.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (21) 'InactivityScores'
{
subLeaves := ssz.LeavesFromUint64(b.InactivityScores)
numItems := len(b.InactivityScores)
tmp, err := ssz.TreeFromNodesWithMixin(subLeaves, numItems, int(ssz.CalculateLimit(1099511627776, uint64(numItems), 8)))
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (22) 'CurrentSyncCommittee'
if err := b.CurrentSyncCommittee.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (23) 'NextSyncCommittee'
if err := b.NextSyncCommittee.GetTreeWithWrapper(w); err != nil {
return err
}
for i := 0; i < 8; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (b *BeaconStateAltair) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := b.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the Fork object
func (f *Fork) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'PreviousVersion'
if len(f.PreviousVersion) != 4 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(f.PreviousVersion)
// Field (1) 'CurrentVersion'
if len(f.CurrentVersion) != 4 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(f.CurrentVersion)
// Field (2) 'Epoch'
w.AddUint64(uint64(f.Epoch))
for i := 0; i < 1; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (f *Fork) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := f.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the ForkData object
func (f *ForkData) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'CurrentVersion'
if len(f.CurrentVersion) != 4 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(f.CurrentVersion)
// Field (1) 'GenesisValidatorsRoot'
if len(f.GenesisValidatorsRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(f.GenesisValidatorsRoot)
w.Commit(indx)
return nil
}
func (f *ForkData) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := f.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the SyncCommittee object
func (s *SyncCommittee) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Pubkeys'
{
subLeaves := ssz.LeavesFromBytes(s.Pubkeys)
tmp, err := ssz.TreeFromNodes(subLeaves)
if err != nil {
return err
}
w.AddNode(tmp)
}
// Field (1) 'AggregatePubkey'
if len(s.AggregatePubkey) != 48 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.AggregatePubkey)
w.Commit(indx)
return nil
}
func (s *SyncCommittee) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := s.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the SyncCommitteeMessage object
func (s *SyncCommitteeMessage) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Slot'
w.AddUint64(uint64(s.Slot))
// Field (1) 'BlockRoot'
if len(s.BlockRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.BlockRoot)
// Field (2) 'ValidatorIndex'
w.AddUint64(uint64(s.ValidatorIndex))
// Field (3) 'Signature'
if len(s.Signature) != 96 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.Signature)
w.Commit(indx)
return nil
}
func (s *SyncCommitteeMessage) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := s.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the SyncCommitteeContribution object
func (s *SyncCommitteeContribution) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Slot'
w.AddUint64(uint64(s.Slot))
// Field (1) 'BlockRoot'
if len(s.BlockRoot) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.BlockRoot)
// Field (2) 'SubcommitteeIndex'
w.AddUint64(s.SubcommitteeIndex)
// Field (3) 'AggregationBits'
if len(s.AggregationBits) != 16 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.AggregationBits)
// Field (4) 'Signature'
if len(s.Signature) != 96 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.Signature)
for i := 0; i < 3; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (s *SyncCommitteeContribution) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := s.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the ContributionAndProof object
func (c *ContributionAndProof) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'AggregatorIndex'
w.AddUint64(uint64(c.AggregatorIndex))
// Field (1) 'Contribution'
if err := c.Contribution.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (2) 'SelectionProof'
if len(c.SelectionProof) != 96 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(c.SelectionProof)
for i := 0; i < 1; i++ {
w.AddEmpty()
}
w.Commit(indx)
return nil
}
func (c *ContributionAndProof) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := c.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the SignedContributionAndProof object
func (s *SignedContributionAndProof) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'Message'
if err := s.Message.GetTreeWithWrapper(w); err != nil {
return err
}
// Field (1) 'Signature'
if len(s.Signature) != 96 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(s.Signature)
w.Commit(indx)
return nil
}
func (s *SignedContributionAndProof) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := s.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}
// GetTree returns tree-backing for the Validator object
func (v *Validator) GetTreeWithWrapper(w *ssz.Wrapper) (err error) {
indx := w.Indx()
// Field (0) 'PublicKey'
if len(v.PublicKey) != 48 {
err = ssz.ErrBytesLength
return
}
buf := make([]byte, 48)
copy(buf, v.PublicKey)
zeroBytes := make([]byte, 32)
if rest := len(buf) % 32; rest != 0 {
// pad zero bytes to the left
buf = append(buf, zeroBytes[:32-rest]...)
}
items := make([][]byte, 2)
items[0] = zeroBytes
items[1] = zeroBytes
copy(items[0], buf[0:32])
copy(items[1], buf[32:64])
var leaf *ssz.Node
leaf, err = ssz.TreeFromChunks(items)
if err != nil {
return
}
w.AddNode(leaf)
// Field (1) 'WithdrawalCredentials'
if len(v.WithdrawalCredentials) != 32 {
err = ssz.ErrBytesLength
return
}
w.AddBytes(v.WithdrawalCredentials)
// Field (2) 'EffectiveBalance'
w.AddUint64(v.EffectiveBalance)
// Field (3) 'Slashed'
tmp := ssz.LeafFromBool(v.Slashed)
w.AddNode(tmp)
// Field (4) 'ActivationEligibilityEpoch'
w.AddUint64(uint64(v.ActivationEligibilityEpoch))
// Field (5) 'ActivationEpoch'
w.AddUint64(uint64(v.ActivationEpoch))
// Field (6) 'ExitEpoch'
w.AddUint64(uint64(v.ExitEpoch))
// Field (7) 'WithdrawableEpoch'
w.AddUint64(uint64(v.WithdrawableEpoch))
w.Commit(indx)
return nil
}
func (v *Validator) GetTree() (*ssz.Node, error) {
w := &ssz.Wrapper{}
if err := v.GetTreeWithWrapper(w); err != nil {
return nil, err
}
return w.Node(), nil
}

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
func request_Health_StreamBeaconLogs_0(ctx context.Context, marshaler runtime.Marshaler, client HealthClient, req *http.Request, pathParams map[string]string) (Health_StreamBeaconLogsClient, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty

912
proto/prysm/v1alpha1/light_client.pb.go generated Executable file
View File

@@ -0,0 +1,912 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.15.8
// source: proto/prysm/v1alpha1/light_client.proto
package eth
import (
context "context"
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto"
empty "github.com/golang/protobuf/ptypes/empty"
github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield"
_ "github.com/prysmaticlabs/prysm/proto/eth/ext"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
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)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type BestUpdatesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SyncCommitteePeriods []uint64 `protobuf:"varint,1,rep,packed,name=sync_committee_periods,json=syncCommitteePeriods,proto3" json:"sync_committee_periods,omitempty"`
}
func (x *BestUpdatesRequest) Reset() {
*x = BestUpdatesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BestUpdatesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BestUpdatesRequest) ProtoMessage() {}
func (x *BestUpdatesRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 BestUpdatesRequest.ProtoReflect.Descriptor instead.
func (*BestUpdatesRequest) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{0}
}
func (x *BestUpdatesRequest) GetSyncCommitteePeriods() []uint64 {
if x != nil {
return x.SyncCommitteePeriods
}
return nil
}
type BestUpdatesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Updates []*LightClientUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates,omitempty"`
}
func (x *BestUpdatesResponse) Reset() {
*x = BestUpdatesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BestUpdatesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BestUpdatesResponse) ProtoMessage() {}
func (x *BestUpdatesResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 BestUpdatesResponse.ProtoReflect.Descriptor instead.
func (*BestUpdatesResponse) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{1}
}
func (x *BestUpdatesResponse) GetUpdates() []*LightClientUpdate {
if x != nil {
return x.Updates
}
return nil
}
type LightClientUpdate struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Header *BeaconBlockHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
NextSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"`
NextSyncCommitteeBranch [][]byte `protobuf:"bytes,3,rep,name=next_sync_committee_branch,json=nextSyncCommitteeBranch,proto3" json:"next_sync_committee_branch,omitempty" ssz-size:"5,32"`
FinalityHeader *BeaconBlockHeader `protobuf:"bytes,4,opt,name=finality_header,json=finalityHeader,proto3" json:"finality_header,omitempty"`
FinalityBranch [][]byte `protobuf:"bytes,5,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"6,32"`
SyncCommitteeBits github_com_prysmaticlabs_go_bitfield.Bitvector512 `protobuf:"bytes,6,opt,name=sync_committee_bits,json=syncCommitteeBits,proto3" json:"sync_committee_bits,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector512" ssz-size:"64"`
SyncCommitteeSignature []byte `protobuf:"bytes,7,opt,name=sync_committee_signature,json=syncCommitteeSignature,proto3" json:"sync_committee_signature,omitempty" ssz-size:"96"`
ForkVersion []byte `protobuf:"bytes,8,opt,name=fork_version,json=forkVersion,proto3" json:"fork_version,omitempty" ssz-size:"4"`
}
func (x *LightClientUpdate) Reset() {
*x = LightClientUpdate{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LightClientUpdate) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LightClientUpdate) ProtoMessage() {}
func (x *LightClientUpdate) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 LightClientUpdate.ProtoReflect.Descriptor instead.
func (*LightClientUpdate) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{2}
}
func (x *LightClientUpdate) GetHeader() *BeaconBlockHeader {
if x != nil {
return x.Header
}
return nil
}
func (x *LightClientUpdate) GetNextSyncCommittee() *SyncCommittee {
if x != nil {
return x.NextSyncCommittee
}
return nil
}
func (x *LightClientUpdate) GetNextSyncCommitteeBranch() [][]byte {
if x != nil {
return x.NextSyncCommitteeBranch
}
return nil
}
func (x *LightClientUpdate) GetFinalityHeader() *BeaconBlockHeader {
if x != nil {
return x.FinalityHeader
}
return nil
}
func (x *LightClientUpdate) GetFinalityBranch() [][]byte {
if x != nil {
return x.FinalityBranch
}
return nil
}
func (x *LightClientUpdate) GetSyncCommitteeBits() github_com_prysmaticlabs_go_bitfield.Bitvector512 {
if x != nil {
return x.SyncCommitteeBits
}
return github_com_prysmaticlabs_go_bitfield.Bitvector512(nil)
}
func (x *LightClientUpdate) GetSyncCommitteeSignature() []byte {
if x != nil {
return x.SyncCommitteeSignature
}
return nil
}
func (x *LightClientUpdate) GetForkVersion() []byte {
if x != nil {
return x.ForkVersion
}
return nil
}
type ClientSnapshot struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Header *BeaconBlockHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
CurrentSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=current_sync_committee,json=currentSyncCommittee,proto3" json:"current_sync_committee,omitempty"`
NextSyncCommittee *SyncCommittee `protobuf:"bytes,3,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"`
}
func (x *ClientSnapshot) Reset() {
*x = ClientSnapshot{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClientSnapshot) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClientSnapshot) ProtoMessage() {}
func (x *ClientSnapshot) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 ClientSnapshot.ProtoReflect.Descriptor instead.
func (*ClientSnapshot) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{3}
}
func (x *ClientSnapshot) GetHeader() *BeaconBlockHeader {
if x != nil {
return x.Header
}
return nil
}
func (x *ClientSnapshot) GetCurrentSyncCommittee() *SyncCommittee {
if x != nil {
return x.CurrentSyncCommittee
}
return nil
}
func (x *ClientSnapshot) GetNextSyncCommittee() *SyncCommittee {
if x != nil {
return x.NextSyncCommittee
}
return nil
}
type SyncAttestedData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Header *BeaconBlockHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
FinalityCheckpoint *Checkpoint `protobuf:"bytes,2,opt,name=finality_checkpoint,json=finalityCheckpoint,proto3" json:"finality_checkpoint,omitempty"`
FinalityBranch [][]byte `protobuf:"bytes,3,rep,name=finality_branch,json=finalityBranch,proto3" json:"finality_branch,omitempty" ssz-size:"6,32"`
NextSyncCommittee *SyncCommittee `protobuf:"bytes,4,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"`
NextSyncCommitteeBranch [][]byte `protobuf:"bytes,5,rep,name=next_sync_committee_branch,json=nextSyncCommitteeBranch,proto3" json:"next_sync_committee_branch,omitempty" ssz-size:"5,32"`
}
func (x *SyncAttestedData) Reset() {
*x = SyncAttestedData{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SyncAttestedData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SyncAttestedData) ProtoMessage() {}
func (x *SyncAttestedData) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 SyncAttestedData.ProtoReflect.Descriptor instead.
func (*SyncAttestedData) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{4}
}
func (x *SyncAttestedData) GetHeader() *BeaconBlockHeader {
if x != nil {
return x.Header
}
return nil
}
func (x *SyncAttestedData) GetFinalityCheckpoint() *Checkpoint {
if x != nil {
return x.FinalityCheckpoint
}
return nil
}
func (x *SyncAttestedData) GetFinalityBranch() [][]byte {
if x != nil {
return x.FinalityBranch
}
return nil
}
func (x *SyncAttestedData) GetNextSyncCommittee() *SyncCommittee {
if x != nil {
return x.NextSyncCommittee
}
return nil
}
func (x *SyncAttestedData) GetNextSyncCommitteeBranch() [][]byte {
if x != nil {
return x.NextSyncCommitteeBranch
}
return nil
}
type LightClientFinalizedCheckpoint struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Header *BeaconBlockHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
NextSyncCommittee *SyncCommittee `protobuf:"bytes,2,opt,name=next_sync_committee,json=nextSyncCommittee,proto3" json:"next_sync_committee,omitempty"`
NextSyncCommitteeBranch [][]byte `protobuf:"bytes,3,rep,name=next_sync_committee_branch,json=nextSyncCommitteeBranch,proto3" json:"next_sync_committee_branch,omitempty" ssz-size:"5,32"`
}
func (x *LightClientFinalizedCheckpoint) Reset() {
*x = LightClientFinalizedCheckpoint{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_light_client_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LightClientFinalizedCheckpoint) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LightClientFinalizedCheckpoint) ProtoMessage() {}
func (x *LightClientFinalizedCheckpoint) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_light_client_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 LightClientFinalizedCheckpoint.ProtoReflect.Descriptor instead.
func (*LightClientFinalizedCheckpoint) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP(), []int{5}
}
func (x *LightClientFinalizedCheckpoint) GetHeader() *BeaconBlockHeader {
if x != nil {
return x.Header
}
return nil
}
func (x *LightClientFinalizedCheckpoint) GetNextSyncCommittee() *SyncCommittee {
if x != nil {
return x.NextSyncCommittee
}
return nil
}
func (x *LightClientFinalizedCheckpoint) GetNextSyncCommitteeBranch() [][]byte {
if x != nil {
return x.NextSyncCommitteeBranch
}
return nil
}
var File_proto_prysm_v1alpha1_light_client_proto protoreflect.FileDescriptor
var file_proto_prysm_v1alpha1_light_client_proto_rawDesc = []byte{
0x0a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 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, 0x1a, 0x1c, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70,
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x61,
0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x73, 0x74,
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f,
0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 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, 0x4a, 0x0a,
0x12, 0x42, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x04, 0x52, 0x14, 0x73, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
0x65, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x22, 0x59, 0x0a, 0x13, 0x42, 0x65, 0x73,
0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x42, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x28, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x07, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x73, 0x22, 0xd1, 0x04, 0x0a, 0x11, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x40, 0x0a, 0x06, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 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, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x13,
0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x65, 0x18, 0x02, 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, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x52,
0x11, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
0x65, 0x65, 0x12, 0x45, 0x0a, 0x1a, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f,
0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x35, 0x2c, 0x33, 0x32,
0x52, 0x17, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x51, 0x0a, 0x0f, 0x66, 0x69, 0x6e,
0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x28, 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, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0e, 0x66, 0x69,
0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x0f,
0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18,
0x05, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x36, 0x2c, 0x33, 0x32, 0x52,
0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12,
0x6b, 0x0a, 0x13, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65,
0x65, 0x5f, 0x62, 0x69, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x3b, 0x8a, 0xb5,
0x18, 0x02, 0x31, 0x36, 0x82, 0xb5, 0x18, 0x31, 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, 0x31, 0x32, 0x38, 0x52, 0x11, 0x73, 0x79, 0x6e, 0x63, 0x43,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x42, 0x69, 0x74, 0x73, 0x12, 0x40, 0x0a, 0x18,
0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x73,
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06,
0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x16, 0x73, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x74, 0x65, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x28,
0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08,
0x20, 0x01, 0x28, 0x0c, 0x42, 0x05, 0x8a, 0xb5, 0x18, 0x01, 0x34, 0x52, 0x0b, 0x66, 0x6f, 0x72,
0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x84, 0x02, 0x0a, 0x0e, 0x43, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x68,
0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 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, 0x48,
0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x5a, 0x0a,
0x16, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x18, 0x02, 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, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x65, 0x52, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x79, 0x6e, 0x63,
0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x12, 0x54, 0x0a, 0x13, 0x6e, 0x65, 0x78,
0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
0x18, 0x03, 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, 0x53,
0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x52, 0x11, 0x6e, 0x65,
0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x22,
0xf8, 0x02, 0x0a, 0x10, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64,
0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 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, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06,
0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x13, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69,
0x74, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 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, 0x12, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x0f, 0x66, 0x69,
0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x18, 0x03, 0x20,
0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x36, 0x2c, 0x33, 0x32, 0x52, 0x0e, 0x66,
0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x54, 0x0a,
0x13, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x74, 0x65, 0x65, 0x18, 0x04, 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, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65,
0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
0x74, 0x65, 0x65, 0x12, 0x45, 0x0a, 0x1a, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63,
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x62, 0x72, 0x61, 0x6e, 0x63,
0x68, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x35, 0x2c, 0x33,
0x32, 0x52, 0x17, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
0x74, 0x74, 0x65, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x22, 0xff, 0x01, 0x0a, 0x1e, 0x4c,
0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69,
0x7a, 0x65, 0x64, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x40, 0x0a,
0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 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, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
0x54, 0x0a, 0x13, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x18, 0x02, 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, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74,
0x65, 0x65, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d,
0x69, 0x74, 0x74, 0x65, 0x65, 0x12, 0x45, 0x0a, 0x1a, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x79,
0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x62, 0x72, 0x61,
0x6e, 0x63, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x42, 0x08, 0x8a, 0xb5, 0x18, 0x04, 0x35,
0x2c, 0x33, 0x32, 0x52, 0x17, 0x6e, 0x65, 0x78, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x32, 0xda, 0x03, 0x0a,
0x0b, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x96, 0x01, 0x0a,
0x0b, 0x42, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 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, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 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, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x22, 0x25, 0x2f, 0x65, 0x74,
0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74,
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x62, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x15, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12,
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x28, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65,
0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e,
0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x12, 0x31, 0x2f, 0x65, 0x74, 0x68, 0x2f,
0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x63, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x9a, 0x01, 0x0a,
0x18, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x6e,
0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x1a, 0x28, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68,
0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3c, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x36, 0x12, 0x34, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6c,
0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x6f, 0x6e,
0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x42, 0x93, 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, 0x0b, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73,
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79,
0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa,
0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x56,
0x31, 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_light_client_proto_rawDescOnce sync.Once
file_proto_prysm_v1alpha1_light_client_proto_rawDescData = file_proto_prysm_v1alpha1_light_client_proto_rawDesc
)
func file_proto_prysm_v1alpha1_light_client_proto_rawDescGZIP() []byte {
file_proto_prysm_v1alpha1_light_client_proto_rawDescOnce.Do(func() {
file_proto_prysm_v1alpha1_light_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_prysm_v1alpha1_light_client_proto_rawDescData)
})
return file_proto_prysm_v1alpha1_light_client_proto_rawDescData
}
var file_proto_prysm_v1alpha1_light_client_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_proto_prysm_v1alpha1_light_client_proto_goTypes = []interface{}{
(*BestUpdatesRequest)(nil), // 0: ethereum.eth.v1alpha1.BestUpdatesRequest
(*BestUpdatesResponse)(nil), // 1: ethereum.eth.v1alpha1.BestUpdatesResponse
(*LightClientUpdate)(nil), // 2: ethereum.eth.v1alpha1.LightClientUpdate
(*ClientSnapshot)(nil), // 3: ethereum.eth.v1alpha1.ClientSnapshot
(*SyncAttestedData)(nil), // 4: ethereum.eth.v1alpha1.SyncAttestedData
(*LightClientFinalizedCheckpoint)(nil), // 5: ethereum.eth.v1alpha1.LightClientFinalizedCheckpoint
(*BeaconBlockHeader)(nil), // 6: ethereum.eth.v1alpha1.BeaconBlockHeader
(*SyncCommittee)(nil), // 7: ethereum.eth.v1alpha1.SyncCommittee
(*Checkpoint)(nil), // 8: ethereum.eth.v1alpha1.Checkpoint
(*empty.Empty)(nil), // 9: google.protobuf.Empty
}
var file_proto_prysm_v1alpha1_light_client_proto_depIdxs = []int32{
2, // 0: ethereum.eth.v1alpha1.BestUpdatesResponse.updates:type_name -> ethereum.eth.v1alpha1.LightClientUpdate
6, // 1: ethereum.eth.v1alpha1.LightClientUpdate.header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
7, // 2: ethereum.eth.v1alpha1.LightClientUpdate.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
6, // 3: ethereum.eth.v1alpha1.LightClientUpdate.finality_header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
6, // 4: ethereum.eth.v1alpha1.ClientSnapshot.header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
7, // 5: ethereum.eth.v1alpha1.ClientSnapshot.current_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
7, // 6: ethereum.eth.v1alpha1.ClientSnapshot.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
6, // 7: ethereum.eth.v1alpha1.SyncAttestedData.header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
8, // 8: ethereum.eth.v1alpha1.SyncAttestedData.finality_checkpoint:type_name -> ethereum.eth.v1alpha1.Checkpoint
7, // 9: ethereum.eth.v1alpha1.SyncAttestedData.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
6, // 10: ethereum.eth.v1alpha1.LightClientFinalizedCheckpoint.header:type_name -> ethereum.eth.v1alpha1.BeaconBlockHeader
7, // 11: ethereum.eth.v1alpha1.LightClientFinalizedCheckpoint.next_sync_committee:type_name -> ethereum.eth.v1alpha1.SyncCommittee
0, // 12: ethereum.eth.v1alpha1.LightClient.BestUpdates:input_type -> ethereum.eth.v1alpha1.BestUpdatesRequest
9, // 13: ethereum.eth.v1alpha1.LightClient.LatestUpdateFinalized:input_type -> google.protobuf.Empty
9, // 14: ethereum.eth.v1alpha1.LightClient.LatestUpdateNonFinalized:input_type -> google.protobuf.Empty
1, // 15: ethereum.eth.v1alpha1.LightClient.BestUpdates:output_type -> ethereum.eth.v1alpha1.BestUpdatesResponse
2, // 16: ethereum.eth.v1alpha1.LightClient.LatestUpdateFinalized:output_type -> ethereum.eth.v1alpha1.LightClientUpdate
2, // 17: ethereum.eth.v1alpha1.LightClient.LatestUpdateNonFinalized:output_type -> ethereum.eth.v1alpha1.LightClientUpdate
15, // [15:18] is the sub-list for method output_type
12, // [12:15] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
}
func init() { file_proto_prysm_v1alpha1_light_client_proto_init() }
func file_proto_prysm_v1alpha1_light_client_proto_init() {
if File_proto_prysm_v1alpha1_light_client_proto != nil {
return
}
file_proto_prysm_v1alpha1_attestation_proto_init()
file_proto_prysm_v1alpha1_beacon_state_proto_init()
file_proto_prysm_v1alpha1_beacon_block_proto_init()
file_proto_prysm_v1alpha1_sync_committee_proto_init()
if !protoimpl.UnsafeEnabled {
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BestUpdatesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BestUpdatesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LightClientUpdate); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientSnapshot); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncAttestedData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_prysm_v1alpha1_light_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LightClientFinalizedCheckpoint); 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_light_client_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_prysm_v1alpha1_light_client_proto_goTypes,
DependencyIndexes: file_proto_prysm_v1alpha1_light_client_proto_depIdxs,
MessageInfos: file_proto_prysm_v1alpha1_light_client_proto_msgTypes,
}.Build()
File_proto_prysm_v1alpha1_light_client_proto = out.File
file_proto_prysm_v1alpha1_light_client_proto_rawDesc = nil
file_proto_prysm_v1alpha1_light_client_proto_goTypes = nil
file_proto_prysm_v1alpha1_light_client_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// LightClientClient is the client API for LightClient service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type LightClientClient interface {
BestUpdates(ctx context.Context, in *BestUpdatesRequest, opts ...grpc.CallOption) (*BestUpdatesResponse, error)
LatestUpdateFinalized(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*LightClientUpdate, error)
LatestUpdateNonFinalized(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*LightClientUpdate, error)
}
type lightClientClient struct {
cc grpc.ClientConnInterface
}
func NewLightClientClient(cc grpc.ClientConnInterface) LightClientClient {
return &lightClientClient{cc}
}
func (c *lightClientClient) BestUpdates(ctx context.Context, in *BestUpdatesRequest, opts ...grpc.CallOption) (*BestUpdatesResponse, error) {
out := new(BestUpdatesResponse)
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.LightClient/BestUpdates", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lightClientClient) LatestUpdateFinalized(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*LightClientUpdate, error) {
out := new(LightClientUpdate)
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateFinalized", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lightClientClient) LatestUpdateNonFinalized(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*LightClientUpdate, error) {
out := new(LightClientUpdate)
err := c.cc.Invoke(ctx, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateNonFinalized", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// LightClientServer is the server API for LightClient service.
type LightClientServer interface {
BestUpdates(context.Context, *BestUpdatesRequest) (*BestUpdatesResponse, error)
LatestUpdateFinalized(context.Context, *empty.Empty) (*LightClientUpdate, error)
LatestUpdateNonFinalized(context.Context, *empty.Empty) (*LightClientUpdate, error)
}
// UnimplementedLightClientServer can be embedded to have forward compatible implementations.
type UnimplementedLightClientServer struct {
}
func (*UnimplementedLightClientServer) BestUpdates(context.Context, *BestUpdatesRequest) (*BestUpdatesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BestUpdates not implemented")
}
func (*UnimplementedLightClientServer) LatestUpdateFinalized(context.Context, *empty.Empty) (*LightClientUpdate, error) {
return nil, status.Errorf(codes.Unimplemented, "method LatestUpdateFinalized not implemented")
}
func (*UnimplementedLightClientServer) LatestUpdateNonFinalized(context.Context, *empty.Empty) (*LightClientUpdate, error) {
return nil, status.Errorf(codes.Unimplemented, "method LatestUpdateNonFinalized not implemented")
}
func RegisterLightClientServer(s *grpc.Server, srv LightClientServer) {
s.RegisterService(&_LightClient_serviceDesc, srv)
}
func _LightClient_BestUpdates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BestUpdatesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LightClientServer).BestUpdates(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ethereum.eth.v1alpha1.LightClient/BestUpdates",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LightClientServer).BestUpdates(ctx, req.(*BestUpdatesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LightClient_LatestUpdateFinalized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(empty.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LightClientServer).LatestUpdateFinalized(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ethereum.eth.v1alpha1.LightClient/LatestUpdateFinalized",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LightClientServer).LatestUpdateFinalized(ctx, req.(*empty.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _LightClient_LatestUpdateNonFinalized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(empty.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LightClientServer).LatestUpdateNonFinalized(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ethereum.eth.v1alpha1.LightClient/LatestUpdateNonFinalized",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LightClientServer).LatestUpdateNonFinalized(ctx, req.(*empty.Empty))
}
return interceptor(ctx, in, info, handler)
}
var _LightClient_serviceDesc = grpc.ServiceDesc{
ServiceName: "ethereum.eth.v1alpha1.LightClient",
HandlerType: (*LightClientServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "BestUpdates",
Handler: _LightClient_BestUpdates_Handler,
},
{
MethodName: "LatestUpdateFinalized",
Handler: _LightClient_LatestUpdateFinalized_Handler,
},
{
MethodName: "LatestUpdateNonFinalized",
Handler: _LightClient_LatestUpdateNonFinalized_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/prysm/v1alpha1/light_client.proto",
}

View File

@@ -0,0 +1,301 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: proto/prysm/v1alpha1/light_client.proto
/*
Package eth is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package eth
import (
"context"
"io"
"net/http"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
github_com_prysmaticlabs_eth2_types "github.com/prysmaticlabs/eth2-types"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
func request_LightClient_BestUpdates_0(ctx context.Context, marshaler runtime.Marshaler, client LightClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BestUpdatesRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.BestUpdates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_LightClient_BestUpdates_0(ctx context.Context, marshaler runtime.Marshaler, server LightClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BestUpdatesRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.BestUpdates(ctx, &protoReq)
return msg, metadata, err
}
func request_LightClient_LatestUpdateFinalized_0(ctx context.Context, marshaler runtime.Marshaler, client LightClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty
var metadata runtime.ServerMetadata
msg, err := client.LatestUpdateFinalized(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_LightClient_LatestUpdateFinalized_0(ctx context.Context, marshaler runtime.Marshaler, server LightClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty
var metadata runtime.ServerMetadata
msg, err := server.LatestUpdateFinalized(ctx, &protoReq)
return msg, metadata, err
}
func request_LightClient_LatestUpdateNonFinalized_0(ctx context.Context, marshaler runtime.Marshaler, client LightClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty
var metadata runtime.ServerMetadata
msg, err := client.LatestUpdateNonFinalized(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_LightClient_LatestUpdateNonFinalized_0(ctx context.Context, marshaler runtime.Marshaler, server LightClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty
var metadata runtime.ServerMetadata
msg, err := server.LatestUpdateNonFinalized(ctx, &protoReq)
return msg, metadata, err
}
// RegisterLightClientHandlerServer registers the http handlers for service LightClient to "mux".
// UnaryRPC :call LightClientServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLightClientHandlerFromEndpoint instead.
func RegisterLightClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LightClientServer) error {
mux.Handle("POST", pattern_LightClient_BestUpdates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/BestUpdates")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_LightClient_BestUpdates_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_BestUpdates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_LightClient_LatestUpdateFinalized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateFinalized")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_LightClient_LatestUpdateFinalized_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_LatestUpdateFinalized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_LightClient_LatestUpdateNonFinalized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateNonFinalized")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_LightClient_LatestUpdateNonFinalized_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_LatestUpdateNonFinalized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterLightClientHandlerFromEndpoint is same as RegisterLightClientHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterLightClientHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterLightClientHandler(ctx, mux, conn)
}
// RegisterLightClientHandler registers the http handlers for service LightClient to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterLightClientHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterLightClientHandlerClient(ctx, mux, NewLightClientClient(conn))
}
// RegisterLightClientHandlerClient registers the http handlers for service LightClient
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LightClientClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LightClientClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "LightClientClient" to call the correct interceptors.
func RegisterLightClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LightClientClient) error {
mux.Handle("POST", pattern_LightClient_BestUpdates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/BestUpdates")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_LightClient_BestUpdates_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_BestUpdates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_LightClient_LatestUpdateFinalized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateFinalized")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_LightClient_LatestUpdateFinalized_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_LatestUpdateFinalized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_LightClient_LatestUpdateNonFinalized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ethereum.eth.v1alpha1.LightClient/LatestUpdateNonFinalized")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_LightClient_LatestUpdateNonFinalized_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_LightClient_LatestUpdateNonFinalized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_LightClient_BestUpdates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1alpha1", "lightclient", "best_update"}, ""))
pattern_LightClient_LatestUpdateFinalized_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1alpha1", "lightclient", "latest_update_finalized"}, ""))
pattern_LightClient_LatestUpdateNonFinalized_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"eth", "v1alpha1", "lightclient", "latest_update_nonfinalized"}, ""))
)
var (
forward_LightClient_BestUpdates_0 = runtime.ForwardResponseMessage
forward_LightClient_LatestUpdateFinalized_0 = runtime.ForwardResponseMessage
forward_LightClient_LatestUpdateNonFinalized_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,91 @@
// Copyright 2021 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "proto/eth/ext/options.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "proto/prysm/v1alpha1/attestation.proto";
import "proto/prysm/v1alpha1/beacon_state.proto";
import "proto/prysm/v1alpha1/beacon_block.proto";
import "proto/prysm/v1alpha1/sync_committee.proto";
option csharp_namespace = "Ethereum.Eth.V1alpha1";
option go_package = "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1;eth";
option java_multiple_files = true;
option java_outer_classname = "LightClient";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";
service LightClient {
rpc BestUpdates(BestUpdatesRequest) returns (BestUpdatesResponse) {
option (google.api.http) = {
post: "/eth/v1alpha1/lightclient/best_update",
body: "*"
};
}
rpc LatestUpdateFinalized(google.protobuf.Empty) returns (LightClientUpdate) {
option (google.api.http) = {
get: "/eth/v1alpha1/lightclient/latest_update_finalized",
};
}
rpc LatestUpdateNonFinalized(google.protobuf.Empty) returns (LightClientUpdate) {
option (google.api.http) = {
get: "/eth/v1alpha1/lightclient/latest_update_nonfinalized",
};
}
}
message BestUpdatesRequest {
repeated uint64 sync_committee_periods = 1;
}
message BestUpdatesResponse {
repeated LightClientUpdate updates = 1;
}
message LightClientUpdate {
ethereum.eth.v1alpha1.BeaconBlockHeader header = 1;
ethereum.eth.v1alpha1.SyncCommittee next_sync_committee = 2;
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
ethereum.eth.v1alpha1.BeaconBlockHeader finality_header = 4;
repeated bytes finality_branch = 5 [(ethereum.eth.ext.ssz_size) = "6,32"];
bytes sync_committee_bits = 6 [(ethereum.eth.ext.ssz_size) = "sync_committee_aggregate_bytes.size", (ethereum.eth.ext.cast_type) = "sync_committee_aggregate_bits.type"];
bytes sync_committee_signature = 7 [(ethereum.eth.ext.ssz_size) = "96"];
bytes fork_version = 8 [(ethereum.eth.ext.ssz_size) = "4"];
}
message ClientSnapshot {
ethereum.eth.v1alpha1.BeaconBlockHeader header = 1;
ethereum.eth.v1alpha1.SyncCommittee current_sync_committee = 2;
ethereum.eth.v1alpha1.SyncCommittee next_sync_committee = 3;
}
message SyncAttestedData {
ethereum.eth.v1alpha1.BeaconBlockHeader header = 1;
ethereum.eth.v1alpha1.Checkpoint finality_checkpoint = 2;
repeated bytes finality_branch = 3 [(ethereum.eth.ext.ssz_size) = "6,32"];
ethereum.eth.v1alpha1.SyncCommittee next_sync_committee = 4;
repeated bytes next_sync_committee_branch = 5 [(ethereum.eth.ext.ssz_size) = "5,32"];
}
message LightClientFinalizedCheckpoint {
ethereum.eth.v1alpha1.BeaconBlockHeader header = 1;
ethereum.eth.v1alpha1.SyncCommittee next_sync_committee = 2;
repeated bytes next_sync_committee_branch = 3 [(ethereum.eth.ext.ssz_size) = "5,32"];
}

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
func request_Node_GetSyncStatus_0(ctx context.Context, marshaler runtime.Marshaler, client NodeClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq emptypb.Empty

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
func request_Slasher_IsSlashableAttestation_0(ctx context.Context, marshaler runtime.Marshaler, client SlasherClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq IndexedAttestation

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"github.com/golang/protobuf/ptypes/empty"
emptypb "github.com/golang/protobuf/ptypes/empty"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
@@ -35,7 +34,6 @@ var _ = utilities.NewDoubleArray
var _ = metadata.Join
var _ = github_com_prysmaticlabs_eth2_types.Epoch(0)
var _ = emptypb.Empty{}
var _ = empty.Empty{}
var (
filter_BeaconNodeValidator_GetDuties_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}