Skip to content

Commit

Permalink
Update narwhal pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-koshy committed Aug 26, 2022
1 parent 83cb004 commit 8829d7b
Show file tree
Hide file tree
Showing 36 changed files with 941 additions and 621 deletions.
492 changes: 305 additions & 187 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/sui-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async-trait = "0.1.57"
rayon = "1.5.3"
anyhow = { version = "1.0.57", features = ["backtrace"] }
futures = "0.3.23"
serde = { version = "1.0.142", features = ["derive"] }
serde = { version = "1.0.144", features = ["derive"] }
serde_json = "1.0.83"
tempfile = "3.3.0"
tokio = { version = "1.20.1", features = ["full"] }
Expand Down Expand Up @@ -41,7 +41,7 @@ sui-node = { path = "../sui-node" }
sui-json-rpc-types = { path = "../sui-json-rpc-types" }

move-core-types = { git = "https://github.com/move-language/move", rev = "70b34a66473c34ad30d101290b249f2db3c847a2", features = ["address20"] }
narwhal-node = { git = "https://github.com/MystenLabs/narwhal", rev = "f4cab79d77cf70b0d564fa640fb748584a3ba36f", package = "node" }
narwhal-node = { git = "https://github.com/MystenLabs/narwhal", rev = "c6b9f05a5260362e7b7fe1235f5e887cd6ec92cd", package = "node" }
workspace-hack = { path = "../workspace-hack"}
test-utils = { path = "../test-utils" }

Expand Down
2 changes: 2 additions & 0 deletions crates/sui-benchmark/src/benchmark/validator_preparer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ fn make_authority_state(
));
let epoch_store = Arc::new(EpochStore::new(path.join("epochs"), committee, Some(opts)));
let (tx_reconfigure_consensus, _rx_reconfigure_consensus) = tokio::sync::mpsc::channel(10);
let (tx_consensus_to_sui, _rx_consensus_to_sui) = tokio::sync::mpsc::channel(1_000);
(
Runtime::new().unwrap().block_on(async {
AuthorityState::new(
Expand All @@ -297,6 +298,7 @@ fn make_authority_state(
&sui_config::genesis::Genesis::get_default_genesis(),
&prometheus::Registry::new(),
tx_reconfigure_consensus,
tx_consensus_to_sui,
)
.await
}),
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-cluster-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
edition = "2021"

[dependencies]
serde = { version = "1.0.142", features = ["derive"] }
serde = { version = "1.0.144", features = ["derive"] }
futures = "0.3.23"
serde_json = "1.0.83"
tempfile = "3.3.0"
Expand All @@ -32,4 +32,4 @@ sui-core = { path = "../sui-core" }
sui-json = { path = "../sui-json" }
sui-config = { path = "../sui-config" }
test-utils = { path = "../test-utils" }
workspace-hack = { path = "../workspace-hack"}
workspace-hack = { path = "../workspace-hack"}
6 changes: 3 additions & 3 deletions crates/sui-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bcs = "0.1.3"
arc-swap = "1.5.1"
camino = "1.1.1"
anyhow = { version = "1.0.58", features = ["backtrace"] }
serde = { version = "1.0.141", features = ["derive", "rc"] }
serde = { version = "1.0.144", features = ["derive", "rc"] }
serde_with = "1.14.0"
serde_yaml = "0.8.26"
rand = "0.8.5"
Expand All @@ -20,13 +20,13 @@ multiaddr = "0.14.0"
once_cell = "1.13.1"
tracing = "0.1.36"

fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "a9e58305dc463c40b9d357730203406214909f04" }
fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "c022a2ae23ca7cc2778293fd3b1db42e8cd02d3b" }

move-binary-format = { git = "https://github.com/move-language/move", rev = "70b34a66473c34ad30d101290b249f2db3c847a2" }
move-package = { git = "https://github.com/move-language/move", rev = "70b34a66473c34ad30d101290b249f2db3c847a2" }
move-core-types = { git = "https://github.com/move-language/move", rev = "70b34a66473c34ad30d101290b249f2db3c847a2", features = ["address20"] }
move-vm-runtime = { git = "https://github.com/move-language/move", rev = "70b34a66473c34ad30d101290b249f2db3c847a2" }
narwhal-config = { git = "https://github.com/MystenLabs/narwhal", rev = "f4cab79d77cf70b0d564fa640fb748584a3ba36f", package = "config" }
narwhal-config = { git = "https://github.com/MystenLabs/narwhal", rev = "c6b9f05a5260362e7b7fe1235f5e887cd6ec92cd", package = "config" }


sui-framework = { path = "../sui-framework" }
Expand Down
38 changes: 29 additions & 9 deletions crates/sui-config/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@ impl Genesis {
primary_to_primary: validator.narwhal_primary_to_primary.clone(),
worker_to_primary: validator.narwhal_worker_to_primary.clone(),
};
let authority = narwhal_config::Authority {
stake: validator.stake as narwhal_config::Stake, //TODO this should at least be the same size integer
primary,
};

(name, authority)
})
.collect();
std::sync::Arc::new(arc_swap::ArcSwap::from_pointee(narwhal_config::Committee {
authorities: narwhal_committee,
epoch: self.epoch() as narwhal_config::Epoch,
}))
}

pub fn narwhal_worker_cache(&self) -> narwhal_config::SharedWorkerCache {
let workers = self
.validator_set
.iter()
.map(|validator| {
let name = validator
.protocol_key()
.try_into()
.expect("Can't get narwhal public key");
let workers = [(
0, // worker_id
narwhal_config::WorkerInfo {
Expand All @@ -83,19 +106,16 @@ impl Genesis {
)]
.into_iter()
.collect();
let authority = narwhal_config::Authority {
stake: validator.stake as narwhal_config::Stake, //TODO this should at least be the same size integer
primary,
workers,
};
let worker_index = narwhal_config::WorkerIndex(workers);

(name, authority)
(name, worker_index)
})
.collect();
std::sync::Arc::new(arc_swap::ArcSwap::from_pointee(narwhal_config::Committee {
authorities: narwhal_committee,
narwhal_config::WorkerCache {
workers,
epoch: self.epoch() as narwhal_config::Epoch,
}))
}
.into()
}

pub fn sui_system_object(&self) -> SuiSystemState {
Expand Down
1 change: 1 addition & 0 deletions crates/sui-config/tests/snapshot_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fn populated_genesis_snapshot_matches() {
assert_yaml_snapshot!(genesis.validator_set());
assert_yaml_snapshot!(genesis.committee().unwrap());
assert_yaml_snapshot!(genesis.narwhal_committee());
assert_yaml_snapshot!(genesis.narwhal_worker_cache());
assert_yaml_snapshot!(genesis.sui_system_object());
// Serialized `genesis` is not static and cannot be snapshot tested.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,4 @@ authorities:
primary:
primary_to_primary: ""
worker_to_primary: ""
workers:
0:
transactions: ""
worker_to_worker: ""
primary_to_worker: ""
epoch: 0

Loading

0 comments on commit 8829d7b

Please sign in to comment.