-
Notifications
You must be signed in to change notification settings - Fork 52
Fix tx_payment TransactionExtensions; Use call_weight instead of total_weight
#1863
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
base: develop_v8
Are you sure you want to change the base?
Conversation
| fee, | ||
| subsidiser: _, | ||
| } => { | ||
| let tip = self.ensure_valid_tip(&who, info)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be rejected in validate? I don't think we need to check this again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The val value is coming from validate, so we can trust the tip value (line 1032) from it.
TransactionExtensions; Use call_weight instead of total_weight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes TransactionExtensions in the tx_payment pallet by changing from total_weight() method calls to direct call_weight field access across multiple pallets. The PR also refactors the transaction payment logic by splitting fee checking and withdrawal into separate methods (can_withdraw_fee and withdraw_fee) and renaming the fee parameter to the more descriptive fee_with_tip in the OnChargeTransaction trait methods.
Key Changes
- Replaced all
total_weight()method calls with directcall_weightfield access onDispatchInfostructs across utility, transaction-payment, multisig, contracts, and committee pallets - Refactored
ChargeTransactionPaymentto implement properTransactionExtensiontrait with separatevalidateandpreparemethods - Renamed
feeparameter tofee_with_tipinOnChargeTransactiontrait for clarity
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pallets/utility/src/lib.rs |
Changed total_weight() to call_weight in weight calculation functions |
pallets/transaction-payment/src/payment.rs |
Renamed fee parameter to fee_with_tip for better clarity |
pallets/transaction-payment/src/lib.rs |
Refactored transaction payment extension, added can_withdraw_fee and withdraw_fee methods, updated validate and prepare implementations |
pallets/runtime/tests/src/utility_test.rs |
Updated tests to use call_weight instead of total_weight() |
pallets/runtime/tests/src/transaction_payment_test.rs |
Updated tests to call validate before prepare following new TransactionExtension pattern |
pallets/runtime/tests/src/relayer_test.rs |
Updated tests to call validate before prepare |
pallets/runtime/tests/src/balances_test.rs |
Updated test to use validate instead of prepare directly |
pallets/runtime/build_tool/src/lib.rs |
Removed disable_runtime_version_section_check() call |
pallets/multisig/src/lib.rs |
Changed total_weight() to call_weight |
pallets/contracts/src/chain_extension.rs |
Changed total_weight() to call_weight |
pallets/committee/src/lib.rs |
Changed total_weight() to call_weight |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
changelog
other
total_weighttocall_weight;