Add client side check of withdraw-ability#1546
Add client side check of withdraw-ability#1546pLabarta wants to merge 2 commits intopolkadot-evm:masterfrom
Conversation
| } | ||
| } | ||
|
|
||
| pub fn max_withdraw_amount(&self) -> Result<U256, E> { |
There was a problem hiding this comment.
Does with_balance_for in CheckEvmTransaction meet your needs?
|
|
||
| use pallet_evm::OnChargeEVMTransaction; | ||
| let max_withdraw = check_transaction.max_withdraw_amount().map_err(|e| e.0)?; | ||
| <T as pallet_evm::Config>::OnChargeTransaction::can_withdraw(&origin, max_withdraw) |
There was a problem hiding this comment.
What additional validation does this offer compared to the with_balance_for mentioned above?
There was a problem hiding this comment.
I'm rechecking this change we have at Moonbeam's frontier fork to see if the issue was fixed with paritytech/polkadot-sdk#2292. Basically it meant to make a consistent check for the withdraw amount to prevent a corner case where the TX would be included in the pool even if it did not have enough balance to pay the fees.
|
I spent some time evaluating whether this change is still necessary, and the answer is yes.
Here are my notes comparing the behavior of both implementations: Upstream (reducible_balance): Our fork (can_withdraw): As you can see, the behavior and constraints differ significantly. |
This pull request introduces changes to the
frame/ethereumandframe/evmmodules to improve transaction validation and add a new method for checking the maximum withdrawable amount on the client side.