diff --git a/rpc/contract_test.go b/rpc/contract_test.go index dc84a37fd9..4d0ee8c2c8 100644 --- a/rpc/contract_test.go +++ b/rpc/contract_test.go @@ -124,7 +124,7 @@ func TestStorageAt(t *testing.T) { t.Run("non-existent contract", func(t *testing.T) { mockReader.EXPECT().HeadState().Return(mockState, nopCloser, nil) // we check if the contract exists by getting its nonce - mockState.EXPECT().ContractNonce(gomock.Any()).Return(nil, errors.New("non-existent contract")) + mockState.EXPECT().ContractNonce(gomock.Any()).Return(nil, db.ErrKeyNotFound) storage, rpcErr := handler.StorageAt(felt.Zero, felt.Zero, rpc.BlockID{Latest: true}) require.Nil(t, storage) @@ -133,8 +133,8 @@ func TestStorageAt(t *testing.T) { t.Run("non-existent key", func(t *testing.T) { mockReader.EXPECT().HeadState().Return(mockState, nopCloser, nil) - // we check if the contract exists by getting its nonce - mockState.EXPECT().ContractNonce(gomock.Any()).Return(nil, errors.New("non-existent contract")) + mockState.EXPECT().ContractNonce(&felt.Zero).Return(nil, nil) + mockState.EXPECT().ContractStorage(gomock.Any(), gomock.Any()).Return(nil, db.ErrKeyNotFound) storage, rpcErr := handler.StorageAt(felt.Zero, felt.Zero, rpc.BlockID{Latest: true}) require.Nil(t, storage)