Followed the create a first substrate chain it all works good.
And then I want to go one step further to customize my on the demo.rs
file, here is what I am doing:
Totally replace code in demo.rs with code here, there is event involved now .
update the
lib.rs
with
Demo: demo::{Module, Call, Storage, Event<T>},
and
impl demo::Trait for Runtime {
type Event = Event;
}
- run
./scripts/build.rs
- run
./target/release/node-name --dev
Then I see my updated extrinsic function is NOT listed here on the Polkadot Web App or by upload the substrate_node_template_runtime_wasm.compact.wasm
file by following the the step 5 on tutorial
So I have to run the following code to make the update happens:
rm -rf ./target
cargo build --release
./target/release/node-name --dev
By discuss with @shawntabrizi he suggest with the following command
./scripts/build.sh
cargo build --release
./target/release/node-name purge-chain --dev
./target/release/node-name --dev
It seems that without purge-chain
both the substrate_node_template_runtime_wasm.compact.wasm
and ./target/release/node-name
are not updated.
Quoted here
By upgrading the runtime, you're simply switching out the block of code that is going to be receiving extrinsics and reading storage.
But I want know one step deeper, when upgrade a runtime node, what is the difference behind build.sh
and cargo build
? Is that because that substrate_node_template_runtime_wasm.compact.wasm
and/or ./target/release/node-name
binary is not updated in the case above?