Skip to content
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

Specify the currency for the execution fee #461

Merged
merged 25 commits into from
Nov 20, 2023

Conversation

imstar15
Copy link
Member

@imstar15 imstar15 commented Nov 2, 2023

We have implemented the functionality to specify different currencies as the execution fee.

Based on whether the currency is native or foreign, we have employed different processing flows and XCM instructions.

pallets/automation-time/src/fees.rs Outdated Show resolved Hide resolved
pallets/automation-time/src/fees.rs Outdated Show resolved Hide resolved
pallets/automation-time/src/fees.rs Outdated Show resolved Hide resolved
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 15bc38d to 28c77e1 Compare November 9, 2023 12:37
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from d3538ae to b6392d5 Compare November 10, 2023 12:23
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from b6392d5 to 2d8387c Compare November 10, 2023 12:37
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 484439e to 93c9877 Compare November 14, 2023 14:56
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 93c9877 to 955fd18 Compare November 14, 2023 15:02
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 13a6dab to 0ad89ef Compare November 14, 2023 15:19
Copy link
Member

@chrisli30 chrisli30 left a comment

Choose a reason for hiding this comment

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

The code is now much cleaner, making it easier for me to read and understand. 👍

pallets/automation-time/src/fees.rs Show resolved Hide resolved
pallets/automation-time/src/fees.rs Show resolved Hide resolved
pallets/automation-time/src/fees.rs Show resolved Hide resolved
pallets/automation-time/src/lib.rs Show resolved Hide resolved
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from b7ebf10 to 27f51dd Compare November 15, 2023 15:57
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 9d183cc to 7c2f3e2 Compare November 16, 2023 07:19
@imstar15 imstar15 marked this pull request as ready for review November 16, 2023 11:02
new_test_ext(0).execute_with(|| {
let destination = MultiLocation::new(1, X1(Parachain(PARA_ID)));
let alice = AccountId32::new(ALICE);
let mut spy = 0;
Copy link
Member

Choose a reason for hiding this comment

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

What does the variable spy mean?

Copy link
Member

Choose a reason for hiding this comment

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

let’s call it has_callback_run and set it initially false.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

}

#[test]
fn call_pay_checked_fees_for_with_alternate_flow_and_no_execution_fee_success() {
Copy link
Member

Choose a reason for hiding this comment

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

Is will_fail case for alternate flow not needed?

Copy link
Member

Choose a reason for hiding this comment

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

execution_fee in alternate flow is not deducted on our side but after XCM, so there’s no insufficient_execution_fee case.

pallets/automation-time/src/fees.rs Show resolved Hide resolved
pallets/automation-time/src/fees.rs Show resolved Hide resolved
new_test_ext(0).execute_with(|| {
let destination = MultiLocation::new(1, X1(Parachain(PARA_ID)));
let alice = AccountId32::new(ALICE);
let mut spy = 0;
Copy link
Member

Choose a reason for hiding this comment

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

let’s call it has_callback_run and set it initially false.

}

#[test]
fn call_pay_checked_fees_for_with_alternate_flow_and_no_execution_fee_success() {
Copy link
Member

Choose a reason for hiding this comment

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

execution_fee in alternate flow is not deducted on our side but after XCM, so there’s no insufficient_execution_fee case.

pallets/automation-time/src/fees.rs Show resolved Hide resolved
@imstar15 imstar15 force-pushed the specify-currency-for-execution-fee branch from 3581e1a to 6e7f5c3 Compare November 17, 2023 03:21
Copy link
Member

@chrisli30 chrisli30 left a comment

Choose a reason for hiding this comment

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

The comments are all addressed.

@@ -19,6 +19,7 @@
use crate::{AccountOf, Action, ActionOf, Config, Error, MultiBalanceOf, Pallet};

use frame_support::traits::Get;
use frame_system::RawOrigin;
Copy link
Member

Choose a reason for hiding this comment

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

Why is the addition of this line? Is it necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.
During testing, we require Root permissions to deposit funds into the test account.

@chrisli30 chrisli30 merged commit b0f9b92 into master Nov 20, 2023
3 checks passed
@chrisli30 chrisli30 deleted the specify-currency-for-execution-fee branch November 20, 2023 01:00
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