Module scenarios

Module scenarios 

Source
Expand description

§Mina Testing Scenarios

This module contains scenario-based tests for the Mina Rust node implementation. Scenarios are deterministic, ordered sequences of steps that test complex multi-node blockchain interactions.

§Documentation

For comprehensive documentation on the testing framework and available scenarios, see:

§Usage

List available scenarios:

cargo run --release --bin mina-node-testing -- scenarios-list

Run a specific scenario:

cargo run --release --bin mina-node-testing -- scenarios-run --name scenario-name

§Test Categories

§Directory Structure and CI Integration

The directory structure in this module maps to specific test execution contexts:

  • solo_node/ - Single node scenarios, often testing OCaml interoperability
  • multi_node/ - Multi-node Rust network scenarios
  • p2p/ - Low-level P2P networking and protocol tests
  • record_replay/ - Scenario recording and replay functionality
  • simulation/ - Large-scale network simulations

In CI environments, these directories determine which specialized test binaries are used for execution, while locally all scenarios are accessible through the unified mina-node-testing CLI using scenario names.

§Basic Connectivity Tests

  • Ensure new nodes can discover peers and establish initial connections.
  • Test how nodes handle scenarios when they are overwhelmed with too many connections or data requests.

TODO(vlad9486):

  • Reconnection: Validate that nodes can reconnect after both intentional and unintentional disconnections.
  • Handling Latency: Nodes should remain connected and synchronize even under high latency conditions.
  • Intermittent Connections: Nodes should be resilient to sporadic network dropouts and still maintain synchronization.
  • Dynamic IP Handling: Nodes with frequently changing IP addresses should maintain stable connections.

Re-exports§

pub use crate::cluster::runner::*;

Modules§

driver 🔒
multi_node
p2p
record_replay
simulation
solo_node

Structs§

Driver
ScenariosIter
An iterator over the variants of Scenarios

Enums§

ConnectionPredicates
Scenarios

Constants§

PEERS_QUERY

Traits§

ConnectionPredicate
PeerPredicate

Functions§

add_rust_nodes
add_rust_nodes1
Creates num Rust nodes in the cluster
add_rust_nodes_with
Creates num Rust nodes in the cluster
as_event_mio_connection_event
as_event_mio_data_send_receive
as_event_mio_error
as_event_mio_interface_detected
as_event_mio_listener_ready
as_event_mio_outgoing_connection
connect_rust_nodes
connection_finalized_event
get_p2p_state
get_peer_state
get_peers_iter
idle
match_addr_with_port_and_peer_id
next_event
peer_exists
peer_is_ready
run_until_no_events
Runs cluster until there is a quiet_dur period of no events, returning Ok(true) in this case. If there is no such period for timeout period of time, then returns Ok(false)
trace_steps
trace_steps_state
wait_for_connection_error
wait_for_connection_established
Runst the cluster until the node is connected to the node that satisfies the predicate.
wait_for_connection_event
wait_for_nodes_listening_on_localhost
Runs the cluster until each of the nodes is listening on the localhost interface.