Compare commits

...

1 Commits

Author SHA1 Message Date
terence tsao
d51f0b7831 Use SingleAttestation for Gossip 2024-09-19 09:13:31 -07:00
12 changed files with 389 additions and 61 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/prysmaticlabs/prysm/v5/network/forks"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/attestation"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
"github.com/prysmaticlabs/prysm/v5/time/slots"
)
@@ -192,25 +193,38 @@ func createAttestationSignatureBatch(
descs := make([]string, len(atts))
for i, a := range atts {
sigs[i] = a.GetSignature()
committees, err := helpers.AttestationCommittees(ctx, beaconState, a)
if err != nil {
return nil, err
}
ia, err := attestation.ConvertToIndexed(ctx, a, committees...)
if err != nil {
return nil, err
}
if err := attestation.IsValidAttestationIndices(ctx, ia); err != nil {
return nil, err
}
indices := ia.GetAttestingIndices()
aggP, err := beaconState.AggregateKeyFromIndices(indices)
if err != nil {
return nil, err
}
pks[i] = aggP
root, err := signing.ComputeSigningRoot(ia.GetData(), domain)
if a.Version() >= version.Electra {
attestingIndex, err := a.GetAttestingIndex()
if err != nil {
return nil, err
}
pubkey := beaconState.PubkeyAtIndex(attestingIndex)
pks[i], err = bls.PublicKeyFromBytes(pubkey[:])
if err != nil {
return nil, errors.Wrap(err, "could not convert bytes to public key")
}
} else {
committees, err := helpers.AttestationCommittees(ctx, beaconState, a)
if err != nil {
return nil, err
}
ia, err := attestation.ConvertToIndexed(ctx, a, committees...)
if err != nil {
return nil, err
}
if err := attestation.IsValidAttestationIndices(ctx, ia); err != nil {
return nil, err
}
indices := ia.GetAttestingIndices()
aggP, err := beaconState.AggregateKeyFromIndices(indices)
if err != nil {
return nil, err
}
pks[i] = aggP
}
root, err := signing.ComputeSigningRoot(a.GetData(), domain)
if err != nil {
return nil, errors.Wrap(err, "could not get signing root of object")
}

View File

@@ -47,7 +47,7 @@ func GossipTopicMappings(topic string, epoch primitives.Epoch) proto.Message {
return gossipMessage(topic)
case AttestationSubnetTopicFormat:
if epoch >= params.BeaconConfig().ElectraForkEpoch {
return &ethpb.AttestationElectra{}
return &ethpb.SingleAttestation{}
}
return gossipMessage(topic)
case AttesterSlashingSubnetTopicFormat:
@@ -101,7 +101,7 @@ func init() {
GossipTypeMapping[reflect.TypeOf(&ethpb.SignedBeaconBlockDeneb{})] = BlockSubnetTopicFormat
// Specially handle Electra objects.
GossipTypeMapping[reflect.TypeOf(&ethpb.SignedBeaconBlockElectra{})] = BlockSubnetTopicFormat
GossipTypeMapping[reflect.TypeOf(&ethpb.AttestationElectra{})] = AttestationSubnetTopicFormat
GossipTypeMapping[reflect.TypeOf(&ethpb.SingleAttestation{})] = AttestationSubnetTopicFormat
GossipTypeMapping[reflect.TypeOf(&ethpb.AttesterSlashingElectra{})] = AttesterSlashingSubnetTopicFormat
GossipTypeMapping[reflect.TypeOf(&ethpb.SignedAggregateAttestationAndProofElectra{})] = AggregateAndProofSubnetTopicFormat
}

View File

@@ -118,7 +118,7 @@ func TestGossipTopicMappings_CorrectType(t *testing.T) {
_, ok = pMessage.(*ethpb.SignedBeaconBlockElectra)
assert.Equal(t, true, ok)
pMessage = GossipTopicMappings(AttestationSubnetTopicFormat, electraForkEpoch)
_, ok = pMessage.(*ethpb.AttestationElectra)
_, ok = pMessage.(*ethpb.SingleAttestation)
assert.Equal(t, true, ok)
pMessage = GossipTopicMappings(AttesterSlashingSubnetTopicFormat, electraForkEpoch)
_, ok = pMessage.(*ethpb.AttesterSlashingElectra)

View File

@@ -112,7 +112,7 @@ func InitializeDataMaps() {
return &ethpb.Attestation{}, nil
},
bytesutil.ToBytes4(params.BeaconConfig().ElectraForkVersion): func() (ethpb.Att, error) {
return &ethpb.AttestationElectra{}, nil
return &ethpb.SingleAttestation{}, nil
},
}

View File

@@ -94,6 +94,13 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
var validationRes pubsub.ValidationResult
if att.Version() >= version.Electra {
_, ok := att.(*eth.SingleAttestation)
if !ok {
return pubsub.ValidationReject, fmt.Errorf("electra attestation has wrong type (expected %T, got %T)", &eth.SingleAttestation{}, att)
}
}
committeeIndex, result, err := s.validateCommitteeIndex(ctx, att)
if result != pubsub.ValidationAccept {
wrappedErr := errors.Wrapf(err, "could not validate committee index for %s version", version.String(att.Version()))
@@ -101,9 +108,19 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
return result, wrappedErr
}
var attestorIndexBytes []byte
if !features.Get().EnableSlasher {
// Verify this the first attestation received for the participating validator for the slot.
if s.hasSeenCommitteeIndicesSlot(data.Slot, committeeIndex, att.GetAggregationBits()) {
if att.Version() >= version.Electra {
attestorIndex, err := att.GetAttestingIndex()
if err != nil {
return pubsub.ValidationIgnore, err
}
attestorIndexBytes = bytesutil.Bytes32(uint64(attestorIndex))
} else {
attestorIndexBytes = att.GetAggregationBits()
}
if s.hasSeenCommitteeIndicesSlot(data.Slot, committeeIndex, attestorIndexBytes) {
return pubsub.ValidationIgnore, nil
}
@@ -121,12 +138,12 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
if !s.hasBlockAndState(ctx, blockRoot) {
// A node doesn't have the block, it'll request from peer while saving the pending attestation to a queue.
if att.Version() >= version.Electra {
a, ok := att.(*eth.AttestationElectra)
a, ok := att.(*eth.SingleAttestation)
// This will never fail in practice because we asserted the version
if !ok {
return pubsub.ValidationIgnore, fmt.Errorf("attestation has wrong type (expected %T, got %T)", &eth.AttestationElectra{}, att)
return pubsub.ValidationIgnore, fmt.Errorf("attestation has wrong type (expected %T, got %T)", &eth.Attestation{}, att)
}
s.savePendingAtt(&eth.SignedAggregateAttestationAndProofElectra{Message: &eth.AggregateAttestationAndProofElectra{Aggregate: a}})
s.savePendingAtt(a)
} else {
a, ok := att.(*eth.Attestation)
// This will never fail in practice because we asserted the version
@@ -193,7 +210,7 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
}()
}
s.setSeenCommitteeIndicesSlot(data.Slot, committeeIndex, att.GetAggregationBits())
s.setSeenCommitteeIndicesSlot(data.Slot, committeeIndex, attestorIndexBytes)
msg.ValidatorData = att
@@ -256,21 +273,23 @@ func (s *Service) validateUnaggregatedAttWithState(ctx context.Context, a eth.At
ctx, span := trace.StartSpan(ctx, "sync.validateUnaggregatedAttWithState")
defer span.End()
committeeIndex, err := a.GetCommitteeIndex()
if err != nil {
return pubsub.ValidationIgnore, err
}
if a.Version() < version.Electra {
committeeIndex, err := a.GetCommitteeIndex()
if err != nil {
return pubsub.ValidationIgnore, err
}
committee, result, err := s.validateBitLength(ctx, bs, a.GetData().Slot, committeeIndex, a.GetAggregationBits())
if result != pubsub.ValidationAccept {
return result, err
}
committee, result, err := s.validateBitLength(ctx, bs, a.GetData().Slot, committeeIndex, a.GetAggregationBits())
if result != pubsub.ValidationAccept {
return result, err
}
// Attestation must be unaggregated and the bit index must exist in the range of committee indices.
// Note: The Ethereum Beacon chain spec suggests (len(get_attesting_indices(state, attestation.data, attestation.aggregation_bits)) == 1)
// however this validation can be achieved without use of get_attesting_indices which is an O(n) lookup.
if a.GetAggregationBits().Count() != 1 || a.GetAggregationBits().BitIndices()[0] >= len(committee) {
return pubsub.ValidationReject, errors.New("attestation bitfield is invalid")
// Attestation must be unaggregated and the bit index must exist in the range of committee indices.
// Note: The Ethereum Beacon chain spec suggests (len(get_attesting_indices(state, attestation.data, attestation.aggregation_bits)) == 1)
// however this validation can be achieved without use of get_attesting_indices which is an O(n) lookup.
if a.GetAggregationBits().Count() != 1 || a.GetAggregationBits().BitIndices()[0] >= len(committee) {
return pubsub.ValidationReject, errors.New("attestation bitfield is invalid")
}
}
set, err := blocks.AttestationSignatureBatch(ctx, bs, []eth.Att{a})

View File

@@ -11,7 +11,6 @@ import (
)
// validateCommitteeIndexElectra implements the following checks from the spec:
// - [REJECT] len(committee_indices) == 1, where committee_indices = get_committee_indices(attestation).
// - [REJECT] attestation.data.index == 0
func validateCommitteeIndexElectra(ctx context.Context, a ethpb.Att) (primitives.CommitteeIndex, pubsub.ValidationResult, error) {
_, span := trace.StartSpan(ctx, "sync.validateCommitteeIndexElectra")
@@ -24,5 +23,8 @@ func validateCommitteeIndexElectra(ctx context.Context, a ethpb.Att) (primitives
if err != nil {
return 0, pubsub.ValidationReject, err
}
if committeeIndex == 0 {
return 0, pubsub.ValidationReject, fmt.Errorf("attestation.data.index is 0")
}
return committeeIndex, pubsub.ValidationAccept, nil
}

View File

@@ -152,6 +152,7 @@ ssz_electra_objs = [
"SignedBeaconBlockElectra",
"SignedBlindedBeaconBlockElectra",
"SignedConsolidation",
"SingleAttestation",
]
ssz_gen_marshal(

View File

@@ -25,6 +25,7 @@ type Att interface {
CommitteeBitsVal() bitfield.Bitfield
GetSignature() []byte
GetCommitteeIndex() (primitives.CommitteeIndex, error)
GetAttestingIndex() (primitives.ValidatorIndex, error)
}
// IndexedAtt defines common functionality for all indexed attestation types.
@@ -135,6 +136,11 @@ func (a *Attestation) GetCommitteeIndex() (primitives.CommitteeIndex, error) {
return a.Data.CommitteeIndex, nil
}
// GetAttestingIndex --
func (a *Attestation) GetAttestingIndex() (primitives.ValidatorIndex, error) {
return 0, errors.New("attestation does not have attesting index field")
}
// Version --
func (a *PendingAttestation) Version() int {
return version.Phase0
@@ -176,6 +182,11 @@ func (a *PendingAttestation) GetCommitteeIndex() (primitives.CommitteeIndex, err
return a.Data.CommitteeIndex, nil
}
// GetAttestingIndex --
func (a *PendingAttestation) GetAttestingIndex() (primitives.ValidatorIndex, error) {
return 0, errors.New("pending attestation does not have attesting index field")
}
// Version --
func (a *AttestationElectra) Version() int {
return version.Electra
@@ -222,6 +233,11 @@ func (a *AttestationElectra) GetCommitteeIndex() (primitives.CommitteeIndex, err
return primitives.CommitteeIndex(uint64(indices[0])), nil
}
// GetAttestingIndex --
func (a *AttestationElectra) GetAttestingIndex() (primitives.ValidatorIndex, error) {
return 0, errors.New("attestation electra does not have attesting index field")
}
// Version --
func (a *IndexedAttestation) Version() int {
return version.Phase0
@@ -354,3 +370,64 @@ func (a *SignedAggregateAttestationAndProofElectra) Version() int {
func (a *SignedAggregateAttestationAndProofElectra) AggregateAttestationAndProof() AggregateAttAndProof {
return a.Message
}
// Version --
func (a *SingleAttestation) Version() int {
return version.Electra
}
// Clone --
func (a *SingleAttestation) Clone() Att {
return a.Copy()
}
// Copy --
func (a *SingleAttestation) Copy() *SingleAttestation {
if a == nil {
return nil
}
return &SingleAttestation{
CommitteeId: a.CommitteeId,
AttesterIndex: a.AttesterIndex,
Data: a.Data.Copy(),
Signature: bytesutil.SafeCopyBytes(a.Signature),
}
}
// CommitteeBitsVal --
func (a *SingleAttestation) CommitteeBitsVal() bitfield.Bitfield {
cb := primitives.NewAttestationCommitteeBits()
cb.SetBitAt(uint64(a.CommitteeId), true)
return cb
}
// GetAggregationBits --
func (a *SingleAttestation) GetAggregationBits() bitfield.Bitlist {
return nil
}
// GetCommitteeIndex --
func (a *SingleAttestation) GetCommitteeIndex() (primitives.CommitteeIndex, error) {
return a.CommitteeId, nil
}
// GetAttestingIndex --
func (a *SingleAttestation) GetAttestingIndex() (primitives.ValidatorIndex, error) {
return a.AttesterIndex, nil
}
type PendingSyncAttestation interface {
IsAttestation()
AggregateAttestationAndProof() AggregateAttAndProof
SignedAggregateAttAndProof() SignedAggregateAttAndProof
}
// IsAttestation Implement the interface for SignedAggregateAttAndProof
func (s *SignedAggregateAttestationAndProof) IsAttestation() {}
// IsAttestation Implement the interface for SingleAttestation
func (s *SingleAttestation) IsAttestation() {}
func (a *SingleAttestation) AggregateAttestationAndProof() AggregateAttAndProof {
panic("implement me")
}

View File

@@ -528,6 +528,77 @@ func (x *Checkpoint) GetRoot() []byte {
return nil
}
type SingleAttestation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CommitteeId github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex `protobuf:"varint,1,opt,name=committee_id,json=committeeId,proto3" json:"committee_id,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.CommitteeIndex"`
AttesterIndex github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex `protobuf:"varint,2,opt,name=attester_index,json=attesterIndex,proto3" json:"attester_index,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"`
Data *AttestationData `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
}
func (x *SingleAttestation) Reset() {
*x = SingleAttestation{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SingleAttestation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SingleAttestation) ProtoMessage() {}
func (x *SingleAttestation) ProtoReflect() protoreflect.Message {
mi := &file_proto_prysm_v1alpha1_attestation_proto_msgTypes[8]
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 SingleAttestation.ProtoReflect.Descriptor instead.
func (*SingleAttestation) Descriptor() ([]byte, []int) {
return file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP(), []int{8}
}
func (x *SingleAttestation) GetCommitteeId() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex {
if x != nil {
return x.CommitteeId
}
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex(0)
}
func (x *SingleAttestation) GetAttesterIndex() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex {
if x != nil {
return x.AttesterIndex
}
return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(0)
}
func (x *SingleAttestation) GetData() *AttestationData {
if x != nil {
return x.Data
}
return nil
}
func (x *SingleAttestation) GetSignature() []byte {
if x != nil {
return x.Signature
}
return nil
}
var File_proto_prysm_v1alpha1_attestation_proto protoreflect.FileDescriptor
var file_proto_prysm_v1alpha1_attestation_proto_rawDesc = []byte{
@@ -659,17 +730,39 @@ var file_proto_prysm_v1alpha1_attestation_proto_rawDesc = []byte{
0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f,
0x63, 0x68, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x1a, 0x0a, 0x04, 0x72, 0x6f, 0x6f,
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32, 0x52,
0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74,
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x31, 0x42, 0x10, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62,
0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b,
0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x45,
0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x15, 0x45, 0x74,
0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76, 0x31, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22, 0xe1, 0x02, 0x0a, 0x11, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x72, 0x0a, 0x0c, 0x63,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f,
0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73,
0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69,
0x76, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64,
0x65, 0x78, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x64, 0x12,
0x76, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x4f, 0x82, 0xb5, 0x18, 0x4b, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69,
0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63,
0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70,
0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74,
0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x3a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d,
0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x41, 0x74,
0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64,
0x61, 0x74, 0x61, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09,
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x9b, 0x01, 0x0a, 0x19, 0x6f, 0x72,
0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69,
0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x31, 0x3b, 0x65, 0x74, 0x68, 0xaa, 0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65,
0x75, 0x6d, 0x2e, 0x45, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca,
0x02, 0x15, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x45, 0x74, 0x68, 0x5c, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -684,7 +777,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_rawDescGZIP() []byte {
return file_proto_prysm_v1alpha1_attestation_proto_rawDescData
}
var file_proto_prysm_v1alpha1_attestation_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_proto_prysm_v1alpha1_attestation_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_proto_prysm_v1alpha1_attestation_proto_goTypes = []interface{}{
(*Attestation)(nil), // 0: ethereum.eth.v1alpha1.Attestation
(*AttestationElectra)(nil), // 1: ethereum.eth.v1alpha1.AttestationElectra
@@ -694,6 +787,7 @@ var file_proto_prysm_v1alpha1_attestation_proto_goTypes = []interface{}{
(*SignedAggregateAttestationAndProofElectra)(nil), // 5: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProofElectra
(*AttestationData)(nil), // 6: ethereum.eth.v1alpha1.AttestationData
(*Checkpoint)(nil), // 7: ethereum.eth.v1alpha1.Checkpoint
(*SingleAttestation)(nil), // 8: ethereum.eth.v1alpha1.SingleAttestation
}
var file_proto_prysm_v1alpha1_attestation_proto_depIdxs = []int32{
6, // 0: ethereum.eth.v1alpha1.Attestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
@@ -704,11 +798,12 @@ var file_proto_prysm_v1alpha1_attestation_proto_depIdxs = []int32{
3, // 5: ethereum.eth.v1alpha1.SignedAggregateAttestationAndProofElectra.message:type_name -> ethereum.eth.v1alpha1.AggregateAttestationAndProofElectra
7, // 6: ethereum.eth.v1alpha1.AttestationData.source:type_name -> ethereum.eth.v1alpha1.Checkpoint
7, // 7: ethereum.eth.v1alpha1.AttestationData.target:type_name -> ethereum.eth.v1alpha1.Checkpoint
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
6, // 8: ethereum.eth.v1alpha1.SingleAttestation.data:type_name -> ethereum.eth.v1alpha1.AttestationData
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
}
func init() { file_proto_prysm_v1alpha1_attestation_proto_init() }
@@ -813,6 +908,18 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
return nil
}
}
file_proto_prysm_v1alpha1_attestation_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SingleAttestation); 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{
@@ -820,7 +927,7 @@ func file_proto_prysm_v1alpha1_attestation_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_prysm_v1alpha1_attestation_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -117,3 +117,10 @@ message Checkpoint {
// Block root of the checkpoint references.
bytes root = 2 [(ethereum.eth.ext.ssz_size) = "32"];
}
message SingleAttestation {
uint64 committee_id = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.CommitteeIndex"];
uint64 attester_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.ValidatorIndex"];
AttestationData data = 3;
bytes signature = 4 [(ethereum.eth.ext.ssz_size) = "96"];
}

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: 13b762a7d53ab6cf5d5ffb582d580edb05efc65de762692f09af914819d3bb3e
// Hash: 371a28cc17d29788d01a03c20e917fd188c5fa6e2790531e00fd86fe2cb739b9
package eth
import (

View File

@@ -1,5 +1,5 @@
// Code generated by fastssz. DO NOT EDIT.
// Hash: 502599304fd370b8602d212eaf1956fe5bf034fe59c75d1a3a6e3db8bcde291a
// Hash: 5d4e7cc536966b4e3449dd52a1b3e5cbe2ddfb28746f8cf6163de67a4318c5be
package eth
import (
@@ -384,6 +384,107 @@ func (s *SignedAggregateAttestationAndProofElectra) HashTreeRootWith(hh *ssz.Has
return
}
// MarshalSSZ ssz marshals the SingleAttestation object
func (s *SingleAttestation) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(s)
}
// MarshalSSZTo ssz marshals the SingleAttestation object to a target array
func (s *SingleAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'CommitteeId'
dst = ssz.MarshalUint64(dst, uint64(s.CommitteeId))
// Field (1) 'AttesterIndex'
dst = ssz.MarshalUint64(dst, uint64(s.AttesterIndex))
// Field (2) 'Data'
if s.Data == nil {
s.Data = new(AttestationData)
}
if dst, err = s.Data.MarshalSSZTo(dst); err != nil {
return
}
// Field (3) 'Signature'
if size := len(s.Signature); size != 96 {
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
return
}
dst = append(dst, s.Signature...)
return
}
// UnmarshalSSZ ssz unmarshals the SingleAttestation object
func (s *SingleAttestation) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 240 {
return ssz.ErrSize
}
// Field (0) 'CommitteeId'
s.CommitteeId = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.CommitteeIndex(ssz.UnmarshallUint64(buf[0:8]))
// Field (1) 'AttesterIndex'
s.AttesterIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
// Field (2) 'Data'
if s.Data == nil {
s.Data = new(AttestationData)
}
if err = s.Data.UnmarshalSSZ(buf[16:144]); err != nil {
return err
}
// Field (3) 'Signature'
if cap(s.Signature) == 0 {
s.Signature = make([]byte, 0, len(buf[144:240]))
}
s.Signature = append(s.Signature, buf[144:240]...)
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the SingleAttestation object
func (s *SingleAttestation) SizeSSZ() (size int) {
size = 240
return
}
// HashTreeRoot ssz hashes the SingleAttestation object
func (s *SingleAttestation) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(s)
}
// HashTreeRootWith ssz hashes the SingleAttestation object with a hasher
func (s *SingleAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'CommitteeId'
hh.PutUint64(uint64(s.CommitteeId))
// Field (1) 'AttesterIndex'
hh.PutUint64(uint64(s.AttesterIndex))
// Field (2) 'Data'
if err = s.Data.HashTreeRootWith(hh); err != nil {
return
}
// Field (3) 'Signature'
if size := len(s.Signature); size != 96 {
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
return
}
hh.PutBytes(s.Signature)
hh.Merkleize(indx)
return
}
// MarshalSSZ ssz marshals the AttesterSlashingElectra object
func (a *AttesterSlashingElectra) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(a)