-
Notifications
You must be signed in to change notification settings - Fork 104
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
Refactoring XcmExportFeeToSibling and more tests for outbound fee #1109
Merged
Merged
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3ac5f12
Handle fee with error instead of silently failing
yrong 319d4ba
Merge branch 'main' into ron/handle-fee-with-error
yrong 279dbf2
Fix for pallet rename
yrong 7f7e4bc
AssetTransactor::deposit_asset directly with error thrown
yrong 4ddca9c
Move invalid params to test
yrong 965e579
Check more strictly
yrong 5fb402b
More tests
yrong 3894746
More tests
yrong 8361b26
Handle fee without error
yrong 79f79f1
Update sdk
yrong 3fa6fcd
More tests for outbound fee
yrong 76f4d4f
More tests
yrong d359e19
Update parachain/runtime/runtime-common/src/lib.rs
yrong 6ca0929
Update parachain/runtime/runtime-common/src/lib.rs
yrong 5922a5e
Update parachain/runtime/runtime-common/src/lib.rs
yrong 122a5a2
Update parachain/runtime/runtime-common/src/lib.rs
yrong 986f19e
Merge branch 'main' into ron/handle-fee
yrong c789e69
Merge branch 'ron/handle-fee' of https://github.com/Snowfork/snowbrid…
yrong 7514bd1
More param checks & more tests
yrong 18daf99
Rename test case less confusing
yrong f43fce3
Remove sanity check for Pricing params
yrong 711720c
Remove test unnecessary
yrong de03393
Revert to unroutable
yrong 85cb976
Merge branch 'main' into ron/handle-fee
yrong af15053
Revert the checks
yrong 122572d
Rename as MockAssetTransactor
yrong 15132aa
Update sdk
yrong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks don't make sense to me. The expectation is that
T::GasMeter::maximum_gas_used_at_most
andSelf::calculate_fee
always return correct values for any arbitraryCommand
.This behavior is important, as we can't reject commands because for some reason we could not calculate fees. To do otherwise would lead to a loss of user funds.
It seems these checks are acting as unit tests, and so we should convert them to actual unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check
fee.remote > 0
is for the test case as I mentioned here in #1109 (comment) in which theremote_fee
calculated being zero(though pricing parameters are all non-zero and valid). It will lead to the sovereign account of the sibling chain not being properly refunded inXcmExportFeeToSibling
and finally the agent on the Ethereum side can't be funded.That's also the reason why I introduced the sanity check of the pricing params, prefer to
reject commands because for some reason we could not calculate fees
rather than silently ignoring.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAXIMUM_GAS_CAP
added here is a hard limit that applies to all commands. It's mainly for command Upgrade with a sanityinitializer_max_gas
. It also applies to the future arbitrary transact for which the gas is dynamic from the input of the end-user.MAXIMUM_GAS_CAP
should be consistent with the default relayer config otherwise the check in Gateway will always fail and the bridge stuck.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ron, that makes sense. But it seems there is a bug in our code if the calculated remote fee ends up being zero. Can you investigate why this happens? We should try and fix it so that we don't need to have these checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should introduce
MAXIMUM_GAS_CAP
, for the same reasons I outlined in #1109 (comment).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1109 (comment). I think its fine if calculated remote fee is zero. It just means the fee is too low to be represented using DOT decimals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks reverted in af15053