Skip to main content

Module reachability

Module reachability 

Source
Expand description

Reachability assertions whose “must be hit” expectation is decided at runtime from the protocol config, rather than at compile time.

mysten_common::assert_reachable! registers with Antithesis at compile time: every call site linked into the binary is unconditionally expected to execute at least once during a run. That is the wrong expectation for code behind a protocol feature flag. One sui-node binary serves every chain configuration - Antithesis picks one per run by setting SUI_PROTOCOL_CONFIG_CHAIN_OVERRIDE - so a flag that is on for one chain is off for another, and a site that is correctly dark for the run’s configuration is still reported as “never reached”. The same thing happens in reverse while a flag is rolling out: a path guarded by !flag is dark on whichever chains already have the flag on.

assert_reachable_gated! takes a predicate over ProtocolConfig and registers a reachability expectation when the node adopts a config that satisfies it:

assert_reachable_gated!(
    "retry object withdraw later",
    |pc| !pc.check_object_funds_withdraw_in_execution()
);

register_reachability_for_config performs that registration and is called at every epoch start. Registration is cumulative across epochs, so an upgrade test that starts below a flag’s enabling version and upgrades through it requires both the old and the new path, since both configurations were adopted. A point reached before registration is also catalogued as required: the observed hit already satisfies that expectation.

Structs§

GatedReachabilityPoint
A reachability assertion that is registered with Antithesis at runtime.

Statics§

GATED_REACHABILITY_CATALOG
Every crate::assert_reachable_gated! site linked into the binary.

Functions§

as_predicate
Forces a non-capturing closure at a call site to the predicate signature, so that |pc| ... can be written without naming ProtocolConfig.
register_reachability_for_config
Catalogs every gated point that config makes live.