From d39139dce09fd693bcba87a6804fb757c1d575d0 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Fri, 20 Dec 2024 11:43:39 -0500 Subject: [PATCH] fix test --- commit/merkleroot/rmn/controller_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/commit/merkleroot/rmn/controller_test.go b/commit/merkleroot/rmn/controller_test.go index dc7c4480..62f19c5f 100644 --- a/commit/merkleroot/rmn/controller_test.go +++ b/commit/merkleroot/rmn/controller_test.go @@ -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), } } @@ -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), }, }, }, @@ -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,