Approve multiple candidates with a single signature (#1191)
Initial implementation for the plan discussed here: https://github.com/paritytech/polkadot-sdk/issues/701 Built on top of https://github.com/paritytech/polkadot-sdk/pull/1178 v0: https://github.com/paritytech/polkadot/pull/7554, ## Overall idea When approval-voting checks a candidate and is ready to advertise the approval, defer it in a per-relay chain block until we either have MAX_APPROVAL_COALESCE_COUNT candidates to sign or a candidate has stayed MAX_APPROVALS_COALESCE_TICKS in the queue, in both cases we sign what candidates we have available. This should allow us to reduce the number of approvals messages we have to create/send/verify. The parameters are configurable, so we should find some values that balance: - Security of the network: Delaying broadcasting of an approval shouldn't but the finality at risk and to make sure that never happens we won't delay sending a vote if we are past 2/3 from the no-show time. - Scalability of the network: MAX_APPROVAL_COALESCE_COUNT = 1 & MAX_APPROVALS_COALESCE_TICKS =0, is what we have now and we know from the measurements we did on versi, it bottlenecks approval-distribution/approval-voting when increase significantly the number of validators and parachains - Block storage: In case of disputes we have to import this votes on chain and that increase the necessary storage with MAX_APPROVAL_COALESCE_COUNT * CandidateHash per vote. Given that disputes are not the normal way of the network functioning and we will limit MAX_APPROVAL_COALESCE_COUNT in the single digits numbers, this should be good enough. Alternatively, we could try to create a better way to store this on-chain through indirection, if that's needed. ## Other fixes: - Fixed the fact that we were sending random assignments to non-validators, that was wrong because those won't do anything with it and they won't gossip it either because they do not have a grid topology set, so we would waste the random assignments. - Added metrics to be able to debug potential no-shows and mis-processing of approvals/assignments. ## TODO: - [x] Get feedback, that this is moving in the right direction. @ordian @sandreim @eskimor @burdges, let me know what you think. - [x] More and more testing. - [x] Test in versi. - [x] Make MAX_APPROVAL_COALESCE_COUNT & MAX_APPROVAL_COALESCE_WAIT_MILLIS a parachain host configuration. - [x] Make sure the backwards compatibility works correctly - [x] Make sure this direction is compatible with other streams of work: https://github.com/paritytech/polkadot-sdk/issues/635 & https://github.com/paritytech/polkadot-sdk/issues/742 - [x] Final versi burn-in before merging --------- Signed-off-by:Alexandru Gheorghe <alexandru.gheorghe@parity.io>
Showing
- .gitlab/pipeline/zombienet/polkadot.yml 8 additions, 0 deletions.gitlab/pipeline/zombienet/polkadot.yml
- cumulus/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs 13 additions, 1 deletion...ent/relay-chain-minimal-node/src/blockchain_rpc_client.rs
- cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs 14 additions, 1 deletioncumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
- cumulus/parachains/integration-tests/emulated/chains/relays/rococo/src/lib.rs 1 addition, 1 deletion...ntegration-tests/emulated/chains/relays/rococo/src/lib.rs
- cumulus/parachains/integration-tests/emulated/chains/relays/westend/src/lib.rs 1 addition, 1 deletion...tegration-tests/emulated/chains/relays/westend/src/lib.rs
- polkadot/Cargo.toml 0 additions, 1 deletionpolkadot/Cargo.toml
- polkadot/cli/Cargo.toml 0 additions, 2 deletionspolkadot/cli/Cargo.toml
- polkadot/node/core/approval-voting/src/approval_checking.rs 129 additions, 83 deletionspolkadot/node/core/approval-voting/src/approval_checking.rs
- polkadot/node/core/approval-voting/src/approval_db/common/migration_helpers.rs 39 additions, 0 deletions...proval-voting/src/approval_db/common/migration_helpers.rs
- polkadot/node/core/approval-voting/src/approval_db/common/mod.rs 293 additions, 0 deletions...t/node/core/approval-voting/src/approval_db/common/mod.rs
- polkadot/node/core/approval-voting/src/approval_db/mod.rs 2 additions, 0 deletionspolkadot/node/core/approval-voting/src/approval_db/mod.rs
- polkadot/node/core/approval-voting/src/approval_db/v1/tests.rs 0 additions, 4 deletions...dot/node/core/approval-voting/src/approval_db/v1/tests.rs
- polkadot/node/core/approval-voting/src/approval_db/v2/migration_helpers.rs 14 additions, 60 deletions...e/approval-voting/src/approval_db/v2/migration_helpers.rs
- polkadot/node/core/approval-voting/src/approval_db/v2/mod.rs 5 additions, 246 deletionspolkadot/node/core/approval-voting/src/approval_db/v2/mod.rs
- polkadot/node/core/approval-voting/src/approval_db/v2/tests.rs 40 additions, 28 deletions...dot/node/core/approval-voting/src/approval_db/v2/tests.rs
- polkadot/node/core/approval-voting/src/approval_db/v3/migration_helpers.rs 237 additions, 0 deletions...e/approval-voting/src/approval_db/v3/migration_helpers.rs
- polkadot/node/core/approval-voting/src/approval_db/v3/mod.rs 137 additions, 0 deletionspolkadot/node/core/approval-voting/src/approval_db/v3/mod.rs
- polkadot/node/core/approval-voting/src/approval_db/v3/tests.rs 575 additions, 0 deletions...dot/node/core/approval-voting/src/approval_db/v3/tests.rs
- polkadot/node/core/approval-voting/src/backend.rs 16 additions, 2 deletionspolkadot/node/core/approval-voting/src/backend.rs
- polkadot/node/core/approval-voting/src/import.rs 14 additions, 10 deletionspolkadot/node/core/approval-voting/src/import.rs
Please register or sign in to comment