silius-rs / silius

ERC-4337 (Account Abstraction) - modular and efficient bundler implementation in Rust.
http://silius.rs/
Apache License 2.0
250 stars 39 forks source link

Provide error code for simulation related errors #211

Open da-bao-jian opened 1 year ago

da-bao-jian commented 1 year ago

It'll be nice to have customized error code for each of simulation related errors

Currently, one would have to parse through the error message to get the returned variables. See handle_response function in ethers-userop.

Vid201 commented 1 year ago

It'll be nice to have customized error code for each of simulation related errors

Currently, one would have to parse through the error message to get the returned variables. See handle_response function in ethers-userop.

@da-bao-jian Can you please provide more information about which error codes exactly - the ones returned from JSON-RPC API?

We should follow the specs fully for error codes: https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace . Or do you mean that single error code in the specs can mean different things?

da-bao-jian commented 1 year ago

Sorry I should've been more clear on that

  1. Yes the ones returned from Json RPC API
  2. and yes, a single error code can have different things. Primarily I was dealing with insufficient verification/call/pre-verification gas errors. They all have the same error code
Vid201 commented 1 year ago

Sorry I should've been more clear on that

  1. Yes the ones returned from Json RPC API
  2. and yes, a single error code can have different things. Primarily I was dealing with insufficient verification/call/pre-verification gas errors. They all have the same error code

Ok, got it. Thinking about what would be the best approach, I am not sure if introducing custom codes would be the best approach since it deviates from standard. But maybe structuring the error message in the meaningful way could be the way to go.

da-bao-jian commented 1 year ago

What do you recommend for implementation.

I can work on it when my schedule is a little bit better

Vid201 commented 1 year ago

What do you recommend for implementation.

I can work on it when my schedule is a little bit better

We could do something similar to errors from the entry points: the message should always start with AA(INT) - https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/core/EntryPoint.sol#L60.

Maybe something like B1 for call gas limit, B2 for preverificationgas ...