From d8bcbdb22b4921300dadaf05a5ffe21cd277ec16 Mon Sep 17 00:00:00 2001 From: apenzk Date: Wed, 28 Aug 2024 11:00:20 +0200 Subject: [PATCH 1/4] init --- mysticeti-core/src/block_handler.rs | 2 ++ mysticeti-core/src/commit_observer.rs | 1 + mysticeti-core/src/config.rs | 3 +++ mysticeti-core/src/consensus/linearizer.rs | 1 + 4 files changed, 7 insertions(+) diff --git a/mysticeti-core/src/block_handler.rs b/mysticeti-core/src/block_handler.rs index 52bec399..e3b8355f 100644 --- a/mysticeti-core/src/block_handler.rs +++ b/mysticeti-core/src/block_handler.rs @@ -62,6 +62,7 @@ pub struct BenchmarkFastPathBlockHandler { consensus_only: bool, } +// COMMENT Here the Block limitations are defined // BenchmarkFastPathBlockHandler can push up to 2x of SOFT_MAX_PROPOSED_PER_BLOCK into block // So the value here should be chosen so that 2*SOFT_MAX_PROPOSED_PER_BLOCK*TRANSACTION_SIZE // is lower then the maximum allowed block size in the system @@ -80,6 +81,7 @@ impl BenchmarkFastPathBlockHandler { transaction_time: TransactionTimeMap, ) -> (Self, mpsc::Sender>) { let (sender, receiver) = mpsc::channel(1024); + // COMMENT Here the transaction log is written let transaction_log = TransactionLog::start(config.certified_transactions_log()) .expect("Failed to open certified transaction log for write"); diff --git a/mysticeti-core/src/commit_observer.rs b/mysticeti-core/src/commit_observer.rs index d9c85c2f..6a2538ba 100644 --- a/mysticeti-core/src/commit_observer.rs +++ b/mysticeti-core/src/commit_observer.rs @@ -197,6 +197,7 @@ impl + Send + Sync> CommitObs } } +// COMMENT observe commit events within the consensus system pub struct SimpleCommitObserver { #[allow(dead_code)] // will be used later during replay block_store: BlockStore, diff --git a/mysticeti-core/src/config.rs b/mysticeti-core/src/config.rs index 24cc471a..fabd186a 100644 --- a/mysticeti-core/src/config.rs +++ b/mysticeti-core/src/config.rs @@ -236,11 +236,14 @@ impl PrivateConfig { impl Print for PrivateConfig {} +// COMMENT StorageDir is a wrapper around a path to a directory where the validator stores its data. impl StorageDir { + // COMMENT for BenchmarkFastPathBlockHandler pub fn certified_transactions_log(&self) -> PathBuf { self.path.join("certified.txt") } + // COMMENT for validator pub fn committed_transactions_log(&self) -> PathBuf { self.path.join("committed.txt") } diff --git a/mysticeti-core/src/consensus/linearizer.rs b/mysticeti-core/src/consensus/linearizer.rs index acf0b895..11eedae2 100644 --- a/mysticeti-core/src/consensus/linearizer.rs +++ b/mysticeti-core/src/consensus/linearizer.rs @@ -64,6 +64,7 @@ impl CommittedSubDag { CommittedSubDag::new(*leader_block_ref, blocks, timestamp_ms, commit_data.height) } + // COMMENT The current implementation uses key, which is not ideal. We can also let the anchor decide on the order. /// Sort the blocks of the sub-dag by round number. Any deterministic algorithm works. pub fn sort(&mut self) { self.blocks.sort_by_key(|x| x.round()); From a754a02f5262faaaecf87baa03d1f00d923a8da1 Mon Sep 17 00:00:00 2001 From: apenzk Date: Mon, 2 Sep 2024 09:17:12 +0200 Subject: [PATCH 2/4] init flake --- flake.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..f7a3cc3b --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +# start the nix shell and start vscode in it +# nix flake init +# nix develop +# code . + +{ + description = "Flake for mysticeti project"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils }: + flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: + let + pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; }; + rustToolchain = pkgs.rust-bin.stable.latest.default; + rustPlatform = pkgs.makeRustPlatform { rustc = rustToolchain; cargo = rustToolchain; }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + rustToolchain + rustPlatform.rustc + rustPlatform.cargo + openssl + pkg-config + clang + ]; + + shellHook = '' + export RUST_BACKTRACE=1 + export CARGO_INCREMENTAL=0 + ''; + }; + } + ); +} From ca456b2da3935e38796cd6c0a2213b29edc9c702 Mon Sep 17 00:00:00 2001 From: apenzk Date: Mon, 2 Sep 2024 09:34:58 +0200 Subject: [PATCH 3/4] update flake.nix --- .gitignore | 2 ++ flake.nix | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index baaf304a..933d11b9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ dryrun-* local-testbed* *.log.ansi results/ + +flake.lock \ No newline at end of file diff --git a/flake.nix b/flake.nix index f7a3cc3b..8084acf7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,4 @@ # start the nix shell and start vscode in it -# nix flake init # nix develop # code . @@ -15,16 +14,16 @@ outputs = { self, nixpkgs, rust-overlay, flake-utils }: flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: let - pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; }; + pkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; rustToolchain = pkgs.rust-bin.stable.latest.default; - rustPlatform = pkgs.makeRustPlatform { rustc = rustToolchain; cargo = rustToolchain; }; in { devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ rustToolchain - rustPlatform.rustc - rustPlatform.cargo openssl pkg-config clang From 932bd34b7923680716035ec641068803f667778a Mon Sep 17 00:00:00 2001 From: apenzk Date: Mon, 2 Sep 2024 09:36:31 +0200 Subject: [PATCH 4/4] update readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 041359b8..a108cae3 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,14 @@ The code in this branch is a prototype of Mysticeti. It supplements the paper [Mysticeti: Low-Latency DAG Consensus with Fast Commit Path](https://arxiv.org/abs/2310.14821) enabling reproducible results. There are no plans to maintain this branch. +## Development + +When developing, the analyzer may show errors in files. To fix this start code in a nix environment. + + nix develop + code . + + ## License This software is licensed as [Apache 2.0](LICENSE).