web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

At 4.x branch pipeline: Error: unable to decode storage key: hex string invalid

Open Muhammad-Altabba opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

For branches that are based on the latest changes in 4.x, the pipeline of their MRs fails with an error that is fired in 3 places:

web3-eth: FAIL test/integration/defaults.test.ts (13.821 s)
web3-eth:   ● defaults › defaults › defaultBlock
web3-eth:     InvalidResponseError: Returned error: unable to decode storage key: hex string invalid
web3-eth:       288 | 		// A valid JSON-RPC response with error object
web3-eth:       289 | 		if (jsonRpc.isResponseWithError<ErrorType>(response)) {
web3-eth:     > 290 | 			throw new InvalidResponseError<ErrorType>(response);
web3-eth:           | 			      ^
web3-eth:       291 | 		}
web3-eth:       292 |
web3-eth:       293 | 		// This is the majority of the cases so check these first
web3-eth:       at Web3RequestManager._processJsonRpcResponse (../web3-core/src/web3_request_manager.ts:290:10)
web3-eth:       at Web3RequestManager.<anonymous> (../web3-core/src/web3_request_manager.ts:[174](https://github.com/web3/web3.js/actions/runs/3078741320/jobs/4974513808#step:4:175):16)
web3-eth:       at fulfilled (../web3-core/dist/web3_request_manager.js:5:58)
web3-eth: FAIL test/integration/rpc.test.ts
web3-eth:   ● rpc › methods › getStorageAt
web3-eth:     InvalidResponseError: Returned error: unable to decode storage key: hex string invalid
web3-eth:       288 | 		// A valid JSON-RPC response with error object
web3-eth:       289 | 		if (jsonRpc.isResponseWithError<ErrorType>(response)) {
web3-eth:     > 290 | 			throw new InvalidResponseError<ErrorType>(response);
web3-eth:           | 			      ^
web3-eth:       291 | 		}
web3-eth:       292 |
web3-eth:       293 | 		// This is the majority of the cases so check these first
web3-eth:       at Web3RequestManager._processJsonRpcResponse (../web3-core/src/web3_request_manager.ts:290:10)
web3-eth:       at Web3RequestManager.<anonymous> (../web3-core/src/web3_request_manager.ts:174:16)
web3-eth:       at fulfilled (../web3-core/dist/web3_request_manager.js:5:58)
web3-eth:           at runMicrotasks (<anonymous>)
web3-eth:   ● rpc › methods › getProof
web3-eth:     InvalidResponseError: Returned error: unable to decode storage key: hex string invalid
web3-eth:       288 | 		// A valid JSON-RPC response with error object
web3-eth:       289 | 		if (jsonRpc.isResponseWithError<ErrorType>(response)) {
web3-eth:     > 290 | 			throw new InvalidResponseError<ErrorType>(response);
web3-eth:           | 			      ^
web3-eth:       291 | 		}
web3-eth:       292 |
web3-eth:       293 | 		// This is the majority of the cases so check these first
web3-eth:       at Web3RequestManager._processJsonRpcResponse (../web3-core/src/web3_request_manager.ts:290:10)
web3-eth:       at Web3RequestManager.<anonymous> (../web3-core/src/web3_request_manager.ts:174:16)
web3-eth:       at fulfilled (../web3-core/dist/web3_request_manager.js:5:58)
web3-eth:           at runMicrotasks (<anonymous>)
web3-eth: Test Suites: 2 failed, 9 skipped, 11 passed, 13 of 22 total
web3-eth: Tests:       3 failed, 22 skipped, 153 passed, [178](https://github.com/web3/web3.js/actions/runs/3078741320/jobs/4974513808#step:4:179) total

Expected Behavior

To have no issues when creating MRs to 4.x.

Steps to Reproduce

This is produced at this experimental PR: https://github.com/web3/web3.js/pull/5455. Which contains only a change in one space.

Web3.js Version

4.x

Environment

At GitHub pipeline.

Anything Else?

No response

Muhammad-Altabba avatar Sep 19 '22 08:09 Muhammad-Altabba

When running these tests locally, I get the following error in multiple places (and do not receive the error mentioned above):

  ● defaults › defaults › defaultBlock

    InvalidResponseError: Returned error: no key for given address or file

      288 | 		// A valid JSON-RPC response with error object
      289 | 		if (jsonRpc.isResponseWithError<ErrorType>(response)) {
    > 290 | 			throw new InvalidResponseError<ErrorType>(response);
          | 			      ^
      291 | 		}
      292 |
      293 | 		// This is the majority of the cases so check these first

      at Web3RequestManager._processJsonRpcResponse (../web3-core/src/web3_request_manager.ts:290:10)
      at Web3RequestManager.<anonymous> (../web3-core/src/web3_request_manager.ts:174:16)
      at fulfilled (../web3-core/dist/web3_request_manager.js:5:58)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        1.776 s, estimated 2 s
Ran all test suites matching /test\/integration\/defaults.test.ts/i.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Which is being caused by this. Calling ethPersonal.getAccounts right before this line yields:

[
        '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
        '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
        '0xccFE90C862D2501ce233107D1A1F40afd50d09d0',
        '0xFe10D1f19baa4e3Ba57ff9c13C978571E092628A',
        '0xEe8cb9B4A71d2cd134884834313a7e808D5fC1e4'
]

and acc.address was 0xe2597eB05CF9a87eB1309e86750C903EC38E527e which is an account that the Geth node is not aware of, hence the error


I believe the error mentioned by @Muhammad-Altabba and the error mentioned above are symptoms of system_tests_utils.ts not working as expected which is what spawned the refactor #5426

spacesailor24 avatar Sep 20 '22 01:09 spacesailor24

This is interesting @spacesailor24 And so, will the refactor at https://github.com/web3/web3.js/pull/5426 fix those issues? If yes, it would be great. However, if it will add more overhead to https://github.com/web3/web3.js/pull/5426, Then, I suggest that you create a task to fix the error you are facing locally, and try to resolve it alone, as you can debug easier locally. And it would be then great if you would be able to fix the pipeline issue along with fixing your local issue. Or, else it would be a separate issue. Or what do you think?

Muhammad-Altabba avatar Sep 20 '22 10:09 Muhammad-Altabba

The account that is not known to geth (0xe2597eB05CF9a87eB1309e86750C903EC38E527e ) is the first account of scripts/accounts.json. It seems that something is not right in their import.

nikoulai avatar Sep 20 '22 12:09 nikoulai

Can this be closed now that testcases are passing?

luu-alex avatar Oct 04 '22 04:10 luu-alex