Skip to content
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

[Quorum Store] Implementation of quorum store components #6055

Merged
merged 395 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
395 commits
Select commit Hold shift + click to select a range
c97f66f
change back to close loop forge, comment something from QS DB
danielxiangzl Oct 4, 2022
3c0adf5
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 4, 2022
4baff03
try different network workers for different QS message types
danielxiangzl Oct 4, 2022
cd664e3
add end_batch counter
danielxiangzl Oct 4, 2022
04422a9
comment out expiration round check just to see performance
danielxiangzl Oct 5, 2022
e5d0eb8
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 5, 2022
6202909
Merge branch 'main' into quorum-store-reset
sasha8 Oct 5, 2022
91d16a0
test 1 network worker
danielxiangzl Oct 5, 2022
016677e
back to multiple network workers, bring back QC DB
danielxiangzl Oct 5, 2022
351a062
try parameters
danielxiangzl Oct 5, 2022
aca53f9
parameters
danielxiangzl Oct 5, 2022
b0308eb
disable tokio-console
danielxiangzl Oct 5, 2022
487975d
parameter
danielxiangzl Oct 6, 2022
cd0cb7f
parameter
danielxiangzl Oct 6, 2022
4e3cc5e
change run time
danielxiangzl Oct 6, 2022
e108bed
nit
danielxiangzl Oct 6, 2022
32c0c7d
parameter
danielxiangzl Oct 6, 2022
6f01d67
order PoS for consensus
sasha8 Oct 6, 2022
bbffe5f
Merge branch 'quorum-store-reset' of https://github.com/aptos-labs/ap…
sasha8 Oct 6, 2022
abed4b3
fmt
sasha8 Oct 6, 2022
66b5720
Merge branch 'main' into quorum-store-reset
sasha8 Oct 6, 2022
785759a
try parameter
danielxiangzl Oct 6, 2022
a89fcdf
run forge with different tps
danielxiangzl Oct 7, 2022
801393f
trucking num bytes in PoS plus security bug fix
sasha8 Oct 7, 2022
9a21bb5
Merge branch 'quorum-store-reset' of https://github.com/aptos-labs/ap…
sasha8 Oct 7, 2022
68659b0
Merge branch 'main' into quorum-store-reset
sasha8 Oct 7, 2022
775494a
try standard forge
danielxiangzl Oct 7, 2022
04d23b7
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 7, 2022
d4313ff
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 7, 2022
36e0818
run limited bw test
danielxiangzl Oct 8, 2022
e91acf4
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 8, 2022
c8ec6f0
bw test
danielxiangzl Oct 8, 2022
8196c4b
3 region test
danielxiangzl Oct 8, 2022
e2f7e11
3 region test with 100 nodes
danielxiangzl Oct 8, 2022
bd0ea25
3 region with 100 nodes and 100mbps BW
danielxiangzl Oct 8, 2022
99dafd1
0 memory quota test
danielxiangzl Oct 10, 2022
1248ed0
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 10, 2022
246ad6b
3 region 100nodes test with 0 memory quota
danielxiangzl Oct 10, 2022
eb480f8
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 10, 2022
9b29b08
Differ verifying batch respond to batch requester
sasha8 Oct 11, 2022
41ecafc
3 region 200 nodes
danielxiangzl Oct 11, 2022
7b21541
300 nodes
danielxiangzl Oct 11, 2022
229d7ff
debug print for batch out of order
danielxiangzl Oct 11, 2022
1adfaa1
debug prints
danielxiangzl Oct 11, 2022
f68c225
try with larger timeouts
danielxiangzl Oct 11, 2022
9da55f4
try parameters
danielxiangzl Oct 11, 2022
acf8353
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 11, 2022
27acb22
no epoch change
danielxiangzl Oct 11, 2022
6877ffe
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 11, 2022
79c6795
debug
danielxiangzl Oct 12, 2022
d6cc33f
update logicaltime for quorum store when state sync
danielxiangzl Oct 12, 2022
d4d13f9
fix
danielxiangzl Oct 12, 2022
f9e85c3
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 12, 2022
bf1b8d3
temp fix just to see performance
danielxiangzl Oct 12, 2022
9158b56
merge
danielxiangzl Oct 12, 2022
1271079
quick fix
danielxiangzl Oct 13, 2022
d3223fd
Merge branch 'main' into quorum-store-reset
sasha8 Oct 13, 2022
0fd6982
update logical time differently
danielxiangzl Oct 13, 2022
c34ba26
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 13, 2022
20e36ca
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 13, 2022
6393490
test fix
sasha8 Oct 13, 2022
2add524
Merge branch 'quorum-store-reset' of https://github.com/aptos-labs/ap…
sasha8 Oct 13, 2022
1776f4e
revert change for testing
danielxiangzl Oct 13, 2022
04a4163
debug
danielxiangzl Oct 14, 2022
dacd451
3 region 100 nodes
danielxiangzl Oct 14, 2022
b7a1556
debug info
danielxiangzl Oct 14, 2022
a501ca5
normal forge
danielxiangzl Oct 14, 2022
84bd1d0
epoch change may contain nonincreasing rounds
danielxiangzl Oct 16, 2022
5777f9c
fix
danielxiangzl Oct 16, 2022
08c2cf0
parameter
danielxiangzl Oct 16, 2022
ad5321c
revert
danielxiangzl Oct 17, 2022
09dfa09
fix batch_reader race between expiry extension and clear, add test
gelash Oct 17, 2022
f4267ad
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
gelash Oct 17, 2022
0cc5e17
counter
danielxiangzl Oct 17, 2022
083d991
add back notify commit during state sync
danielxiangzl Oct 17, 2022
754cedf
nit
danielxiangzl Oct 17, 2022
c0825b7
revert for debug
danielxiangzl Oct 18, 2022
1c749da
fix
danielxiangzl Oct 18, 2022
0e51891
100 nodes
danielxiangzl Oct 18, 2022
5395b63
low load test
danielxiangzl Oct 20, 2022
dccb79c
nit
danielxiangzl Oct 20, 2022
bf7dc6f
100nodes low tps test
danielxiangzl Oct 20, 2022
b92c31f
run high load test
danielxiangzl Oct 20, 2022
a7e60a5
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 20, 2022
e6d8dee
add 2 sec to expiration limit when pull from mempool, for high load test
danielxiangzl Oct 20, 2022
7420196
add 10 sec to mempool expiration
danielxiangzl Oct 21, 2022
58295f3
add back pressure to quorum sotre
danielxiangzl Oct 21, 2022
9b01f70
fix
danielxiangzl Oct 21, 2022
6a92694
parameter
danielxiangzl Oct 22, 2022
31cd140
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 22, 2022
000168b
parameter
danielxiangzl Oct 22, 2022
50fcff8
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 22, 2022
31a80af
test normal load
danielxiangzl Oct 22, 2022
dbb5c59
revert mempool
danielxiangzl Oct 22, 2022
13e0bd7
close loop
danielxiangzl Oct 22, 2022
ec9374f
revert backpressure for testing
danielxiangzl Oct 24, 2022
4b9a698
parameter with backpressure
danielxiangzl Oct 24, 2022
cd3cb36
end batch when QS is back pressured
danielxiangzl Oct 24, 2022
2390ad1
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 24, 2022
c25d57c
parameter
danielxiangzl Oct 24, 2022
9df8890
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 24, 2022
47c7555
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 24, 2022
2245d13
3 region 100 nodes with backpressure
danielxiangzl Oct 25, 2022
2f5ad01
QS backpressure only when consensus also backpressure
danielxiangzl Oct 25, 2022
fee7830
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 25, 2022
848eee4
test with larger block size
danielxiangzl Oct 26, 2022
a82ada8
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 26, 2022
63c4cc5
parameter and counters
danielxiangzl Oct 26, 2022
b1fe287
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 26, 2022
b9fec28
block size
danielxiangzl Oct 26, 2022
19ac30b
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 26, 2022
c19335e
200 nodes test
danielxiangzl Oct 27, 2022
a487d47
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 27, 2022
e2ffd17
counter
danielxiangzl Oct 28, 2022
a90e084
larger block size
danielxiangzl Oct 28, 2022
0edf8ce
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 28, 2022
6d6f7dc
close loop
danielxiangzl Oct 28, 2022
625a180
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 28, 2022
521ae2f
open loop 8k
danielxiangzl Oct 29, 2022
dfb0d9a
Merge branch 'main' into quorum-store-reset
danielxiangzl Oct 29, 2022
11a4b2a
nit
danielxiangzl Oct 29, 2022
b7406cc
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Oct 29, 2022
9669e3d
close loop mempool 60k
danielxiangzl Oct 29, 2022
56c554c
change backpressure
danielxiangzl Oct 29, 2022
f1d8277
change PoS queue
danielxiangzl Oct 29, 2022
97b1c38
close loop
danielxiangzl Oct 29, 2022
7361084
larger parameters
danielxiangzl Oct 29, 2022
1cea780
test 20 nodes
danielxiangzl Oct 30, 2022
d349092
separate config file
danielxiangzl Nov 1, 2022
f410f0a
100nodes
danielxiangzl Nov 1, 2022
98de606
Merge branch 'main' into quorum-store-reset
danielxiangzl Nov 1, 2022
3ddbee5
hacky way to check if steaming is needed
danielxiangzl Nov 1, 2022
1eed335
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Nov 1, 2022
d2d0970
100 nodes test
danielxiangzl Nov 1, 2022
840b284
parameters
danielxiangzl Nov 2, 2022
383d24a
smaller block to remove expiration
danielxiangzl Nov 2, 2022
9f80aad
add batch counts, fix unit test, clean up
danielxiangzl Nov 2, 2022
7b51c8c
Merge branch 'main' into quorum-store-reset
danielxiangzl Nov 2, 2022
75bb8f1
merge DataMenagers
sasha8 Nov 2, 2022
13e04e5
Merge branch 'quorum-store-reset' of https://github.com/aptos-labs/ap…
sasha8 Nov 2, 2022
57d0b8c
fix
danielxiangzl Nov 2, 2022
fd327fe
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Nov 2, 2022
eff2ab4
Merge branch 'main' into quorum-store-reset
danielxiangzl Nov 2, 2022
896dab0
rebase
danielxiangzl Nov 15, 2022
0883f49
Merge branch 'main' into quorum-store-reset
danielxiangzl Nov 15, 2022
8778191
fix potential panic
danielxiangzl Nov 15, 2022
939ab4e
Merge branch 'quorum-store-reset' of github.com:aptos-labs/aptos-core…
danielxiangzl Nov 15, 2022
b566128
parameter and revert pos queue
danielxiangzl Nov 15, 2022
ac49162
test perf without fragment
danielxiangzl Nov 16, 2022
1e3cbc0
use fragments, 8k open loop
danielxiangzl Dec 2, 2022
680ecfd
Merge branch 'main' into quorum-store-reset
bchocho Dec 13, 2022
8d1d229
fix build
bchocho Dec 15, 2022
47dc97e
proper fix
bchocho Dec 15, 2022
c4a87db
fix forge
bchocho Dec 15, 2022
7b28b21
fix a warning
bchocho Dec 15, 2022
8a10655
Merge branch 'main' into quorum-store-reset
bchocho Dec 17, 2022
9934587
fix test
bchocho Dec 17, 2022
2b4a1c5
small fix for non-qs
bchocho Dec 17, 2022
50ee113
Merge branch 'main' into quorum-store-reset
bchocho Dec 19, 2022
de2ac8c
Fix Cargo.lock from main
bchocho Dec 19, 2022
919cb36
remove unnecessary changes in lib.rs
bchocho Dec 19, 2022
b311017
Fix unit test build
bchocho Dec 19, 2022
230f1f1
quick fix for twins tests with quorum store off - need a better strat…
bchocho Dec 19, 2022
38b8457
Make quorum store shutdown faster on epoch change
bchocho Dec 20, 2022
e119a8e
cleanup temp test files
bchocho Dec 20, 2022
ee299cc
revert changes in testsuite (forge-related changes)
bchocho Dec 20, 2022
0461cc3
[DONOTLAND] hard-code quorum store
bchocho Dec 20, 2022
a8dd235
Fix CleanRequest?
bchocho Dec 21, 2022
8f92f8f
submitting txn to all nodes
danielxiangzl Dec 21, 2022
a00a8df
3 region test
danielxiangzl Dec 21, 2022
c811c30
fix
danielxiangzl Dec 21, 2022
b32207b
Revert mempool expiration change (that fails tests)
bchocho Dec 21, 2022
64205c4
Turn QS off to get baseline
bchocho Dec 22, 2022
ed0ab40
revert to QS
danielxiangzl Dec 23, 2022
3bf4bad
Merge branch 'main' into quorum-store-reset
danielxiangzl Dec 23, 2022
7966ffa
Merge branch 'main' into quorum-store-reset
danielxiangzl Dec 29, 2022
88d0ffb
fmt
danielxiangzl Dec 29, 2022
d1310de
Create Batch Generator
bchocho Dec 7, 2022
e4e322c
Update changes to compile
bchocho Dec 30, 2022
09eb646
batch_coordinator and quorum_store_coordinator
bchocho Dec 30, 2022
a6f238f
Add quorum_store_builder
bchocho Dec 31, 2022
fc3a00e
cleanup some build warnings
bchocho Dec 31, 2022
2b8b839
checkpoint - mostly done?
bchocho Jan 3, 2023
52e4aa3
passes most smoke tests
bchocho Jan 3, 2023
8365fd2
fix unit test compile
bchocho Jan 3, 2023
9d6bfea
remove unnecessary changes as prep for merge
bchocho Jan 3, 2023
74c0764
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Jan 3, 2023
d7fb5d9
some cleanup
bchocho Jan 3, 2023
aeed10a
Change tokio::spawn to spawn_named
bchocho Jan 5, 2023
b931d4b
Some cleanup, no more warnings in cargo build
bchocho Jan 6, 2023
efed7f5
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Jan 6, 2023
95aca26
resolve panics during shutdown
bchocho Jan 7, 2023
8da5f9a
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Jan 10, 2023
1004508
add simple counter for QS backpressure, and change QS backpressure to…
danielxiangzl Jan 11, 2023
98f8b16
more counters and simple counter fix
danielxiangzl Jan 11, 2023
7e3b8e1
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Jan 11, 2023
5c366af
push backpressure from proof_manager to batch_generator
bchocho Jan 12, 2023
6d01626
adding latest consensus back pressure when creating QS batch
danielxiangzl Jan 13, 2023
e87a9bb
Merge branch 'main' into brian/quorum-store-restructure-1230
danielxiangzl Jan 13, 2023
2a1eaa6
update QS backpressure upon every commit
danielxiangzl Jan 13, 2023
cc9eedc
Merge branch 'brian/quorum-store-restructure-1230' of github.com:apto…
danielxiangzl Jan 13, 2023
5297114
backpressure optimization and add counters
danielxiangzl Jan 13, 2023
6e926bd
small fix
danielxiangzl Jan 13, 2023
bc7f367
counter
danielxiangzl Jan 13, 2023
50ba3fd
Merge branch 'main' into brian/quorum-store-restructure-1230
danielxiangzl Jan 13, 2023
acb5413
counters and parameters
danielxiangzl Jan 13, 2023
531cc99
counter
danielxiangzl Jan 14, 2023
f6d1234
Create multiple batch_coordinators and a single network listener
bchocho Jan 14, 2023
ad45f86
some cleanup for batch coordinator creation
bchocho Jan 15, 2023
e52b39b
more cleanup
bchocho Jan 15, 2023
2e64ad8
fix some lints
bchocho Jan 15, 2023
ea60749
fix some lint issues
bchocho Jan 15, 2023
e6d225e
cargo +nightly fmt
bchocho Jan 15, 2023
c0d9a3b
fix cargo sort
bchocho Jan 15, 2023
801e53a
some more cleanup
bchocho Jan 16, 2023
400e9ce
Merge branch 'main' into brian/quorum-store-restructure-1230
danielxiangzl Jan 18, 2023
401ae3b
wrap in a box
bchocho Jan 19, 2023
0901934
Merge branch 'brian/quorum-store-restructure-1230' of https://github.…
bchocho Jan 19, 2023
19b6cfd
Reset quorum store enabled to false in ConsensusConfigV1 for landing …
bchocho Jan 19, 2023
c64fb6c
More cleanup
bchocho Jan 20, 2023
ba64b3d
tiny cleanup
bchocho Jan 20, 2023
7ed3102
More small cleanup
bchocho Jan 20, 2023
44a87ad
cargo fmt
bchocho Jan 20, 2023
f408413
Revert forge changes and more cleanup and formatting
bchocho Jan 20, 2023
7746750
Move quorum_store shutdown to the end, to avoid any new incoming requ…
bchocho Jan 20, 2023
d12abca
Turn quorum store back on for sanity check of cleanup
bchocho Jan 20, 2023
461628c
proof_manager tests
bchocho Jan 20, 2023
a551956
batch_generator tests
bchocho Jan 20, 2023
d3b5ef9
remove unneeded config
bchocho Jan 20, 2023
35118ba
some more cleanup
bchocho Jan 20, 2023
ae160d8
remove back pressure updates on proposal
bchocho Jan 20, 2023
97cf10f
logic fix for backpressure proof cleanning
danielxiangzl Jan 20, 2023
aef1dab
Merge branch 'main' into brian/quorum-store-restructure-1230
danielxiangzl Jan 20, 2023
6554cbb
more cleanup: remove all println
bchocho Jan 21, 2023
95bd55a
linter
bchocho Jan 21, 2023
4b6a3cb
unit test: check proof_manager_rx
bchocho Jan 21, 2023
088b8ce
add a fail_point test
bchocho Jan 21, 2023
795e8ca
Remove unused Result in init_proof
bchocho Jan 24, 2023
278aca6
Add smoke test that flips quorum store to enabled
bchocho Jan 25, 2023
1e915b1
Add batch_store_recovery unit test
bchocho Jan 26, 2023
54bb290
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Feb 2, 2023
24d4fba
Reset values in prep for merge
bchocho Feb 2, 2023
e5cd3a2
address naming
bchocho Feb 2, 2023
976dfbf
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Feb 2, 2023
4a2ad6f
Fix consensus-only test
bchocho Feb 2, 2023
ce2a170
Comment fix
bchocho Feb 2, 2023
940b5c5
Build resource_groups test packages in a separate thread, to avoid st…
bchocho Feb 2, 2023
fc60dc9
cleanup spawn_named macro
bchocho Feb 3, 2023
22d15ce
remove aptos-console as default
bchocho Feb 7, 2023
fc7cfc2
Merge branch 'main' into brian/quorum-store-restructure-1230
bchocho Feb 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ claims = "0.7"
clap = { version = "3.2.17", features = ["derive", "env", "suggestions"] }
clap_complete = "3.2.3"
codespan-reporting = "0.11.1"
console-subscriber = "0.1.6"
console-subscriber = "0.1.8"
const_format = "0.2.26"
criterion = "0.3.5"
criterion-cpu-time = "0.1.0"
Expand Down Expand Up @@ -439,6 +439,7 @@ tracing = "0.1.34"
tracing-subscriber = "0.3.11"
trybuild = "1.0.41"
tokio = { version = "1.21.0", features = ["full"] }
tokio-metrics = "0.1.0"
tokio-retry = "0.3.0"
tokio-stream = "0.1.8"
tokio-test = "0.4.1"
Expand Down
11 changes: 6 additions & 5 deletions config/src/config/consensus_config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use crate::config::SafetyRulesConfig;
use crate::config::{QuorumStoreConfig, SafetyRulesConfig};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

