-
Notifications
You must be signed in to change notification settings - Fork 553
Parallel block import #1662
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
base: develop
Are you sure you want to change the base?
Parallel block import #1662
Conversation
…eet10/parallel-block-import
|
From the run log, it looks like one issue is that the node won't be able to process a block/header unless its parent is known.
|
ba47b51 to
7ad379c
Compare
core/blockchain.go
Outdated
| for i, block := range chain { | ||
| // Check if block is already known before attempting to process | ||
| wg.Add(1) | ||
| go func(block *types.Block, i int) { |
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.
This is a very big function. Could you move it to a separate function and potentially break it down?
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.
Done.
core/blockchain.go
Outdated
| var processed atomic.Int32 | ||
|
|
||
| bs := NewBlockState() // Block state tracker to manage parallel block processing | ||
| bc.parallelImport.Store(true) |
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.
Let's add a config to enable/disable parallel block processing.
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.
Done.
core/blockchain_test.go
Outdated
| } | ||
| */ | ||
| factoryBIN := common.Hex2Bytes("608060405234801561001057600080fd5b50610241806100206000396000f3fe608060405234801561001057600080fd5b506004361061002a5760003560e01c80627743601461002f575b600080fd5b610049600480360381019061004491906100d8565b61004b565b005b6000808251602084016000f59050803b61006457600080fd5b5050565b600061007b61007684610146565b610121565b905082815260208101848484011115610097576100966101eb565b5b6100a2848285610177565b509392505050565b600082601f8301126100bf576100be6101e6565b5b81356100cf848260208601610068565b91505092915050565b6000602082840312156100ee576100ed6101f5565b5b600082013567ffffffffffffffff81111561010c5761010b6101f0565b5b610118848285016100aa565b91505092915050565b600061012b61013c565b90506101378282610186565b919050565b6000604051905090565b600067ffffffffffffffff821115610161576101606101b7565b5b61016a826101fa565b9050602081019050919050565b82818337600083830152505050565b61018f826101fa565b810181811067ffffffffffffffff821117156101ae576101ad6101b7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f830116905091905056fea2646970667358221220ea8b35ed310d03b6b3deef166941140b4d9e90ea2c92f6b41eb441daf49a59c364736f6c63430008070033") | ||
| factoryBIN := common.Hex2Bytes("608060405234801561001057600080fd5b50610241806100206000396000f3fe608060405234801561001057600080fd5b506004361061002a5760003560e01c80627743601461002f575b600080fd5b610049600480360381019061004491906100d8565b61004b565b005b6000808251602084016000f59050803b61006457600080fd5b5050565b600061007b61007684610146565b610121565b905082815260208101848484011115610097576100966101eb565b5b6100a2848285610177565b509392505050565b600082601f8301126100bf576100be6101e6565b5b81356100cf848260208601610068565b91505092915050565b6000602082840312156100ee576100ed6101f5565b5b600082013567ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535050565b6000604051905090565b600067ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1115610161576101606101b7565b5b61016a826101fa565b9050602081019050919050565b82818337600083830152505050565b61018f826101fa565b810181811067ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17156101ae576101ad6101b7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f830116905091905056fea2646970667358221220ea8b35ed310d03b6b3deef166941140b4d9e90ea2c92f6b41eb441daf49a59c364736f6c63430008070033") |
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.
Why is it required to change this?
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.
Ouch. Yeah reverted this.
…p-parallel-stateless
…sequential and parallel stateless imports
…ork/bor into raneet10/parallel-block-import
73f3270 to
02e53a9
Compare
…into raneet10/parallel-block-import
…ork/bor into raneet10/parallel-block-import
…ork/bor into raneet10/parallel-block-import
…arallel-block-import
…arallel-block-import
60e727d to
cf63cc3
Compare
|
| ProduceWitnesses bool `hcl:"producewitnesses,optional" toml:"producewitnesses,optional"` | ||
|
|
||
| // Parallel stateless import (download path) toggle | ||
| EnableParallelStatelessImport bool `hcl:"parallelstatelessimport,optional" toml:"parallelstatelessimport,optional"` |
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 we put - between words for this flag?




Description
This PR adds the feature to allow a node to import blocks in parallel in stateless mode.
Parallel import currently is ~25% faster.
Changes
Checklist
Testing