From 312bebabbe28ea7c3d431a3e3e21353e2424388d Mon Sep 17 00:00:00 2001 From: Abdul Basit Date: Tue, 26 Nov 2024 04:06:56 +0500 Subject: [PATCH] try with removing sequencer1 from clients --- .env | 2 +- client/src/lib.rs | 12 +++++------- tests/common/mod.rs | 4 ++-- tests/upgrades.rs | 12 ++++++------ 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.env b/.env index 33712fce1..a6cf7f136 100644 --- a/.env +++ b/.env @@ -148,7 +148,7 @@ ESPRESSO_NASTY_CLIENT_PORT=24011 ESPRESSO_SEQUENCER_ETH_MULTISIG_ADDRESS=8626f6940e2eb28930efb4cef49b2d1f2c9c1199 # Set this to the number of blocks you would like to confirm the sequencer can reach -INTEGRATION_TEST_EXPECTED_BLOCK_HEIGHT=10 +INTEGRATION_TEST_EXPECTED_BLOCK_HEIGHT=200 INTEGRATION_TEST_HOST=localhost INTEGRATION_TEST_PROTO=http diff --git a/client/src/lib.rs b/client/src/lib.rs index 9f20f8f71..26d1ce378 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1,16 +1,13 @@ use anyhow::Context; use espresso_types::{FeeAccount, FeeAmount, FeeMerkleTree, Header}; use ethers::types::Address; +use futures::{stream::BoxStream, StreamExt}; use jf_merkle_tree::{ prelude::{MerkleProof, Sha3Node}, MerkleTreeScheme, }; use std::time::Duration; -use surf_disco::{ - error::ClientError, - socket::{Connection, Unsupported}, - Url, -}; +use surf_disco::{error::ClientError, Url}; use tokio::time::sleep; use vbs::version::StaticVersion; @@ -48,12 +45,13 @@ impl SequencerClient { pub async fn subscribe_headers( &self, height: u64, - ) -> anyhow::Result> { + ) -> anyhow::Result>> { self.0 .socket(&format!("availability/stream/headers/{height}")) - .subscribe() + .subscribe::
() .await .context("subscribing to Espresso headers") + .map(|s| s.boxed()) } /// Get the balance for a given account at a given block height, defaulting to current balance. diff --git a/tests/common/mod.rs b/tests/common/mod.rs index fcbd06b4b..5c66498a1 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -112,8 +112,8 @@ impl TestConfig { let sequencer_api_url = url_from_port(dotenvy::var("ESPRESSO_SEQUENCER1_API_PORT")?)?; let sequencer_clients = [ dotenvy::var("ESPRESSO_SEQUENCER_API_PORT")?, - dotenvy::var("ESPRESSO_SEQUENCER1_API_PORT")?, - dotenvy::var("ESPRESSO_SEQUENCER2_API_PORT")?, + dotenvy::var("ESPRESSO_SEQUENCER5_API_PORT")?, + dotenvy::var("ESPRESSO_SEQUENCER6_API_PORT")?, ] .iter() .map(|port| url_from_port(port.clone()).unwrap()) diff --git a/tests/upgrades.rs b/tests/upgrades.rs index cc78f7c0d..d8d72a47e 100644 --- a/tests/upgrades.rs +++ b/tests/upgrades.rs @@ -1,7 +1,7 @@ use crate::common::TestConfig; use anyhow::Result; use espresso_types::{FeeVersion, MarketplaceVersion}; -use futures::StreamExt; +use futures::{future::join_all, StreamExt}; use vbs::version::StaticVersionType; const SEQUENCER_BLOCKS_TIMEOUT: u64 = 200; @@ -28,15 +28,15 @@ async fn test_upgrade() -> Result<()> { // Test is limited to those sequencers with correct modules // enabled. It would be less fragile if we could discover them. - let subscriptions = vec![ - clients[0].subscribe_headers(0).await?, - clients[1].subscribe_headers(0).await?, - ]; + let subscriptions = join_all(clients.iter().map(|c| c.subscribe_headers(0))) + .await + .into_iter() + .collect::>>()?; for mut stream in subscriptions { while let Some(header) = stream.next().await { let header = header.unwrap(); - println!("{header:?}"); + println!("height={:?}", header.height()); // TODO is it possible to discover the view at which upgrade should be finished? // First few views should be `Base` version.