Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
2
stars
0
forks
source link
Attempt to map Telos error responses to better reponses from the RPC for sendRawTransaction #57
Open
poplexity opened 1 month ago
Here: https://github.com/telosnetwork/telos-reth/blob/1db2e8707f4ad96afc65785799212b48ccc7f7bf/crates/telos/rpc/src/eth/telos_client.rs#L105-L109
Need to consider the possible error types and try to return the proper error type to reth.
For instance, if you send an EIP-2930 type transaction, we reject it with this error in the log:
2024-09-26T18:46:13.872764Z ERROR reth_telos_rpc::eth::telos_client: Error sending transaction to Telos: SERVER(ServerError { error: SendTransactionResponseError { code: 3050003, name: "eosio_assert_message_exception", what: "eosio_assert_message assertion failure", stack: None, details: [SendTransactionResponseErrorDetails { message: "assertion failure with message: Invalid Transaction: Calling from_big_endian with oversized array", file: "cf_system.cpp", line_number: 14, method: "eosio_assert" }, SendTransactionResponseErrorDetails { message: "eosio.evm <= eosio.evm::raw pending console output: ", file: "apply_context.cpp", line_number: 134, method: "exec_one" }] } })
Example with incorrect gas price:
2024-10-03T05:08:40.639077Z ERROR reth_telos_rpc::eth::telos_client: Error sending transaction to Telos: SERVER(ServerError { error: SendTransactionResponseError { code: 3050003, name: "eosio_assert_message_exception", what: "eosio_assert_message assertion failure", stack: None, details: [SendTransactionResponseErrorDetails { message: "assertion failure with message: Transaction gas price 1100000000 is less than the current fixed gas price of 519432999856", file: "cf_system.cpp", line_number: 22, method: "eosio_assert_message" }, SendTransactionResponseErrorDetails { message: "pending console output: ", file: "apply_context.cpp", line_number: 124, method: "exec_one" }] } })
Similarly, if we get the nonce wrong, we can check the error response from Telos and return a more appropriate variant of
EthApiError