Skip to content

Conversation

@HenriqueNogara
Copy link
Contributor

@HenriqueNogara HenriqueNogara commented Dec 22, 2025

changelog

other

  • Fix tx_payment TransactionExtensions;
  • Change total_weight to call_weight;

fee,
subsidiser: _,
} => {
let tip = self.ensure_valid_tip(&who, info)?;
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@HenriqueNogara HenriqueNogara changed the title V8 fix Fix tx_payment TransactionExtensions; Use call_weight instead of total_weight Dec 22, 2025
Copy link

Copilot AI left a 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 direct call_weight field access on DispatchInfo structs across utility, transaction-payment, multisig, contracts, and committee pallets
  • Refactored ChargeTransactionPayment to implement proper TransactionExtension trait with separate validate and prepare methods
  • Renamed fee parameter to fee_with_tip in OnChargeTransaction trait 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants