contracts: Move Schedule from Storage to Config (#8773)

* Move `Schedule` from Storage to Config

* Updated CHANGELOG

* Fix nits from review

* Fix migration

* Print the debug buffer as tracing message

* Use `debug` instead of `trace` and update README

* Add additional assert to test

* Rename `schedule_version` to `instruction_weights_version`

* Fixed typo

* Added more comments to wat fixtures

* Add clarification for the `debug_message` field
This commit is contained in:
Alexander Theißen
2021-05-13 21:56:11 +02:00
committed by GitHub
parent 3c0270fe57
commit 1ac95b6ba6
23 changed files with 1465 additions and 1056 deletions
+16 -7
View File
@@ -59,17 +59,26 @@ writing WebAssembly based smart contracts in the Rust programming language.
## Debugging
Contracts can emit messages to the node console when run on a development chain through the
`seal_println` API. This is exposed in ink! via
Contracts can emit messages to the client when called as RPC through the `seal_debug_message`
API. This is exposed in ink! via
[`ink_env::debug_println()`](https://docs.rs/ink_env/latest/ink_env/fn.debug_println.html).
In order to see these messages the log level for the `runtime::contracts` target needs to be raised
to at least the `info` level which is the default. However, those messages are easy to overlook
because of the noise generated by block production. A good starting point for contract debugging
could be:
Those messages are gathered into an internal buffer and send to the RPC client.
It is up the the individual client if and how those messages are presented to the user.
This buffer is also printed as a debug message. In order to see these messages on the node
console the log level for the `runtime::contracts` target needs to be raised to at least
the `debug` level. However, those messages are easy to overlook because of the noise generated
by block production. A good starting point for observing them on the console is:
```bash
cargo run --release -- --dev --tmp -lerror,runtime::contracts
cargo run --release -- --dev --tmp -lerror,runtime::contracts=debug
```
This raises the log level of `runtime::contracts` to `debug` and all other targets
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)
License: Apache-2.0