Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Nonce error gets returned with unhelpful error #532

Open
CedarMist opened this issue Feb 25, 2024 · 2 comments
Open

Invalid Nonce error gets returned with unhelpful error #532

CedarMist opened this issue Feb 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working p:2 Priority: desired feature

Comments

@CedarMist
Copy link
Member

CedarMist commented Feb 25, 2024

When I start a new local testing node the account nonces are set

When I try to sign a transaction it shows this:

{ "code": -32603, "message": "Internal JSON-RPC error." }, payload={ "id": 16, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "data":

Instead of a helpful error message.

I then have to (unavoidably) go and reset the account data in metamask to detect the new nonce.

In the oasis-web3-gateway logfile the error message is reported:

{"caller":"grpc.go:242","err":"client: transaction check failed: runtime error: module: core code: 4 message: invalid nonce","level":"error","method":"/oasis-core.RuntimeClient/SubmitTxNoWait","module":"grpc/client","msg":"request failed","req_seq":8179,"rsp":null,"ts":"2024-02-25T21:36:35.613327406Z"}

But it's not passed through to the client.

@CedarMist CedarMist added bug Something isn't working p:2 Priority: desired feature labels Feb 25, 2024
@CedarMist
Copy link
Member Author

I also noticed that when the gas limit is exceeded it doesn't seem to provide that message to the user. This made debugging annoying.

@CedarMist CedarMist self-assigned this Mar 13, 2024
@CedarMist
Copy link
Member Author

Re: invalid nonce

This is returned correctly from the JSON-RPC server

Error: could not coalesce error (error={ "code": -32000, "message": "client: transaction check failed: runtime error: module: core code: 4 message: invalid nonce" }, payload={ "id": 59, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "data": "0xa264626f6479a462706b58208ce9223787bbd5da1359e912c11fdeb640cad1e541e72b2fdba750e5374a432f6464617461581b896a9e63a658263764b94d17550d3e5c1a0a4356997dd201646f8a6565706f6368186d656e6f6e63654ff1d7bcd579a9f4c1a27f264fcce8b866666f726d617401", "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "gas": "0x4cb66d", "gasPrice": "0x174876e800", "nonce": "0xd", "to": "0x0dcd1bf9a1b36ce34237eeafef220932846bcd82" } ] }, code=UNKNOWN_ERROR, version=6.10.0)

However, it seems MetaMask is ignoring the error, so the error is being provided to the JSON-RPC consumer, and does show in Ethers (although it doesn't follow the format returned by go-ethereum).

So... This seems like a mostly Metamask problem.

The workaround for Ethers is to mirror the go-ethereum error messages, changing 'invalid nonce' to 'nonce too low'
see: https://github.com/ethers-io/ethers.js/blob/ad5f1c5fc7b73cfb20d9012b669e9dcb9122d244/src.ts/providers/provider-jsonrpc.ts#L1020

Still trying to track down MetaMask code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p:2 Priority: desired feature
Projects
None yet
Development

No branches or pull requests

1 participant