Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
25 changes: 14 additions & 11 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ serial = [ "snarkos-cli/serial" ]
test_targets = [ "snarkos-cli/test_targets" ]
test_consensus_heights = [ "snarkos-cli/test_consensus_heights" ]
test_network = [ "snarkos-cli/test_network" ]
test_consensus_tracking = [ "snarkos-node/test_consensus_tracking" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to start documenting these new features. Either here or in the README similar to what I did in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tokio_console = [ "snarkos-cli/tokio_console" ]

[dependencies.clap]
Expand Down
1 change: 1 addition & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ cuda = [
"snarkos-node-sync/cuda"
]
serial = [ "snarkos-node-bft/serial" ]
test_consensus_tracking = [ "snarkos-node-bft/test_consensus_tracking", "snarkos-node-consensus/test_consensus_tracking" ]
test = []

[dependencies.aleo-std]
Expand Down
11 changes: 11 additions & 0 deletions node/bft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test = [
"snarkos-node-bft-ledger-service/test",
"snarkos-node-bft-storage-service/test"
]
test_consensus_tracking = [ ]
serial = [ "snarkos-node-bft-ledger-service/serial" ]

[dependencies.aleo-std]
Expand Down Expand Up @@ -93,6 +94,16 @@ workspace = true
[dependencies.rayon]
workspace = true

[dependencies.serde]
workspace = true
features = [ "derive" ]

[dependencies.serde_json]
workspace = true

[dependencies.once_cell]
version = "1.0"

[dependencies.sha2]
version = "0.10"
default-features = false
Expand Down
10 changes: 10 additions & 0 deletions node/bft/src/bft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ impl<N: Network> BFT<N> {
// Insert the certificate into the DAG.
self.dag.write().insert(certificate);

#[cfg(feature = "test_consensus_tracking")]
crate::helpers::record_event(certificate_round, crate::helpers::ConsensusStage::CertificateAdded);

// Get the previous round number.
let commit_round = certificate_round.saturating_sub(1);

Expand Down Expand Up @@ -562,6 +565,13 @@ impl<N: Network> BFT<N> {
) -> Result<()> {
// Fetch the leader round.
let latest_leader_round = leader_certificate.round();

#[cfg(feature = "test_consensus_tracking")]
crate::helpers::start_subdag_stage(
latest_leader_round.saturating_sub(2),
latest_leader_round,
crate::helpers::SubdagStage::SubdagProcessing,
);
// Determine the list of all previous leader certificates since the last committed round.
// The order of the leader certificates is from **newest** to **oldest**.
let mut leader_certificates = vec![leader_certificate.clone()];
Expand Down
5 changes: 5 additions & 0 deletions node/bft/src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ pub use telemetry::*;
pub mod timestamp;
pub use timestamp::*;

#[cfg(feature = "test_consensus_tracking")]
pub mod timing;
#[cfg(feature = "test_consensus_tracking")]
pub use timing::*;

/// Formats an ID into a truncated identifier (for logging purposes).
pub fn fmt_id(id: impl ToString) -> String {
let id = id.to_string();
Expand Down
Loading