Skip to content

Commit

Permalink
fully enable RuntimeDebug in feature = try-runtime (paritytech#14136
Browse files Browse the repository at this point in the history
)

* fully enable `RuntimeDebug` in `feature = try-runtime`

* Delete settings.json

* fix

* fix

* fix

* update lock file with sp-debug-derive dep

* update doc

---------

Co-authored-by: muharem <ismailov.m.h@gmail.com>
(cherry picked from commit 1eb0611)
  • Loading branch information
kianenigma authored and ekovalev committed Jul 3, 2023
1 parent 6fedf4d commit 2ce3bac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

11 changes: 9 additions & 2 deletions frame/support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../pri
sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../primitives/inherents" }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../primitives/staking" }
sp-weights = { version = "4.0.0", default-features = false, path = "../../primitives/weights" }
sp-debug-derive = { default-features = false, path = "../../primitives/debug-derive" }
tt-call = "1.0.8"
frame-support-procedural = { version = "4.0.0-dev", default-features = false, path = "./procedural" }
paste = "1.0"
Expand Down Expand Up @@ -70,8 +71,14 @@ std = [
"log/std",
"environmental/std",
]
runtime-benchmarks = []
try-runtime = []
runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks"
]
try-runtime = [
"sp-debug-derive/force-debug"
]
# By default some types have documentation, `no-metadata-docs` allows to reduce the documentation
# in the metadata.
no-metadata-docs = ["frame-support-procedural/no-metadata-docs"]
Expand Down
14 changes: 5 additions & 9 deletions frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,13 @@ pub fn derive_debug_no_bound(input: TokenStream) -> TokenStream {
}

/// Derive [`Debug`], if `std` is enabled it uses `frame_support::DebugNoBound`, if `std` is not
/// enabled it just returns `"<stripped>"`.
/// enabled it just returns `"<wasm:stripped>"`.
/// This behaviour is useful to prevent bloating the runtime WASM blob from unneeded code.
#[proc_macro_derive(RuntimeDebugNoBound)]
pub fn derive_runtime_debug_no_bound(input: TokenStream) -> TokenStream {
#[cfg(not(feature = "std"))]
{
if cfg!(any(feature = "std", feature = "try-runtime")) {
debug_no_bound::derive_debug_no_bound(input)
} else {
let input: syn::DeriveInput = match syn::parse(input) {
Ok(input) => input,
Err(e) => return e.to_compile_error().into(),
Expand All @@ -662,18 +663,13 @@ pub fn derive_runtime_debug_no_bound(input: TokenStream) -> TokenStream {
const _: () = {
impl #impl_generics core::fmt::Debug for #name #ty_generics #where_clause {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
fmt.write_str("<stripped>")
fmt.write_str("<wasm:stripped>")
}
}
};
)
.into()
}

#[cfg(feature = "std")]
{
debug_no_bound::derive_debug_no_bound(input)
}
}

/// Derive [`PartialEq`] but do not bound any generic. Docs are at
Expand Down

0 comments on commit 2ce3bac

Please sign in to comment.