Skip to content

Commit

Permalink
pallet-xcm: added useful error logs (#2408) (#4982)
Browse files Browse the repository at this point in the history
Added error logs in pallet-xcm to help in debugging, fixes #2408 

## TODO

- [x] change `log::error` to `tracing::error` format for `xcm-executor`
- [x] check existing logs, e.g. this one can be extended with more info
`tracing::error!(target: "xcm::reanchor", ?error, "Failed reanchoring
with error");`
- [x] use `tracing` instead of `log` for `pallet-xcm/src/lib.rs`

---------

Co-authored-by: Ayevbeosa Iyamu <aiyamu@vatebra.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
6 people authored Oct 15, 2024
1 parent 36eadec commit b20be7c
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 99 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions polkadot/xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bounded-collections = { workspace = true }
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
serde = { optional = true, features = ["derive"], workspace = true, default-features = true }
log = { workspace = true }
tracing = { workspace = true }

frame-support = { workspace = true }
frame-system = { workspace = true }
Expand Down Expand Up @@ -44,13 +44,13 @@ std = [
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-balances/std",
"scale-info/std",
"serde",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"tracing/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-runtime-apis/std",
Expand Down
8 changes: 4 additions & 4 deletions polkadot/xcm/pallet-xcm/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ benchmarks! {
&origin_location,
None,
).map_err(|error| {
log::error!("Fungible asset couldn't be deposited, error: {:?}", error);
tracing::error!("Fungible asset couldn't be deposited, error: {:?}", error);
BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX))
})?;
},
NonFungible(instance) => {
<T::XcmExecutor as XcmAssetTransfers>::AssetTransactor::deposit_asset(&asset, &origin_location, None)
.map_err(|error| {
log::error!("Nonfungible asset couldn't be deposited, error: {:?}", error);
tracing::error!("Nonfungible asset couldn't be deposited, error: {:?}", error);
BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX))
})?;
}
Expand Down Expand Up @@ -178,14 +178,14 @@ benchmarks! {
&origin_location,
None,
).map_err(|error| {
log::error!("Fungible asset couldn't be deposited, error: {:?}", error);
tracing::error!("Fungible asset couldn't be deposited, error: {:?}", error);
BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX))
})?;
},
NonFungible(instance) => {
<T::XcmExecutor as XcmAssetTransfers>::AssetTransactor::deposit_asset(&asset, &origin_location, None)
.map_err(|error| {
log::error!("Nonfungible asset couldn't be deposited, error: {:?}", error);
tracing::error!("Nonfungible asset couldn't be deposited, error: {:?}", error);
BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX))
})?;
}
Expand Down
Loading

0 comments on commit b20be7c

Please sign in to comment.