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

Make XCM fee handler implementation more compliant with MultiAsset non-zero amounts #2269

Merged
merged 4 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ jobs:
# Checks are run after uploading artifacts since they are modified by the tests
- name: Unit tests
run: |
cargo test --release --all --features=evm-tracing
cargo test --profile testnet --all --features=evm-tracing
- name: Run sccache stat for check pre test
shell: bash
run: ${SCCACHE_PATH} --show-stats
Expand Down
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ incremental = false
inherits = "release"
lto = true

[profile.testnet]
inherits = "release"
debug = 1 # debug symbols are useful for profilers
debug-assertions = true
overflow-checks = true

[profile.release]
# Moonbeam runtime requires unwinding.
opt-level = 3
Expand Down
10 changes: 5 additions & 5 deletions primitives/xcm/src/fee_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ impl<
{
fn drop(&mut self) {
if let Some((id, amount, _)) = self.1.clone() {
R::take_revenue((id, amount).into());
if amount > 0 {
R::take_revenue((id, amount).into());
}
}
}
}
Expand All @@ -167,10 +169,8 @@ impl<
fn take_revenue(revenue: MultiAsset) {
match Matcher::matches_fungibles(&revenue) {
Ok((asset_id, amount)) => {
if !amount.is_zero() {
let ok = Assets::mint_into(asset_id, &ReceiverAccount::get(), amount).is_ok();
debug_assert!(ok, "`mint_into` cannot generally fail; qed");
}
let ok = Assets::mint_into(asset_id, &ReceiverAccount::get(), amount).is_ok();
debug_assert!(ok, "`mint_into` cannot generally fail; qed");
}
Err(_) => log::debug!(
target: "xcm",
Expand Down