Skip to content

Conversation

athei
Copy link
Member

@athei athei commented Sep 9, 2025

This builds on #9590. The plan is to get that in first and then this PR. After that new new gas mapping can get id of the the max_deposit.

Is basically just changes were to collect the deposit from depending on configutation and if its an eth or native transaction.

Sorry for tbe big diff but needed to another arg to bare_call and its always a huge hassle to so. While I had to do this anyways I grouped the all the together in a new ExecConfig. Will making new config params much easier, in the future.

It will take the storage deposits from he hold created by the transaction payment. It is disabled on Westend for now.

@athei athei requested review from a team as code owners September 9, 2025 08:37
@athei athei changed the title pallet_revive: Allow collecting fees from the txpayment hold insead of free_balance pallet_revive: Allow collecting fees from the txpayment hold instead of free_balance Sep 9, 2025
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/17576836057
Failed job name: test-linux-stable

Comment on lines +282 to +285
/// Set to `Some` in order to collect all storage deposits from the specified hold.
///
/// If `None` the deposits are collected from free balance. In any case, they are
/// collected from the transaction signers native balance.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a feature flag that we will remove later? Not sure why it's an Option otherwise

Copy link
Member Author

@athei athei Sep 10, 2025

Choose a reason for hiding this comment

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

I would love to make it non optional. However, this

#[frame_support::register_default_impl(TestDefaultConfig)]

forces me to provide a default. Can I skip some types there?

In the mean time I decided to abuse as feature flag. But eventually it shouldn't be optional.

/// `from` is usually the transaction origin and `to` a contract or
/// the pallets own account.
fn charge_deposit(
hold_reason: Option<HoldReason>,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is always HoldReason::StorageDepositReserve when Some right?
not sure it's not easier to read if we just pass a bool

Copy link
Member Author

Choose a reason for hiding this comment

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

Can also be CodeUploadDepositReserve.

Comment on lines 1804 to 1816
T::Currency::transfer_on_hold(
&deposit_source,
from,
to,
amount,
Precision::BestEffort,
Restriction::Free,
Fortitude::Polite,
)?;
if let Some(hold_reason) = hold_reason {
T::Currency::hold(&hold_reason.into(), to, amount)?;
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't tis be Precision::Exact here? or you can end up transferring some of the free balance of the contract to to the hold

too bad we can't transfer from one hold to the other directly, should we add that feature?`

Copy link
Member Author

Choose a reason for hiding this comment

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

shouldn't tis be Precision::Exact here? or you can end up transferring some of the free balance of the contract to to the hold

Got catch. Copy paste fuckup.

too bad we can't transfer from one hold to the other directly, should we add that feature?

You can with MutateHold::transfer_on_hold but it doesn't let you specify the target hold reason. I guess it uses the sorce hold reason. Yes, I think we should add this feature. But changing the trait will be a big refactor. So I decided to not do that here.

@athei
Copy link
Member Author

athei commented Sep 10, 2025

Okay the CI fails because is doesn't work with the current gas mapping. This is because there is not enough balance in the hold since we do not pre-charge the deposit as weight. So I will disable the collection from the hold in every runtime. Otherwise we cannot merge to master.

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.

2 participants