Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ bytesize = "1.3"
committable = { git = "https://github.com/EspressoSystems/commit.git", features = ["ark-serialize"] }
derivative = "2.2"
itertools = "0.12"
jf-advz = { git = "https://github.com/EspressoSystems/jellyfish-compat", tag = "jf-advz-v0.2.2", features = [
"std",
"parallel",
] }
jf-crhf = { git = "https://github.com/EspressoSystems/jellyfish", tag = "jf-crhf-v0.2.0" }
jf-merkle-tree-compat = { git = "https://github.com/EspressoSystems/jellyfish-compat", tag = "jf-merkle-tree-compat-v0.2.0", features = [
"std",
Expand All @@ -200,10 +204,6 @@ jf-signature = { git = "https://github.com/EspressoSystems/jellyfish", tag = "jf
"std",
] }
jf-utils = { git = "https://github.com/EspressoSystems/jellyfish", tag = "jf-utils-v0.5.0" }
jf-advz = { git = "https://github.com/EspressoSystems/jellyfish-compat", tag = "jf-advz-v0.2.2", features = [
"std",
"parallel",
] }
libp2p = { package = "libp2p", version = "0.56", default-features = false, features = [
"macros",
"autonat",
Expand Down
6 changes: 3 additions & 3 deletions contracts/rust/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ derive_more = { workspace = true }
hotshot-types = { workspace = true }
jf-pcs = { workspace = true }
jf-plonk = { workspace = true }
jf-plonk-compat = { package = "jf-plonk", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }
jf-signature = { workspace = true, features = ["bls", "schnorr"] }
jf-utils = { workspace = true }
num-bigint = { version = "0.4", default-features = false }
Expand All @@ -35,9 +38,6 @@ rand = { workspace = true }
serde = { workspace = true }
serde_arrays = "0.2.0"
thiserror = { workspace = true }
jf-plonk-compat = { package = "jf-plonk", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }

[dev-dependencies]
bincode = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub mod testing {
let config: HotShotConfig<SeqTypes> = HotShotConfig {
num_nodes_with_stake: NonZeroUsize::new(num_nodes_with_stake).unwrap(),
known_da_nodes: known_nodes_with_stake.clone(),
da_committees: Default::default(),
known_nodes_with_stake: known_nodes_with_stake.clone(),
next_view_timeout: Duration::from_secs(5).as_millis() as u64,
num_bootstrap: 1usize,
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn build_instance_state<V: Versions>(
let coordinator = EpochMembershipCoordinator::new(
Arc::new(RwLock::new(EpochCommittees::new_stake(
vec![],
vec![],
Default::default(),
None,
fetcher,
genesis.epoch_height.unwrap_or_default(),
Expand Down
7 changes: 7 additions & 0 deletions crates/hotshot/orchestrator/run-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@ start_proposing_time = 1
stop_proposing_time = 0
start_voting_time = 1
stop_voting_time = 0

[[config.da_committees]]
start_version = "99.99"
start_epoch = 0
committee = [
{ stake_table_entry = { stake_key = "BLS_VER_KEY~bQszS-QKYvUij2g20VqS8asttGSb95NrTu2PUj0uMh1CBUxNy1FqyPDjZqB29M7ZbjWqj79QkEOWkpga84AmDYUeTuWmy-0P1AdKHD3ehc-dKvei78BDj5USwXPJiDUlCxvYs_9rWYhagaq-5_LXENr78xel17spftNd5MA1Mw5U", stake_amount = 1 }, state_ver_key = "SCHNORR_VER_KEY~lJqDaVZyM0hWP2Br52IX5FeE-dCAIC-dPX7bL5-qUx-vjbunwe-ENOeZxj6FuOyvDCFzoGeP7yZ0fM995qF-CRE" }
]
1 change: 1 addition & 0 deletions crates/hotshot/testing/src/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub fn default_hotshot_config<TYPES: NodeType>(
start_threshold: (1, 1),
num_nodes_with_stake: NonZeroUsize::new(known_nodes_with_stake.len()).unwrap(),
known_da_nodes: known_da_nodes.clone(),
da_committees: Default::default(),
num_bootstrap: num_bootstrap_nodes,
known_nodes_with_stake: known_nodes_with_stake.clone(),
da_staked_committee_size: known_da_nodes.len(),
Expand Down
2 changes: 1 addition & 1 deletion crates/hotshot/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ dyn-clone = "1.0.17"
either = { workspace = true }
futures = { workspace = true, features = ["alloc"] }
hotshot-utils = { workspace = true }
jf-advz = { workspace = true }
jf-crhf = { workspace = true }
jf-pcs = { workspace = true }
jf-rescue = { workspace = true }
jf-signature = { workspace = true, features = ["bls", "schnorr"] }
jf-utils = { workspace = true }
jf-advz = { workspace = true }
lazy_static = { workspace = true }
libp2p-identity = { workspace = true }
memoize = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion crates/hotshot/types/src/hotshot_config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use vec1::Vec1;

use crate::{
constants::REQUEST_DATA_DELAY, upgrade_config::UpgradeConfig, HotShotConfig, NodeType,
PeerConfig, ValidatorConfig,
PeerConfig, ValidatorConfig, VersionedDaCommittee,
};

/// Default builder URL, used as placeholder
Expand Down Expand Up @@ -45,6 +45,9 @@ pub struct HotShotConfigFile<TYPES: NodeType> {
#[serde(skip)]
/// The known DA nodes' public key and stake values
pub known_da_nodes: Vec<PeerConfig<TYPES>>,
#[serde(skip)]
/// The known DA nodes' public keys and stake values, by start epoch
pub da_committees: Vec<VersionedDaCommittee<TYPES>>,
/// Number of staking DA nodes
pub staked_da_nodes: usize,
/// Number of fixed leaders for GPU VID
Expand Down Expand Up @@ -89,6 +92,7 @@ impl<TYPES: NodeType> From<HotShotConfigFile<TYPES>> for HotShotConfig<TYPES> {
start_threshold: val.start_threshold,
num_nodes_with_stake: val.num_nodes_with_stake,
known_da_nodes: val.known_da_nodes,
da_committees: val.da_committees,
known_nodes_with_stake: val.known_nodes_with_stake,
da_staked_committee_size: val.staked_da_nodes,
fixed_leader_for_gpuvid: val.fixed_leader_for_gpuvid,
Expand Down Expand Up @@ -154,6 +158,7 @@ impl<TYPES: NodeType> HotShotConfigFile<TYPES> {
known_nodes_with_stake: gen_known_nodes_with_stake,
staked_da_nodes,
known_da_nodes,
da_committees: Default::default(),
fixed_leader_for_gpuvid: 1,
next_view_timeout: 10000,
view_sync_timeout: Duration::from_millis(1000),
Expand Down
45 changes: 45 additions & 0 deletions crates/hotshot/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use traits::{
signature_key::{SignatureKey, StateSignatureKey},
};
use url::Url;
use vbs::version::Version;
use vec1::Vec1;

use crate::utils::bincode_opts;
Expand Down Expand Up @@ -181,6 +182,15 @@ impl<TYPES: NodeType> Debug for PeerConfig<TYPES> {
}
}

#[derive(Clone, derive_more::Debug, serde::Serialize, serde::Deserialize)]
#[serde(bound(deserialize = ""))]
pub struct VersionedDaCommittee<TYPES: NodeType> {
#[serde(with = "version_ser")]
pub start_version: Version,
pub start_epoch: u64,
pub committee: Vec<PeerConfig<TYPES>>,
}

/// Holds configuration for a `HotShot`
#[derive(Clone, derive_more::Debug, serde::Serialize, serde::Deserialize)]
#[serde(bound(deserialize = ""))]
Expand All @@ -195,6 +205,8 @@ pub struct HotShotConfig<TYPES: NodeType> {
pub known_nodes_with_stake: Vec<PeerConfig<TYPES>>,
/// All public keys known to be DA nodes
pub known_da_nodes: Vec<PeerConfig<TYPES>>,
/// All public keys known to be DA nodes, by start epoch
pub da_committees: Vec<VersionedDaCommittee<TYPES>>,
/// List of DA committee (staking)nodes for static DA committee
pub da_staked_committee_size: usize,
/// Number of fixed leaders for GPU VID, normally it will be 0, it's only used when running GPU VID
Expand Down Expand Up @@ -267,3 +279,36 @@ impl<TYPES: NodeType> HotShotConfig<TYPES> {
self.known_nodes_with_stake.clone().into()
}
}

pub mod version_ser {

use serde::{de, Deserialize, Deserializer, Serializer};
use vbs::version::Version;

pub fn serialize<S>(ver: &Version, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(&ver.to_string())
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Version, D::Error>
where
D: Deserializer<'de>,
{
let version_str = String::deserialize(deserializer)?;

let version: Vec<_> = version_str.split('.').collect();

let version = Version {
major: version[0]
.parse()
.map_err(|_| de::Error::custom("invalid version format"))?,
minor: version[1]
.parse()
.map_err(|_| de::Error::custom("invalid version format"))?,
};

Ok(version)
}
}
4 changes: 2 additions & 2 deletions hotshot-query-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ hotshot-types = { workspace = true }
# Dependencies enabled by feature "sql-data-source".
include_dir = { version = "0.7", optional = true }
itertools = "0.12.1"
jf-merkle-tree-compat = { workspace = true , features = [
jf-advz = { workspace = true }
jf-merkle-tree-compat = { workspace = true, features = [
"std",
] }
jf-advz = { workspace = true }
lazy_static = "1"
log = { version = "0.4", optional = true }
portpicker = { version = "0.1", optional = true }
Expand Down
1 change: 1 addition & 0 deletions hotshot-query-service/examples/simple-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ async fn init_consensus(
next_view_timeout: 10000,
num_bootstrap: 0,
known_da_nodes: known_nodes_with_stake.clone(),
da_committees: Default::default(),
da_staked_committee_size: pub_keys.len(),
data_request_delay: Duration::from_millis(200),
view_sync_timeout: Duration::from_millis(250),
Expand Down
1 change: 1 addition & 0 deletions hotshot-query-service/src/testing/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ impl<D: DataSourceLifeCycle + UpdateStatusData, V: Versions> MockNetwork<D, V> {
num_bootstrap: 0,
da_staked_committee_size: pub_keys.len(),
known_da_nodes: known_nodes_with_stake.clone(),
da_committees: Default::default(),
data_request_delay: Duration::from_millis(200),
view_sync_timeout: Duration::from_millis(250),
start_threshold: (
Expand Down
26 changes: 13 additions & 13 deletions hotshot-state-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,22 @@ itertools = { workspace = true }
jf-crhf = { workspace = true }
jf-pcs = { workspace = true }
jf-plonk = { workspace = true }
# Dependencies below are for LCV1 backward compatibility
jf-plonk-compat = { package = "jf-plonk", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }
jf-relation = { workspace = true }
jf-relation-compat = { package = "jf-relation", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }
jf-rescue = { workspace = true, features = ["gadgets"] }
jf-rescue-compat = { package = "jf-rescue", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"gadgets",
] }
jf-signature = { workspace = true, features = ["schnorr", "bls", "gadgets"] }
jf-signature-compat = { package = "jf-signature", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"schnorr", "bls", "gadgets",
] }
jf-utils = { workspace = true }
reqwest = { workspace = true }
sequencer-utils = { path = "../utils" }
Expand All @@ -48,19 +61,6 @@ toml = "0.8"
tracing = { workspace = true }
url = { workspace = true }
vbs = { workspace = true }
# Dependencies below are for LCV1 backward compatibility
jf-plonk-compat = { package = "jf-plonk", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }
jf-relation-compat = { package = "jf-relation", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"std",
] }
jf-rescue-compat = { package = "jf-rescue", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"gadgets",
] }
jf-signature-compat = { package = "jf-signature", git = "https://github.com/EspressoSystems/jellyfish", branch = "jf-relation-v0.5.0-compat", features = [
"schnorr", "bls", "gadgets",
] }

[dev-dependencies]
sequencer-utils = { path = "../utils", features = ["testing"] }
Expand Down
2 changes: 1 addition & 1 deletion sdks/crypto-helper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ ark-ff = { workspace = true }
ark-serialize = { workspace = true }
committable = { workspace = true }
espresso-types = { path = "../../types" }
primitive-types = { version = "0.13" }
hotshot-query-service = { workspace = true }
hotshot-types = { workspace = true }
jf-crhf = { workspace = true }
jf-merkle-tree-compat = { workspace = true, features = ["std"] }
primitive-types = { version = "0.13" }
serde = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ jf-crhf = { workspace = true }
jf-merkle-tree-compat = { workspace = true }
jf-rescue = { workspace = true }

jf-signature = { workspace = true, features = ["bls", "schnorr"] }
jf-advz = { workspace = true }
jf-signature = { workspace = true, features = ["bls", "schnorr"] }
libp2p = { workspace = true }
num_enum = "0.7"
parking_lot = "0.12"
Expand Down
47 changes: 12 additions & 35 deletions sequencer/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ use std::{
use alloy::primitives::Address;
use anyhow::{Context, Ok};
use espresso_types::{
v0_3::ChainConfig, FeeAccount, FeeAmount, GenesisHeader, L1BlockInfo, L1Client, Timestamp,
Upgrade,
v0_3::ChainConfig, FeeAccount, FeeAmount, GenesisHeader, L1BlockInfo, L1Client, SeqTypes,
Timestamp, Upgrade,
};
use hotshot_types::{traits::node_implementation::NodeType, version_ser, VersionedDaCommittee};
use serde::{Deserialize, Serialize};
use vbs::version::Version;

Expand Down Expand Up @@ -44,6 +45,13 @@ pub enum L1Finalized {
Timestamp { timestamp: Timestamp },
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerConfigData {
pub stake_table_key: <SeqTypes as NodeType>::SignatureKey,
pub state_ver_key: <SeqTypes as NodeType>::StateSignatureKey,
pub stake: u64,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this struct now unused? if so we should delete it

/// Genesis of an Espresso chain.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Genesis {
Expand All @@ -67,6 +75,8 @@ pub struct Genesis {
#[serde(rename = "upgrade", with = "upgrade_ser")]
#[serde(default)]
pub upgrades: BTreeMap<Version, Upgrade>,
#[serde(default)]
pub da_committees: Option<Vec<VersionedDaCommittee<SeqTypes>>>,
}

impl Genesis {
Expand Down Expand Up @@ -133,39 +143,6 @@ impl Genesis {
}
}

mod version_ser {

use serde::{de, Deserialize, Deserializer, Serializer};
use vbs::version::Version;

pub fn serialize<S>(ver: &Version, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(&ver.to_string())
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Version, D::Error>
where
D: Deserializer<'de>,
{
let version_str = String::deserialize(deserializer)?;

let version: Vec<_> = version_str.split('.').collect();

let version = Version {
major: version[0]
.parse()
.map_err(|_| de::Error::custom("invalid version format"))?,
minor: version[1]
.parse()
.map_err(|_| de::Error::custom("invalid version format"))?,
};

Ok(version)
}
}

mod upgrade_ser {

use std::{collections::BTreeMap, fmt};
Expand Down
6 changes: 6 additions & 0 deletions sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ where
network_config.config.epoch_start_block = epoch_start_block;
network_config.config.stake_table_capacity = stake_table_capacity;

if let Some(da_committees) = &genesis.da_committees {
tracing::warn!("setting da_committees from genesis");
network_config.config.da_committees = da_committees.clone();
}

// If the `Libp2p` bootstrap nodes were supplied via the command line, override those
// present in the config file.
if let Some(bootstrap_nodes) = network_params.libp2p_bootstrap_nodes {
Expand Down Expand Up @@ -1020,6 +1025,7 @@ pub mod testing {
fixed_leader_for_gpuvid: 0,
num_nodes_with_stake: num_nodes.try_into().unwrap(),
known_da_nodes: known_nodes_with_stake.clone(),
da_committees: Default::default(),
known_nodes_with_stake: known_nodes_with_stake.clone(),
next_view_timeout: Duration::from_secs(5).as_millis() as u64,
num_bootstrap: 1usize,
Expand Down
1 change: 1 addition & 0 deletions sequencer/src/restart_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ impl TestNetwork {
.into_iter()
.collect(),
genesis_version: Version { major: 0, minor: 1 },
da_committees: None,
};

let node_params = (0..da_nodes + regular_nodes)
Expand Down
Loading
Loading