Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions graft/coreth/plugin/evm/vm_warp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,11 @@ func testWarpVMTransaction(t *testing.T, scheme string, unsignedMessage *avalanc
vdrs := validators.WarpSet{
Validators: []*validators.Warp{
{
PublicKey: blsPublicKey1,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(blsPublicKey1),
Weight: 50,
NodeIDs: []ids.NodeID{nodeID1},
},
{
PublicKey: blsPublicKey2,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(blsPublicKey2),
Weight: 50,
NodeIDs: []ids.NodeID{nodeID2},
Expand Down Expand Up @@ -665,7 +663,6 @@ func testReceiveWarpMessage(
for _, s := range signers {
pk := s.secret.PublicKey()
vdrs.Validators = append(vdrs.Validators, &validators.Warp{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: s.weight,
NodeIDs: []ids.NodeID{s.nodeID},
Expand Down
14 changes: 6 additions & 8 deletions graft/coreth/precompile/contracts/warp/predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ func init() {
vdrs = map[ids.NodeID]*validators.GetValidatorOutput{
testVdrs[0].nodeID: {
NodeID: testVdrs[0].nodeID,
PublicKey: testVdrs[0].vdr.PublicKey,
PublicKey: testVdrs[0].vdr.PublicKey(),
Weight: testVdrs[0].vdr.Weight,
},
testVdrs[1].nodeID: {
NodeID: testVdrs[1].nodeID,
PublicKey: testVdrs[1].vdr.PublicKey,
PublicKey: testVdrs[1].vdr.PublicKey(),
Weight: testVdrs[1].vdr.Weight,
},
testVdrs[2].nodeID: {
NodeID: testVdrs[2].nodeID,
PublicKey: testVdrs[2].vdr.PublicKey,
PublicKey: testVdrs[2].vdr.PublicKey(),
Weight: testVdrs[2].vdr.Weight,
},
}
Expand Down Expand Up @@ -128,8 +128,7 @@ func newTestValidator() *testValidator {
nodeID: nodeID,
sk: sk,
vdr: &avalancheWarp.Validator{
PublicKey: pk,
PublicKeyBytes: pk.Serialize(),
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: 3,
NodeIDs: []ids.NodeID{nodeID},
},
Expand Down Expand Up @@ -213,7 +212,7 @@ func createSnowCtx(tb testing.TB, validatorRanges []validatorRange) *snow.Contex
Weight: validatorRange.weight,
}
if validatorRange.publicKey {
validatorOutput.PublicKey = testVdrs[i].vdr.PublicKey
validatorOutput.PublicKey = testVdrs[i].vdr.PublicKey()
}
validatorSet[testVdrs[i].nodeID] = validatorOutput
}
Expand Down Expand Up @@ -289,7 +288,6 @@ func testWarpMessageFromPrimaryNetwork(t *testing.T, requirePrimaryNetworkSigner

pk := vdr.sk.PublicKey()
warpValidators.Validators = append(warpValidators.Validators, &validators.Warp{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: 20,
NodeIDs: []ids.NodeID{vdr.nodeID},
Expand Down Expand Up @@ -779,7 +777,7 @@ func makeWarpPredicateTests(tb testing.TB, rules extras.AvalancheRules) []precom
validatorSet[testVdrs[i].nodeID] = &validators.GetValidatorOutput{
NodeID: testVdrs[i].nodeID,
Weight: 20,
PublicKey: testVdrs[i%numSigners].vdr.PublicKey,
PublicKey: testVdrs[i%numSigners].vdr.PublicKey(),
}
}
warpValidators, err := validators.FlattenValidatorSet(validatorSet)
Expand Down
3 changes: 0 additions & 3 deletions graft/subnet-evm/plugin/evm/vm_warp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,11 @@ func testWarpVMTransaction(t *testing.T, scheme string, unsignedMessage *avalanc
vdrs := validators.WarpSet{
Validators: []*validators.Warp{
{
PublicKey: blsPublicKey1,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(blsPublicKey1),
Weight: 50,
NodeIDs: []ids.NodeID{nodeID1},
},
{
PublicKey: blsPublicKey2,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(blsPublicKey2),
Weight: 50,
NodeIDs: []ids.NodeID{nodeID2},
Expand Down Expand Up @@ -687,7 +685,6 @@ func testReceiveWarpMessage(
for _, s := range signers {
pk := s.secret.PublicKey()
vdrs.Validators = append(vdrs.Validators, &validators.Warp{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: s.weight,
NodeIDs: []ids.NodeID{s.nodeID},
Expand Down
14 changes: 6 additions & 8 deletions graft/subnet-evm/precompile/contracts/warp/predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ func init() {
vdrs = map[ids.NodeID]*validators.GetValidatorOutput{
testVdrs[0].nodeID: {
NodeID: testVdrs[0].nodeID,
PublicKey: testVdrs[0].vdr.PublicKey,
PublicKey: testVdrs[0].vdr.PublicKey(),
Weight: testVdrs[0].vdr.Weight,
},
testVdrs[1].nodeID: {
NodeID: testVdrs[1].nodeID,
PublicKey: testVdrs[1].vdr.PublicKey,
PublicKey: testVdrs[1].vdr.PublicKey(),
Weight: testVdrs[1].vdr.Weight,
},
testVdrs[2].nodeID: {
NodeID: testVdrs[2].nodeID,
PublicKey: testVdrs[2].vdr.PublicKey,
PublicKey: testVdrs[2].vdr.PublicKey(),
Weight: testVdrs[2].vdr.Weight,
},
}
Expand Down Expand Up @@ -128,8 +128,7 @@ func newTestValidator() *testValidator {
nodeID: nodeID,
sk: sk,
vdr: &avalancheWarp.Validator{
PublicKey: pk,
PublicKeyBytes: pk.Serialize(),
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: 3,
NodeIDs: []ids.NodeID{nodeID},
},
Expand Down Expand Up @@ -214,7 +213,7 @@ func createSnowCtx(tb testing.TB, validatorRanges []validatorRange) *snow.Contex
Weight: validatorRange.weight,
}
if validatorRange.publicKey {
validatorOutput.PublicKey = testVdrs[i].vdr.PublicKey
validatorOutput.PublicKey = testVdrs[i].vdr.PublicKey()
}
validatorSet[testVdrs[i].nodeID] = validatorOutput
}
Expand Down Expand Up @@ -290,7 +289,6 @@ func testWarpMessageFromPrimaryNetwork(t *testing.T, requirePrimaryNetworkSigner

pk := vdr.sk.PublicKey()
warpValidators.Validators = append(warpValidators.Validators, &validators.Warp{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: 20,
NodeIDs: []ids.NodeID{vdr.nodeID},
Expand Down Expand Up @@ -781,7 +779,7 @@ func makeWarpPredicateTests(tb testing.TB, rules extras.AvalancheRules) []precom
validatorSet[testVdrs[i].nodeID] = &validators.GetValidatorOutput{
NodeID: testVdrs[i].nodeID,
Weight: 20,
PublicKey: testVdrs[i%numSigners].vdr.PublicKey,
PublicKey: testVdrs[i%numSigners].vdr.PublicKey(),
}
}
warpValidators, err := validators.FlattenValidatorSet(validatorSet)
Expand Down
2 changes: 1 addition & 1 deletion network/p2p/acp118/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (r *responseHandler) HandleResponse(
return
}

if !bls.Verify(validator.PublicKey, signature, r.message.UnsignedMessage.Bytes()) {
if !bls.Verify(validator.PublicKey(), signature, r.message.UnsignedMessage.Bytes()) {
r.results <- result{NodeID: nodeID, Validator: validator, Err: errFailedVerification}
return
}
Expand Down
Loading