-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make block time configurable #483
Comments
you should use chopsticks |
Moved to backlog as this is already possible, not particularly easy though |
@juangirini please don't post internal links. People outside of parity can not access them. |
@juangirini @kianenigma Would it be possible to re-prioritize this issue? This has a huge impact in the DX for JS developers and to onboard new contributors. |
This can not just be done at genesis. It requires that you build with the |
Sorry, I didn't want suggest what is the best way to implement this. But I do wanted to highlight the huge impact on the DX. Regarding |
I can’t believe you still haven’t tried https://github.com/AcalaNetwork/chopsticks |
What @xlc is saying 🙈 |
@xlc apologies for the late reply and thx for the chopsticks suggestion. I did try chopsticks and it's a super nice tool. However, the idea for this request is to have some kind of native support within |
why? you can’t request something without explanation |
this is already covered by chopsticks so it doesn’t count |
I think it depends
|
I just don't understand this sentence. Can you elaborate?
I guess you really didn't try Chopsticks. Please, give it a go. It produces block as soon as transaction is received OR you can be manually triggered by |
@xlc I am aware about chopsticks instant transactions and (again) I have tried Chopsticks. Regarding dependency risk, there may be scenarios where it’s fine to add an extra dependency to the workflow and be at the mercy of the dependency reliability/features/bugs. And there may be scenarios where you are not wiling to take any extra dependency risks. For example, exploring chopsticks I spotted AcalaNetwork/chopsticks#304 and AcalaNetwork/chopsticks#305 findings related to the simulated RPC API, some people would be ok taking these risks. On the other side, there may be people that prefer a workflow without any simulated RPC API and trade instant transactions with a faster block time using a production like node. |
Would it help if we make a new node-template that has fast block times? but still, if you want that on Polkadot, you need to change a few lines of code in there. All of that is if you really really have to use a full, real node. You should consider using Chopsticks as well. |
To change the block time in the node-template, modify this line: /// This determines the average expected block time that we are targeting.
/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`.
/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked
/// up by `pallet_aura` to implement `fn slot_duration()`.
///
/// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 6000; For example, if I change it to 1000, the node starts producing blocks every second. node-template-faster-block-time.mov |
To change the block time in the kitchensink node (for development purposes), modify this line: /// Since BABE is probabilistic this is the average expected block time that
/// we are targeting. Blocks will be produced at a minimum duration defined
/// by `SLOT_DURATION`, but some slots will not be allocated to any
/// authority and hence no block will be produced. We expect to have this
/// block time on average following the defined slot duration and the value
/// of `c` configured for BABE (where `1 - c` represents the probability of
/// a slot being empty).
/// This value is only used indirectly to define the unit constants below
/// that are expressed in blocks. The rest of the code should use
/// `SLOT_DURATION` instead (like the Timestamp pallet for calculating the
/// minimum period).
///
/// If using BABE with secondary slots (default) then all of the slots will
/// always be assigned, in which case `MILLISECS_PER_BLOCK` and
/// `SLOT_DURATION` should have the same value.
///
/// <https://research.web3.foundation/en/latest/polkadot/block-production/Babe.html#-6.-practical-results>
pub const MILLISECS_PER_BLOCK: Moment = 3000; For example, if I change it to 1000, the node starts producing blocks every second. kitchensink-faster-block-time-01.movKeep in mind, the kitchensink runtime uses BABE where as the node-template uses AURA to produce blocks. Simply changing Here are some good discussions on these topics: |
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
* initialize substrate bridge from relay * is_halted: false * initialize using su instead of owner * Fix wording in comments Co-authored-by: Hernando Castano <[email protected]>
Enable a developer to start a node (
polkadot
/polkadot-parachain
) with a custom block time.The configuration could be set by
Note: The idea is to not instruct the developer to go and customize runtime code.
Why this is needed?
Today, one of the greatest pain points in the multi-chain JS developer experience is the sluggishness of transactions.
If we were able to configure shorter block times for development in the Polkadot and Cumulus runtimes, this would have a huge positive impact on the DX. This would enable faster app development, testing of more complex scenarios, and smoother contributor onboarding.
The text was updated successfully, but these errors were encountered: