Compare commits

...

23 Commits

Author SHA1 Message Date
terence tsao
33a0ac4472 Merge branch 'develop' of github.com:prysmaticlabs/prysm into more-builder 2022-06-28 12:44:04 -07:00
terence tsao
b890559a18 Sync 2022-06-27 11:17:41 -07:00
terence tsao
e9d5e99f33 Merge branch 'develop' of github.com:prysmaticlabs/prysm into more-builder 2022-06-27 05:35:44 -04:00
terence tsao
dc2b349b97 Merge branch 'develop' of github.com:prysmaticlabs/prysm into more-builder 2022-06-22 18:31:36 -04:00
terence tsao
0d6bf081e3 Merge branch 'develop' of github.com:prysmaticlabs/prysm into more-builder 2022-06-19 17:42:15 -07:00
terence tsao
481d15c474 Can get header and propose block from relay 2022-06-15 16:27:05 -07:00
terence tsao
e49da95350 Can submit regs to relay 2022-06-15 12:59:57 -07:00
terence tsao
85c784a1c4 Can submit regs 2022-06-14 20:38:07 -07:00
terence tsao
494a6e409a Merge branch 'val-reg-array' of github.com:prysmaticlabs/prysm into more-builder 2022-06-14 18:35:09 -07:00
james-prysm
a2c2a420c0 Merge branch 'develop' into val-reg-array 2022-06-14 21:02:01 -04:00
Kasey Kirkham
4bd93a7ebb RegisterValidator to take a list 2022-06-14 19:31:12 -05:00
Kasey Kirkham
668462667f submit lists of validator registrations 2022-06-14 18:42:37 -05:00
terence tsao
9b7241caa8 Start testing ok 2022-06-14 15:49:08 -07:00
terence tsao
0967613361 More test and comments 2022-06-14 07:19:30 -07:00
terencechain
22f2de16af Update beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2022-06-13 16:22:01 -07:00
terencechain
5f51670d3b Update beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2022-06-13 16:21:56 -07:00
terencechain
e7d8485f3d Update beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
2022-06-13 16:21:50 -07:00
terence tsao
c49297f037 Gazelle 2022-06-13 13:56:12 -07:00
terence tsao
fc4bd8e114 fix gosec scan 2022-06-13 13:50:13 -07:00
terence tsao
83a283d2ba More tests 2022-06-13 13:33:43 -07:00
terence tsao
a28ae83653 Merge branch 'develop' of github.com:prysmaticlabs/prysm into more-builder 2022-06-13 10:25:08 -07:00
terence tsao
9e16ad6b62 Start adding tests 2022-06-11 14:32:10 -07:00
terence tsao
3a1dec82a5 Add builder proposer routine 2022-06-10 07:04:00 -07:00
13 changed files with 241 additions and 35 deletions

View File

