-
Notifications
You must be signed in to change notification settings - Fork 985
Incorrect docs for Handler::validate_against_state_and_deduct_caller #3255
Copy link
Copy link
Closed
Description
The validate_against_state_and_deduct_caller docs state that the method is responsible for deducting the transfer value from the caller's balance.
revm/crates/handler/src/handler.rs
Line 298 in 3b17ee6
| /// Deducts maximum possible fee and transfer value from caller's balance. |
In fact, the default implementation only deducts the fee and the deduction of the transfer value is performed during execution. Overrides which follow the documented behavior can result in loss of funds, since the deduction is also made during EVM execution.
revm/crates/handler/src/pre_execution.rs
Lines 143 to 153 in 3b17ee6
| let gas_balance_spending = effective_balance_spending - tx.value(); | |
| // new balance | |
| let mut new_balance = balance.saturating_sub(gas_balance_spending); | |
| if is_balance_check_disabled { | |
| // Make sure the caller's balance is at least the value of the transaction. | |
| new_balance = new_balance.max(tx.value()); | |
| } | |
| Ok(new_balance) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels