Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add some readme doc
  • Loading branch information
pgherveou committed Mar 24, 2023
commit 174ef9e1ca64fe6321c0809121be334788adefdc
12 changes: 12 additions & 0 deletions frame/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ to `error` in order to prevent them from spamming the console.
`--dev`: Use a dev chain spec
`--tmp`: Use temporary storage for chain data (the chain state is deleted on exit)

## Host function tracing

For contract authors it can be a helpful debugging tool to see which host functions are called with
which arguments and what was the result. In order to see these messages on the node console,
the log level for the `runtime::contracts::strace` target needs to be raised to the `trace` level

Example:

```bash
cargo run --release -- --dev -lerror,runtime::contracts::strace=trace,runtime::contracts=debug
```

## Unstable Interfaces

Driven by the desire to have an iterative approach in developing new contract interfaces
Expand Down
5 changes: 2 additions & 3 deletions frame/contracts/proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,8 @@ fn expand_functions(def: &EnvDef, expand_blocks: bool, host_state: TokenStream2)
let is_stable = f.is_stable;
let not_deprecated = f.not_deprecated;

// wrapped host function body call with traces when target is`runtime::contracts::strace` and level is `trace`
// e.g ./target/release/substrate-contracts-node -l "fatal,runtime::contracts::strace=trace" --dev
//WIP(pg): replace comment above with link once the doc has been added to the readme
// wrapped host function body call with host function traces
// see https://github.com/paritytech/substrate/tree/master/frame/contracts#host-function-tracing
let wrapped_body_with_trace = {
let params_fmt_str = params.clone().filter_map(|arg| match arg {
syn::FnArg::Receiver(_) => None,
Expand Down