Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4a37c53
WIP: see if removing portpicker affects flakyness
sveitser Feb 5, 2026
53d82ad
feat(test-utils): replace portpicker with compile-time safe port binding
sveitser Feb 5, 2026
986fe68
fix(test-utils): ensure port bindings stay alive during tests
sveitser Feb 5, 2026
062646a
fix(test-utils): fix remaining port binding race conditions
sveitser Feb 5, 2026
32c91f5
fix(test-utils): keep port bindings alive in config structs
sveitser Feb 5, 2026
153ad32
fix(hotshot): drop port guards before network binds
sveitser Feb 5, 2026
456e8e6
refactor(test-utils): use TIME_WAIT port reservation pattern
sveitser Feb 5, 2026
37ff741
fix(slow-tests): remove Default derive from unit struct PortPicker
sveitser Feb 5, 2026
547c86b
refactor(slow-tests): remove PortPicker wrapper struct
sveitser Feb 5, 2026
68ffa78
style(espresso-dev-node): restore chained method calls in tests
sveitser Feb 5, 2026
9764ff3
Merge remote-tracking branch 'origin/main' into ma/remove-portpicker
sveitser Feb 6, 2026
d87a95c
fix(slow-tests): use reserve_tcp_port instead of port 0 in merklized …
sveitser Feb 6, 2026
8c41c75
refactor(test-utils): remove reserve_udp_port, inline at call site
sveitser Feb 6, 2026
9684bf0
refactor(espresso-dev-node): remove redundant _anvil_layer binding
sveitser Feb 6, 2026
336a38b
fixup: remove leftover change
sveitser Feb 6, 2026
2ce24ac
style: use expect-as-precondition for port allocation
sveitser Feb 11, 2026
8791d3b
Merge branch 'main' into ma/remove-portpicker
sveitser Feb 19, 2026
94d803a
revert(anvil): restore Anvil::spawn() instead of AnvilLayer
sveitser Feb 19, 2026
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
39 changes: 21 additions & 18 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ members = [
"sequencer-sqlite",
"slow-tests",
"staking-cli",
"test-utils",
"tests",
"types",
"utils",
Expand Down Expand Up @@ -83,6 +84,7 @@ default-members = [
"sequencer",
"slow-tests",
"staking-cli",
"test-utils",
"tests",
"types",
"utils",
Expand Down Expand Up @@ -194,6 +196,7 @@ hotshot-utils = { path = "crates/hotshot/utils" }

espresso-types = { path = "types" }
light-client = { path = "light-client" }
test-utils = { path = "test-utils" }

# VID import
vid = { path = "vid", features = ["parallel", "keccak256"] }
Expand Down Expand Up @@ -248,7 +251,6 @@ log-panics = { version = "2.0", features = ["with-backtrace"] }
lru = "0.12"
num-traits = "0.2"
paste = "1.0"
portpicker = "0.1.1"
pretty_assertions = { version = "1.4", features = ["unstable"] }
priority-queue = "2"
rand = "0.8.5"
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ hotshot-events-service = { workspace = true }
hotshot-example-types = { workspace = true }
hotshot-state-prover = { workspace = true }
hotshot-types = { workspace = true }
portpicker = { workspace = true }
rand = { workspace = true }
sequencer = { path = "../../sequencer", default-features = false }
sequencer-utils = { path = "../../utils" }
surf-disco = { workspace = true }
test-utils = { workspace = true }
tide-disco = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
Expand Down
23 changes: 6 additions & 17 deletions crates/builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub mod testing {
_known_nodes_without_stake,
) = generate_stake_table_entries(num_nodes_without_stake as u64, 0);

let builder_url = hotshot_builder_url();
let (_bound_builder_port, builder_url) = hotshot_builder_url();

let config: HotShotConfig<SeqTypes> = HotShotConfig {
num_nodes_with_stake: NonZeroUsize::new(num_nodes_with_stake).unwrap(),
Expand Down Expand Up @@ -239,18 +239,6 @@ pub mod testing {
}
}

// url for the hotshot event streaming api
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems to be unused, hence removed.

pub fn hotshot_event_streaming_api_url() -> Url {
// spawn the event streaming api
let port = portpicker::pick_unused_port()
.expect("Could not find an open port for hotshot event streaming api");

let hotshot_events_streaming_api_url =
Url::parse(format!("http://localhost:{port}").as_str()).unwrap();

hotshot_events_streaming_api_url
}

// start the server for the hotshot event streaming api
pub fn run_hotshot_event_streaming_api(
url: Url,
Expand Down Expand Up @@ -403,15 +391,16 @@ pub mod testing {
}
}

pub fn hotshot_builder_url() -> Url {
pub fn hotshot_builder_url() -> (test_utils::BoundPort, Url) {
// spawn the builder api
let port =
portpicker::pick_unused_port().expect("Could not find an open port for builder api");
let bound_port =
test_utils::bind_tcp_port().expect("Failed to bind TCP port for builder api");
let port = bound_port.port();

let hotshot_builder_api_url =
Url::parse(format!("http://localhost:{port}").as_str()).unwrap();

hotshot_builder_api_url
(bound_port, hotshot_builder_api_url)
}

pub async fn test_builder_impl(
Expand Down
7 changes: 4 additions & 3 deletions crates/builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ impl BuilderConfig {
mod test {
use espresso_types::MockSequencerVersions;
use futures::StreamExt;
use portpicker::pick_unused_port;
use sequencer::{
api::{
options::HotshotEvents,
Expand All @@ -267,11 +266,13 @@ mod test {
/// Builder subscrived to this api, and server the hotshot client request and the private mempool tx submission
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_non_permissioned_builder() {
let query_port = pick_unused_port().expect("No ports free");
let query_bound_port = test_utils::bind_tcp_port().expect("Failed to bind port");
let query_port = *query_bound_port.port();

let event_service_url: Url = format!("http://localhost:{query_port}").parse().unwrap();

let builder_port = pick_unused_port().expect("No ports free");
let builder_bound_port = test_utils::bind_tcp_port().expect("Failed to bind port");
let builder_port = *builder_bound_port.port();
let builder_api_url: Url = format!("http://localhost:{builder_port}").parse().unwrap();

let network_config = TestConfigBuilder::default().build();
Expand Down
2 changes: 1 addition & 1 deletion crates/cliquenet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ hotshot-types = { workspace = true, optional = true }

[dev-dependencies]
criterion = "0.8.1"
portpicker = { workspace = true }
quickcheck = { workspace = true }
test-utils = { workspace = true }
tracing-subscriber = { workspace = true }

[[bench]]
Expand Down
Loading
Loading