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

Add upgrade test #2086

Merged
merged 12 commits into from
Oct 9, 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
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,6 @@ INTEGRATION_TEST_EXPECTED_BLOCK_HEIGHT=10
INTEGRATION_TEST_HOST=localhost
INTEGRATION_TEST_PROTO=http

MARKETPLACE_SMOKE_TEST=false
# Version of sequencer protocol we want to test. If this is set to
# `03`, marketplace upgrade will be tested.
INTEGRATION_TEST_SEQUENCER_VERSION=02
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
- name: Test Integration
env:
NEXTEST_PROFILE: integration
INTEGRATION_TEST_SEQUENCER_VERSION: 02
run: cargo nextest run --locked --release --all-features --verbose --nocapture
timeout-minutes: 40

Expand All @@ -89,7 +90,7 @@ jobs:
- name: Test Marketplace Integration
env:
NEXTEST_PROFILE: integration
MARKETPLACE_SMOKE_TEST: true
INTEGRATION_TEST_SEQUENCER_VERSION: 03
run: cargo nextest run --locked --release --all-features --verbose --nocapture
timeout-minutes: 40

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

14 changes: 6 additions & 8 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context;
use async_std::task::sleep;
use espresso_types::{FeeAccount, FeeAmount, FeeMerkleTree};
use espresso_types::{FeeAccount, FeeAmount, FeeMerkleTree, Header};
use ethers::types::Address;
use jf_merkle_tree::{
prelude::{MerkleProof, Sha3Node},
Expand All @@ -9,14 +9,12 @@ use jf_merkle_tree::{
use std::time::Duration;
use surf_disco::{
error::ClientError,
http::convert::DeserializeOwned,
socket::{Connection, Unsupported},
Url,
};
use vbs::version::StaticVersion;

pub type SequencerApiVersion = StaticVersion<0, 1>;
// pub type EspressoClient = surf_disco::Client<ClientError, SequencerApiVersion>;

#[derive(Clone, Debug)]
pub struct SequencerClient(surf_disco::Client<ClientError, SequencerApiVersion>);
Expand Down Expand Up @@ -46,13 +44,13 @@ impl SequencerClient {
.context("getting Espresso transaction count")
}

/// Subscribe to a stream to Block Headers
pub async fn subscribe_headers<FromServer: DeserializeOwned>(
/// Subscribe to a stream of Block Headers
pub async fn subscribe_headers(
&self,
connect: &str,
) -> anyhow::Result<Connection<FromServer, Unsupported, ClientError, SequencerApiVersion>> {
height: u64,
) -> anyhow::Result<Connection<Header, Unsupported, ClientError, SequencerApiVersion>> {
self.0
.socket(connect)
.socket(&format!("availability/stream/headers/{height}"))
.subscribe()
.await
.context("subscribing to Espresso headers")
Expand Down
Empty file added common/mod.rs
Empty file.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ demo *args:

demo-native:
cargo build --release
scripts/demo-native -D
scripts/demo-native

demo-native-mp:
cargo build --release
Expand Down
8 changes: 4 additions & 4 deletions process-compose-mp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ processes:
environment:
- ESPRESSO_SUBMIT_TRANSACTIONS_PORT=$ESPRESSO_SUBMIT_TRANSACTIONS_PRIVATE_FALLBACK_PORT
- ESPRESSO_SUBMIT_TRANSACTIONS_SUBMIT_URL=http://localhost:$ESPRESSO_FALLBACK_BUILDER_SERVER_PORT/txn_submit
- ESPRESSO_SUBMIT_TRANSACTIONS_MIN_NAMESPACE=1
- ESPRESSO_SUBMIT_TRANSACTIONS_MAX_NAMESPACE=3
- ESPRESSO_SUBMIT_TRANSACTIONS_MIN_NAMESPACE=4
- ESPRESSO_SUBMIT_TRANSACTIONS_MAX_NAMESPACE=6
depends_on:
sequencer0:
condition: process_healthy
Expand All @@ -93,8 +93,8 @@ processes:
environment:
- ESPRESSO_SUBMIT_TRANSACTIONS_PORT=$ESPRESSO_SUBMIT_TRANSACTIONS_PRIVATE_RESERVE_PORT
- ESPRESSO_SUBMIT_TRANSACTIONS_SUBMIT_URL=http://localhost:$ESPRESSO_RESERVE_BUILDER_SERVER_PORT/txn_submit
- ESPRESSO_SUBMIT_TRANSACTIONS_MIN_NAMESPACE=4
- ESPRESSO_SUBMIT_TRANSACTIONS_MAX_NAMESPACE=6
- ESPRESSO_SUBMIT_TRANSACTIONS_MIN_NAMESPACE=1
- ESPRESSO_SUBMIT_TRANSACTIONS_MAX_NAMESPACE=3
depends_on:
sequencer0:
condition: process_healthy
Expand Down
4 changes: 1 addition & 3 deletions sequencer/src/bin/espresso-bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ async fn deposit(opt: Deposit) -> anyhow::Result<()> {

// Wait for Espresso to catch up to the L1.
let espresso_height = espresso.get_height().await?;
let mut headers = espresso
.subscribe_headers(&format!("availability/stream/headers/{espresso_height}"))
.await?;
let mut headers = espresso.subscribe_headers(espresso_height).await?;
let espresso_block = loop {
let header: Header = match headers.next().await.context("header stream ended")? {
Ok(header) => header,
Expand Down
5 changes: 3 additions & 2 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = { workspace = true }
publish = false

[[test]]
name = "test_demo_native"
path = "demo_native.rs"
name = "integration"
path = "main.rs"

[dev-dependencies]
anyhow = { workspace = true }
Expand All @@ -19,3 +19,4 @@ ethers = { workspace = true }
futures = { workspace = true }
reqwest = { workspace = true, features = ["json", "blocking"] }
surf-disco = { workspace = true }
vbs = { workspace = true }
Loading