Expand Down Expand Up @@ -30,6 +30,7 @@ pub struct ConsensusConfig {
// the period = (poll_count - 1) * 30ms
pub quorum_store_poll_count: u64,
pub intra_consensus_channel_buffer_size: usize,
pub quorum_store_configs: QuorumStoreConfig,

// Used to decide if backoff is needed.
// must match one of the CHAIN_HEALTH_WINDOW_SIZES values.
Expand All @@ -48,10 +49,10 @@ pub struct ChainHealthBackoffValues {
impl Default for ConsensusConfig {
fn default() -> ConsensusConfig {
ConsensusConfig {
max_sending_block_txns: 2500,
max_sending_block_txns: 4000,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielxiangzl @sasha8 do we want these consensus changes when quorum store is enabled? @igor-aptos would it make sense to make these changes without quorum store at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need larger block size to fully utilize the potential of QS. We can tune these parameters after landing in testnet/production.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we cannot really change these now.

either :

  • keep them as is, and then increase in the next release once QS is enabled in main
  • or have new fields (qs_max_sending_block_txns, and others) in the interrim, before the cleanup)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should flip default value back before landing

// defaulting to under 0.5s to broadcast the proposal to 100 validators
// over 1gbps link
max_sending_block_bytes: 600 * 1024, // 600 KB
max_sending_block_bytes: 1000 * 1024, // 1 MB
max_receiving_block_txns: 10000,
max_receiving_block_bytes: 3 * 1024 * 1024, // 3MB
max_pruned_blocks_in_mem: 100,
Expand All @@ -64,11 +65,11 @@ impl Default for ConsensusConfig {
round_timeout_backoff_max_exponent: 6,
safety_rules: SafetyRulesConfig::default(),
sync_only: false,
channel_size: 30, // hard-coded

channel_size: 100, // hard-coded
quorum_store_pull_timeout_ms: 1000,
quorum_store_poll_count: 10,
intra_consensus_channel_buffer_size: 10,
quorum_store_configs: QuorumStoreConfig::default(),

window_for_chain_health: 100,
chain_health_backoff: vec![
Expand Down
2 changes: 2 additions & 0 deletions config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use thiserror::Error;

mod consensus_config;
pub use consensus_config::*;
mod quorum_store_config;
pub use quorum_store_config::*;
mod error;
pub use error::*;
mod execution_config;
Expand Down
61 changes: 61 additions & 0 deletions config/src/config/quorum_store_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use aptos_types::block_info::Round;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct QuorumStoreConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some more comments what are the constants and what are they referring to? for example what channel is "channel_size" here

pub channel_size: usize,
pub proof_timeout_ms: usize,
pub batch_request_num_peers: usize,
pub mempool_pulling_interval: usize,
pub end_batch_ms: u128,
pub max_batch_counts: usize,
pub max_batch_bytes: usize,
pub batch_request_timeout_ms: usize,
/// Used when setting up the expiration time for the batch initation.
pub batch_expiry_round_gap_when_init: Round,
/// Batches may have expiry set for batch_expiry_rounds_gap rounds after the
/// latest committed round, and it will not be cleared from storage for another
/// so other batch_expiry_grace_rounds rounds, so the peers on the network
/// can still fetch the data they fall behind (later, they would have to state-sync).
/// Used when checking the expiration time of the received batch against current logical time to prevent DDoS.
pub batch_expiry_round_gap_behind_latest_certified: Round,
pub batch_expiry_round_gap_beyond_latest_certified: Round,
pub batch_expiry_grace_rounds: Round,
pub memory_quota: usize,
pub db_quota: usize,
pub mempool_txn_pull_max_count: u64,
pub mempool_txn_pull_max_bytes: u64,
pub back_pressure_local_batch_num: usize,
pub num_workers_for_remote_fragments: usize,
}

impl Default for QuorumStoreConfig {
fn default() -> QuorumStoreConfig {
QuorumStoreConfig {
channel_size: 1000,
proof_timeout_ms: 10000,
batch_request_num_peers: 2,
mempool_pulling_interval: 100,
end_batch_ms: 500,
max_batch_counts: 300,
max_batch_bytes: 1000000,
batch_request_timeout_ms: 10000,
batch_expiry_round_gap_when_init: 100,
batch_expiry_round_gap_behind_latest_certified: 500,
batch_expiry_round_gap_beyond_latest_certified: 500,
batch_expiry_grace_rounds: 5,
memory_quota: 100000000,
db_quota: 10000000000,
mempool_txn_pull_max_count: 300,
mempool_txn_pull_max_bytes: 1000000,
// QS will be backpressured if the remaining local batches is more than this number
back_pressure_local_batch_num: 10,
// number of batch coordinators to handle QS Fragment messages, should be >= 1
num_workers_for_remote_fragments: 2,
}
}
}
6 changes: 6 additions & 0 deletions consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ aptos-config = { workspace = true }
aptos-consensus-notifications = { workspace = true }
aptos-consensus-types = { workspace = true }
aptos-crypto = { workspace = true }
aptos-crypto-derive = { workspace = true }
aptos-event-notifications = { workspace = true }
aptos-executor = { workspace = true }
aptos-executor-types = { workspace = true }
aptos-fallible = { workspace = true }
aptos-global-constants = { workspace = true }
aptos-infallible = { workspace = true }
aptos-logger = { workspace = true }
aptos-mempool = { workspace = true }
Expand All @@ -43,6 +45,9 @@ async-trait = { workspace = true }
bcs = { workspace = true }
byteorder = { workspace = true }
bytes = { workspace = true }
chrono = { workspace = true }
claims = { workspace = true }
dashmap = { workspace = true }
fail = { workspace = true }
futures = { workspace = true }
futures-channel = { workspace = true }
Expand All @@ -58,6 +63,7 @@ serde_bytes = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tokio-metrics = { workspace = true }

[dev-dependencies]
aptos-config = { workspace = true, features = ["fuzzing"] }
Expand Down
1 change: 1 addition & 0 deletions consensus/consensus-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ futures = { workspace = true }
itertools = { workspace = true }
mirai-annotations = { workspace = true }
proptest = { workspace = true, optional = true }
rand = { workspace = true }
rayon = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions consensus/consensus-types/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ impl Block {
self.block_data.payload()
}

pub fn payload_size(&self) -> usize {
match self.block_data.payload() {
None => 0,
Some(payload) => match payload {
Payload::InQuorumStore(pos) => pos.proofs.len(),
Payload::DirectMempool(txns) => txns.len(),
},
}
}

pub fn quorum_cert(&self) -> &QuorumCert {
self.block_data.quorum_cert()
}
Expand Down
31 changes: 31 additions & 0 deletions consensus/consensus-types/src/proof_of_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use aptos_types::{
aggregate_signature::AggregateSignature, validator_signer::ValidatorSigner,
validator_verifier::ValidatorVerifier, PeerId,
};
use rand::{seq::SliceRandom, thread_rng};
use serde::{Deserialize, Serialize};
use std::sync::Arc;

Expand Down Expand Up @@ -81,13 +82,35 @@ impl SignedDigest {
})
}

pub fn peer_id(&self) -> PeerId {
self.peer_id
}

pub fn epoch(&self) -> u64 {
self.epoch
}

pub fn verify(&self, validator: &ValidatorVerifier) -> anyhow::Result<()> {
Ok(validator.verify(self.peer_id, &self.info, &self.signature)?)
}

pub fn info(&self) -> &SignedDigestInfo {
&self.info
}

pub fn signature(self) -> bls12381::Signature {
self.signature
}

pub fn digest(&self) -> HashValue {
self.info.digest
}
}

#[derive(Debug, PartialEq)]
pub enum SignedDigestError {
WrongInfo,
DuplicatedSignature,
}

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -122,6 +145,14 @@ impl ProofOfStore {
.context("Failed to verify ProofOfStore")
}

pub fn shuffled_signers(&self, validator: &ValidatorVerifier) -> Vec<PeerId> {
let mut ret: Vec<PeerId> = self
.multi_signature
.get_voter_addresses(&validator.validator_addresses());
ret.shuffle(&mut thread_rng());
ret
}

pub fn epoch(&self) -> u64 {
self.info.expiration.epoch
}
Expand Down
23 changes: 16 additions & 7 deletions consensus/consensus-types/src/request_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use aptos_crypto::HashValue;
use futures::channel::oneshot;
use std::{fmt, fmt::Formatter};

/// Message sent from Consensus to QuorumStore.
pub enum PayloadRequest {
pub enum BlockProposalCommand {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be "GetBlockProposalCommand" ?

proposal generator issues this, and then it proposes there. this command prepares the proposal only?

/// Request to pull block to submit to consensus.
GetBlockRequest(
Round,
Expand All @@ -24,21 +23,30 @@ pub enum PayloadRequest {
// callback to respond to
oneshot::Sender<Result<ConsensusResponse>>,
),
/// Request to clean quorum store at commit logical time
CleanRequest(LogicalTime, Vec<HashValue>),
}

impl fmt::Display for PayloadRequest {
impl fmt::Display for BlockProposalCommand {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
PayloadRequest::GetBlockRequest(round, max_txns, max_bytes, excluded, _) => {
BlockProposalCommand::GetBlockRequest(round, max_txns, max_bytes, excluded, _) => {
write!(
f,
"GetBlockRequest [round: {}, max_txns: {}, max_bytes: {} excluded: {}]",
round, max_txns, max_bytes, excluded
)
},
PayloadRequest::CleanRequest(logical_time, digests) => {
}
}
}

pub enum CleanCommand {
CleanRequest(LogicalTime, Vec<HashValue>),
}

impl fmt::Display for CleanCommand {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
CleanCommand::CleanRequest(logical_time, digests) => {
write!(
f,
"CleanRequest [epoch: {}, round: {}, digests: {:?}]",
Expand All @@ -51,6 +59,7 @@ impl fmt::Display for PayloadRequest {
}
}

#[derive(Debug)]
pub enum ConsensusResponse {
GetBlockResponse(Payload),
}
Loading