-
Notifications
You must be signed in to change notification settings - Fork 21
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 ACP-118 updates #422
Changes from 11 commits
fa60e03
0108081
cf689e5
b186d1c
95797af
b8735b0
0be46eb
e3cefff
79132a1
2f337c9
bce634d
811c97a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import ( | |
|
||
"github.com/ava-labs/avalanchego/ids" | ||
"github.com/ava-labs/avalanchego/message" | ||
networkP2P "github.com/ava-labs/avalanchego/network/p2p" | ||
"github.com/ava-labs/avalanchego/proto/pb/p2p" | ||
"github.com/ava-labs/avalanchego/proto/pb/sdk" | ||
"github.com/ava-labs/avalanchego/subnets" | ||
|
@@ -24,7 +25,6 @@ import ( | |
avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" | ||
"github.com/ava-labs/awm-relayer/peers" | ||
"github.com/ava-labs/awm-relayer/utils" | ||
msg "github.com/ava-labs/subnet-evm/plugin/evm/message" | ||
"go.uber.org/zap" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
@@ -120,9 +120,11 @@ func (s *SignatureAggregator) CreateSignedMessage( | |
return nil, errNotEnoughConnectedStake | ||
} | ||
|
||
reqBytes, err := proto.Marshal( | ||
reqBytes := networkP2P.ProtocolPrefix(networkP2P.SignatureRequestHandlerID) | ||
messageBytes, err := proto.Marshal( | ||
&sdk.SignatureRequest{Message: unsignedMessage.Bytes()}, | ||
) | ||
reqBytes = append(reqBytes, messageBytes...) | ||
if err != nil { | ||
msg := "Failed to marshal request bytes" | ||
s.logger.Error( | ||
|
@@ -426,8 +428,9 @@ func (s *SignatureAggregator) isValidSignatureResponse( | |
return blsSignatureBuf{}, false | ||
} | ||
|
||
var sigResponse msg.SignatureResponse | ||
if _, err := msg.Codec.Unmarshal(appResponse.AppBytes, &sigResponse); err != nil { | ||
sigResponse := sdk.SignatureResponse{} | ||
err := proto.Unmarshal(appResponse.AppBytes, &sigResponse) | ||
if err != nil { | ||
s.logger.Error( | ||
"Error unmarshaling signature response", | ||
zap.Error(err), | ||
|
@@ -459,8 +462,9 @@ func (s *SignatureAggregator) isValidSignatureResponse( | |
) | ||
return blsSignatureBuf{}, false | ||
} | ||
|
||
return signature, true | ||
blsSig := blsSignatureBuf{} | ||
copy(blsSig[:], signature[:]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a check higher up that the length of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly, we do call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 811c97a |
||
return blsSig, true | ||
} | ||
|
||
// aggregateSignatures constructs a BLS aggregate signature from the collected validator signatures. Also | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is messy checking but I used this to see error codes received from validator nodes which we don't log anywhere right now