mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
Altair: ssz_static tests (#8847)
This commit is contained in:
@@ -27,7 +27,6 @@ go_library(
|
||||
"//beacon-chain/operations/attestations:go_default_library",
|
||||
"//beacon-chain/operations/slashings:go_default_library",
|
||||
"//beacon-chain/operations/voluntaryexits:go_default_library",
|
||||
"//beacon-chain/operations/synccommittee:go_default_library",
|
||||
"//beacon-chain/p2p:go_default_library",
|
||||
"//beacon-chain/powchain:go_default_library",
|
||||
"//beacon-chain/rpc:go_default_library",
|
||||
|
||||
4
deps.bzl
4
deps.bzl
@@ -2744,8 +2744,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_go_bitfield",
|
||||
importpath = "github.com/prysmaticlabs/go-bitfield",
|
||||
sum = "h1:n1fCZPIMlcNQ3iCN5w4vxmFFNWhEdEz3ICTerxjUFvA=",
|
||||
version = "v0.0.0-20210515192923-def021850363",
|
||||
sum = "h1:46gKr69IlRpv/ENdlzG0SWo5nMLKJxS3tI5NOSdZndQ=",
|
||||
version = "v0.0.0-20210607200045-4da71aaf6c2d",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_prombbolt",
|
||||
|
||||
2
go.mod
2
go.mod
@@ -87,7 +87,7 @@ require (
|
||||
github.com/prometheus/prom2json v1.3.0
|
||||
github.com/prometheus/tsdb v0.10.0 // indirect
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210607200045-4da71aaf6c2d
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c
|
||||
github.com/rs/cors v1.7.0
|
||||
github.com/schollz/progressbar/v3 v3.3.4
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1085,8 +1085,8 @@ github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20210420143944-f4dfc9744288 h1
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20210420143944-f4dfc9744288/go.mod h1:YmSRTZNqAvVUg3BIG8uhT/BOkFk9+R2iCbxw5zOlnWY=
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d h1:1dN7YAqMN3oAJ0LceWcyv/U4jHLh+5urnSnr4br6zg4=
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d/go.mod h1:kOmQ/zdobQf7HUohDTifDNFEZfNaSCIY5fkONPL+dWU=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363 h1:n1fCZPIMlcNQ3iCN5w4vxmFFNWhEdEz3ICTerxjUFvA=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210607200045-4da71aaf6c2d h1:46gKr69IlRpv/ENdlzG0SWo5nMLKJxS3tI5NOSdZndQ=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210607200045-4da71aaf6c2d/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210524084005-787489c53c84 h1:0v/JSzw2zi7K/vPQ2MImHEeAVSJlHBgZWgZhqX8XNIg=
|
||||
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210524084005-787489c53c84/go.mod h1:IOyTYjcIO0rkmnGBfJTL0NJ11exy/Tc2QEuv7hCXp24=
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c h1:9PHRCuO/VN0s9k+RmLykho7AjDxblNYI5bYKed16NPU=
|
||||
|
||||
0
proto/beacon/p2p/v1/generated.ssz.go
Executable file → Normal file
0
proto/beacon/p2p/v1/generated.ssz.go
Executable file → Normal file
@@ -3111,7 +3111,7 @@ func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err er
|
||||
dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex)
|
||||
|
||||
// Field (3) 'AggregationBits'
|
||||
if len(s.AggregationBits) != 32 {
|
||||
if len(s.AggregationBits) != 16 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
@@ -3131,7 +3131,7 @@ func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err er
|
||||
func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 176 {
|
||||
if size != 160 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
@@ -3149,22 +3149,22 @@ func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error {
|
||||
|
||||
// Field (3) 'AggregationBits'
|
||||
if cap(s.AggregationBits) == 0 {
|
||||
s.AggregationBits = make([]byte, 0, len(buf[48:80]))
|
||||
s.AggregationBits = make([]byte, 0, len(buf[48:64]))
|
||||
}
|
||||
s.AggregationBits = append(s.AggregationBits, buf[48:80]...)
|
||||
s.AggregationBits = append(s.AggregationBits, buf[48:64]...)
|
||||
|
||||
// Field (4) 'Signature'
|
||||
if cap(s.Signature) == 0 {
|
||||
s.Signature = make([]byte, 0, len(buf[80:176]))
|
||||
s.Signature = make([]byte, 0, len(buf[64:160]))
|
||||
}
|
||||
s.Signature = append(s.Signature, buf[80:176]...)
|
||||
s.Signature = append(s.Signature, buf[64:160]...)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object
|
||||
func (s *SyncCommitteeContribution) SizeSSZ() (size int) {
|
||||
size = 176
|
||||
size = 160
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3191,7 +3191,7 @@ func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error)
|
||||
hh.PutUint64(s.SubcommitteeIndex)
|
||||
|
||||
// Field (3) 'AggregationBits'
|
||||
if len(s.AggregationBits) != 32 {
|
||||
if len(s.AggregationBits) != 16 {
|
||||
err = ssz.ErrBytesLength
|
||||
return
|
||||
}
|
||||
@@ -3242,7 +3242,7 @@ func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||
func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 280 {
|
||||
if size != 264 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
@@ -3253,22 +3253,22 @@ func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
||||
if c.Contribution == nil {
|
||||
c.Contribution = new(SyncCommitteeContribution)
|
||||
}
|
||||
if err = c.Contribution.UnmarshalSSZ(buf[8:184]); err != nil {
|
||||
if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (2) 'SelectionProof'
|
||||
if cap(c.SelectionProof) == 0 {
|
||||
c.SelectionProof = make([]byte, 0, len(buf[184:280]))
|
||||
c.SelectionProof = make([]byte, 0, len(buf[168:264]))
|
||||
}
|
||||
c.SelectionProof = append(c.SelectionProof, buf[184:280]...)
|
||||
c.SelectionProof = append(c.SelectionProof, buf[168:264]...)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object
|
||||
func (c *ContributionAndProof) SizeSSZ() (size int) {
|
||||
size = 280
|
||||
size = 264
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3331,7 +3331,7 @@ func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err e
|
||||
func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
||||
var err error
|
||||
size := uint64(len(buf))
|
||||
if size != 376 {
|
||||
if size != 360 {
|
||||
return ssz.ErrSize
|
||||
}
|
||||
|
||||
@@ -3339,22 +3339,22 @@ func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
||||
if s.Message == nil {
|
||||
s.Message = new(ContributionAndProof)
|
||||
}
|
||||
if err = s.Message.UnmarshalSSZ(buf[0:280]); err != nil {
|
||||
if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Field (1) 'Signature'
|
||||
if cap(s.Signature) == 0 {
|
||||
s.Signature = make([]byte, 0, len(buf[280:376]))
|
||||
s.Signature = make([]byte, 0, len(buf[264:360]))
|
||||
}
|
||||
s.Signature = append(s.Signature, buf[280:376]...)
|
||||
s.Signature = append(s.Signature, buf[264:360]...)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object
|
||||
func (s *SignedContributionAndProof) SizeSSZ() (size int) {
|
||||
size = 376
|
||||
size = 360
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
107
proto/eth/v1alpha1/sync_committee.pb.go
generated
107
proto/eth/v1alpha1/sync_committee.pb.go
generated
@@ -7,13 +7,15 @@
|
||||
package eth
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
github_com_prysmaticlabs_eth2_types "github.com/prysmaticlabs/eth2-types"
|
||||
github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield"
|
||||
_ "github.com/prysmaticlabs/prysm/proto/eth/ext"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -103,11 +105,11 @@ type SyncCommitteeContribution struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Slot github_com_prysmaticlabs_eth2_types.Slot `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty" cast-type:"github.com/prysmaticlabs/eth2-types.Slot"`
|
||||
BlockRoot []byte `protobuf:"bytes,2,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty" ssz-size:"32"`
|
||||
SubcommitteeIndex uint64 `protobuf:"varint,3,opt,name=subcommittee_index,json=subcommitteeIndex,proto3" json:"subcommittee_index,omitempty"`
|
||||
AggregationBits []byte `protobuf:"bytes,4,opt,name=aggregation_bits,json=aggregationBits,proto3" json:"aggregation_bits,omitempty" ssz-size:"32"`
|
||||
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
|
||||
Slot github_com_prysmaticlabs_eth2_types.Slot `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty" cast-type:"github.com/prysmaticlabs/eth2-types.Slot"`
|
||||
BlockRoot []byte `protobuf:"bytes,2,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty" ssz-size:"32"`
|
||||
SubcommitteeIndex uint64 `protobuf:"varint,3,opt,name=subcommittee_index,json=subcommitteeIndex,proto3" json:"subcommittee_index,omitempty"`
|
||||
AggregationBits github_com_prysmaticlabs_go_bitfield.Bitvector128 `protobuf:"bytes,4,opt,name=aggregation_bits,json=aggregationBits,proto3" json:"aggregation_bits,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector128" ssz-size:"16"`
|
||||
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty" ssz-size:"96"`
|
||||
}
|
||||
|
||||
func (x *SyncCommitteeContribution) Reset() {
|
||||
@@ -163,11 +165,11 @@ func (x *SyncCommitteeContribution) GetSubcommitteeIndex() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SyncCommitteeContribution) GetAggregationBits() []byte {
|
||||
func (x *SyncCommitteeContribution) GetAggregationBits() github_com_prysmaticlabs_go_bitfield.Bitvector128 {
|
||||
if x != nil {
|
||||
return x.AggregationBits
|
||||
}
|
||||
return nil
|
||||
return github_com_prysmaticlabs_go_bitfield.Bitvector128(nil)
|
||||
}
|
||||
|
||||
func (x *SyncCommitteeContribution) GetSignature() []byte {
|
||||
@@ -320,7 +322,7 @@ var file_proto_eth_v1alpha1_sync_committee_proto_rawDesc = []byte{
|
||||
0x65, 0x78, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 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, 0x22, 0x8c, 0x02, 0x0a, 0x19, 0x53, 0x79, 0x6e,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xc1, 0x02, 0x0a, 0x19, 0x53, 0x79, 0x6e,
|
||||
0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x04, 0x42, 0x2c, 0x82, 0xb5, 0x18, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
@@ -331,48 +333,51 @@ var file_proto_eth_v1alpha1_sync_committee_proto_rawDesc = []byte{
|
||||
0x18, 0x02, 0x33, 0x32, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x6f, 0x6f, 0x74, 0x12,
|
||||
0x2d, 0x0a, 0x12, 0x73, 0x75, 0x62, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x5f,
|
||||
0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x75, 0x62,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x31,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x66,
|
||||
0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x69,
|
||||
0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x33, 0x32,
|
||||
0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x74,
|
||||
0x73, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x09, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x80, 0x02, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66,
|
||||
0x12, 0x61, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x36, 0x82, 0xb5, 0x18, 0x32,
|
||||
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, 0x65, 0x74, 0x68, 0x32, 0x2d, 0x74, 0x79,
|
||||
0x70, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x12, 0x54, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x43,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x0f, 0x73, 0x65, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52, 0x0e, 0x73, 0x65, 0x6c, 0x65,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0x89, 0x01, 0x0a, 0x1a, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x45, 0x0a, 0x07, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x74, 0x68,
|
||||
0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41,
|
||||
0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
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, 0x99, 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, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
|
||||
0x74, 0x65, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 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, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2f, 0x65, 0x74, 0x68, 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,
|
||||
0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x3b, 0x8a, 0xb5, 0x18, 0x02, 0x31, 0x36,
|
||||
0x82, 0xb5, 0x18, 0x31, 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, 0x67, 0x6f, 0x2d,
|
||||
0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x31, 0x32, 0x38, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x42, 0x69, 0x74, 0x73, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39,
|
||||
0x36, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x80, 0x02, 0x0a,
|
||||
0x14, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64,
|
||||
0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x61, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42,
|
||||
0x36, 0x82, 0xb5, 0x18, 0x32, 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, 0x65, 0x74,
|
||||
0x68, 0x32, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x54, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30,
|
||||
0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31,
|
||||
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x69,
|
||||
0x74, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f,
|
||||
0x0a, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6f,
|
||||
0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x06, 0x8a, 0xb5, 0x18, 0x02, 0x39, 0x36, 0x52,
|
||||
0x0e, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x22,
|
||||
0x89, 0x01, 0x0a, 0x1a, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x45,
|
||||
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76,
|
||||
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 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, 0x98, 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, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x43,
|
||||
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
|
||||
0x35, 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,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 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 (
|
||||
|
||||
@@ -52,7 +52,7 @@ message SyncCommitteeContribution {
|
||||
|
||||
// A bit is set if a signature from the validator at the corresponding
|
||||
// index in the subcommittee is present in the aggregate `signature`.
|
||||
bytes aggregation_bits = 4 [(ethereum.eth.ext.ssz_size) = "32"];
|
||||
bytes aggregation_bits = 4 [(ethereum.eth.ext.ssz_size) = "16", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector128"];
|
||||
|
||||
// Signature by the validator(s) over the block root of `slot`.
|
||||
bytes signature = 5 [(ethereum.eth.ext.ssz_size) = "96"];
|
||||
|
||||
12
spectest/mainnet/altair/ssz_static/BUILD.bazel
Normal file
12
spectest/mainnet/altair/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@eth2_spec_tests_mainnet//:test_data",
|
||||
],
|
||||
tags = ["spectest"],
|
||||
deps = ["//spectest/shared/altair/ssz_static:go_default_library"],
|
||||
)
|
||||
11
spectest/mainnet/altair/ssz_static/ssz_static_test.go
Normal file
11
spectest/mainnet/altair/ssz_static/ssz_static_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/spectest/shared/altair/ssz_static"
|
||||
)
|
||||
|
||||
func TestMainnet_Altair_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "mainnet")
|
||||
}
|
||||
17
spectest/minimal/altair/ssz_static/BUILD.bazel
Normal file
17
spectest/minimal/altair/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,17 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
||||
|
||||
# Requires --define ssz=minimal
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
srcs = ["ssz_static_test.go"],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@eth2_spec_tests_minimal//:test_data",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"minimal",
|
||||
"spectest",
|
||||
],
|
||||
deps = ["//spectest/shared/altair/ssz_static:go_default_library"],
|
||||
)
|
||||
11
spectest/minimal/altair/ssz_static/ssz_static_test.go
Normal file
11
spectest/minimal/altair/ssz_static/ssz_static_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/spectest/shared/altair/ssz_static"
|
||||
)
|
||||
|
||||
func TestMinimal_Altair_SSZStatic(t *testing.T) {
|
||||
ssz_static.RunSSZStaticTests(t, "minimal")
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
||||
|
||||
# Requires --define ssz=minimal
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
size = "small",
|
||||
|
||||
@@ -17,6 +17,7 @@ go_library(
|
||||
"//beacon-chain/state/state-altair:go_default_library",
|
||||
"//beacon-chain/state/stateV0:go_default_library",
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//proto/eth/v1alpha1:go_default_library",
|
||||
"//shared/interfaces:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil:go_default_library",
|
||||
@@ -24,7 +25,6 @@ go_library(
|
||||
"//spectest/utils:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
|
||||
"github.com/golang/snappy"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
||||
iface "github.com/prysmaticlabs/prysm/beacon-chain/state/interface"
|
||||
stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/state-altair"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateV0"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
|
||||
19
spectest/shared/altair/ssz_static/BUILD.bazel
Normal file
19
spectest/shared/altair/ssz_static/BUILD.bazel
Normal file
@@ -0,0 +1,19 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = ["ssz_static.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/spectest/shared/altair/ssz_static",
|
||||
visibility = ["//spectest:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/state/state-altair:go_default_library",
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//proto/eth/v1alpha1:go_default_library",
|
||||
"//shared/testutil:go_default_library",
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"//spectest/utils:go_default_library",
|
||||
"@com_github_ferranbt_fastssz//:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
],
|
||||
)
|
||||
183
spectest/shared/altair/ssz_static/ssz_static.go
Normal file
183
spectest/shared/altair/ssz_static/ssz_static.go
Normal file
@@ -0,0 +1,183 @@
|
||||
package ssz_static
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
fssz "github.com/ferranbt/fastssz"
|
||||
"github.com/golang/snappy"
|
||||
stateAltair "github.com/prysmaticlabs/prysm/beacon-chain/state/state-altair"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/spectest/utils"
|
||||
)
|
||||
|
||||
// SSZRoots --
|
||||
type SSZRoots struct {
|
||||
Root string `json:"root"`
|
||||
SigningRoot string `json:"signing_root"`
|
||||
}
|
||||
|
||||
// RunSSZStaticTests executes "ssz_static" tests.
|
||||
func RunSSZStaticTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, _ := utils.TestFolders(t, config, "altair", "ssz_static")
|
||||
for _, folder := range testFolders {
|
||||
innerPath := path.Join("ssz_static", folder.Name(), "ssz_random")
|
||||
innerTestFolders, innerTestsFolderPath := utils.TestFolders(t, config, "altair", innerPath)
|
||||
|
||||
for _, innerFolder := range innerTestFolders {
|
||||
t.Run(path.Join(folder.Name(), innerFolder.Name()), func(t *testing.T) {
|
||||
serializedBytes, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "serialized.ssz_snappy")
|
||||
require.NoError(t, err)
|
||||
serializedSSZ, err := snappy.Decode(nil /* dst */, serializedBytes)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
object, err := UnmarshalledSSZ(t, serializedSSZ, folder.Name())
|
||||
require.NoError(t, err, "Could not unmarshall serialized SSZ")
|
||||
|
||||
rootsYamlFile, err := testutil.BazelFileBytes(innerTestsFolderPath, innerFolder.Name(), "roots.yaml")
|
||||
require.NoError(t, err)
|
||||
rootsYaml := &SSZRoots{}
|
||||
require.NoError(t, utils.UnmarshalYaml(rootsYamlFile, rootsYaml), "Failed to Unmarshal")
|
||||
|
||||
// Custom hash tree root for beacon state.
|
||||
var htr func(interface{}) ([32]byte, error)
|
||||
if _, ok := object.(*pb.BeaconStateAltair); ok {
|
||||
htr = func(s interface{}) ([32]byte, error) {
|
||||
beaconState, err := stateAltair.InitializeFromProto(s.(*pb.BeaconStateAltair))
|
||||
require.NoError(t, err)
|
||||
return beaconState.HashTreeRoot(context.Background())
|
||||
}
|
||||
} else {
|
||||
htr = func(s interface{}) ([32]byte, error) {
|
||||
sszObj, ok := s.(fssz.HashRoot)
|
||||
if !ok {
|
||||
return [32]byte{}, errors.New("could not get hash root, not compatible object")
|
||||
}
|
||||
return sszObj.HashTreeRoot()
|
||||
}
|
||||
}
|
||||
|
||||
root, err := htr(object)
|
||||
require.NoError(t, err)
|
||||
rootBytes, err := hex.DecodeString(rootsYaml.Root[2:])
|
||||
require.NoError(t, err)
|
||||
require.DeepEqual(t, rootBytes, root[:], "Did not receive expected hash tree root")
|
||||
|
||||
if rootsYaml.SigningRoot == "" {
|
||||
return
|
||||
}
|
||||
|
||||
var signingRoot [32]byte
|
||||
if v, ok := object.(fssz.HashRoot); ok {
|
||||
signingRoot, err = v.HashTreeRoot()
|
||||
} else {
|
||||
t.Fatal("object does not meet fssz.HashRoot")
|
||||
}
|
||||
|
||||
require.NoError(t, err)
|
||||
signingRootBytes, err := hex.DecodeString(rootsYaml.SigningRoot[2:])
|
||||
require.NoError(t, err)
|
||||
require.DeepEqual(t, signingRootBytes, signingRoot[:], "Did not receive expected signing root")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalledSSZ unmarshalls serialized input.
|
||||
func UnmarshalledSSZ(t *testing.T, serializedBytes []byte, folderName string) (interface{}, error) {
|
||||
var obj interface{}
|
||||
switch folderName {
|
||||
case "Attestation":
|
||||
obj = ðpb.Attestation{}
|
||||
case "AttestationData":
|
||||
obj = ðpb.AttestationData{}
|
||||
case "AttesterSlashing":
|
||||
obj = ðpb.AttesterSlashing{}
|
||||
case "AggregateAndProof":
|
||||
obj = ðpb.AggregateAttestationAndProof{}
|
||||
case "BeaconBlock":
|
||||
obj = ðpb.BeaconBlockAltair{}
|
||||
case "BeaconBlockBody":
|
||||
obj = ðpb.BeaconBlockBodyAltair{}
|
||||
case "BeaconBlockHeader":
|
||||
obj = ðpb.BeaconBlockHeader{}
|
||||
case "BeaconState":
|
||||
obj = &pb.BeaconStateAltair{}
|
||||
case "Checkpoint":
|
||||
obj = ðpb.Checkpoint{}
|
||||
case "Deposit":
|
||||
obj = ðpb.Deposit{}
|
||||
case "DepositMessage":
|
||||
obj = &pb.DepositMessage{}
|
||||
case "DepositData":
|
||||
obj = ðpb.Deposit_Data{}
|
||||
case "Eth1Data":
|
||||
obj = ðpb.Eth1Data{}
|
||||
case "Eth1Block":
|
||||
t.Skip("Unused type")
|
||||
return nil, nil
|
||||
case "Fork":
|
||||
obj = &pb.Fork{}
|
||||
case "ForkData":
|
||||
obj = &pb.ForkData{}
|
||||
case "HistoricalBatch":
|
||||
obj = &pb.HistoricalBatch{}
|
||||
case "IndexedAttestation":
|
||||
obj = ðpb.IndexedAttestation{}
|
||||
case "PendingAttestation":
|
||||
obj = &pb.PendingAttestation{}
|
||||
case "ProposerSlashing":
|
||||
obj = ðpb.ProposerSlashing{}
|
||||
case "SignedAggregateAndProof":
|
||||
obj = ðpb.SignedAggregateAttestationAndProof{}
|
||||
case "SignedBeaconBlock":
|
||||
obj = ðpb.SignedBeaconBlockAltair{}
|
||||
case "SignedBeaconBlockHeader":
|
||||
obj = ðpb.SignedBeaconBlockHeader{}
|
||||
case "SignedVoluntaryExit":
|
||||
obj = ðpb.SignedVoluntaryExit{}
|
||||
case "SigningData":
|
||||
obj = &pb.SigningData{}
|
||||
case "Validator":
|
||||
obj = ðpb.Validator{}
|
||||
case "VoluntaryExit":
|
||||
obj = ðpb.VoluntaryExit{}
|
||||
case "SyncCommitteeSignature":
|
||||
obj = ðpb.SyncCommitteeSignature{}
|
||||
case "SyncCommitteeContribution":
|
||||
obj = ðpb.SyncCommitteeContribution{}
|
||||
case "ContributionAndProof":
|
||||
obj = ðpb.ContributionAndProof{}
|
||||
case "SignedContributionAndProof":
|
||||
obj = ðpb.SignedContributionAndProof{}
|
||||
case "SyncAggregate":
|
||||
obj = ðpb.SyncAggregate{}
|
||||
case "SyncAggregatorSelectionData":
|
||||
obj = &pb.SyncAggregatorSelectionData{}
|
||||
case "SyncCommittee":
|
||||
t.Skip("TODO(8638): fssz bug, using custom HTR so state works")
|
||||
return nil, nil
|
||||
case "LightClientSnapshot":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
case "LightClientUpdate":
|
||||
t.Skip("not a beacon node type, this is a light node type")
|
||||
return nil, nil
|
||||
default:
|
||||
return nil, errors.New("type not found")
|
||||
}
|
||||
var err error
|
||||
if o, ok := obj.(fssz.Unmarshaler); ok {
|
||||
err = o.UnmarshalSSZ(serializedBytes)
|
||||
} else {
|
||||
err = errors.New("could not unmarshal object, not a fastssz compatible object")
|
||||
}
|
||||
return obj, err
|
||||
}
|
||||
Reference in New Issue
Block a user