Skip to content

feat(starfish): send full block #6803

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

Draft
wants to merge 14 commits into
base: consensus/feat/starfish-consensus
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
/crates/prometheus-closure-metric/ @iotaledger/node
/crates/shared-crypto/ @iotaledger/core-protocol
/crates/simulacrum/ @iotaledger/vm-language
/crates/starfish/ @iotaledger/consensus
/crates/telemetry-subscribers/ @iotaledger/core-protocol
/crates/transaction-fuzzer/ @iotaledger/node @iotaledger/vm-language
/crates/test-cluster/ @iotaledger/infrastructure
Expand Down
10 changes: 9 additions & 1 deletion .github/crates-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,16 @@ iota-move-natives-latest:
iota-verifier-latest:
- "iota-execution/latest/iota-verifier/**"

# Consensus
# Mysticeti Consensus
consensus-config:
- "consensus/config/**"
consensus-core:
- "consensus/core/**"

# Starfish Consensus
starfish-config:
- "crates/starfish/config/**"
starfish-core:
- "crates/starfish/core/**"
starfish-simtests:
- "crates/starfish/simtests/**"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ build/
!crates/iota-single-node-benchmark/tests/data/package_publish_from_bytecode/package_b/build/
storage/
!consensus/core/src/storage/
!crates/starfish/core/src/storage/
!crates/iota-types/src/storage/

# Move-related files
Expand Down
111 changes: 111 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ members = [
"crates/prometheus-closure-metric",
"crates/shared-crypto",
"crates/simulacrum",
"crates/starfish/config",
"crates/starfish/core",
"crates/starfish/simtests",
"crates/telemetry-subscribers",
"crates/test-cluster",
"crates/transaction-fuzzer",
Expand Down Expand Up @@ -470,6 +473,9 @@ move-vm-types = { path = "external-crates/move/crates/move-vm-types" }
prometheus-closure-metric = { path = "crates/prometheus-closure-metric" }
shared-crypto = { path = "crates/shared-crypto" }
simulacrum = { path = "crates/simulacrum" }
starfish-config = { path = "crates/starfish/config" }
starfish-core = { path = "crates/starfish/core" }
starfish-simtests = { path = "crates/starfish/simtests" }
telemetry-subscribers = { path = "crates/telemetry-subscribers" }
test-cluster = { path = "crates/test-cluster" }
transaction-fuzzer = { path = "crates/transaction-fuzzer" }
Expand Down
2 changes: 1 addition & 1 deletion consensus/core/src/linearizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Linearizer {
let mut to_commit = Vec::new();

// The new logic will perform the recursion without stopping at the highest
// round round that has been committed per authority. Instead it will
// round that has been committed per authority. Instead it will
// allow to commit blocks that are lower than the highest committed round for an
// authority but higher than gc_round.
if context.protocol_config.consensus_linearize_subdag_v2() {
Expand Down
2 changes: 2 additions & 0 deletions crates/iota-config/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ impl NodeConfig {
pub enum ConsensusProtocol {
#[serde(rename = "mysticeti")]
Mysticeti,
#[serde(rename = "starfish")]
Starfish,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down
2 changes: 2 additions & 0 deletions crates/iota-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ move-core-types.workspace = true
move-package.workspace = true
move-symbol-pool.workspace = true
shared-crypto.workspace = true
starfish-config.workspace = true
starfish-core.workspace = true
telemetry-subscribers.workspace = true
typed-store.workspace = true
typed-store-derive.workspace = true
Expand Down
45 changes: 45 additions & 0 deletions crates/iota-core/src/consensus_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,51 @@ impl Drop for MysticetiConsensusHandler {
}
}

/// Consensus handler used by Starfish.
/// During initialization, the sender is passed into Starfish which can send
/// consensus output to the channel.
pub struct StarfishConsensusHandler {
handle: Option<tokio::task::JoinHandle<()>>,
}

impl StarfishConsensusHandler {
pub fn new(
mut consensus_handler: ConsensusHandler<CheckpointService>,
mut receiver: UnboundedReceiver<starfish_core::CommittedSubDag>,
commit_consumer_monitor: Arc<starfish_core::CommitConsumerMonitor>,
) -> Self {
let handle = spawn_monitored_task!(async move {
// TODO: pause when execution is overloaded, so consensus can detect the
// backpressure.
while let Some(consensus_output) = receiver.recv().await {
let commit_index = consensus_output.commit_ref.index;
consensus_handler
.handle_consensus_output(consensus_output)
.await;
commit_consumer_monitor.set_highest_handled_commit(commit_index);
}
});
Self {
handle: Some(handle),
}
}

pub async fn abort(&mut self) {
if let Some(handle) = self.handle.take() {
handle.abort();
let _ = handle.await;
}
}
}

impl Drop for StarfishConsensusHandler {
fn drop(&mut self) {
if let Some(handle) = self.handle.take() {
handle.abort();
}
}
}

impl<C> ConsensusHandler<C> {
fn authenticator_state_update_transaction(
&self,
Expand Down
Loading