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

Fix lp-gateway routers' weight and fee calculations #1537

Merged
merged 7 commits into from
Sep 11, 2023

Conversation

NunoAlexandre
Copy link
Contributor

@NunoAlexandre NunoAlexandre commented Sep 8, 2023

Changes

Drop the XcmRouter.fee_per_second field and add the 2 following new ones

pub transact_weight_at_most: Weight,
pub overall_weight: Weight,
pub fee_amount: u128,

That way we have complete control over those two values being passed down to XcmTransactor, instead of storing values which then have harcoded calculations in the runtime which we can't change without a runtime upgrade.

And adjust the integration tests to use reasonable amounts and verify
the fees being charged.
@NunoAlexandre NunoAlexandre self-assigned this Sep 8, 2023
@NunoAlexandre
Copy link
Contributor Author

We have to keep the max_gas_limit since we needed that for the encoded evm call function. We could derive that from the transact max weight but then we are again stucking ourselves with hardcoded logic.

@NunoAlexandre
Copy link
Contributor Author

@cdamian @wischli @mustermeiszer this should be ready now. The only thing we need to discuss is migrations, which would only be needed for Algol. do we want to do that? 🙃

@mustermeiszer
Copy link
Collaborator

Nope we just set a new router for algol

@NunoAlexandre NunoAlexandre marked this pull request as ready for review September 8, 2023 15:18
Copy link
Collaborator

@mustermeiszer mustermeiszer left a comment

Choose a reason for hiding this comment

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

Can we merge this?

@NunoAlexandre
Copy link
Contributor Author

Can we merge this?

yes please :) if there are no review remarks ofc.

@@ -814,10 +814,28 @@ fn add_currency() {
})
));

assert_eq!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding these checks! <3

@@ -315,29 +304,6 @@ mod xcm_router {
assert_ok!(router.do_send(test_data.sender, test_data.msg));
});
}

#[test]
fn transactor_info_not_set() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for removing this, it was a left-over from the time we had init logic in the router IIRC.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My artifact. just thought it is still valid to test whether it works if global info is not set. But is implicitly anyways tested ^^

Copy link
Contributor

@cdamian cdamian left a comment

Choose a reason for hiding this comment

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

Thank you @NunoAlexandre !

@NunoAlexandre NunoAlexandre enabled auto-merge (squash) September 11, 2023 09:18
@mustermeiszer mustermeiszer merged commit 90837d9 into main Sep 11, 2023
10 checks passed
@NunoAlexandre NunoAlexandre deleted the n/fix-lpg-weights branch September 11, 2023 15:02
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