diff --git a/templates/parachain/README.md b/templates/parachain/README.md index 91c3a90e537e..385b0cfd7a38 100644 --- a/templates/parachain/README.md +++ b/templates/parachain/README.md @@ -201,9 +201,34 @@ Development parachains: We recommend using [`chopsticks`](https://github.com/AcalaNetwork/chopsticks) when the focus is more on the runtime development and `OmniNode` is enough as is. +### Install chopsticks + +To use `chopsticks`, please install the latest version according to the installation [guide](https://github.com/AcalaNetwork/chopsticks?tab=readme-ov-file#install). + +### Build a raw chain spec + +Build the `parachain-template-runtime` as mentioned before in this guide and use `chain-spec-builder` +again but this time by passing `--raw-storage` flag: + +```sh +chain-spec-builder create --raw-storage --relay-chain "rococo-local" --para-id 1000 --runtime \ + target/release/wbuild/parachain-template-runtime/parachain_template_runtime.wasm named-preset development +``` + +### Start `chopsticks` with the chain spec + +We'll also need to set `--allow-unresolved-imports=true` because the `parachain-template-runtime` is not built +with the benchmarking feature, and some of the host functions required for it are missing. + +```sh +npx @acala-network/chopsticks@latest --chain-spec --allow-unresolved-imports=true +``` + +### Alternatives + `OmniNode` can be still used for runtime development if using the `--dev` flag, while `parachain-template-node` doesn't -support it at this moment (but it can still be used to test a runtime in a full setup where it is started alongside a -relay chain network, as we do with the `zombienet.toml` file). +support it at this moment. It can still be used to test a runtime in a full setup where it is started alongside a +relay chain network (see [Parachain Template node](#parachain-template-node) setup). ## Contributing diff --git a/templates/parachain/runtime/src/configs/mod.rs b/templates/parachain/runtime/src/configs/mod.rs index ba4c71c7f218..57bb8e7c1470 100644 --- a/templates/parachain/runtime/src/configs/mod.rs +++ b/templates/parachain/runtime/src/configs/mod.rs @@ -63,7 +63,8 @@ use super::{ MessageQueue, Nonce, PalletInfo, ParachainSystem, Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, Session, SessionKeys, System, WeightToFee, XcmpQueue, AVERAGE_ON_INITIALIZE_RATIO, EXISTENTIAL_DEPOSIT, HOURS, - MAXIMUM_BLOCK_WEIGHT, MICRO_UNIT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION, + MAXIMUM_BLOCK_WEIGHT, MICRO_UNIT, MINIMUM_PERIOD, NORMAL_DISPATCH_RATIO, SLOT_DURATION, + VERSION, }; use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin}; @@ -133,7 +134,7 @@ impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - type MinimumPeriod = ConstU64<0>; + type MinimumPeriod = ConstU64; type WeightInfo = (); } diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index 43e76dba0591..d21f33d4da6b 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -187,6 +187,9 @@ mod block_times { // NOTE: Currently it is not possible to change the slot duration after the chain has started. // Attempting to do so will brick block production. pub const SLOT_DURATION: u64 = MILLI_SECS_PER_BLOCK; + + /// Minimum period between blocks set for the `pallet_timestamp`. + pub const MINIMUM_PERIOD: u64 = SLOT_DURATION / 2; } pub use block_times::*;