diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64960a2277..5ddc82e0f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: cargo build --locked --release --workspace - name: Build sequencer-sqlite - run: cargo build --locked --release --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target + run: cargo build --release --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target - name: Build Espresso Dev Node # Espresso Dev Node currently requires testing feature, so it is built separately. diff --git a/Cargo.lock b/Cargo.lock index 02f7f6de2f..85dea358a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1259,10 +1259,8 @@ dependencies = [ "anyhow", "async-broadcast", "async-lock 3.4.0", - "async-trait", "clap", "committable", - "dotenvy", "espresso-types", "ethers", "futures", @@ -1270,21 +1268,14 @@ dependencies = [ "hotshot-builder-api", "hotshot-builder-core", "hotshot-events-service", - "hotshot-example-types", - "hotshot-orchestrator", - "hotshot-stake-table", "hotshot-state-prover", "hotshot-types", "jf-signature 0.2.0", - "libp2p", - "libp2p-networking", "marketplace-builder-shared", "portpicker", "rand 0.8.5", "sequencer", "sequencer-utils", - "serde", - "surf", "surf-disco", "tempfile", "tide-disco", @@ -1386,15 +1377,6 @@ dependencies = [ "serde", ] -[[package]] -name = "capnp" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e985a566bdaae9a428a957d12b10c318d41b2afddb54cfbb764878059df636e" -dependencies = [ - "embedded-io", -] - [[package]] name = "capnp" version = "0.20.3" @@ -1404,22 +1386,13 @@ dependencies = [ "embedded-io", ] -[[package]] -name = "capnpc" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ba30e0f08582d53c2f3710cf4bb65ff562614b1ba86906d7391adffe189ec" -dependencies = [ - "capnp 0.19.8", -] - [[package]] name = "capnpc" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aa3d5f01e69ed11656d2c7c47bf34327ea9bfb5c85c7de787fcd7b6c5e45b61" dependencies = [ - "capnp 0.20.3", + "capnp", ] [[package]] @@ -1445,6 +1418,16 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "cargo_toml" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" +dependencies = [ + "serde", + "toml 0.7.8", +] + [[package]] name = "cbor4ii" version = "0.3.3" @@ -1468,9 +1451,9 @@ dependencies = [ [[package]] name = "cdn-broker" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5#f6cc7c2fc53eaa52a4901e775d9be7ac820af72c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade#849e7edb32788e42738541ba4d5c64d3e061d86d" dependencies = [ - "cdn-proto 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5)", + "cdn-proto 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade)", "clap", "console-subscriber", "dashmap", @@ -1530,9 +1513,9 @@ dependencies = [ [[package]] name = "cdn-marshal" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5#f6cc7c2fc53eaa52a4901e775d9be7ac820af72c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade#849e7edb32788e42738541ba4d5c64d3e061d86d" dependencies = [ - "cdn-proto 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5)", + "cdn-proto 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade)", "clap", "jf-signature 0.1.0", "tokio", @@ -1556,13 +1539,13 @@ dependencies = [ [[package]] name = "cdn-proto" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5#f6cc7c2fc53eaa52a4901e775d9be7ac820af72c" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade#849e7edb32788e42738541ba4d5c64d3e061d86d" dependencies = [ "anyhow", "ark-serialize", "async-trait", - "capnp 0.19.8", - "capnpc 0.19.0", + "capnp", + "capnpc", "derivative", "jf-signature 0.1.0", "kanal", @@ -1574,7 +1557,7 @@ dependencies = [ "quinn", "rand 0.8.5", "rcgen 0.13.1", - "redis 0.25.4", + "redis", "rkyv", "rustls 0.23.18", "rustls-pki-types", @@ -1595,8 +1578,8 @@ dependencies = [ "anyhow", "ark-serialize", "async-trait", - "capnp 0.20.3", - "capnpc 0.20.1", + "capnp", + "capnpc", "derivative", "derive_more 1.0.0", "jf-signature 0.2.0", @@ -1609,7 +1592,7 @@ dependencies = [ "quinn", "rand 0.8.5", "rcgen 0.13.1", - "redis 0.27.5", + "redis", "rkyv", "rustls 0.23.18", "rustls-pki-types", @@ -1725,12 +1708,10 @@ name = "client" version = "0.1.0" dependencies = [ "anyhow", - "contract-bindings", "espresso-types", "ethers", "futures", "jf-merkle-tree", - "sequencer-utils", "surf-disco", "tokio", "tracing", @@ -1851,7 +1832,7 @@ dependencies = [ "rust-ini", "serde", "serde_json", - "toml", + "toml 0.8.19", "yaml-rust2", ] @@ -2515,7 +2496,6 @@ dependencies = [ "ethers", "hotshot-contract-adapter", "hotshot-state-prover", - "itertools 0.12.1", "jf-pcs", "jf-plonk", "jf-signature 0.2.0", @@ -2859,7 +2839,6 @@ dependencies = [ "fluent-asserter", "futures", "hotshot", - "hotshot-orchestrator", "hotshot-query-service", "hotshot-types", "itertools 0.12.1", @@ -3036,7 +3015,7 @@ dependencies = [ "serde", "serde_json", "syn 2.0.87", - "toml", + "toml 0.8.19", "walkdir", ] @@ -4065,7 +4044,7 @@ dependencies = [ "tagged-base64", "thiserror 2.0.3", "tide-disco", - "toml", + "toml 0.8.19", "vbs", ] @@ -4103,8 +4082,6 @@ version = "0.1.0" dependencies = [ "anyhow", "ark-bn254", - "ark-ec", - "ark-ed-on-bn254", "ark-ff", "ark-poly", "ark-serialize", @@ -4142,7 +4119,7 @@ dependencies = [ "tagged-base64", "tide-disco", "tokio", - "toml", + "toml 0.8.19", "tracing", "tracing-test", "vbs", @@ -4187,7 +4164,7 @@ dependencies = [ "rand 0.8.5", "tide-disco", "tokio", - "toml", + "toml 0.8.19", "vbs", ] @@ -4220,7 +4197,7 @@ dependencies = [ "surf-disco", "tide-disco", "tokio", - "toml", + "toml 0.8.19", "tracing", "vbs", ] @@ -4270,7 +4247,7 @@ dependencies = [ "tide-disco", "time 0.3.36", "tokio", - "toml", + "toml 0.8.19", "tracing", "tracing-subscriber 0.3.18", "trait-variant", @@ -4336,7 +4313,7 @@ dependencies = [ "tide-disco", "time 0.3.36", "tokio", - "toml", + "toml 0.8.19", "tracing", "url", "vbs", @@ -4476,7 +4453,7 @@ dependencies = [ "thiserror 2.0.3", "time 0.3.36", "tokio", - "toml", + "toml 0.8.19", "tracing", "typenum", "url", @@ -6294,7 +6271,6 @@ dependencies = [ "async-trait", "bincode", "clap", - "cld", "committable", "espresso-types", "futures", @@ -6302,18 +6278,16 @@ dependencies = [ "hotshot-events-service", "hotshot-query-service", "hotshot-types", - "jf-signature 0.2.0", "marketplace-solver", "portpicker", "rand 0.8.5", "serde", - "serde_json", "sqlx", "surf-disco", "thiserror 1.0.69", "tide-disco", "tokio", - "toml", + "toml 0.8.19", "tracing", "vbs", ] @@ -6676,7 +6650,7 @@ dependencies = [ "tide-disco", "time 0.3.36", "tokio", - "toml", + "toml 0.8.19", "tracing", "url", "vbs", @@ -7445,7 +7419,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit", + "toml_edit 0.22.22", ] [[package]] @@ -7852,28 +7826,6 @@ dependencies = [ "yasna", ] -[[package]] -name = "redis" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d7a6955c7511f60f3ba9e86c6d02b3c3f144f8c24b288d1f4e18074ab8bbec" -dependencies = [ - "arc-swap", - "async-trait", - "bytes 1.8.0", - "combine", - "futures", - "futures-util", - "itoa", - "percent-encoding", - "pin-project-lite 0.2.15", - "ryu", - "tokio", - "tokio-retry", - "tokio-util", - "url", -] - [[package]] name = "redis" version = "0.27.5" @@ -7943,7 +7895,7 @@ dependencies = [ "time 0.3.36", "tokio", "tokio-postgres", - "toml", + "toml 0.8.19", "url", "walkdir", ] @@ -8648,8 +8600,8 @@ dependencies = [ "async-once-cell", "async-trait", "bincode", - "cdn-broker 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5)", - "cdn-marshal 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.5)", + "cdn-broker 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade)", + "cdn-marshal 0.4.0 (git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.1-upgrade)", "clap", "client", "committable", @@ -8665,7 +8617,6 @@ dependencies = [ "ethers", "futures", "hotshot", - "hotshot-builder-api", "hotshot-contract-adapter", "hotshot-events-service", "hotshot-example-types", @@ -8709,8 +8660,9 @@ dependencies = [ "tempfile", "tide-disco", "time 0.3.36", + "todo_by", "tokio", - "toml", + "toml 0.8.19", "tracing", "tracing-subscriber 0.3.18", "url", @@ -9124,7 +9076,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c3c6b7927ffe7ecaa769ee0e3994da3b8cafc8f444578982c83ecb161af917" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.87", @@ -9973,7 +9925,7 @@ dependencies = [ "tagged-base64", "tide", "tide-websockets", - "toml", + "toml 0.8.19", "tracing", "tracing-distributed", "tracing-futures", @@ -10106,6 +10058,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "todo_by" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e25529b77ab1841ec52a4e8356632b417698b53ea9ad62c6be7d04d5e420dc4" +dependencies = [ + "cargo_toml", + "chrono", + "proc-macro2", + "quote", + "semver 1.0.23", + "syn 2.0.87", +] + [[package]] name = "tokio" version = "1.41.1" @@ -10181,17 +10147,6 @@ dependencies = [ "whoami", ] -[[package]] -name = "tokio-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" -dependencies = [ - "pin-project", - "rand 0.8.5", - "tokio", -] - [[package]] name = "tokio-retry2" version = "0.5.6" @@ -10263,6 +10218,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.15", +] + [[package]] name = "toml" version = "0.8.19" @@ -10272,7 +10239,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.22.22", ] [[package]] @@ -10284,6 +10251,19 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.6.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.5.40", +] + [[package]] name = "toml_edit" version = "0.22.22" @@ -10294,7 +10274,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.20", ] [[package]] @@ -11273,6 +11253,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.6.20" diff --git a/Cargo.toml b/Cargo.toml index e882629163..f8358292ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,8 +84,8 @@ hotshot-contract-adapter = { version = "0.1.0", path = "contracts/rust/adapter" hotshot-example-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.82" } # Push CDN imports -cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.4.5", package = "cdn-broker" } -cdn-marshal = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.4.5", package = "cdn-marshal" } +cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.5.1-upgrade", package = "cdn-broker" } +cdn-marshal = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.5.1-upgrade", package = "cdn-marshal" } jf-plonk = { git = "https://github.com/EspressoSystems/jellyfish", tag = "jf-plonk-v0.5.1", features = [ "test-apis", diff --git a/builder/Cargo.toml b/builder/Cargo.toml index d23387f874..590abddf47 100644 --- a/builder/Cargo.toml +++ b/builder/Cargo.toml @@ -9,10 +9,8 @@ edition = { workspace = true } anyhow = { workspace = true } async-broadcast = { workspace = true } async-lock = { workspace = true } -async-trait = { workspace = true } clap = { workspace = true } committable = { workspace = true } -dotenvy = { workspace = true } espresso-types = { path = "../types" } ethers = { workspace = true } futures = { workspace = true } @@ -20,20 +18,13 @@ hotshot = { workspace = true } hotshot-builder-api = { workspace = true } hotshot-builder-core = { workspace = true } hotshot-events-service = { workspace = true } -hotshot-example-types = { workspace = true } -hotshot-orchestrator = { workspace = true } -hotshot-stake-table = { workspace = true } hotshot-state-prover = { path = "../hotshot-state-prover" } hotshot-types = { workspace = true } -libp2p = { workspace = true } -libp2p-networking = { workspace = true } marketplace-builder-shared = { workspace = true } portpicker = { workspace = true } rand = "0.8.5" sequencer = { path = "../sequencer" } sequencer-utils = { path = "../utils" } -serde = { workspace = true } -surf = "2.3.1" surf-disco = { workspace = true } tide-disco = { workspace = true } tokio = { workspace = true } diff --git a/client/Cargo.toml b/client/Cargo.toml index 94c5e7d819..85db2033cc 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -7,12 +7,10 @@ publish = false [dependencies] anyhow = { workspace = true } -contract-bindings = { path = "../contract-bindings" } espresso-types = { path = "../types" } ethers = { workspace = true } futures = { workspace = true } jf-merkle-tree = { workspace = true } -sequencer-utils = { path = "../utils" } surf-disco = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } diff --git a/contracts/rust/adapter/Cargo.toml b/contracts/rust/adapter/Cargo.toml index 59f1756702..88e7e6c1b2 100644 --- a/contracts/rust/adapter/Cargo.toml +++ b/contracts/rust/adapter/Cargo.toml @@ -8,8 +8,6 @@ edition = { workspace = true } [dependencies] anyhow = { workspace = true } ark-bn254 = { workspace = true } -ark-ec = { workspace = true } -ark-ed-on-bn254 = { workspace = true } ark-ff = { workspace = true } ark-poly = { workspace = true } ark-serialize = { workspace = true } diff --git a/contracts/rust/diff-test/Cargo.toml b/contracts/rust/diff-test/Cargo.toml index 91414de0f8..210dbb03fc 100644 --- a/contracts/rust/diff-test/Cargo.toml +++ b/contracts/rust/diff-test/Cargo.toml @@ -17,7 +17,6 @@ diff-test-bn254 = { git = "https://github.com/EspressoSystems/solidity-bn254.git ethers = { version = "2.0.4" } hotshot-contract-adapter = { path = "../adapter" } hotshot-state-prover = { path = "../../../hotshot-state-prover" } -itertools = { workspace = true } jf-pcs = { workspace = true } jf-plonk = { workspace = true } jf-signature = { workspace = true } diff --git a/marketplace-solver/Cargo.toml b/marketplace-solver/Cargo.toml index 06d8b5b1f5..07895157b1 100644 --- a/marketplace-solver/Cargo.toml +++ b/marketplace-solver/Cargo.toml @@ -17,7 +17,6 @@ async-lock = { workspace = true } async-trait = { workspace = true } bincode = { workspace = true } clap = { workspace = true } -cld = { workspace = true } committable = { workspace = true } espresso-types = { path = "../types" } futures = { workspace = true } @@ -25,11 +24,9 @@ hotshot = { workspace = true } hotshot-events-service = { workspace = true } hotshot-query-service = { workspace = true, optional = true } hotshot-types = { workspace = true } -jf-signature = { workspace = true } portpicker = { workspace = true, optional = true } rand = { workspace = true } serde = { workspace = true } -serde_json = { workspace = true } sqlx = { workspace = true, features = [ "postgres", "macros" ] } surf-disco = { workspace = true } thiserror = { workspace = true } diff --git a/node-metrics/src/service/data_state/mod.rs b/node-metrics/src/service/data_state/mod.rs index d1df72c8aa..5aeea99070 100644 --- a/node-metrics/src/service/data_state/mod.rs +++ b/node-metrics/src/service/data_state/mod.rs @@ -627,8 +627,7 @@ mod tests { }; let instance_state = NodeState::mock(); - let sample_leaf = Leaf::genesis(&validated_state, &instance_state) - .await; + let sample_leaf = Leaf::genesis(&validated_state, &instance_state).await; let mut leaf_sender = leaf_sender; // We should be able to send a leaf without issue diff --git a/sequencer/Cargo.toml b/sequencer/Cargo.toml index 41848e92a5..5fb19d8f63 100644 --- a/sequencer/Cargo.toml +++ b/sequencer/Cargo.toml @@ -10,7 +10,6 @@ testing = [ "hotshot-testing", "marketplace-builder-core", "marketplace-builder-shared", - "hotshot-builder-api", "espresso-types/testing", "sequencer-utils/testing", "hotshot-query-service/testing", @@ -49,6 +48,7 @@ async-lock = { workspace = true } async-once-cell = { workspace = true } async-trait = { workspace = true } bincode = { workspace = true } +todo_by = "0.3" # CDN imports cdn-broker = { workspace = true } @@ -68,7 +68,6 @@ ethers = { workspace = true } futures = { workspace = true } hotshot = { workspace = true } -hotshot-builder-api = { workspace = true, optional = true } hotshot-contract-adapter = { workspace = true } hotshot-events-service = { workspace = true } hotshot-orchestrator = { workspace = true } diff --git a/sequencer/src/api/sql.rs b/sequencer/src/api/sql.rs index 83bb208a55..f08a55a790 100644 --- a/sequencer/src/api/sql.rs +++ b/sequencer/src/api/sql.rs @@ -4,7 +4,7 @@ use committable::{Commitment, Committable}; use espresso_types::{ get_l1_deposits, v0_99::{ChainConfig, IterableFeeInfo}, - BlockMerkleTree, FeeAccount, FeeMerkleTree, Leaf2, NodeState, ValidatedState, + BlockMerkleTree, FeeAccount, FeeMerkleTree, Leaf, Leaf2, NodeState, ValidatedState, }; use hotshot::traits::ValidatedState as _; use hotshot_query_service::{ @@ -21,7 +21,7 @@ use hotshot_query_service::{ Resolvable, }; use hotshot_types::{ - data::{QuorumProposal2, ViewNumber}, + data::{QuorumProposal, ViewNumber}, message::Proposal, traits::node_implementation::ConsensusTime, }; @@ -443,8 +443,8 @@ where .bind(param) .fetch_one(tx.as_mut()) .await?; - let proposal: Proposal> = bincode::deserialize(&data)?; - Ok(Leaf2::from_quorum_proposal(&proposal.data)) + let proposal: Proposal> = bincode::deserialize(&data)?; + Ok(Leaf::from_quorum_proposal(&proposal.data).into()) } #[cfg(any(test, feature = "testing"))] diff --git a/sequencer/src/bin/cdn-broker.rs b/sequencer/src/bin/cdn-broker.rs index a45c9f4461..33df268136 100644 --- a/sequencer/src/bin/cdn-broker.rs +++ b/sequencer/src/bin/cdn-broker.rs @@ -1,7 +1,10 @@ //! The following is the main `Broker` binary, which just instantiates and runs //! a `Broker` object. use anyhow::{Context, Result}; -use cdn_broker::{reexports::crypto::signature::KeyPair, Broker, Config}; +use cdn_broker::{ + reexports::{crypto::signature::KeyPair, def::hook::NoMessageHook}, + Broker, Config, +}; use clap::Parser; use espresso_types::{parse_size, SeqTypes}; use hotshot_types::traits::{node_implementation::NodeType, signature_key::SignatureKey}; @@ -125,6 +128,9 @@ async fn main() -> Result<()> { private_key, }, + user_message_hook: NoMessageHook, + broker_message_hook: NoMessageHook, + public_bind_endpoint: args.public_bind_endpoint, public_advertise_endpoint: args.public_advertise_endpoint, private_bind_endpoint: args.private_bind_endpoint, diff --git a/sequencer/src/bin/dev-cdn.rs b/sequencer/src/bin/dev-cdn.rs index 5434c392b6..4ad18f7ca1 100644 --- a/sequencer/src/bin/dev-cdn.rs +++ b/sequencer/src/bin/dev-cdn.rs @@ -4,7 +4,10 @@ use std::path::Path; use anyhow::Result; -use cdn_broker::{reexports::crypto::signature::KeyPair, Broker, Config as BrokerConfig}; +use cdn_broker::{ + reexports::{crypto::signature::KeyPair, def::hook::NoMessageHook}, + Broker, Config as BrokerConfig, +}; use cdn_marshal::{Config as MarshalConfig, Marshal}; use clap::Parser; use espresso_types::SeqTypes; @@ -69,6 +72,9 @@ async fn main() -> Result<()> { private_key, }, + user_message_hook: NoMessageHook, + broker_message_hook: NoMessageHook, + ca_cert_path: None, ca_key_path: None, global_memory_pool_size: Some(1024 * 1024 * 1024), diff --git a/sequencer/src/network/cdn.rs b/sequencer/src/network/cdn.rs index b3b7a667bf..a69c79518f 100644 --- a/sequencer/src/network/cdn.rs +++ b/sequencer/src/network/cdn.rs @@ -3,9 +3,9 @@ use std::marker::PhantomData; use bincode::Options; use cdn_broker::reexports::{ - connection::protocols::{Quic, Tcp}, + connection::protocols::{Quic, Tcp, TcpTls}, crypto::signature::{Serializable, SignatureScheme}, - def::{ConnectionDef, RunDef, Topic as TopicTrait}, + def::{hook::NoMessageHook, ConnectionDef, RunDef, Topic as TopicTrait}, discovery::{Embedded, Redis}, }; use hotshot::types::SignatureKey; @@ -15,6 +15,7 @@ use hotshot_types::{ }; use num_enum::{IntoPrimitive, TryFromPrimitive}; use static_assertions::const_assert_eq; +use todo_by::todo_by; /// The enum for the topics we can subscribe to in the Push CDN #[repr(u8)] @@ -26,6 +27,8 @@ pub enum Topic { Da = 1, } +pub enum Namespace {} + // Make sure the topics are the same as defined in `HotShot`. const_assert_eq!(Topic::Global as u8, HotShotTopic::Global as u8); const_assert_eq!(Topic::Da as u8, HotShotTopic::Da as u8); @@ -43,22 +46,45 @@ impl SignatureScheme for WrappedSignatureKey { type PublicKey = Self; /// Sign a message of arbitrary data and return the serialized signature - fn sign(private_key: &Self::PrivateKey, message: &[u8]) -> anyhow::Result> { - let signature = T::sign(private_key, message)?; - // TODO: replace with rigorously defined serialization scheme... - // why did we not make `PureAssembledSignatureType` be `CanonicalSerialize + CanonicalDeserialize`? + /// + /// The namespace is prefixed to the message before signing to prevent + /// signature replay attacks in different parts of the system. + fn sign( + private_key: &Self::PrivateKey, + namespace: &str, + message: &[u8], + ) -> anyhow::Result> { + // Combine the namespace and message into a single byte array + let message = [namespace.as_bytes(), message].concat(); + + let signature = T::sign(private_key, &message)?; Ok(bincode_opts().serialize(&signature)?) } /// Verify a message of arbitrary data and return the result - fn verify(public_key: &Self::PublicKey, message: &[u8], signature: &[u8]) -> bool { - // TODO: replace with rigorously defined signing scheme + /// + /// The namespace is prefixed to the message before verification to prevent + /// signature replay attacks in different parts of the system. + fn verify( + public_key: &Self::PublicKey, + namespace: &str, + message: &[u8], + signature: &[u8], + ) -> bool { + // Combine the namespace and message into a single byte array + let namespaced_message = [namespace.as_bytes(), message].concat(); + let signature: T::PureAssembledSignatureType = match bincode_opts().deserialize(signature) { Ok(key) => key, Err(_) => return false, }; + todo_by!( + "2025-1-4", + "Only accept the namespaced message once everyone has upgraded" + ); public_key.0.validate(&signature, message) + || public_key.0.validate(&signature, &namespaced_message) } } @@ -78,18 +104,33 @@ impl Serializable for WrappedSignatureKey { /// Uses the real protocols and a Redis discovery client. pub struct ProductionDef(PhantomData); impl RunDef for ProductionDef { - type User = UserDef; + type User = UserDefQuic; + type User2 = UserDefTcp; type Broker = BrokerDef; type DiscoveryClientType = Redis; type Topic = Topic; } +todo_by!( + "2025-1-4", + "Remove this, switching to TCP+TLS singularly when everyone has updated" +); /// The user definition for the Push CDN. /// Uses the Quic protocol and untrusted middleware. -pub struct UserDef(PhantomData); -impl ConnectionDef for UserDef { +pub struct UserDefQuic(PhantomData); +impl ConnectionDef for UserDefQuic { type Scheme = WrappedSignatureKey; type Protocol = Quic; + type MessageHook = NoMessageHook; +} + +/// The (parallel, TCP) user definition for the Push CDN. +/// Uses the TCP+TLS protocol and untrusted middleware. +pub struct UserDefTcp(PhantomData); +impl ConnectionDef for UserDefTcp { + type Scheme = WrappedSignatureKey; + type Protocol = TcpTls; + type MessageHook = NoMessageHook; } /// The broker definition for the Push CDN. @@ -98,6 +139,7 @@ pub struct BrokerDef(PhantomData); impl ConnectionDef for BrokerDef { type Scheme = WrappedSignatureKey; type Protocol = Tcp; + type MessageHook = NoMessageHook; } /// The client definition for the Push CDN. Uses the Quic @@ -108,13 +150,15 @@ pub struct ClientDef(PhantomData); impl ConnectionDef for ClientDef { type Scheme = WrappedSignatureKey; type Protocol = Quic; + type MessageHook = NoMessageHook; } /// The testing run definition for the Push CDN. /// Uses the real protocols, but with an embedded discovery client. pub struct TestingDef(PhantomData); impl RunDef for TestingDef { - type User = UserDef; + type User = UserDefQuic; + type User2 = UserDefTcp; type Broker = BrokerDef; type DiscoveryClientType = Embedded; type Topic = Topic; diff --git a/sequencer/src/restart_tests.rs b/sequencer/src/restart_tests.rs index 574fdd7212..59dae6d41a 100755 --- a/sequencer/src/restart_tests.rs +++ b/sequencer/src/restart_tests.rs @@ -9,7 +9,10 @@ use crate::{ SequencerApiVersion, }; use anyhow::bail; -use cdn_broker::{reexports::crypto::signature::KeyPair, Broker, Config as BrokerConfig}; +use cdn_broker::{ + reexports::{crypto::signature::KeyPair, def::hook::NoMessageHook}, + Broker, Config as BrokerConfig, +}; use cdn_marshal::{Config as MarshalConfig, Marshal}; use clap::Parser; use derivative::Derivative; @@ -860,6 +863,9 @@ async fn start_broker(ports: &mut PortPicker, dir: &Path) -> JoinHandle<()> { private_key, }, + user_message_hook: NoMessageHook, + broker_message_hook: NoMessageHook, + ca_cert_path: None, ca_key_path: None, global_memory_pool_size: Some(1024 * 1024 * 1024), diff --git a/types/Cargo.toml b/types/Cargo.toml index 5d39890637..0c4151f691 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" testing = [] [dependencies] - anyhow = { workspace = true } ark-serialize = { workspace = true } async-broadcast = { workspace = true } @@ -27,7 +26,6 @@ ethers = { workspace = true } fluent-asserter = "0.1.9" futures = { workspace = true } hotshot = { workspace = true } -hotshot-orchestrator = { workspace = true } hotshot-query-service = { workspace = true } hotshot-types = { workspace = true } itertools = { workspace = true }