-
Notifications
You must be signed in to change notification settings - Fork 14
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
Custom Delayed Finalize #61
Conversation
.await | ||
} | ||
|
||
pub async fn run_delayed_finalize<B, CB, C>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What matters in client/consensus/manual-seal
package is this section.
Others are just copied from Substrate repo here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add more info in the readme ?
ex:
How to instant seal ?
How to set 1 sec blocktime
Updated README! |
Updated swanky node version to support `--finalize-delay-sec` swanky-node companion inkdevhub/swanky-node#61
Adds `--finalize-delay-sec` cli argument, based on the great work by @shunsukew at inkdevhub/swanky-node#61. Manual testing by starting node with/without option, along with example contract upload: ```shell # build example contract cargo contract build --manifest-path=../ink-examples/erc20/Cargo.toml # start node cargo run # upload contract cargo contract upload --suri //Alice --execute --manifest-path=../ink-examples/erc20/Cargo.toml # check finalized head remains at genesis sleep 1 test $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chainHead_unstable_genesisHash", "params":[]}' http://localhost:9944 | jq .result) \ = $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getFinalizedHead", "params":[]}' http://localhost:9944 | jq .result) && echo PASS || echo FAIL # start node (with delayed finalization) cargo run -- --finalize-delay-sec 1 # upload contract cargo contract upload --suri //Alice --execute --manifest-path=../ink-examples/erc20/Cargo.toml # check finalized head matches chain head sleep 1 test $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getHead", "params":[]}' http://localhost:9944 | jq .result) \ = $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getFinalizedHead", "params":[]}' http://localhost:9944 | jq .result) && echo PASS || echo FAIL ``` Closes #160
Adds `--finalize-delay-sec` cli argument, based on the great work by @shunsukew at inkdevhub/swanky-node#61. Manual testing by starting node with/without option, along with example contract upload: ```shell # build example contract cargo contract build --manifest-path=../ink-examples/erc20/Cargo.toml # start node cargo run # upload contract cargo contract upload --suri //Alice --execute --manifest-path=../ink-examples/erc20/Cargo.toml # check finalized head remains at genesis sleep 1 test $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chainHead_unstable_genesisHash", "params":[]}' http://localhost:9944 | jq .result) \ = $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getFinalizedHead", "params":[]}' http://localhost:9944 | jq .result) && echo PASS || echo FAIL # start node (with delayed finalization) cargo run -- --finalize-delay-sec 1 # upload contract cargo contract upload --suri //Alice --execute --manifest-path=../ink-examples/erc20/Cargo.toml # check finalized head matches chain head sleep 1 test $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getHead", "params":[]}' http://localhost:9944 | jq .result) \ = $(curl -sH "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getFinalizedHead", "params":[]}' http://localhost:9944 | jq .result) && echo PASS || echo FAIL ``` Closes #160
Provide
--finalize-delay-sec <sec>
option for finalizing blocks.Setting to
0
mean instant finalization.Note that, without providing
--finalize-delay-sec
, blocks won't be finalized unless you do it manually by RPC call.