Skip to content
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
32 changes: 28 additions & 4 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ members = [
"crates/tracing",
"crates/peerinfo",
"crates/frost",
"crates/priority",
]
# Vendored fork consumed only via [patch.crates-io]; excluded so it builds/tests
# standalone (its upstream code isn't written to this workspace's lints) without
# cargo treating it as a member.
exclude = ["third_party/multistream-select"]
resolver = "3"

[workspace.package]
Expand Down Expand Up @@ -162,3 +167,10 @@ opt-level = 3

[profile.test.package.aes]
opt-level = 3

# Forked multistream-select that accepts slash-less protocol names, required for
# the priority protocol to interoperate with Charon's "charon/priority/2.0.0"
# (no leading slash). Upstream rejects such names; the only delta is relaxing
# that check. See third_party/multistream-select/PATCHES.md.
[patch.crates-io]
multistream-select = { path = "third_party/multistream-select" }
4 changes: 2 additions & 2 deletions crates/consensus/src/qbft/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl SomeMsg<ConsensusQbftTypes> for Msg {
/// The hash input is deterministic protobuf encoding, then SSZ `PutBytes`
/// merkleization. `Any` is rejected because the consensus value hash must bind
/// to the inner message bytes, not the transport envelope.
pub(crate) fn hash_proto<M>(msg: &M) -> Result<[u8; 32]>
pub fn hash_proto<M>(msg: &M) -> Result<[u8; 32]>
where
M: prost::Message + prost::Name,
{
Expand All @@ -288,7 +288,7 @@ where
/// This helper hashes the bytes exactly as provided; it does not decode or
/// canonicalize a protobuf envelope. Callers must pass bytes produced from the
/// concrete inner message with deterministic field/map ordering.
pub(crate) fn hash_proto_bytes(encoded: &[u8]) -> Result<[u8; 32]> {
pub fn hash_proto_bytes(encoded: &[u8]) -> Result<[u8; 32]> {
let mut hasher = Hasher::default();
let index = hasher.index();
hasher.put_bytes(encoded).map_err(Error::HashProto)?;
Expand Down
10 changes: 10 additions & 0 deletions crates/core/src/deadline/calculator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Deadline calculator trait and beacon-node-derived implementation.

use std::sync::Arc;

use chrono::{DateTime, Duration, Utc};
use pluto_eth2api::EthBeaconNodeApiClient;

Expand Down Expand Up @@ -86,6 +88,14 @@ pub trait DeadlineCalculator: Send + Sync + 'static {
fn deadline(&self, duty: &Duty) -> Result<Option<DateTime<Utc>>>;
}

/// Lets a shared (`Arc`-wrapped) calculator satisfy the trait, so a single
/// calculator instance can back both a deadliner task and other consumers.
impl<T: DeadlineCalculator + ?Sized> DeadlineCalculator for Arc<T> {
fn deadline(&self, duty: &Duty) -> Result<Option<DateTime<Utc>>> {
(**self).deadline(duty)
}
}

/// Calculator that reports every duty as never expiring. Useful for
/// scenarios that need to plug into the deadliner API but don't actually want
/// any eviction (e.g. DKG, which is one-shot and outside the slot timeline).
Expand Down
2 changes: 1 addition & 1 deletion crates/p2p/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub(crate) fn default_swarm_config(cfg: libp2p::swarm::Config) -> libp2p::swarm:
}

/// Converts a secret key to a libp2p keypair.
pub(crate) fn keypair_from_secret_key(key: k256::SecretKey) -> crate::p2p::Result<Keypair> {
pub fn keypair_from_secret_key(key: k256::SecretKey) -> crate::p2p::Result<Keypair> {
let mut der = key.to_sec1_der()?;
let keypair = Keypair::secp256k1_from_der(&mut der)?;
Ok(keypair)
Expand Down
37 changes: 37 additions & 0 deletions crates/priority/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "pluto-priority"
version.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
publish.workspace = true

[dependencies]
async-trait.workspace = true
chrono.workspace = true
futures.workspace = true
k256.workspace = true
libp2p.workspace = true
pluto-consensus.workspace = true
pluto-core.workspace = true
pluto-k1util.workspace = true
pluto-p2p.workspace = true
prost.workspace = true
prost-types.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-util.workspace = true
tracing.workspace = true

[dev-dependencies]
pluto-testutil.workspace = true
rand.workspace = true
test-case.workspace = true
tokio = { workspace = true, features = ["test-util", "rt-multi-thread", "macros", "net", "time", "io-util"] }
# Interop proof: drive the patched multistream-select negotiation over real TCP.
multistream-select = "0.13"
tokio-util = { workspace = true, features = ["compat"] }
futures.workspace = true

[lints]
workspace = true
Loading
Loading