Skip to content

Commit 7265864

Browse files
committed
swap TypeOf for TypeFor
1 parent 23d5f79 commit 7265864

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

internal/v3marshaling.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func MarshalPriShare(priShare *share.PriShare) ([]byte, error) {
3333
func UnmarshalPriShare(data []byte, suite Suite) (*share.PriShare, error) {
3434
compatiblePriShare := &compatiblePriShare{}
3535
constructors := make(protobuf.Constructors)
36-
var secret kyber.Scalar
37-
constructors[reflect.TypeOf(&secret).Elem()] = func() interface{} { return suite.Scalar() }
36+
constructors[reflect.TypeFor[kyber.Scalar]().Elem()] = func() interface{} { return suite.Scalar() }
3837
err := protobuf.DecodeWithConstructors(data, compatiblePriShare, constructors)
3938
if err != nil {
4039
return nil, err

share/vss/pedersen/vss.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ func (d *Deal) Marshal() ([]byte, error) {
8585
func (d *Deal) Unmarshal(data []byte, suite Suite) error {
8686
compatibleDeal := &pedersenCompatibleDeal{}
8787
constructors := make(protobuf.Constructors)
88-
var point kyber.Point
89-
constructors[reflect.TypeOf(&point).Elem()] = func() interface{} { return suite.Point() }
88+
constructors[reflect.TypeFor[kyber.Point]().Elem()] = func() interface{} { return suite.Point() }
9089
err := protobuf.DecodeWithConstructors(data, compatibleDeal, constructors)
9190
if err != nil {
9291
return err

share/vss/rabin/vss.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ func (deal *Deal) Marshal() ([]byte, error) {
119119
func (deal *Deal) Unmarshal(data []byte, suite Suite) error {
120120
compatibleDeal := &rabinCompatibleDeal{}
121121
constructors := make(protobuf.Constructors)
122-
var point kyber.Point
123-
constructors[reflect.TypeOf(&point).Elem()] = func() interface{} { return suite.Point() }
122+
constructors[reflect.TypeFor[kyber.Point]().Elem()] = func() interface{} { return suite.Point() }
124123
err := protobuf.DecodeWithConstructors(data, compatibleDeal, constructors)
125124
if err != nil {
126125
return err

0 commit comments

Comments
 (0)