Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature Aggregator: Happy path unit test #467

Merged
merged 13 commits into from
Sep 11, 2024
6 changes: 3 additions & 3 deletions peers/app_request_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ type ConnectedCanonicalValidators struct {
ConnectedWeight uint64
TotalValidatorWeight uint64
ValidatorSet []*warp.Validator
nodeValidatorIndexMap map[ids.NodeID]int
NodeValidatorIndexMap map[ids.NodeID]int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that I love this struct having all of it's fields exported instead of using getters/setters but every other field is already exported so not a blocker for this PR

}

// Returns the Warp Validator and its index in the canonical Validator ordering for a given nodeID
func (c *ConnectedCanonicalValidators) GetValidator(nodeID ids.NodeID) (*warp.Validator, int) {
return c.ValidatorSet[c.nodeValidatorIndexMap[nodeID]], c.nodeValidatorIndexMap[nodeID]
return c.ValidatorSet[c.NodeValidatorIndexMap[nodeID]], c.NodeValidatorIndexMap[nodeID]
}

// ConnectToCanonicalValidators connects to the canonical validators of the given subnet and returns the connected
Expand Down Expand Up @@ -258,7 +258,7 @@ func (n *appRequestNetwork) ConnectToCanonicalValidators(subnetID ids.ID) (*Conn
ConnectedWeight: connectedWeight,
TotalValidatorWeight: totalValidatorWeight,
ValidatorSet: validatorSet,
nodeValidatorIndexMap: nodeValidatorIndexMap,
NodeValidatorIndexMap: nodeValidatorIndexMap,
}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions signature-aggregator/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package aggregator

import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -554,6 +555,7 @@ func (s *SignatureAggregator) isValidSignatureResponse(
if !bls.Verify(pubKey, sig, unsignedMessage.Bytes()) {
s.logger.Debug(
"Failed verification for signature",
zap.String("pubKey", hex.EncodeToString(bls.PublicKeyToUncompressedBytes(pubKey))),
)
return blsSignatureBuf{}, false
}
Expand Down
Loading