Add proto for attestation protection (#4579)

This commit is contained in:
Ivan Martinez
2020-01-18 14:46:33 -05:00
committed by GitHub
parent 68c1ca755d
commit 2ba81193b0
2 changed files with 370 additions and 58 deletions

View File

@@ -6,10 +6,6 @@ package ethereum_slashing
import (
context "context"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
types "github.com/gogo/protobuf/types"
@@ -18,6 +14,9 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -142,11 +141,11 @@ func (m *ValidatorIDToIdxAttList) GetIndicesList() []*ValidatorIDToIdxAtt {
}
type ProposerSlashingRequest struct {
BlockHeader *v1alpha1.BeaconBlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
BlockHeader *v1alpha1.SignedBeaconBlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
ValidatorIndex uint64 `protobuf:"varint,2,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ProposerSlashingRequest) Reset() { *m = ProposerSlashingRequest{} }
@@ -182,7 +181,7 @@ func (m *ProposerSlashingRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ProposerSlashingRequest proto.InternalMessageInfo
func (m *ProposerSlashingRequest) GetBlockHeader() *v1alpha1.BeaconBlockHeader {
func (m *ProposerSlashingRequest) GetBlockHeader() *v1alpha1.SignedBeaconBlockHeader {
if m != nil {
return m.BlockHeader
}
@@ -447,6 +446,61 @@ func (m *ProposalHistory) GetLatestEpochWritten() uint64 {
return 0
}
type AttestationHistory struct {
TargetToSource map[uint64]uint64 `protobuf:"bytes,1,rep,name=target_to_source,json=targetToSource,proto3" json:"target_to_source,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
LatestEpochWritten uint64 `protobuf:"varint,2,opt,name=latest_epoch_written,json=latestEpochWritten,proto3" json:"latest_epoch_written,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AttestationHistory) Reset() { *m = AttestationHistory{} }
func (m *AttestationHistory) String() string { return proto.CompactTextString(m) }
func (*AttestationHistory) ProtoMessage() {}
func (*AttestationHistory) Descriptor() ([]byte, []int) {
return fileDescriptor_da7e95107d0081b4, []int{8}
}
func (m *AttestationHistory) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AttestationHistory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AttestationHistory.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *AttestationHistory) XXX_Merge(src proto.Message) {
xxx_messageInfo_AttestationHistory.Merge(m, src)
}
func (m *AttestationHistory) XXX_Size() int {
return m.Size()
}
func (m *AttestationHistory) XXX_DiscardUnknown() {
xxx_messageInfo_AttestationHistory.DiscardUnknown(m)
}
var xxx_messageInfo_AttestationHistory proto.InternalMessageInfo
func (m *AttestationHistory) GetTargetToSource() map[uint64]uint64 {
if m != nil {
return m.TargetToSource
}
return nil
}
func (m *AttestationHistory) GetLatestEpochWritten() uint64 {
if m != nil {
return m.LatestEpochWritten
}
return 0
}
func init() {
proto.RegisterType((*ValidatorIDToIdxAtt)(nil), "ethereum.slashing.ValidatorIDToIdxAtt")
proto.RegisterType((*ValidatorIDToIdxAttList)(nil), "ethereum.slashing.ValidatorIDToIdxAttList")
@@ -457,57 +511,63 @@ func init() {
proto.RegisterType((*EpochSpanMap)(nil), "ethereum.slashing.EpochSpanMap")
proto.RegisterMapType((map[uint64]*MinMaxEpochSpan)(nil), "ethereum.slashing.EpochSpanMap.EpochSpanMapEntry")
proto.RegisterType((*ProposalHistory)(nil), "ethereum.slashing.ProposalHistory")
proto.RegisterType((*AttestationHistory)(nil), "ethereum.slashing.AttestationHistory")
proto.RegisterMapType((map[uint64]uint64)(nil), "ethereum.slashing.AttestationHistory.TargetToSourceEntry")
}
func init() { proto.RegisterFile("proto/slashing/slashing.proto", fileDescriptor_da7e95107d0081b4) }
var fileDescriptor_da7e95107d0081b4 = []byte{
// 716 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0xd3, 0x4a,
0x10, 0x97, 0x9b, 0xbe, 0xd7, 0xd7, 0x4d, 0x5e, 0x9b, 0xee, 0x7b, 0xb4, 0x51, 0x0a, 0x6d, 0x65,
0x21, 0x1a, 0xfe, 0xd4, 0x49, 0xc3, 0xa5, 0xe2, 0xd6, 0x88, 0x4a, 0x8d, 0xa0, 0x02, 0xb9, 0x15,
0x95, 0x90, 0x90, 0xb5, 0xb6, 0xb7, 0xf6, 0x52, 0x67, 0x77, 0xf1, 0x4e, 0x4a, 0xf2, 0x29, 0xb8,
0x70, 0xe5, 0xfb, 0x70, 0xe0, 0xc0, 0x27, 0x40, 0xa8, 0x1f, 0x83, 0x13, 0xf2, 0xda, 0x49, 0xdc,
0xc4, 0x91, 0xca, 0x6d, 0x67, 0xe6, 0x37, 0xf3, 0x9b, 0xfd, 0xed, 0xcc, 0xa2, 0x7b, 0x32, 0x16,
0x20, 0x9a, 0x2a, 0x22, 0x2a, 0x64, 0x3c, 0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0x99, 0x5d, 0xe0, 0x87, 0x73, 0xae, 0x85, 0xbc, 0xdd, 0xd4, 0xce, 0xa4, 0xd6, 0x1f, 0xcf,
0x15, 0x24, 0xe7, 0x26, 0x5e, 0xa0, 0x6a, 0x86, 0x51, 0xbe, 0x33, 0xf8, 0x51, 0x0e, 0xc0, 0x9c,
0x37, 0x2d, 0x97, 0x6c, 0xee, 0x43, 0x73, 0x86, 0xf0, 0x98, 0x2a, 0x3d, 0x7a, 0x02, 0xaf, 0x6b,
0xf1, 0x8f, 0xa3, 0xa5, 0x5f, 0x85, 0x76, 0x1c, 0xfd, 0x38, 0xf5, 0x9b, 0xbe, 0x3d, 0x4d, 0x05,
0xbf, 0x43, 0x77, 0xf2, 0x54, 0xbb, 0x3d, 0xf6, 0xb4, 0x4e, 0x4d, 0xa5, 0x5d, 0xfe, 0x76, 0xb5,
0xa5, 0xfc, 0xb8, 0xda, 0x52, 0x7e, 0x5d, 0x6d, 0x29, 0xe6, 0xbf, 0x12, 0xe8, 0xe9, 0xdf, 0x00,
0x00, 0x00, 0xff, 0xff, 0x45, 0x17, 0xfd, 0x16, 0x58, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1106,6 +1166,53 @@ func (m *ProposalHistory) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AttestationHistory) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *AttestationHistory) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AttestationHistory) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.LatestEpochWritten != 0 {
i = encodeVarintSlashing(dAtA, i, uint64(m.LatestEpochWritten))
i--
dAtA[i] = 0x10
}
if len(m.TargetToSource) > 0 {
for k := range m.TargetToSource {
v := m.TargetToSource[k]
baseI := i
i = encodeVarintSlashing(dAtA, i, uint64(v))
i--
dAtA[i] = 0x10
i = encodeVarintSlashing(dAtA, i, uint64(k))
i--
dAtA[i] = 0x8
i = encodeVarintSlashing(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintSlashing(dAtA []byte, offset int, v uint64) int {
offset -= sovSlashing(v)
base := offset
@@ -1279,6 +1386,29 @@ func (m *ProposalHistory) Size() (n int) {
return n
}
func (m *AttestationHistory) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.TargetToSource) > 0 {
for k, v := range m.TargetToSource {
_ = k
_ = v
mapEntrySize := 1 + sovSlashing(uint64(k)) + 1 + sovSlashing(uint64(v))
n += mapEntrySize + 1 + sovSlashing(uint64(mapEntrySize))
}
}
if m.LatestEpochWritten != 0 {
n += 1 + sovSlashing(uint64(m.LatestEpochWritten))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovSlashing(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -1630,7 +1760,7 @@ func (m *ProposerSlashingRequest) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.BlockHeader == nil {
m.BlockHeader = &v1alpha1.BeaconBlockHeader{}
m.BlockHeader = &v1alpha1.SignedBeaconBlockHeader{}
}
if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -2224,6 +2354,178 @@ func (m *ProposalHistory) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AttestationHistory) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: AttestationHistory: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AttestationHistory: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TargetToSource", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthSlashing
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthSlashing
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.TargetToSource == nil {
m.TargetToSource = make(map[uint64]uint64)
}
var mapkey uint64
var mapvalue uint64
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
mapkey |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
} else if fieldNum == 2 {
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
mapvalue |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
} else {
iNdEx = entryPreIndex
skippy, err := skipSlashing(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthSlashing
}
if (iNdEx + skippy) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.TargetToSource[mapkey] = mapvalue
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LatestEpochWritten", wireType)
}
m.LatestEpochWritten = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSlashing
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LatestEpochWritten |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipSlashing(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthSlashing
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthSlashing
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipSlashing(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@@ -70,7 +70,7 @@ message EpochSpanMap {
map<uint64, MinMaxEpochSpan> epoch_span_map = 1;
}
// ProposalHistory defines the structure for recording a validators historical proposals.
// ProposalHistory defines the structure for recording a validator's historical proposals.
// Using a bitlist to represent the epochs and an uint64 to mark the latest marked
// epoch of the bitlist, we can easily store which epochs a validator has proposed
// a block for while pruning the older data.
@@ -78,3 +78,13 @@ message ProposalHistory {
bytes epoch_bits = 1 [(gogoproto.casttype) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
uint64 latest_epoch_written = 2;
}
// AttestationHistory defines the structure for recording a validator's historical attestation.
// Using a map[uint64]uint64 to map its target epoch to its source epoch, in order to detect if a
// vote being created is not a double vote and surrounded by, or surrounding any other votes.
// Using an uint64 to mark the latest written epoch, we can safely perform a rolling prune whenever
// the history is updated.
message AttestationHistory {
map<uint64, uint64> target_to_source = 1;
uint64 latest_epoch_written = 2;
}