Centrifuge Chain is Centrifuge's substrate based chain.
Install Rust:
curl https://sh.rustup.rs -sSf | sh
Initialize your Wasm Build environment:
./scripts/init.sh install-toolchain
Build Wasm and native code:
cargo build --release
cargo test -p centrifuge-runtime --release
Start relay chain
./scripts/init.sh start-relay-chain
Start centrifuge-chain as parachain
./scripts/init.sh start-parachain
Note: above command will show logs and block until parachain is stopped
Detailed logs may be shown by running the node with the following environment variables set: RUST_LOG=debug RUST_BACKTRACE=1
.
Onboard parachain to Relay chain
./scripts/init.sh onboard-parachain
- Be sure to change the
id
andprotocol_id
insrc/chain_spec.rs
- Run
cargo run --release build-spec --disable-default-bootnode --chain fulvous > res/[name]-spec.json
to export the chain spec - Commit
Lint the project with cargo +nightly fmt
. This excludes certain paths (defined in rustfmt.toml
) that we want to stay as close as possible to paritytech/substrate
to simplify upgrading to new releases.
- Check out the commit at which the runtime was built.
- Run
TARGET=build-runtime RUST_TOOLCHAIN=nightly ./ci/script.sh
- A similar output is generated
✨ Your Substrate WASM Runtime is ready! ✨
Summary:
Generator : srtool v0.9.5
GIT commit : 27326e69481f08313d6048da1500befe209bdf71
GIT tag : v0.0.3
GIT branch : master
Time : 2020-03-20T11:00:24Z
Rustc : rustc 1.43.0-nightly (5e7af4669 2020-02-16)
Size : 928 KB (950464 bytes)
Content : 0x0061736d0100000001c2022f60037f7f...3436363920323032302d30322d313629
Package : centrifuge-runtime
Proposal : 0x5c3d2cd41d70c514566c9b512743ad229fa96518061fe21c8178ba43cfcf16dc
SHA256 : 3f0d2e98e2351144027826f26277bda90e5fabc13f0945fc8fec13d116602e2a
Wasm : ./target/srtool/release/wbuild/centrifuge-runtime/centrifuge_runtime.compact.wasm
Proposal
hash should match the runtime upgrade proposal
- Pull the latest commit of
cumulus
that is building without issues. - Then take the commits of
substrate, polkadot, and grandap-bridge-gadget
from Cargo.lock of cumulus. - Move our substrate fork
master
branch to commit you derived above. - Then for each repo in the order
grandpa-bridge-gadget, polkadot, and cumulus
, move our fork'smaster
branch to the commit derived above and rebase those oncentrifuge
branch - Then on centrifuge, deleting Cargo.lock file and running
cargo check
will pull the latest commits from respective forks
This script will take a valid chain-spec chain_id, a parachain_id and a flag to build new spec or not, and will output genesis spec (raw and plain), wasm and state files.
./scripts/export_parachain_files.sh charcoal-staging 10001 true
Adapt parameters accordingly.
Pallets are to be benchmarked to find the correct weight for extrinsics. Follow substrate's benchmarking boiler-plate code
and add pallet benchmark to the runtime. Then run the following script to generate a benchamarked weights.rs
file for the pallet
./scripts/init.sh benchmark <your_pallet> <output generated weight file>(optional)
Example command to generate pallet_fees
with default output
./scripts/init.sh benchmark pallet_fees
default output will be ./pallets/fees/src/weight.rs
You can override this by passing output path as last argument
- First collect commits of Substrate, Grandpa-Bridge, Polkadot from the latest cumulus
- Bring our fork of all the above repos to the above commits
- Use diener in Grandpa brigde, polkadot, and cumulus to use our forks in
centrifuge
branch - Then update deps on centrifuge chain