diff --git a/core/auth/auth_test.go b/core/auth/auth_test.go index 80f318f2cf..55c405f552 100644 --- a/core/auth/auth_test.go +++ b/core/auth/auth_test.go @@ -19,9 +19,12 @@ func TestAuthentication(t *testing.T) { privateKeyHex := "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" signer := auth.NewLocalBlobRequestSigner(privateKeyHex) + accountId, err := signer.GetAccountID() + assert.NoError(t, err) + testHeader := core.BlobAuthHeader{ BlobCommitments: encoding.BlobCommitments{}, - AccountID: signer.GetAccountID(), + AccountID: accountId, Nonce: rand.Uint32(), AuthenticationData: []byte{}, } @@ -46,9 +49,12 @@ func TestAuthenticationFail(t *testing.T) { privateKeyHex := "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" signer := auth.NewLocalBlobRequestSigner(privateKeyHex) + accountId, err := signer.GetAccountID() + assert.NoError(t, err) + testHeader := core.BlobAuthHeader{ BlobCommitments: encoding.BlobCommitments{}, - AccountID: signer.GetAccountID(), + AccountID: accountId, Nonce: rand.Uint32(), AuthenticationData: []byte{}, } @@ -66,3 +72,18 @@ func TestAuthenticationFail(t *testing.T) { assert.Error(t, err) } + +func TestNoopSignerFail(t *testing.T) { + signer := auth.NewLocalNoopSigner() + accountId, err := signer.GetAccountID() + assert.EqualError(t, err, "noop signer cannot get accountID") + + testHeader := core.BlobAuthHeader{ + BlobCommitments: encoding.BlobCommitments{}, + AccountID: accountId, + Nonce: rand.Uint32(), + AuthenticationData: []byte{}, + } + _, err = signer.SignBlobRequest(testHeader) + assert.EqualError(t, err, "noop signer cannot sign blob request") +} diff --git a/disperser/apiserver/ratelimit_test.go b/disperser/apiserver/ratelimit_test.go index 69b3f99093..63bb02c72d 100644 --- a/disperser/apiserver/ratelimit_test.go +++ b/disperser/apiserver/ratelimit_test.go @@ -225,12 +225,15 @@ func simulateClient(t *testing.T, signer core.BlobRequestSigner, origin string, stream.Close() }() - err := stream.SendFromClient(&pb.AuthenticatedRequest{ + accountId, err := signer.GetAccountID() + assert.NoError(t, err) + + err = stream.SendFromClient(&pb.AuthenticatedRequest{ Payload: &pb.AuthenticatedRequest_DisperseRequest{ DisperseRequest: &pb.DisperseBlobRequest{ Data: data, CustomQuorumNumbers: quorums, - AccountId: signer.GetAccountID(), + AccountId: accountId, }, }, })