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

add fee handling for automation price #436

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

v9n
Copy link
Member

@v9n v9n commented Sep 28, 2023

Now that we have weight, attempt to handle fee properly.

We charged fee only once when schedule the job succesfully. Because this isn't recurring tasks, we only need to charge once.

@v9n v9n marked this pull request as draft September 28, 2023 10:17
@v9n v9n force-pushed the fee-handle-for-automation-price branch from c9050e0 to 550ce0f Compare September 29, 2023 18:16
@v9n v9n changed the title fee handling for automation price add fee handling for automation price Sep 29, 2023
@v9n v9n requested a review from chrisli30 September 29, 2023 18:23
@v9n v9n marked this pull request as ready for review September 29, 2023 18:23
@v9n v9n force-pushed the fee-handle-for-automation-price branch 2 times, most recently from b846c99 to 1395048 Compare September 30, 2023 00:11
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.

I re-compiled with this PR but found tasks are not being scheduled after Shibuya’s polkadotXcm.send.

@v9n could you test the code with our demo to see what’s wrong? /~https://github.com/OAK-Foundation/automation-price-demo

@@ -407,13 +444,14 @@ fn test_shift_tasks_movement_through_price_changes() {
Box::new(NATIVE_LOCATION.into()),
Box::new(AssetPayment {
asset_location: MultiLocation::new(0, Here).into(),
amount: 10000000000000
amount: 10
Copy link
Member

Choose a reason for hiding this comment

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

Is 10 too small for testing purpose? 10 * 10^10 units would make more sense?

Copy link
Member

@chrisli30 chrisli30 Oct 10, 2023

Choose a reason for hiding this comment

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

@v9n, follow up on this comment.

@v9n v9n added the WIP work in progress, not ready for review label Oct 10, 2023
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.

I have no more comments on this PR. @imstar15 could you also examine the XCM related code?

@v9n v9n force-pushed the fee-handle-for-automation-price branch 2 times, most recently from 164e12a to f81a7a8 Compare October 23, 2023 16:36
@v9n v9n removed the WIP work in progress, not ready for review label Oct 23, 2023
@v9n
Copy link
Member Author

v9n commented Oct 23, 2023

This PR is ready to review again.

The issue with failure to schedule job is because we send an invalid XCM v3 location and MultiLocation::try_from instead of reject converting it to {Parent: 0, interrior: Here} so it always say not sufficient balance.

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.

LGTM. I left a few comments.

#[cfg(not(feature = "dev-queue"))]
ensure_root(origin)?;
// #[cfg(not(feature = "dev-queue"))]
// ensure_root(origin)?;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to turn on this #[cfg(not(feature = "dev-queue"))]?

@@ -756,12 +765,9 @@ pub mod pallet {
};

Self::validate_and_schedule_task(task)?;
// TODO withdraw fee
//T::FeeHandler::withdraw_fee(&who, fee).map_err(|_| Error::<T>::InsufficientBalance)?;
Copy link
Member

Choose a reason for hiding this comment

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

Without this line, is the fee actually withdrawn?

@v9n v9n force-pushed the fee-handle-for-automation-price branch from cdc9cc0 to 369b795 Compare October 24, 2023 19:01
@v9n v9n merged commit 5f5a08f into master Oct 24, 2023
3 checks passed
@v9n v9n deleted the fee-handle-for-automation-price branch October 24, 2023 20:39
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