Skip to main content

Module persistence_waiter

Module persistence_waiter 

Source
Expand description

Persistence waiting utilities for benchmarks.

Provides waiting behavior to control benchmark pacing:

  • Fixed duration waits: Sleep for a fixed time between blocks
  • Persistence-based waits: Wait for blocks to be persisted using reth_subscribePersistedBlock subscription
  • Combined mode: Wait at least the fixed duration, and also wait for persistence if the block hasnโ€™t been persisted yet (whichever takes longer)

Structsยง

PersistenceSubscription ๐Ÿ”’
Wrapper that keeps both the subscription stream and the underlying provider alive. The provider must be kept alive for the subscription to continue receiving events.
PersistenceWaiter ๐Ÿ”’
Encapsulates the block waiting logic.

Constantsยง

DEFAULT_WS_RPC_PORT ๐Ÿ”’
Default WebSocket RPC port for reth.

Functionsยง

derive_ws_rpc_url ๐Ÿ”’
Returns the websocket RPC URL used for the persistence subscription.
engine_url_to_ws_url ๐Ÿ”’
Converts an engine API URL to the default RPC websocket URL.
setup_persistence_subscription ๐Ÿ”’
Establishes a websocket connection and subscribes to reth_subscribePersistedBlock.
wait_for_persistence ๐Ÿ”’
Waits until the persistence subscription reports that target has been persisted.