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

fix(rpc): add fee/value and balance to insufficient funds RPC error #10872

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

emhane
Copy link
Member

@emhane emhane commented Sep 12, 2024

Closes #10732. Closes #10464.

Adds fee/value and balance to error message for RPC error insufficient funds.

This doesn't report the exact same error message as geth now @AntonieDavid, if that doesn't suffice an issue to revm would need to be opened to add address and gas used to error variant

https://github.com/bluealloy/revm/blob/f57e3e639ee157c7e659e740bd175a7357003570/crates/primitives/src/result.rs#L334-L336

InvalidTransaction::LackOfFundForMaxFee { .. } => Self::InsufficientFunds,

@emhane emhane added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation labels Sep 12, 2024
@github-actions github-actions bot added the C-debt Refactor of code section that is hard to understand or maintain label Sep 12, 2024
@emhane emhane removed the C-debt Refactor of code section that is hard to understand or maintain label Sep 12, 2024
)]
Overdraft {
/// Cost transaction is allowed to consume. See `reth_transaction_pool::PoolTransaction`.
value_or_fee: U256,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't quite accurate because this is the cost this tx requires.

imo we can keep overdraft as is, this provides sufficient context

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't possible if we do the conversion from overdraft error to rpc error

@emhane emhane requested a review from mattsse September 13, 2024 13:32
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay I looked at the issue again, looks like the Overdraft field is actually what we want here cost, but InsufficientFund only includes value or fee. which can be lower than balance, so this error could be confusing to users.

this should also be the expected cost.

crates/rpc/rpc-eth-types/src/error.rs Outdated Show resolved Hide resolved
@emhane emhane requested a review from mattsse September 16, 2024 15:07
@mattsse mattsse added this pull request to the merge queue Sep 17, 2024
Merged via the queue into main with commit 21e92b8 Sep 17, 2024
37 checks passed
@mattsse mattsse deleted the emhane/rpc-error-insufficient-funds branch September 17, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
None yet
2 participants