-
Notifications
You must be signed in to change notification settings - Fork 65
apollo_consensus: use instance fields instead of constants in sim test #11035
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
apollo_consensus: use instance fields instead of constants in sim test #11035
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a1c1a15 to
3d8e367
Compare
1db439f to
b6d4662
Compare
matanl-starkware
left a comment
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.
@matanl-starkware reviewed 1 file and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @dafnamatsry).
crates/apollo_consensus/src/simulation_test.rs line 117 at r1 (raw file):
honest_nodes: usize, /// Threshold for reaching consensus (2/3 + 1 of total nodes). threshold: usize,
Too broad IMO
vote_threshold?
Code quote:
thresholdcrates/apollo_consensus/src/simulation_test.rs line 604 at r1 (raw file):
fn test_consensus_simulation(keep_ratio: f64, honest_nodes: usize) { let seed = rand::thread_rng().gen(); let total_nodes = 100;
Consider defining the number of honest nodes as a fraction of the total
Code quote:
let total_nodes = 100;3d8e367 to
fa562d7
Compare
4e6b570 to
5266ccc
Compare
df15f49 to
eae26d0
Compare
5528b54 to
8b82291
Compare
eae26d0 to
e24ce62
Compare
8b82291 to
47060a2
Compare
e24ce62 to
4e25987
Compare
47060a2 to
6034cc2
Compare
0bad337 to
6053cb3
Compare
3ea6dc0 to
909643c
Compare
5b94f3d to
42f99a2
Compare
909643c to
21be2f2
Compare
21be2f2 to
86cd35c
Compare
42f99a2 to
3c5d331
Compare
86cd35c to
344c1a2
Compare
3c5d331 to
e4b0be8
Compare
344c1a2 to
c0b63ba
Compare
e4b0be8 to
bc1f76f
Compare
c0b63ba to
66ce130
Compare
fc969b0 to
64d8ab3
Compare
66ce130 to
2483770
Compare
64d8ab3 to
8f7eded
Compare
2483770 to
3ec8992
Compare
matanl-starkware
left a comment
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.
@matanl-starkware reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry).
3ec8992 to
36f8400
Compare
db4bef2 to
eb1a9dd
Compare
36f8400 to
f1c8b27
Compare
dafnamatsry
left a comment
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.
@dafnamatsry reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @asmaastarkware).
crates/apollo_consensus/src/simulation_test.rs line 479 at r6 (raw file):
} else { round_rng.gen_range(1..total_nodes) };
This code is identical to get_leader_index, which you used before.
I think you can either:
- Make
get_leader_indexaccept theseedandtotal_nodesinstead ofself. - Clone
selfjust before this defining the closure and and then you can call it:
let this = self.clone();
let leader_fn = move |r: Round| {
let idx = this.get_leader_index(r);
validators[idx]
};
Code quote:
let leader_fn = move |r: Round| {
let round_u64 = u64::from(r);
let round_seed = seed.wrapping_mul(31).wrapping_add(round_u64);
let mut round_rng = StdRng::seed_from_u64(round_seed);
let random_value: f64 = round_rng.gen();
let idx = if random_value < NODE_0_LEADER_PROBABILITY {
NODE_UNDER_TEST
} else {
round_rng.gen_range(1..total_nodes)
};f1c8b27 to
cd82d3c
Compare
eb1a9dd to
16c30b1
Compare
asmaastarkware
left a comment
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.
@asmaastarkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dafnamatsry).
crates/apollo_consensus/src/simulation_test.rs line 479 at r6 (raw file):
Previously, dafnamatsry wrote…
This code is identical to
get_leader_index, which you used before.I think you can either:
- Make
get_leader_indexaccept theseedandtotal_nodesinstead ofself.- Clone
selfjust before this defining the closure and and then you can call it:let this = self.clone(); let leader_fn = move |r: Round| { let idx = this.get_leader_index(r); validators[idx] };
Done.
cd82d3c to
bc764c7
Compare
16c30b1 to
9f35e4b
Compare
dafnamatsry
left a comment
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.
@dafnamatsry reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @asmaastarkware).
bc764c7 to
19b869e
Compare

No description provided.