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

Fee handler #363

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Fee handler #363

wants to merge 3 commits into from

Conversation

kku9706
Copy link

@kku9706 kku9706 commented Jan 4, 2025

Try to resolve #361

Btw: Not sure fully understand the request, this is just a draft PR to get some feedback.

Copy link
Member

@seunlanlege seunlanlege left a comment

Choose a reason for hiding this comment

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

Good direction, but i think we can eliminate the WeightRouter entirely.

@@ -91,7 +91,7 @@ parachains-common = { workspace = true }

# ismp modules
ismp = { workspace = true }
pallet-ismp = { workspace = true, features = ["unsigned"] }
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 revert this

fn handle_fee(messages: &[Message], _signer: T::AccountId) -> DispatchResultWithPostInfo {
//Todo: reward the signer
Ok(PostDispatchInfo {
actual_weight: Some(get_weight::<T>(&messages)),
Copy link
Member

Choose a reason for hiding this comment

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

We should remove the WeightRouter from the Config trait as that is now replaced by this FeeHandler

Copy link
Author

Choose a reason for hiding this comment

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

Eliminate the WeightRouter entirely in d03c72b

Comment on lines +20 to +22
pub trait HandleFee<T: Config> {
fn handle_fee(messages: &[Message], signer: T::AccountId) -> DispatchResultWithPostInfo;
}
Copy link
Member

Choose a reason for hiding this comment

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

lets add a get_weight method here instead of using the weight router

Copy link
Author

@kku9706 kku9706 Jan 7, 2025

Choose a reason for hiding this comment

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

I'd suggest leaving weight to benchmark in a separate trait, as the convention FeeHandler focuses on custom fee logic(e.g., rewarding the signer).

Some refactoring accordingly in d03c72b

@seunlanlege Please let me know WDYT.

Self::execute(messages.clone())?;

Ok(PostDispatchInfo {
actual_weight: Some(get_weight::<T>(&messages)),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
actual_weight: Some(get_weight::<T>(&messages)),
actual_weight: Some(T::HandleFee::get_weight(&messages)),

Copy link
Author

Choose a reason for hiding this comment

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

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.

[pallet-ismp]: Introduce a FeeHandler
2 participants