Skip to content

Conversation

@asmaastarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@asmaastarkware asmaastarkware marked this pull request as ready for review December 24, 2025 10:01
Copy link
Contributor Author

asmaastarkware commented Dec 24, 2025

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from a1c1a15 to 3d8e367 Compare December 24, 2025 10:04
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 1db439f to b6d4662 Compare December 24, 2025 10:04
Copy link
Collaborator

@matanl-starkware matanl-starkware left a 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:

threshold

crates/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;

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from 3d8e367 to fa562d7 Compare December 24, 2025 15:14
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch 2 times, most recently from 4e6b570 to 5266ccc Compare December 25, 2025 14:37
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch 2 times, most recently from df15f49 to eae26d0 Compare December 25, 2025 14:39
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch 2 times, most recently from 5528b54 to 8b82291 Compare December 25, 2025 15:10
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from eae26d0 to e24ce62 Compare December 25, 2025 15:10
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 8b82291 to 47060a2 Compare December 26, 2025 10:51
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from e24ce62 to 4e25987 Compare December 26, 2025 10:51
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 47060a2 to 6034cc2 Compare December 28, 2025 08:19
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch 2 times, most recently from 0bad337 to 6053cb3 Compare December 28, 2025 09:54
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch 2 times, most recently from 3ea6dc0 to 909643c Compare December 28, 2025 10:42
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch 2 times, most recently from 5b94f3d to 42f99a2 Compare December 28, 2025 12:39
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 909643c to 21be2f2 Compare December 28, 2025 12:39
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 21be2f2 to 86cd35c Compare January 6, 2026 07:20
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from 42f99a2 to 3c5d331 Compare January 6, 2026 07:20
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 86cd35c to 344c1a2 Compare January 6, 2026 12:53
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from 3c5d331 to e4b0be8 Compare January 6, 2026 12:53
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 344c1a2 to c0b63ba Compare January 7, 2026 11:42
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from e4b0be8 to bc1f76f Compare January 7, 2026 11:42
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from c0b63ba to 66ce130 Compare January 7, 2026 12:12
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch 2 times, most recently from fc969b0 to 64d8ab3 Compare January 7, 2026 12:52
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 66ce130 to 2483770 Compare January 7, 2026 12:52
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from 64d8ab3 to 8f7eded Compare January 8, 2026 11:56
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 2483770 to 3ec8992 Compare January 8, 2026 11:56
Copy link
Collaborator

@matanl-starkware matanl-starkware left a 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry).

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 3ec8992 to 36f8400 Compare January 11, 2026 11:09
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch 2 times, most recently from db4bef2 to eb1a9dd Compare January 12, 2026 12:44
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from 36f8400 to f1c8b27 Compare January 12, 2026 12:44
Copy link
Collaborator

@dafnamatsry dafnamatsry left a 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_index accept the seed and total_nodes instead of self.
  • Clone self just 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)
            };

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from f1c8b27 to cd82d3c Compare January 14, 2026 12:08
@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/add_faulty_nodes branch from eb1a9dd to 16c30b1 Compare January 14, 2026 12:08
@asmaastarkware asmaastarkware changed the base branch from asmaa/sim_test/add_faulty_nodes to graphite-base/11035 January 14, 2026 12:59
Copy link
Contributor Author

@asmaastarkware asmaastarkware left a 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_index accept the seed and total_nodes instead of self.
  • Clone self just 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.

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from cd82d3c to bc764c7 Compare January 14, 2026 12:59
@asmaastarkware asmaastarkware changed the base branch from graphite-base/11035 to main-v0.14.1-committer January 14, 2026 12:59
Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

:lgtm:

@dafnamatsry reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @asmaastarkware).

@asmaastarkware asmaastarkware force-pushed the asmaa/sim_test/use_instance_fields_instead_of_constants branch from bc764c7 to 19b869e Compare January 18, 2026 07:51
@asmaastarkware asmaastarkware added this pull request to the merge queue Jan 18, 2026
Merged via the queue into main-v0.14.1-committer with commit 5e9abc2 Jan 18, 2026
14 checks passed
@asmaastarkware asmaastarkware deleted the asmaa/sim_test/use_instance_fields_instead_of_constants branch January 18, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants