Skip to content

Commit

Permalink
Merge branch 'stage' into override-spec-beacon-config
Browse files Browse the repository at this point in the history
# Conflicts:
#	beacon/goclient/attest_test.go
#	beacon/goclient/goclient.go
#	beacon/goclient/goclient_test.go
#	beacon/goclient/proposer.go
#	beacon/goclient/signing.go
#	cli/operator/node.go
#	operator/duties/scheduler.go
#	protocol/v2/blockchain/beacon/client.go
  • Loading branch information
nkryuchkov committed Jan 21, 2025
2 parents 2a2d7a7 + c55c696 commit 01e255a
Show file tree
Hide file tree
Showing 24 changed files with 2,690 additions and 154 deletions.
8 changes: 4 additions & 4 deletions beacon/goclient/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func (gc *GoClient) SubmitAggregateSelectionProof(slot phase0.Slot, committeeInd
}

aggDataReqStart := time.Now()
aggDataResp, err := gc.client.AggregateAttestation(gc.ctx, &api.AggregateAttestationOpts{
aggDataResp, err := gc.multiClient.AggregateAttestation(gc.ctx, &api.AggregateAttestationOpts{
Slot: slot,
AttestationDataRoot: root,
})
recordRequestDuration(gc.ctx, "AggregateAttestation", gc.client.Address(), http.MethodGet, time.Since(aggDataReqStart), err)
recordRequestDuration(gc.ctx, "AggregateAttestation", gc.multiClient.Address(), http.MethodGet, time.Since(aggDataReqStart), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "AggregateAttestation"),
Expand Down Expand Up @@ -79,8 +79,8 @@ func (gc *GoClient) SubmitAggregateSelectionProof(slot phase0.Slot, committeeInd
// SubmitSignedAggregateSelectionProof broadcasts a signed aggregator msg
func (gc *GoClient) SubmitSignedAggregateSelectionProof(msg *phase0.SignedAggregateAndProof) error {
start := time.Now()
err := gc.client.SubmitAggregateAttestations(gc.ctx, []*phase0.SignedAggregateAndProof{msg})
recordRequestDuration(gc.ctx, "SubmitAggregateAttestations", gc.client.Address(), http.MethodPost, time.Since(start), err)
err := gc.multiClient.SubmitAggregateAttestations(gc.ctx, []*phase0.SignedAggregateAndProof{msg})
recordRequestDuration(gc.ctx, "SubmitAggregateAttestations", gc.multiClient.Address(), http.MethodPost, time.Since(start), err)
return err
}

Expand Down
12 changes: 6 additions & 6 deletions beacon/goclient/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
// AttesterDuties returns attester duties for a given epoch.
func (gc *GoClient) AttesterDuties(ctx context.Context, epoch phase0.Epoch, validatorIndices []phase0.ValidatorIndex) ([]*eth2apiv1.AttesterDuty, error) {
start := time.Now()
resp, err := gc.client.AttesterDuties(ctx, &api.AttesterDutiesOpts{
resp, err := gc.multiClient.AttesterDuties(ctx, &api.AttesterDutiesOpts{
Epoch: epoch,
Indices: validatorIndices,
})
recordRequestDuration(gc.ctx, "AttesterDuties", gc.client.Address(), http.MethodPost, time.Since(start), err)
recordRequestDuration(gc.ctx, "AttesterDuties", gc.multiClient.Address(), http.MethodPost, time.Since(start), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "AttesterDuties"),
Expand Down Expand Up @@ -61,11 +61,11 @@ func (gc *GoClient) GetAttestationData(slot phase0.Slot, committeeIndex phase0.C
// Have to make beacon node request and cache the result.
result, err, _ := gc.attestationReqInflight.Do(slot, func() (*phase0.AttestationData, error) {
attDataReqStart := time.Now()
resp, err := gc.client.AttestationData(gc.ctx, &api.AttestationDataOpts{
resp, err := gc.multiClient.AttestationData(gc.ctx, &api.AttestationDataOpts{
Slot: slot,
})

recordRequestDuration(gc.ctx, "AttestationData", gc.client.Address(), http.MethodGet, time.Since(attDataReqStart), err)
recordRequestDuration(gc.ctx, "AttestationData", gc.multiClient.Address(), http.MethodGet, time.Since(attDataReqStart), err)

if err != nil {
gc.log.Error(clResponseErrMsg,
Expand Down Expand Up @@ -123,8 +123,8 @@ func withCommitteeIndex(data *phase0.AttestationData, committeeIndex phase0.Comm
// SubmitAttestations implements Beacon interface
func (gc *GoClient) SubmitAttestations(attestations []*phase0.Attestation) error {
start := time.Now()
err := gc.client.SubmitAttestations(gc.ctx, attestations)
recordRequestDuration(gc.ctx, "SubmitAttestations", gc.client.Address(), http.MethodPost, time.Since(start), err)
err := gc.multiClient.SubmitAttestations(gc.ctx, attestations)
recordRequestDuration(gc.ctx, "SubmitAttestations", gc.multiClient.Address(), http.MethodPost, time.Since(start), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "SubmitAttestations"),
Expand Down
28 changes: 14 additions & 14 deletions beacon/goclient/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ func TestGoClient_GetAttestationData(t *testing.T) {
t.Logf("mock server handling request: %s", r.URL.Path)

expInitRequests := map[string][]byte{
"/eth/v1/node/syncing": []byte(`{
"data": {
"head_slot": "4239945",
"sync_distance": "1",
"is_syncing": false,
"is_optimistic": false,
"el_offline": false
}
}`),
"/eth/v1/node/version": []byte(`{
"data": {
"version": "Lighthouse/v4.5.0-441fc16/x86_64-linux"
}
}`),
"/eth/v1/config/spec": []byte(`{
"data": {
"CONFIG_NAME": "holesky",
Expand All @@ -77,6 +63,20 @@ func TestGoClient_GetAttestationData(t *testing.T) {
"genesis_fork_version": "0x01017000"
}
}`),
"/eth/v1/node/syncing": []byte(`{
"data": {
"head_slot": "4239945",
"sync_distance": "1",
"is_syncing": false,
"is_optimistic": false,
"el_offline": false
}
}`),
"/eth/v1/node/version": []byte(`{
"data": {
"version": "Lighthouse/v4.5.0-441fc16/x86_64-linux"
}
}`),
}
for reqPath, respData := range expInitRequests {
if reqPath == r.URL.Path {
Expand Down
8 changes: 4 additions & 4 deletions beacon/goclient/committee_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
// SubmitBeaconCommitteeSubscriptions is implementation for subscribing committee to subnet (p2p topic)
func (gc *GoClient) SubmitBeaconCommitteeSubscriptions(ctx context.Context, subscription []*eth2apiv1.BeaconCommitteeSubscription) error {
start := time.Now()
err := gc.client.SubmitBeaconCommitteeSubscriptions(ctx, subscription)
recordRequestDuration(gc.ctx, "SubmitBeaconCommitteeSubscriptions", gc.client.Address(), http.MethodPost, time.Since(start), err)
err := gc.multiClient.SubmitBeaconCommitteeSubscriptions(ctx, subscription)
recordRequestDuration(gc.ctx, "SubmitBeaconCommitteeSubscriptions", gc.multiClient.Address(), http.MethodPost, time.Since(start), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "SubmitBeaconCommitteeSubscriptions"),
Expand All @@ -26,8 +26,8 @@ func (gc *GoClient) SubmitBeaconCommitteeSubscriptions(ctx context.Context, subs
// SubmitSyncCommitteeSubscriptions is implementation for subscribing sync committee to subnet (p2p topic)
func (gc *GoClient) SubmitSyncCommitteeSubscriptions(ctx context.Context, subscription []*eth2apiv1.SyncCommitteeSubscription) error {
start := time.Now()
err := gc.client.SubmitSyncCommitteeSubscriptions(ctx, subscription)
recordRequestDuration(gc.ctx, "SubmitSyncCommitteeSubscriptions", gc.client.Address(), http.MethodPost, time.Since(start), err)
err := gc.multiClient.SubmitSyncCommitteeSubscriptions(ctx, subscription)
recordRequestDuration(gc.ctx, "SubmitSyncCommitteeSubscriptions", gc.multiClient.Address(), http.MethodPost, time.Since(start), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "SubmitSyncCommitteeSubscriptions"),
Expand Down
Loading

0 comments on commit 01e255a

Please sign in to comment.