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

Delivery fee should cover cost of local processing #975

Merged
merged 58 commits into from
Oct 27, 2023
Merged

Delivery fee should cover cost of local processing #975

merged 58 commits into from
Oct 27, 2023

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Oct 20, 2023

We need to take base fee(fee in bridgehub) into consideration, more context in #968 (comment)

@vgeddes
Copy link
Collaborator

vgeddes commented Oct 25, 2023

Lets limit the scope of this PR, as it does solve a few important problems:

Copy link
Contributor

@alistair-singh alistair-singh left a comment

Choose a reason for hiding this comment

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

Looks good!

parachain/pallets/control/src/tests.rs Outdated Show resolved Hide resolved
@yrong
Copy link
Contributor Author

yrong commented Oct 26, 2023

Remove all voucher/redeem and estimate_fee runtime API.

Hey, Vincent. Actually voucher/redeem has been removed in previous commit, but for estimate_fee I prefer to keep as it could be helpful for chains to estimate fee in advance before a real transfer. Also the return of the runtime api includes both base_fee and delivery_fee which is not obvious in current impl.

@vgeddes
Copy link
Collaborator

vgeddes commented Oct 26, 2023

Remove all voucher/redeem and estimate_fee runtime API.

Hey, Vincent. Actually voucher/redeem has been removed in previous commit, but for estimate_fee I prefer to keep as it could be helpful for chains to estimate fee in advance before a real transfer. Also the return of the runtime api includes both base_fee and delivery_fee which is not obvious in current impl.

OK, lets keep estimate_fee.

parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/control/src/mock.rs Show resolved Hide resolved
parachain/pallets/outbound-queue/runtime-api/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/outbound-queue/src/api.rs Outdated Show resolved Hide resolved
parachain/primitives/core/src/outbound.rs Outdated Show resolved Hide resolved
parachain/primitives/router/src/outbound/mod.rs Outdated Show resolved Hide resolved
parachain/primitives/core/src/outbound.rs Outdated Show resolved Hide resolved
parachain/primitives/core/src/outbound.rs Outdated Show resolved Hide resolved
parachain/pallets/outbound-queue/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/outbound-queue/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@vgeddes vgeddes left a comment

Choose a reason for hiding this comment

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

Last round of minor comments

Comment on lines 24 to 26
pub fn calculate_fee<Runtime>(
message: Message,
) -> Result<Fees<<Runtime as Config>::Balance>, SubmitError>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, actually, should rename Runtime to T. They are the same thing really. And I think its not necessary to cast Runtime into Config.

Suggested change
pub fn calculate_fee<Runtime>(
message: Message,
) -> Result<Fees<<Runtime as Config>::Balance>, SubmitError>
pub fn calculate_fee<T>(
message: Message,
) -> Result<Fees<T::Balance>, SubmitError>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

parachain/pallets/outbound-queue/src/api.rs Outdated Show resolved Hide resolved
id: message_id,
origin: message.origin,
message: encoded,
fee,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not seeing the OutboundQueueTicket.fee field being used anywhere. Can it removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -132,7 +132,7 @@ where
})?;

// convert fee to MultiAsset
let fee = MultiAsset::from((MultiLocation::parent(), fee)).into();
let fee = MultiAsset::from((MultiLocation::parent(), fee.total())).into();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let fee = MultiAsset::from((MultiLocation::parent(), fee.total())).into();
let fee = MultiAsset::from((MultiLocation::parent(), fees.total())).into();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vgeddes vgeddes changed the title Base fee Delivery fee should cover costs of local processing Oct 27, 2023
@vgeddes vgeddes changed the title Delivery fee should cover costs of local processing Delivery fee should cover cost of local processing Oct 27, 2023
@yrong yrong merged commit 187c3ff into main Oct 27, 2023
5 checks passed
@yrong yrong deleted the ron/base-fee branch October 27, 2023 14: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.

3 participants