Skip to content

Commit

Permalink
Replace embedded Groups with type assertions (#550)
Browse files Browse the repository at this point in the history
These were always nil and likely unintentional (I assume it started out
as a way to mock unimplemented interface methods?). It doesn't matter
much because these suites all implement `kyber.Group`, but any changes
to `kyber.Group` would have added panicing methods to these suites
without any type errors.

Co-authored-by: AnomalRoil <AnomalRoil@users.noreply.github.com>
  • Loading branch information
Stebalien and AnomalRoil authored Sep 23, 2024
1 parent dbb811a commit d0f3223
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pairing/bls12381/circl/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
// used as a point from the group G1.
type SuiteBLS12381 struct {
Suite
kyber.Group
}

var _ kyber.Group = (*SuiteBLS12381)(nil)

// NewSuiteBLS12381 makes a new BN256 suite
func NewSuiteBLS12381() *SuiteBLS12381 {
return &SuiteBLS12381{}
Expand Down
3 changes: 2 additions & 1 deletion pairing/bls12381/kilic/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
// used as a point from the group G1.
type SuiteBLS12381 struct {
Suite
kyber.Group
}

var _ kyber.Group = (*SuiteBLS12381)(nil)

// NewSuiteBLS12381 makes a new BN256 suite
func NewSuiteBLS12381() *SuiteBLS12381 {
return &SuiteBLS12381{}
Expand Down
3 changes: 2 additions & 1 deletion pairing/bn254/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
// used as a point from the group G1.
type SuiteBn254 struct {
*Suite
kyber.Group
}

var _ kyber.Group = (*SuiteBn254)(nil)

// NewSuiteBn254 makes a new BN254 suite
func NewSuiteBn254() *SuiteBn254 {
return &SuiteBn254{
Expand Down
3 changes: 2 additions & 1 deletion pairing/bn256/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
// used as a point from the group G1.
type SuiteBn256 struct {
*Suite
kyber.Group
}

var _ kyber.Group = (*SuiteBn256)(nil)

// NewSuiteBn256 makes a new BN256 suite
func NewSuiteBn256() *SuiteBn256 {
return &SuiteBn256{
Expand Down

0 comments on commit d0f3223

Please sign in to comment.