Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 2023-update-the-deplo…
Browse files Browse the repository at this point in the history
…yrs-script
  • Loading branch information
jbearer committed Sep 19, 2024
2 parents 2caea19 + 95b3e0b commit ce7a756
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.74",
# Hotshot imports
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74" }
hotshot-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.47" }
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.47" }
marketplace-builder-core = { git = "https://github.com/EspressoSystems/marketplace-builder-core", tag = "0.1.48" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.46" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.74" }
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.57" }
Expand Down
9 changes: 5 additions & 4 deletions data/genesis/staging.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
base_version = "0.1"
upgrade_version = "0.2"
base_version = "0.2"
upgrade_version = "0.3"

[stake_table]
capacity = 200

[chain_config]
chain_id = 888888888
base_fee = '0 wei'
max_block_size = '30mb'
base_fee = '1 wei'
max_block_size = '1mb'
fee_recipient = '0x0000000000000000000000000000000000000000'
fee_contract = '0xa15bb66138824a1c7167f5e85b957d04dd34e468'

[header]
timestamp = "1970-01-01T00:00:00Z"
4 changes: 2 additions & 2 deletions marketplace-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ mod test {
let bundle = builder_client
.get::<Bundle<SeqTypes>>(
format!(
"block_info/bundle/{parent_view_number}/{parent_commitment}/{}",
"bundle_info/bundle/{parent_view_number}/{parent_commitment}/{}",
parent_view_number + 1
)
.as_str(),
Expand Down Expand Up @@ -671,7 +671,7 @@ mod test {
let bundle = builder_client
.get::<Bundle<SeqTypes>>(
format!(
"block_info/bundle/{parent_view_number}/{parent_commitment}/{}",
"bundle_info/bundle/{parent_view_number}/{parent_commitment}/{}",
parent_view_number + 1
)
.as_str(),
Expand Down
10 changes: 4 additions & 6 deletions sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,32 +529,30 @@ pub mod test_helpers {
) -> Self {
let mut cfg = cfg;
let mut builder_tasks = Vec::new();
let mut legacy_builder_url = "http://example.com".parse().unwrap();
let mut marketplace_builder_url = "http://example.com".parse().unwrap();

if <V as Versions>::Base::VERSION < MarketplaceVersion::VERSION {
let (task, url) =
run_test_builder::<{ NUM_NODES }>(cfg.network_config.builder_port()).await;
builder_tasks.push(task);
legacy_builder_url = url;
cfg.network_config.set_builder_urls(vec1::vec1![url]);
};

if <V as Versions>::Upgrade::VERSION >= MarketplaceVersion::VERSION
|| <V as Versions>::Base::VERSION >= MarketplaceVersion::VERSION
{
let (task, url) = run_marketplace_builder::<{ NUM_NODES }>(
cfg.network_config.marketplace_builder_port(),
NodeState::default(),
NodeState::default().with_current_version(V::Base::VERSION),
cfg.state[0].clone(),
)
.await;
builder_tasks.push(task);
cfg.network_config
.set_builder_urls(vec1::vec1![url.clone()]);
marketplace_builder_url = url;
}

cfg.network_config
.set_builder_urls(vec1::vec1![legacy_builder_url]);

let mut nodes = join_all(
izip!(cfg.state, cfg.persistence, cfg.catchup)
.enumerate()
Expand Down
25 changes: 10 additions & 15 deletions sequencer/src/bin/espresso-dev-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ use async_std::task::spawn;
use async_trait::async_trait;
use clap::Parser;
use contract_bindings::light_client_mock::LightClientMock;
use espresso_types::{parse_duration, MockSequencerVersions};
use ethers::types::H160;
use espresso_types::{parse_duration, MarketplaceVersion, SequencerVersions, V0_1};
use ethers::{
middleware::{MiddlewareBuilder, SignerMiddleware},
providers::{Http, Middleware, Provider},
signers::{coins_bip39::English, MnemonicBuilder, Signer},
types::{Address, U256},
types::{Address, H160, U256},
};
use futures::{future::BoxFuture, stream::FuturesUnordered, FutureExt, StreamExt};
use hotshot_state_prover::service::{
Expand Down Expand Up @@ -195,7 +194,7 @@ async fn main() -> anyhow::Result<()> {
.unwrap();

let network_config = TestConfigBuilder::default()
.builder_port(builder_port)
.marketplace_builder_port(builder_port)
.state_relay_url(relay_server_url.clone())
.l1_url(l1_url.clone())
.build();
Expand All @@ -206,7 +205,8 @@ async fn main() -> anyhow::Result<()> {
.network_config(network_config)
.build();

let network = TestNetwork::new(config, MockSequencerVersions::new()).await;
let network =
TestNetwork::new(config, SequencerVersions::<MarketplaceVersion, V0_1>::new()).await;
let st = network.cfg.stake_table();
let total_stake = st.total_stake(SnapshotVersion::LastEpochStart).unwrap();
let config = network.cfg.hotshot_config();
Expand Down Expand Up @@ -351,6 +351,7 @@ async fn main() -> anyhow::Result<()> {

let dev_info = DevInfo {
builder_url: network.cfg.hotshot_config().builder_urls[0].clone(),
sequencer_api_port,
l1_prover_port,
l1_url,
l1_light_client_address: l1_lc,
Expand Down Expand Up @@ -501,6 +502,7 @@ async fn run_dev_node_server<ApiVer: StaticVersionType + 'static, S: Signer + Cl
#[derive(Debug, Clone, Serialize, Deserialize)]
struct DevInfo {
pub builder_url: Url,
pub sequencer_api_port: u16,
pub l1_prover_port: u16,
pub l1_url: Url,
pub l1_light_client_address: Address,
Expand Down Expand Up @@ -632,18 +634,10 @@ mod tests {
Client::new(format!("http://localhost:{builder_port}").parse().unwrap());
builder_api_client.connect(None).await;

let builder_address = builder_api_client
.get::<String>("block_info/builderaddress")
.send()
.await
.unwrap();

assert!(!builder_address.is_empty());

let tx = Transaction::new(100_u32.into(), vec![1, 2, 3]);

let hash: Commitment<Transaction> = api_client
.post("submit/submit")
let hash: Commitment<Transaction> = builder_api_client
.post("txn_submit/submit")
.body_json(&tx)
.unwrap()
.send()
Expand All @@ -661,6 +655,7 @@ mod tests {
.await;
while tx_result.is_err() {
sleep(Duration::from_secs(1)).await;
tracing::warn!("waiting for tx");

tx_result = api_client
.get::<TransactionQueryData<SeqTypes>>(&format!(
Expand Down
11 changes: 9 additions & 2 deletions sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ pub mod testing {
instance_state: NodeState,
validated_state: ValidatedState,
) -> (Box<dyn BuilderTask<SeqTypes>>, Url) {
let builder_key_pair = EthKeyPair::random();
let builder_key_pair = TestConfig::<0>::builder_key();
let port = port.unwrap_or_else(|| pick_unused_port().expect("No ports available"));

// This should never fail.
Expand Down Expand Up @@ -575,7 +575,14 @@ pub mod testing {
.into_app()
.expect("Failed to create builder tide-disco app");

async_spawn(app.serve(url.clone(), MarketplaceVersion::instance()));
async_spawn(
app.serve(
format!("http://0.0.0.0:{port}")
.parse::<Url>()
.expect("Failed to parse builder listener"),
MarketplaceVersion::instance(),
),
);

(
Box::new(MarketplaceBuilderImplementation { hooks, senders }),
Expand Down

0 comments on commit ce7a756

Please sign in to comment.