Skip to content

Commit

Permalink
Merge pull request #285 from attestantio/electra_fixex
Browse files Browse the repository at this point in the history
Fix attestation submission and aggregate fetch
  • Loading branch information
Bez625 authored Jan 31, 2025
2 parents 3f875ab + 7d2b41b commit 329d6f7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.2
require (
github.com/attestantio/go-block-relay v0.4.1
github.com/attestantio/go-builder-client v0.5.4-0.20250114130306-a4d84df4dd4b
github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7
github.com/attestantio/go-eth2-client v0.23.1-0.20250131154731-a4b13c4a75c2
github.com/aws/aws-sdk-go v1.55.5
github.com/holiman/uint256 v1.3.2
github.com/mitchellh/go-homedir v1.1.0
Expand Down
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,9 @@ github.com/attestantio/go-block-relay v0.4.1 h1:FRXQ6KzeDT2OeHz5F0BG2/GySm0Qoxw5
github.com/attestantio/go-block-relay v0.4.1/go.mod h1:VZjBs0TJsBq/3BXveIsNhh8c4yr95Vg0Gn7JepaEI94=
github.com/attestantio/go-builder-client v0.5.4-0.20250114130306-a4d84df4dd4b h1:YFsbpMIMl2HWNVGzXQ62LeMOBvHxjfnu0/qhi9BhIcg=
github.com/attestantio/go-builder-client v0.5.4-0.20250114130306-a4d84df4dd4b/go.mod h1:iGMSAYxHZ84X+Y88QQNJrRtJNIwxvWQgm05TUUNc6IQ=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116160156-52c7c691b908 h1:au9okrJUTi1p78iOOyVOBUNiNgyDDkKSgiEePB8lZQg=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116160156-52c7c691b908/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116161245-b23a5e95cfba h1:9lr4fe82sBprWMiSDK3V3pKkNsaKTsSZ7/oFVVlhWBY=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116161245-b23a5e95cfba/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7 h1:k+x71pLHEEPNVHS+hMlC+G5hjMT0ynAZZygOSkPayrI=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/attestantio/go-eth2-client v0.23.1-0.20250131154731-a4b13c4a75c2 h1:LPaIN7V2z6/aWxgaOe6Qnp2M3XzUPw9v5Jf/lWgADWI=
github.com/attestantio/go-eth2-client v0.23.1-0.20250131154731-a4b13c4a75c2/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/aws/aws-sdk-go v1.44.81/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
Expand Down
6 changes: 4 additions & 2 deletions services/attestationaggregator/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ type Duty struct {
Slot phase0.Slot
// Attestation data root is the root of the attestation to be aggregated; required for obtaining the aggregate.
AttestationDataRoot phase0.Root
// ValidatorIndex is the index of the validator carrying out the aggregation; reuqired for submitting the aggregate.
// ValidatorIndex is the index of the validator carrying out the aggregation; required for submitting the aggregate.
ValidatorIndex phase0.ValidatorIndex
// SlotSignature is the signature of the slot by the validator carrying out the aggregation; reuqired for submitting the aggregate.
// SlotSignature is the signature of the slot by the validator carrying out the aggregation; required for submitting the aggregate.
SlotSignature phase0.BLSSignature
// CommitteeIndex is the committee index of the validator carrying out the aggregation; required for submitting the aggregate.
CommitteeIndex phase0.CommitteeIndex
}

// Service is the attestation aggregation service.
Expand Down
1 change: 1 addition & 0 deletions services/attestationaggregator/standard/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (s *Service) Aggregate(ctx context.Context, duty *attestationaggregator.Dut
aggregateAttestationResponse, err := s.aggregateAttestationProvider.AggregateAttestation(ctx, &api.AggregateAttestationOpts{
Slot: duty.Slot,
AttestationDataRoot: duty.AttestationDataRoot,
CommitteeIndex: duty.CommitteeIndex,
})

startOfSlot := s.chainTime.StartOfSlot(duty.Slot)
Expand Down
10 changes: 9 additions & 1 deletion services/attester/standard/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ func (s *Service) createElectraAttestations(_ context.Context,
Msg("No signature for validator; not creating attestation")
continue
}
if len(duty.ValidatorIndices()) < i {
s.log.Warn().Str("validator_pubkey", fmt.Sprintf("%#x", accounts[i].PublicKey().Marshal())).
Msg("Validator indices array smaller than requested index; not creating attestation")
continue
}
validatorIndex := duty.ValidatorIndices()[i]

aggregationBits := bitfield.NewBitlist(committeeSizes[i])
aggregationBits.SetBitAt(uint64(validatorCommitteeIndices[i]), true)

Expand All @@ -262,7 +269,8 @@ func (s *Service) createElectraAttestations(_ context.Context,
CommitteeBits: committeeBits,
}
copy(attestation.Signature[:], sigs[i][:])
versionedAttestation := &spec.VersionedAttestation{Version: spec.DataVersionElectra, Electra: attestation}

versionedAttestation := &spec.VersionedAttestation{Version: spec.DataVersionElectra, Electra: attestation, ValidatorIndex: &validatorIndex}
attestations = append(attestations, versionedAttestation)
}

Expand Down
1 change: 1 addition & 0 deletions services/controller/standard/attester.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func (s *Service) AttestAndScheduleAggregate(ctx context.Context, duty *attester
AttestationDataRoot: attestationDataRoot,
ValidatorIndex: info.Duty.ValidatorIndex,
SlotSignature: info.Signature,
CommitteeIndex: committeeIndex,
}
if err := s.scheduler.ScheduleJob(ctx,
"Aggregate attestations",
Expand Down

0 comments on commit 329d6f7

Please sign in to comment.