NethermindEth / nethermind

A robust execution client for Ethereum node operators.
https://nethermind.io/nethermind-client
GNU General Public License v3.0
1.27k stars 438 forks source link

rpc error message compatibility #6641

Open 0xyjk opened 9 months ago

0xyjk commented 9 months ago

Is your feature request related to a problem? Please describe. currently for nonce too low error, nethermind rpc error message does not contain nonce too low string many project use string match to determine the error kind, for example optimism this will cause client side can't catch the correct error kind and will lead to incorrect behaviour

Describe the solution you'd like for compatibility, add extra string in rpc errror message, geth error message can be found here

MarekM25 commented 9 months ago

We can do this issue in two stages:

  1. Adjust error messages to geth
  2. Propose better error codes to other client teams.
smartprogrammer93 commented 9 months ago

Well, here what we return in this case is the following

$"{Code}, {Message}"

Code is basically nameof(OldNonce) and message is a descriptive message like so

$"Current nonce: {currentNonce}, nonce of rejected tx: {tx.Nonce}"

Not sure what is the correct approach here. no matter how i try to do it, it will be very custom code for this specific error. or we need to do a completely refactor and rename of enums and our logic of returned errors to comply with a none standardized approach while also losing proper messages explaining exactly what is wrong to the user. if these projects are using string contains instead of string match we can arrange something. to work.