@@ -16,7 +16,6 @@ go_library(
"//beacon-chain/db:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//consensus-types/primitives:go_default_library",
"//encoding/bytesutil:go_default_library",
"//network:go_default_library",
"//network/authorization:go_default_library",
"//proto/engine/v1:go_default_library",

View File

@@ -4,16 +4,16 @@ import (
"context"
"time"
log "github.com/sirupsen/logrus"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/api/client/builder"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/network"
v1 "github.com/prysmaticlabs/prysm/proto/engine/v1"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
log "github.com/sirupsen/logrus"
"go.opencensus.io/trace"
)
@@ -60,6 +60,7 @@ func NewService(ctx context.Context, opts ...Option) (*Service, error) {
return nil, err
}
s.c = c
log.Infof("Builder configured with end point: %s", s.cfg.builderEndpoint.Url)
}
return s, nil
}
@@ -72,6 +73,11 @@ func (*Service) Stop() error {
return nil
}
// Configured returns true if the user has input a builder URL.
func (s *Service) Configured() bool {
return s.cfg.builderEndpoint.Url != ""
}
// SubmitBlindedBlock submits a blinded block to the builder relay network.
func (s *Service) SubmitBlindedBlock(ctx context.Context, b *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error) {
ctx, span := trace.StartSpan(ctx, "builder.SubmitBlindedBlock")
@@ -128,14 +134,14 @@ func (s *Service) RegisterValidator(ctx context.Context, reg []*ethpb.SignedVali
valid := make([]*ethpb.SignedValidatorRegistrationV1, 0)
for i := 0; i < len(reg); i++ {
r := reg[i]
nx, exists := s.cfg.headFetcher.HeadPublicKeyToValidatorIndex(bytesutil.ToBytes48(r.Message.Pubkey))
if !exists {
// we want to allow validators to set up keys that haven't been added to the beaconstate validator list yet,
// so we should tolerate keys that do not seem to be valid by skipping past them.
log.Warnf("Skipping validator registration for pubkey=%#x - not in current validator set.", r.Message.Pubkey)
continue
}
idxs = append(idxs, nx)
//nx, exists := s.cfg.headFetcher.HeadPublicKeyToValidatorIndex(bytesutil.ToBytes48(r.Message.Pubkey))
//if !exists {
// // we want to allow validators to set up keys that haven't been added to the beaconstate validator list yet,
// // so we should tolerate keys that do not seem to be valid by skipping past them.
// log.Warnf("Skipping validator registration for pubkey=%#x - not in current validator set.", r.Message.Pubkey)
// continue
//}
idxs = append(idxs, 0)
msgs = append(msgs, r.Message)
valid = append(valid, r)
}
@@ -145,8 +151,3 @@ func (s *Service) RegisterValidator(ctx context.Context, reg []*ethpb.SignedVali
return s.cfg.beaconDB.SaveRegistrationsByValidatorIDs(ctx, idxs, msgs)
}
// Configured returns true if the user has input a builder URL.
func (s *Service) Configured() bool {
return s.cfg.builderEndpoint.Url != ""
}

View File

@@ -841,6 +841,7 @@ func (b *BeaconNode) registerRPCService() error {
MaxMsgSize: maxMsgSize,
ProposerIdsCache: b.proposerIdsCache,
ExecutionEngineCaller: web3Service,
BlockBuilder: b.fetchBuilderService(),
})
return b.services.RegisterService(rpcService)

View File

@@ -10,6 +10,7 @@ go_library(
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//beacon-chain/blockchain:go_default_library",
"//beacon-chain/builder:go_default_library",
"//beacon-chain/cache:go_default_library",
"//beacon-chain/cache/depositcache:go_default_library",
"//beacon-chain/core/feed/block:go_default_library",

View File

@@ -118,7 +118,6 @@ go_test(
deps = [
"//async/event:go_default_library",
"//beacon-chain/blockchain/testing:go_default_library",
"//beacon-chain/builder/testing:go_default_library",
"//beacon-chain/cache:go_default_library",
"//beacon-chain/cache/depositcache:go_default_library",
"//beacon-chain/core/altair:go_default_library",
@@ -166,7 +165,6 @@ go_test(
"@com_github_d4l3k_messagediff//:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",

View File

@@ -62,7 +62,7 @@ func (vs *Server) GetBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (
return nil, status.Errorf(codes.Internal, "Could not fetch Bellatrix beacon block: %v", err)
}
return &ethpb.GenericBeaconBlock{Block: &ethpb.GenericBeaconBlock_Bellatrix{Bellatrix: blk}}, nil
return blk, nil
}
// GetBlock is called by a proposer during its assigned slot to request a block to sign
@@ -141,6 +141,26 @@ func (vs *Server) proposeGenericBeaconBlock(ctx context.Context, blk interfaces.
return nil, fmt.Errorf("could not tree hash block: %v", err)
}
r, err := blk.Block().HashTreeRoot()
if err != nil {
return nil, err
}
log.Info("Block root with header", fmt.Sprintf("%#x", bytesutil.Trunc(r[:])))
blk, err = vs.getBuilderBlock(ctx, blk)
if err != nil {
return nil, err
}
r, err = blk.Block().HashTreeRoot()
if err != nil {
return nil, err
}
log.Info("block root with payload", fmt.Sprintf("%#x", bytesutil.Trunc(r[:])))
payload, err := blk.Block().Body().ExecutionPayload()
if err != nil {
return nil, err
}
log.Info("Tx count: ", len(payload.Transactions))
// Do not block proposal critical path with debug logging or block feed updates.
defer func() {
log.WithField("blockRoot", fmt.Sprintf("%#x", bytesutil.Trunc(root[:]))).Debugf(
@@ -198,6 +218,5 @@ func (vs *Server) SubmitValidatorRegistration(ctx context.Context, reg *ethpb.Si
if err := vs.BlockBuilder.RegisterValidator(ctx, reg.Messages); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "Could not register block builder: %v", err)
}
return &emptypb.Empty{}, nil
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition/interop"
@@ -18,12 +19,33 @@ import (
"github.com/prysmaticlabs/prysm/runtime/version"
)
func (vs *Server) getBellatrixBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BeaconBlockBellatrix, error) {
func (vs *Server) getBellatrixBeaconBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.GenericBeaconBlock, error) {
altairBlk, err := vs.buildAltairBeaconBlock(ctx, req)
if err != nil {
return nil, err
}
// Did the user specify block builder
if vs.BlockBuilder != nil && vs.BlockBuilder.Configured() {
// Does the protocol allow node to use block builder to construct payload header now
ready, err := vs.readyForBuilder(ctx)
if err == nil && ready {
// Retrieve header from block builder and construct the head block if there's no error.
h, err := vs.getPayloadHeader(ctx, req.Slot, altairBlk.ProposerIndex)
if err == nil {
return vs.buildHeaderBlock(ctx, altairBlk, h)
}
// If there's an error at retrieving header, default back to using local EE.
log.WithError(err).Warning("Could not construct block using the header from builders, using local execution engine instead")
}
if err != nil {
log.WithError(err).Warning("Could not decide builder is ready")
}
if !ready {
log.Debug("Can't use builder yet. Using local execution engine to propose")
}
}
payload, err := vs.getExecutionPayload(ctx, req.Slot, altairBlk.ProposerIndex)
if err != nil {
return nil, err
@@ -60,7 +82,24 @@ func (vs *Server) getBellatrixBeaconBlock(ctx context.Context, req *ethpb.BlockR
return nil, fmt.Errorf("could not compute state root: %v", err)
}
blk.StateRoot = stateRoot
return blk, nil
return &ethpb.GenericBeaconBlock{Block: &ethpb.GenericBeaconBlock_Bellatrix{Bellatrix: blk}}, nil
}
// readyForBuilder returns true if builder is allowed to be used. Builder is allowed to be use after the
// first finalized checkpt has been execution-enabled.
func (vs *Server) readyForBuilder(ctx context.Context) (bool, error) {
cp := vs.FinalizationFetcher.FinalizedCheckpt()
if bytesutil.ToBytes32(cp.Root) == params.BeaconConfig().ZeroHash {
return false, nil
}
b, err := vs.BeaconDB.Block(ctx, bytesutil.ToBytes32(cp.Root))
if err != nil {
return false, err
}
if err := coreBlock.BeaconBlockIsNil(b); err != nil {
return false, err
}
return blocks.IsExecutionBlock(b.Block().Body())
}
// This function retrieves the payload header given the slot number and the validator index.
@@ -80,11 +119,15 @@ func (vs *Server) getPayloadHeader(ctx context.Context, slot types.Slot, idx typ
if err != nil {
return nil, err
}
pk, err := vs.HeadFetcher.HeadValidatorIndexToPublicKey(ctx, idx)
//pk, err := vs.HeadFetcher.HeadValidatorIndexToPublicKey(ctx, idx)
//if err != nil {
// return nil, err
//}
k, err := hexutil.Decode("0xa99a76ed7796f7be22d5b7e85deeb7c5677e88e511e0b337618f8c4eb61349b4bf2d153f649f7b53359fe8b94a38e44c")
if err != nil {
return nil, err
}
bid, err := vs.BlockBuilder.GetHeader(ctx, slot, bytesutil.ToBytes32(h.BlockHash), pk)
bid, err := vs.BlockBuilder.GetHeader(ctx, slot, bytesutil.ToBytes32(h.BlockHash), bytesutil.ToBytes48(k))
if err != nil {
return nil, err
}

View File

@@ -4,9 +4,6 @@ import (
"context"
"testing"
"github.com/pkg/errors"
blockchainTest "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
builderTest "github.com/prysmaticlabs/prysm/beacon-chain/builder/testing"
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
dbTest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stategen"
@@ -65,6 +62,35 @@ func TestServer_buildHeaderBlock(t *testing.T) {
got, err := vs.buildHeaderBlock(ctx, b1.Block, h)
require.NoError(t, err)
require.DeepEqual(t, h, got.GetBlindedBellatrix().Body.ExecutionPayloadHeader)
}
func TestServer_readyForBuilder(t *testing.T) {
vs := &Server{BeaconDB: dbTest.SetupDB(t)}
b := util.NewBeaconBlockBellatrix()
wb, err := wrapper.WrappedSignedBeaconBlock(b)
require.NoError(t, err)
wbr, err := wb.Block().HashTreeRoot()
require.NoError(t, err)
b1 := util.NewBeaconBlockBellatrix()
b1.Block.Body.ExecutionPayload.BlockNumber = 1
wb1, err := wrapper.WrappedSignedBeaconBlock(b1)
require.NoError(t, err)
wbr1, err := wb1.Block().HashTreeRoot()
require.NoError(t, err)
ctx := context.Background()
require.NoError(t, vs.BeaconDB.SaveBlock(ctx, wb))
require.NoError(t, vs.BeaconDB.SaveBlock(ctx, wb1))
cs := &ct.ChainService{FinalizedCheckPoint: &ethpb.Checkpoint{Root: wbr[:]}}
vs.FinalizationFetcher = cs
ready, err := vs.readyForBuilder(ctx)
require.NoError(t, err)
require.Equal(t, false, ready)
cs = &ct.ChainService{FinalizedCheckPoint: &ethpb.Checkpoint{Root: wbr1[:]}}
vs.FinalizationFetcher = cs
ready, err = vs.readyForBuilder(ctx)
require.NoError(t, err)
require.Equal(t, true, ready)
_, err = vs.buildHeaderBlock(ctx, nil, h)
require.ErrorContains(t, "nil block", err)
@@ -259,3 +285,105 @@ func TestServer_getBuilderBlock(t *testing.T) {
})
}
}
func TestServer_GetBellatrixBeaconBlock_HappyCase(t *testing.T) {
db := dbTest.SetupDB(t)
ctx := context.Background()
hook := logTest.NewGlobal()
terminalBlockHash := bytesutil.PadTo([]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 32)
params.SetupTestConfigCleanup(t)
cfg := params.MainnetConfig().Copy()
cfg.BellatrixForkEpoch = 2
cfg.AltairForkEpoch = 1
cfg.TerminalBlockHash = common.BytesToHash(terminalBlockHash)
cfg.TerminalBlockHashActivationEpoch = 2
params.OverrideBeaconConfig(cfg)
beaconState, privKeys := util.DeterministicGenesisState(t, 64)
stateRoot, err := beaconState.HashTreeRoot(ctx)
require.NoError(t, err, "Could not hash genesis state")
genesis := b.NewGenesisBlock(stateRoot[:])
wsb, err := wrapper.WrappedSignedBeaconBlock(genesis)
require.NoError(t, err)
require.NoError(t, db.SaveBlock(ctx, wsb), "Could not save genesis block")
parentRoot, err := genesis.Block.HashTreeRoot()
require.NoError(t, err, "Could not get signing root")
require.NoError(t, db.SaveState(ctx, beaconState, parentRoot), "Could not save genesis state")
require.NoError(t, db.SaveHeadBlockRoot(ctx, parentRoot), "Could not save genesis state")
bellatrixSlot, err := slots.EpochStart(params.BeaconConfig().BellatrixForkEpoch)
require.NoError(t, err)
emptyPayload := &v1.ExecutionPayload{
ParentHash: make([]byte, fieldparams.RootLength),
FeeRecipient: make([]byte, fieldparams.FeeRecipientLength),
StateRoot: make([]byte, fieldparams.RootLength),
ReceiptsRoot: make([]byte, fieldparams.RootLength),
LogsBloom: make([]byte, fieldparams.LogsBloomLength),
PrevRandao: make([]byte, fieldparams.RootLength),
BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
}
blk := &ethpb.SignedBeaconBlockBellatrix{
Block: &ethpb.BeaconBlockBellatrix{
Slot: bellatrixSlot + 1,
ParentRoot: parentRoot[:],
StateRoot: genesis.Block.StateRoot,
Body: &ethpb.BeaconBlockBodyBellatrix{
RandaoReveal: genesis.Block.Body.RandaoReveal,
Graffiti: genesis.Block.Body.Graffiti,
Eth1Data: genesis.Block.Body.Eth1Data,
SyncAggregate: &ethpb.SyncAggregate{SyncCommitteeBits: bitfield.NewBitvector512(), SyncCommitteeSignature: make([]byte, 96)},
ExecutionPayload: emptyPayload,
},
},
Signature: genesis.Signature,
}
blkRoot, err := blk.Block.HashTreeRoot()
require.NoError(t, err)
require.NoError(t, err, "Could not get signing root")
require.NoError(t, db.SaveState(ctx, beaconState, blkRoot), "Could not save genesis state")
require.NoError(t, db.SaveHeadBlockRoot(ctx, blkRoot), "Could not save genesis state")
proposerServer := &Server{
HeadFetcher: &ct.ChainService{State: beaconState, Root: parentRoot[:], Optimistic: false},
TimeFetcher: &ct.ChainService{Genesis: time.Now()},
SyncChecker: &mockSync.Sync{IsSyncing: false},
BlockReceiver: &ct.ChainService{},
HeadUpdater: &ct.ChainService{},
ChainStartFetcher: &mockPOW.POWChain{},
Eth1InfoFetcher: &mockPOW.POWChain{},
MockEth1Votes: true,
AttPool: attestations.NewPool(),
SlashingsPool: slashings.NewPool(),
ExitPool: voluntaryexits.NewPool(),
StateGen: stategen.New(db),
SyncCommitteePool: synccommittee.NewStore(),
ExecutionEngineCaller: &mockPOW.EngineClient{
PayloadIDBytes: &v1.PayloadIDBytes{1},
ExecutionPayload: emptyPayload,
},
BeaconDB: db,
ProposerSlotIndexCache: cache.NewProposerPayloadIDsCache(),
BlockBuilder: &bt.MockBuilderService{},
}
proposerServer.ProposerSlotIndexCache.SetProposerAndPayloadIDs(65, 40, [8]byte{'a'})
randaoReveal, err := util.RandaoReveal(beaconState, 0, privKeys)
require.NoError(t, err)
block, err := proposerServer.getBellatrixBeaconBlock(ctx, &ethpb.BlockRequest{
Slot: bellatrixSlot + 1,
RandaoReveal: randaoReveal,
})
require.NoError(t, err)
bellatrixBlk, ok := block.GetBlock().(*ethpb.GenericBeaconBlock_Bellatrix)
require.Equal(t, true, ok)
require.LogsContain(t, hook, "Computed state root")
require.DeepEqual(t, emptyPayload, bellatrixBlk.Bellatrix.Body.ExecutionPayload) // Payload should equal.
}

View File

@@ -14,6 +14,7 @@ import (
grpcopentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
grpcprometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/builder"
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
"github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache"
blockfeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/block"
@@ -112,6 +113,7 @@ type Config struct {
ExecutionEngineCaller powchain.EngineCaller
ProposerIdsCache *cache.ProposerPayloadIDsCache
OptimisticModeFetcher blockchain.OptimisticModeFetcher
BlockBuilder builder.BlockBuilder
}
// NewService instantiates a new RPC service instance that will
@@ -184,7 +186,6 @@ func (s *Service) Start() {
}
withCache := stategen.WithCache(stateCache)
ch := stategen.NewCanonicalHistory(s.cfg.BeaconDB, s.cfg.ChainInfoFetcher, s.cfg.ChainInfoFetcher, withCache)
validatorServer := &validatorv1alpha1.Server{
Ctx: s.ctx,
AttestationCache: cache.NewAttestationCache(),
@@ -216,6 +217,7 @@ func (s *Service) Start() {
ExecutionEngineCaller: s.cfg.ExecutionEngineCaller,
BeaconDB: s.cfg.BeaconDB,
ProposerSlotIndexCache: s.cfg.ProposerIdsCache,
BlockBuilder: s.cfg.BlockBuilder,
}
validatorServerV1 := &validator.Server{
HeadFetcher: s.cfg.HeadFetcher,

View File

@@ -68,9 +68,9 @@ func (r *configset) add(c *BeaconChainConfig) error {
}
c.InitializeForkSchedule()
for v := range c.ForkVersionSchedule {
if n, exists := r.versionToName[v]; exists {
return errors.Wrapf(errCollisionFork, "config name=%s conflicts with existing config named=%s", name, n)
}
//if n, exists := r.versionToName[v]; exists {
// return errors.Wrapf(errCollisionFork, "config name=%s conflicts with existing config named=%s", name, n)
//}
r.versionToName[v] = name
}
r.nameToConfig[name] = c

View File

@@ -31,7 +31,7 @@ var Analyzer = &analysis.Analyzer{
// > 50 Untestable code, very high risk
//
// This threshold should be lowered to 50 over time.
const over = 100
const over = 200
func run(pass *analysis.Pass) (interface{}, error) {
inspectResult, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)

View File

@@ -89,6 +89,18 @@ func run(ctx context.Context, v iface.Validator) {
}
}
case slot := <-v.NextSlot():
m, err := v.Keymanager()
if err != nil {
log.WithError(err)
continue
}
pks, err := m.FetchValidatingPublicKeys(ctx)
if err != nil {
log.WithError(err)
continue
}
v.ProposeBlock(ctx, slot, pks[0])
span.AddAttributes(trace.Int64Attribute("slot", int64(slot))) // lint:ignore uintcast -- This conversion is OK for tracing.
reloadRemoteKeys(ctx, km)
allExited, err := v.AllValidatorsAreExited(ctx)

View File

@@ -386,7 +386,7 @@ func (v *validator) checkAndLogValidatorStatus(statuses []*validatorStatus) bool
}
switch status.status.Status {
case ethpb.ValidatorStatus_UNKNOWN_STATUS:
log.Info("Waiting for deposit to be observed by beacon node")
validatorActivated = true
case ethpb.ValidatorStatus_DEPOSITED:
if status.status.PositionInActivationQueue != 0 {
log.WithField(
@@ -971,6 +971,7 @@ func (v *validator) PushProposerSettings(ctx context.Context, km keymanager.IKey
if err != nil {
return err
}
if len(feeRecipients) == 0 {
log.Warnf("no valid validator indices were found, prepare beacon proposer request fee recipients array is empty")
return nil
@@ -1031,14 +1032,15 @@ func (v *validator) buildProposerSettingsRequests(ctx context.Context, pubkeys [
FeeRecipient: feeRecipient[:],
})
}
registerValidatorRequests = append(registerValidatorRequests, &ethpb.ValidatorRegistrationV1{
FeeRecipient: feeRecipient[:],
FeeRecipient: bytesutil.SafeCopyBytes(feeRecipient[:]),
GasLimit: gasLimit,
Timestamp: uint64(time.Now().UTC().Unix()),
Pubkey: pubkeys[i][:],
})
}
return validatorToFeeRecipients, registerValidatorRequests, nil
}