Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gopalswami committed Dec 20, 2024
1 parent 01dbd80 commit d39139d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions commit/merkleroot/rmn/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,11 @@ func TestClient_ComputeReportSignatures(t *testing.T) {
const numNodes = 8
rmnNodes := make([]rmntypes.HomeNodeInfo, numNodes)
for i := 0; i < numNodes; i++ {
// deterministically create a public key by seeding with a 32char string.
publicKey, _, err := ed25519.GenerateKey(
strings.NewReader(strconv.Itoa(i) + strings.Repeat("x", 31)))
require.NoError(t, err)
rmnNodes[i] = rmntypes.HomeNodeInfo{
ID: rmntypes.NodeID(i + 1),
PeerID: [32]byte{1, 2, 3},
SupportedSourceChains: mapset.NewSet(chainS1, chainS2),
OffchainPublicKey: &publicKey,
OffchainPublicKey: getDeterministicPubKey(t),
}
}

Expand Down Expand Up @@ -648,7 +644,7 @@ func Test_controller_validateSignedObservationResponse(t *testing.T) {
{
ID: 20,
SupportedSourceChains: mapset.NewSet[cciptypes.ChainSelector](cciptypes.ChainSelector(2)),
OffchainPublicKey: &ed25519.PublicKey{},
OffchainPublicKey: getDeterministicPubKey(t),
},
},
},
Expand Down Expand Up @@ -733,6 +729,14 @@ func Test_controller_validateSignedObservationResponse(t *testing.T) {
}
}

func getDeterministicPubKey(t *testing.T) *ed25519.PublicKey {
// deterministically create a public key by seeding with a 32char string.
publicKey, _, err := ed25519.GenerateKey(
strings.NewReader(strconv.Itoa(1) + strings.Repeat("x", 31)))
require.NoError(t, err)
return &publicKey
}

func (ts *testSetup) waitForObservationRequestsToBeSent(
rmnClient *mockPeerClient,
homeF int,
Expand Down

0 comments on commit d39139d

Please sign in to comment.