Skip to content
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

Remove es_version crate and use SeqTypes::Base version #1804

Merged
merged 3 commits into from
Aug 1, 2024
Merged
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
13 changes: 5 additions & 8 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ blake3 = "1.5"
clap = { version = "4.4", features = ["derive", "env", "string"] }
cld = "0.5"
derive_more = "0.99.17"
es-version = { git = "https://github.com/EspressoSystems/es-version.git", branch = "main" }
dotenvy = "0.15"
ethers = { version = "2.0", features = ["solc"] }
futures = "0.3"
Expand Down
1 change: 0 additions & 1 deletion builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ clap = { workspace = true }
cld = { workspace = true }
committable = { workspace = true }
dotenvy = { workspace = true }
es-version = { workspace = true }
espresso-types = { path = "../types", features = ["testing"] }
ethers = { workspace = true }
futures = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions builder/src/bin/permissioned-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::{
use anyhow::{bail, Context};
use builder::permissioned::init_node;
use clap::Parser;
use es_version::SEQUENCER_VERSION;
use espresso_types::eth_signature_key::EthKeyPair;
use ethers::types::Address;
use hotshot_types::{
Expand All @@ -20,6 +19,7 @@ use sequencer::{
};
use sequencer_utils::logging;
use url::Url;
use vbs::version::{StaticVersion, StaticVersionType};

#[derive(Parser, Clone, Debug)]
pub struct PermissionedBuilderOptions {
Expand Down Expand Up @@ -260,7 +260,7 @@ async fn main() -> anyhow::Result<()> {
catchup_backoff: Default::default(),
};

let sequencer_version = SEQUENCER_VERSION;
let sequencer_version = StaticVersion::<0, 1>::instance();

let builder_server_url: Url = format!("http://0.0.0.0:{}", opt.port).parse().unwrap();

Expand Down
7 changes: 3 additions & 4 deletions builder/src/bin/permissionless-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ use std::{num::NonZeroUsize, path::PathBuf, str::FromStr, time::Duration};
use builder::non_permissioned::{build_instance_state, BuilderConfig};
use clap::Parser;
use cld::ClDuration;
use espresso_types::{eth_signature_key::EthKeyPair, SeqTypes};
use espresso_types::eth_signature_key::EthKeyPair;
use hotshot::traits::ValidatedState;
use hotshot_builder_core::testing::basic_test::NodeType;
use hotshot_types::{data::ViewNumber, traits::node_implementation::ConsensusTime};
use sequencer::{Genesis, L1Params};
use sequencer_utils::logging;
use snafu::Snafu;
use url::Url;
use vbs::version::StaticVersionType;
use vbs::version::{StaticVersion, StaticVersionType};

#[derive(Parser, Clone, Debug)]
struct NonPermissionedBuilderOptions {
Expand Down Expand Up @@ -123,7 +122,7 @@ async fn main() -> anyhow::Result<()> {
genesis.chain_config,
l1_params,
opt.state_peers,
<SeqTypes as NodeType>::Base::instance(),
StaticVersion::<0, 1>::instance(),
imabdulbasit marked this conversation as resolved.
Show resolved Hide resolved
)
.unwrap();

Expand Down
18 changes: 11 additions & 7 deletions builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use sequencer::{
L1Params, NetworkParams, Node,
};
use tide_disco::{app, method::ReadState, App, Url};
use vbs::version::StaticVersionType;
use vbs::version::{StaticVersion, StaticVersionType};

pub mod non_permissioned;
pub mod permissioned;
Expand All @@ -86,7 +86,7 @@ pub fn run_builder_api_service(url: Url, source: ProxyGlobalState<SeqTypes>) {
let private_mempool_api = hotshot_builder_api::v0_1::builder::submit_api::<
ProxyGlobalState<SeqTypes>,
SeqTypes,
<SeqTypes as NodeType>::Base,
StaticVersion<0, 1>,
imabdulbasit marked this conversation as resolved.
Show resolved Hide resolved
>(&HotshotBuilderApiOptions::default())
.expect("Failed to construct the builder API for private mempool txns");

Expand All @@ -98,7 +98,7 @@ pub fn run_builder_api_service(url: Url, source: ProxyGlobalState<SeqTypes>) {
app.register_module("txn_submit", private_mempool_api)
.expect("Failed to register the private mempool API");

async_spawn(app.serve(url, <SeqTypes as NodeType>::Base::instance()));
async_spawn(app.serve(url, StaticVersion::<0, 1>::instance()));
imabdulbasit marked this conversation as resolved.
Show resolved Hide resolved
}

#[cfg(test)]
Expand All @@ -118,6 +118,7 @@ pub mod testing {
use async_lock::RwLock;
use async_trait::async_trait;
use committable::Committable;

use espresso_types::{
mock::MockStateCatchup, v0_3::ChainConfig, Event, FeeAccount, L1Client, NodeState, PrivKey,
PubKey, Transaction, ValidatedState,
Expand Down Expand Up @@ -406,6 +407,7 @@ pub mod testing {
L1Client::new(self.anvil.endpoint().parse().unwrap(), 1),
MockStateCatchup::default(),
)
.with_current_version(Ver::VERSION)
.with_genesis(ValidatedState::default());

tracing::info!("Before init hotshot");
Expand Down Expand Up @@ -448,7 +450,7 @@ pub mod testing {
let hotshot_events_api = hotshot_events_service::events::define_api::<
Arc<RwLock<EventsStreamer<SeqTypes>>>,
SeqTypes,
<SeqTypes as NodeType>::Base,
StaticVersion<0, 1>,
>(&EventStreamingApiOptions::default())
.expect("Failed to define hotshot eventsAPI");

Expand All @@ -457,7 +459,7 @@ pub mod testing {
app.register_module("hotshot-events", hotshot_events_api)
.expect("Failed to register hotshot events API");

async_spawn(app.serve(url, <SeqTypes as NodeType>::Base::instance()));
async_spawn(app.serve(url, StaticVersion::<0, 1>::instance()));
}
// enable hotshot event streaming
pub fn enable_hotshot_node_event_streaming<P: SequencerPersistence>(
Expand Down Expand Up @@ -547,6 +549,7 @@ pub mod testing {
),
MockStateCatchup::default(),
)
.with_current_version(StaticVersion::<0, 1>::VERSION)
.with_genesis(ValidatedState::default());

// generate builder keys
Expand Down Expand Up @@ -615,6 +618,7 @@ pub mod testing {
),
MockStateCatchup::default(),
)
.with_current_version(Ver::VERSION)
.with_genesis(ValidatedState::default());

// generate builder keys
Expand Down Expand Up @@ -670,7 +674,6 @@ pub mod testing {
mod test {
use async_std::stream::IntoStream;
use clap::builder;
use es_version::SequencerVersion;
use espresso_types::{Header, NodeState, Payload, ValidatedState};
use ethers::providers::Quorum;
use futures::StreamExt;
Expand All @@ -686,6 +689,7 @@ mod test {
};
use sequencer_utils::test_utils::setup_test;
use testing::{wait_for_decide_on_handle, HotShotTestConfig};
use vbs::version::StaticVersion;

use super::*;

Expand All @@ -697,7 +701,7 @@ mod test {
async fn test_non_voting_hotshot_node() {
setup_test();

let ver = SequencerVersion::instance();
let ver = StaticVersion::<0, 1>::instance();

let success_height = 5;
// Assign `config` so it isn't dropped early.
Expand Down
12 changes: 6 additions & 6 deletions builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ mod test {
};
use async_lock::RwLock;
use async_std::task;
use es_version::SequencerVersion;
use espresso_types::{FeeAccount, NamespaceId, Transaction};
use hotshot_builder_api::v0_1::{
block_info::{AvailableBlockData, AvailableBlockHeaderInput, AvailableBlockInfo},
Expand Down Expand Up @@ -257,6 +256,7 @@ mod test {
use sequencer::persistence::no_storage::{self, NoStorage};
use sequencer_utils::test_utils::setup_test;
use surf_disco::Client;
use vbs::version::StaticVersion;

use super::*;
use crate::testing::{
Expand All @@ -270,7 +270,7 @@ mod test {
async fn test_non_permissioned_builder() {
setup_test();

let ver = SequencerVersion::instance();
let ver = StaticVersion::<0, 1>::instance();
// Hotshot Test Config
let hotshot_config = HotShotTestConfig::default();

Expand Down Expand Up @@ -316,10 +316,10 @@ mod test {
let builder_pub_key = builder_config.fee_account;

// Start a builder api client
let builder_client = Client::<
hotshot_builder_api::v0_1::builder::Error,
<SeqTypes as NodeType>::Base,
>::new(hotshot_builder_api_url.clone());
let builder_client =
Client::<hotshot_builder_api::v0_1::builder::Error, StaticVersion<0, 1>>::new(
hotshot_builder_api_url.clone(),
);
assert!(builder_client.connect(Some(Duration::from_secs(60))).await);

let seed = [207_u8; 32];
Expand Down
13 changes: 7 additions & 6 deletions builder/src/permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ mod test {
use async_compatibility_layer::art::{async_sleep, async_spawn};
use async_lock::RwLock;
use async_std::task;
use es_version::SequencerVersion;

use espresso_types::{FeeAccount, NamespaceId, Transaction};
use hotshot_builder_api::v0_1::{
block_info::{AvailableBlockData, AvailableBlockHeaderInput, AvailableBlockInfo},
Expand Down Expand Up @@ -581,6 +581,7 @@ mod test {
use sequencer::persistence::no_storage::{self, NoStorage};
use sequencer_utils::test_utils::setup_test;
use surf_disco::Client;
use vbs::version::StaticVersion;

use super::*;
use crate::{
Expand All @@ -595,7 +596,7 @@ mod test {
async fn test_permissioned_builder() {
setup_test();

let ver = SequencerVersion::instance();
let ver = StaticVersion::<0, 1>::instance();

// Hotshot Test Config
let hotshot_config = HotShotTestConfig::default();
Expand Down Expand Up @@ -629,10 +630,10 @@ mod test {
let builder_pub_key = builder_config.fee_account;

// Start a builder api client
let builder_client = Client::<
hotshot_builder_api::v0_1::builder::Error,
<SeqTypes as NodeType>::Base,
>::new(hotshot_builder_api_url.clone());
let builder_client =
Client::<hotshot_builder_api::v0_1::builder::Error, StaticVersion<0, 1>>::new(
hotshot_builder_api_url.clone(),
);
assert!(builder_client.connect(Some(Duration::from_secs(60))).await);

let seed = [207_u8; 32];
Expand Down
2 changes: 1 addition & 1 deletion hotshot-state-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ clap = { workspace = true }
cld = { workspace = true }
contract-bindings = { path = "../contract-bindings" }
displaydoc = { version = "0.2.3", default-features = false }
es-version = { workspace = true }
espresso-types = { path = "../types", features = ["testing"] }
ethers = { workspace = true }
futures = { workspace = true }
hotshot-contract-adapter = { workspace = true }
Expand Down
9 changes: 6 additions & 3 deletions hotshot-state-prover/src/bin/state-prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ use std::{str::FromStr as _, time::Duration};

use clap::Parser;
use cld::ClDuration;
use es_version::SEQUENCER_VERSION;
use espresso_types::SeqTypes;
use ethers::{
providers::{Http, Middleware, Provider},
signers::{coins_bip39::English, MnemonicBuilder, Signer},
types::Address,
};
use hotshot_stake_table::config::STAKE_TABLE_CAPACITY;
use hotshot_state_prover::service::{run_prover_once, run_prover_service, StateProverConfig};
use hotshot_types::traits::node_implementation::NodeType;
use sequencer_utils::logging;
use snafu::Snafu;
use url::Url;
use vbs::version::StaticVersionType;

#[derive(Parser)]
struct Args {
Expand Down Expand Up @@ -126,12 +128,13 @@ async fn main() {

if args.daemon {
// Launching the prover service daemon
if let Err(err) = run_prover_service(config, SEQUENCER_VERSION).await {
if let Err(err) = run_prover_service(config, <SeqTypes as NodeType>::Base::instance()).await
{
tracing::error!("Error running prover service: {:?}", err);
};
} else {
// Run light client state update once
if let Err(err) = run_prover_once(config, SEQUENCER_VERSION).await {
if let Err(err) = run_prover_once(config, <SeqTypes as NodeType>::Base::instance()).await {
tracing::error!("Error running prover once: {:?}", err);
};
}
Expand Down
1 change: 0 additions & 1 deletion sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ csv = "1"
derivative = "2.2"
derive_more = { workspace = true }
dotenvy = { workspace = true }
es-version = { workspace = true }
espresso-types = { path = "../types", features = ["testing"] }
ethers = { workspace = true }
futures = { workspace = true }
Expand Down
Loading
Loading