Versions in this module Expand all Collapse all v1 v1.6.0 Jul 6, 2026 Changes in this version + const DefaultModelNodeLimit + var ErrInvalidScenario = errors.New("invalid scenario") + var ErrNoStatusReader = errors.New("network has no status reader") + var ErrNodeNotFound = errors.New("node not found") + var ErrNodeNotManaged = errors.New("node is not managed by this network") + func IsModelInvariantError(err error) bool + func SeededValidatorPowers(nodeCount int, seed int64) map[NodeID]int64 + type Action interface + Name func() string + Run func(ctx context.Context, run *RunContext) error + func AdvertiseEndpointWith(mutator EndpointMutator, id NodeID, endpoint string) Action + func CaptureReachabilityBaseline(baseline *ReachabilityBaseline) Action + func CaptureValidatorPowerBaseline(baseline *ValidatorPowerBaseline) Action + func DeregisterNodeWith(registrar Registrar, id NodeID) Action + func HookAction(name string, fn func(context.Context, *RunContext) error) Action + func JailNodeWith(jailer Jailer, id NodeID) Action + func Parallel(name string, actions ...Action) Action + func RegisterNodeWith(registrar Registrar, id NodeID) Action + func RestartNode(id NodeID) Action + func Sequence(name string, actions ...Action) Action + func StartNode(id NodeID) Action + func StopNode(id NodeID) Action + func UnjailNodeWith(jailer Jailer, id NodeID) Action + func Wait(duration time.Duration) Action + type ActionFunc struct + Fn func(context.Context, *RunContext) error + Label string + func (a ActionFunc) Name() string + func (a ActionFunc) Run(ctx context.Context, run *RunContext) error + type Assertion interface + Check func(ctx context.Context, run *RunContext) error + Name func() string + func AllReachable() Assertion + func HeightAdvances(minDelta int64, within, pollInterval time.Duration) Assertion + func HeightFollowsValidatorQuorum(within, pollInterval time.Duration) Assertion + func HeightStalls(observeFor, pollInterval time.Duration) Assertion + func HeightStallsWithoutValidatorQuorum(within, pollInterval time.Duration) Assertion + func LiveValidatorHeightsConverge(maxSpread int64, within, pollInterval time.Duration) Assertion + func NoHeightRegression(observeFor, pollInterval time.Duration) Assertion + func NoLiveValidatorFork() Assertion + func NodesAvailable(ids []NodeID, within, pollInterval time.Duration) Assertion + func NodesUnavailable(ids []NodeID, within, pollInterval time.Duration) Assertion + func NodesWithoutValidatorPower(ids []NodeID, within, pollInterval time.Duration) Assertion + func QuorumReady(required int, within, pollInterval time.Duration) Assertion + func ReachabilityRestored(baseline *ReachabilityBaseline, within, pollInterval time.Duration) Assertion + func ReachableAtLeast(required int, within, pollInterval time.Duration) Assertion + func ValidatorOutcomeAssertions(within, pollInterval time.Duration, requireConvergence bool) []Assertion + func ValidatorPowerEquals(id NodeID, power int64, within, pollInterval time.Duration) Assertion + func ValidatorPowerRestored(baseline *ValidatorPowerBaseline, within, pollInterval time.Duration) Assertion + func ValidatorStallOutcomeAssertions(within, pollInterval time.Duration) []Assertion + type AssertionFunc struct + Fn func(context.Context, *RunContext) error + Label string + func (a AssertionFunc) Check(ctx context.Context, run *RunContext) error + func (a AssertionFunc) Name() string + type Client struct + DefaultScheme string + HTTPClient *http.Client + RequestTimeout time.Duration + func NewClient(opts ...ClientOption) *Client + func (c *Client) DiscoverValidatorEndpoints(ctx context.Context, endpoint string) ([]string, error) + func (c *Client) GetNodeStatus(ctx context.Context, node NodeSpec) (NodeStatus, error) + type ClientOption func(*Client) + func WithDefaultScheme(scheme string) ClientOption + func WithHTTPClient(client *http.Client) ClientOption + func WithInsecureTLS() ClientOption + func WithRequestTimeout(timeout time.Duration) ClientOption + type EndpointMutator interface + SetNodeEndpoint func(ctx context.Context, node NodeSpec, endpoint string) error + type EthRegistryController struct + func NewEthRegistryController(ctx context.Context, opts EthRegistryControllerOptions) (*EthRegistryController, error) + func (c *EthRegistryController) Close() + func (c *EthRegistryController) DeregisterNode(ctx context.Context, node NodeSpec) error + func (c *EthRegistryController) RegisterNode(ctx context.Context, node NodeSpec) error + func (c *EthRegistryController) SetNodeEndpoint(ctx context.Context, node NodeSpec, endpoint string) error + type EthRegistryControllerOptions struct + DelegateOwnerWallet string + PrivateKey string + RPCURL string + ReceiptTimeout time.Duration + RegistryAddress string + ServiceType [32]byte + StakeAmount *big.Int + type Event struct + Detail string + Kind string + Message string + Time time.Time + type Jailer interface + JailNode func(ctx context.Context, node NodeSpec) error + UnjailNode func(ctx context.Context, node NodeSpec) error + type ModelAction struct + Kind ModelActionKind + Node NodeID + type ModelActionKind uint8 + const ModelDeregister + const ModelDeregisterTwice + const ModelJail + const ModelLieEndpoint + const ModelRegister + const ModelRepairEndpoint + const ModelStart + const ModelStop + const ModelTick + const ModelUnjail + func (a ModelActionKind) String() string + type ModelEvent struct + Action ModelActionKind + EmittedUpdate bool + Error string + Height int64 + InCometAfter bool + InCometBefore bool + Node NodeID + OnlineAfter bool + OnlineBefore bool + OnlinePower int64 + QuorumAfter bool + QuorumBefore bool + StateAfter ModelValidatorState + StateBefore ModelValidatorState + Step int + TotalPower int64 + type ModelInvariantError struct + Event ModelEvent + Message string + Trace []ModelEvent + func (e *ModelInvariantError) Error() string + type ModelNode struct + EndpointHonest bool + ID NodeID + InCometSet bool + Online bool + Power int64 + State ModelValidatorState + type ModelResult struct + Events []ModelEvent + Height int64 + NodeCount int + Seed int64 + Steps int + func RunValidatorLifecycleModel(seed int64, nodeCount, steps int, behavior ValidatorSetBehavior) (ModelResult, error) + func RunValidatorLifecycleProgram(program []byte, nodeCount int, behavior ValidatorSetBehavior) (ModelResult, error) + type ModelValidatorState int + const ModelValidatorAbsent + const ModelValidatorActive + const ModelValidatorJailed + func (s ModelValidatorState) String() string + type Network interface + Close func(ctx context.Context) error + RestartNode func(ctx context.Context, id NodeID) error + Snapshot func(ctx context.Context) (Snapshot, error) + Spec func() NetworkSpec + StartNode func(ctx context.Context, id NodeID) error + StopNode func(ctx context.Context, id NodeID) error + type NetworkSpec struct + Name string + Nodes []NodeSpec + func (s NetworkSpec) Node(id NodeID) (NodeSpec, bool) + func (s NetworkSpec) NodeIDs() []NodeID + func (s NetworkSpec) Validate() error + type NodeID string + type NodeSpec struct + Command []string + Dir string + Endpoint string + Env map[string]string + ID NodeID + LogPath string + ShutdownTimeout time.Duration + StartupTimeout time.Duration + type NodeStatus struct + BlockHash string + Endpoint string + Git string + Height int64 + ID NodeID + Live bool + ObservationError string + ObservedAt time.Time + ProcessError string + ProcessState string + Reachable bool + Ready bool + Synced bool + ValidatorPower int64 + Version string + type ProcessNetwork struct + func NewProcessNetwork(spec NetworkSpec, reader StatusReader) (*ProcessNetwork, error) + func (n *ProcessNetwork) Close(ctx context.Context) error + func (n *ProcessNetwork) RestartNode(ctx context.Context, id NodeID) error + func (n *ProcessNetwork) Snapshot(ctx context.Context) (Snapshot, error) + func (n *ProcessNetwork) Spec() NetworkSpec + func (n *ProcessNetwork) StartNode(ctx context.Context, id NodeID) error + func (n *ProcessNetwork) StopNode(ctx context.Context, id NodeID) error + type ReachabilityBaseline struct + type Registrar interface + DeregisterNode func(ctx context.Context, node NodeSpec) error + RegisterNode func(ctx context.Context, node NodeSpec) error + type Result struct + Error string + Events []Event + FinishedAt time.Time + Passed bool + ScenarioName string + Seed int64 + StartedAt time.Time + type RunContext struct + Network Network + Rand *rand.Rand + func (r *RunContext) Events() []Event + type Runner struct + EventSink func(Event) + Network Network + Seed int64 + StepTimeout time.Duration + func (r Runner) Run(ctx context.Context, scenario Scenario) (Result, error) + type Scenario struct + Name string + Seed int64 + Steps []Step + func BasicLivenessScenario(minHeightDelta int64, within, pollInterval time.Duration) Scenario + func CohortEndpointConsensusIsolationScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + func CohortLifecycleRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + func CompoundOutcomeEdgeCaseScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + func DuplicateDeregisterIdempotencyScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func DuplicateJailIdempotencyScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func EndpointLieConsensusIsolationScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func EndpointRegisterRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func EndpointRepairIdempotencyScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func InactiveEndpointIsolationScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func InactiveStartIsolationScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func JailedDeregisterCompatibilityScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func JailedEndpointRepairRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func JailedRegisterRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func LiveLivenessScenario(requiredReachable int, minHeightDelta int64, ...) Scenario + func MixedLifecycleQuorumRecoveryScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + func NonJailedUnjailIsolationScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func OutcomeEdgeCaseScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + func PowerBoundaryOutcomeScenario(within, pollInterval time.Duration) Scenario + func PowerSkewOutcomeScenario(spec NetworkSpec, controller ValidatorChaosController, highPowerID NodeID, ...) Scenario + func QuorumLossRecoveryScenario(spec NetworkSpec, within, pollInterval time.Duration) Scenario + func RegisterIdempotencyScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func RegisterRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func RestartNodeScenario(id NodeID, readyCount int, within, pollInterval time.Duration) Scenario + func SimulatedChaosScenarioFromProgram(spec NetworkSpec, controller ValidatorChaosController, program []byte, ...) Scenario + func StopStartRoundTripScenario(spec NetworkSpec, target NodeID, within, pollInterval time.Duration) Scenario + func UnjailRoundTripScenario(spec NetworkSpec, controller ValidatorChaosController, target NodeID, ...) Scenario + func ValidatorChaosScenario(spec NetworkSpec, controller ValidatorChaosController, ...) Scenario + type SimulatedNetwork struct + func NewSimulatedNetwork(opts SimulatedNetworkOptions) (*SimulatedNetwork, error) + func (n *SimulatedNetwork) Close(context.Context) error + func (n *SimulatedNetwork) DeregisterNode(ctx context.Context, node NodeSpec) error + func (n *SimulatedNetwork) JailNode(ctx context.Context, node NodeSpec) error + func (n *SimulatedNetwork) RegisterNode(ctx context.Context, node NodeSpec) error + func (n *SimulatedNetwork) RestartNode(ctx context.Context, id NodeID) error + func (n *SimulatedNetwork) SetNodeEndpoint(ctx context.Context, node NodeSpec, endpoint string) error + func (n *SimulatedNetwork) Snapshot(ctx context.Context) (Snapshot, error) + func (n *SimulatedNetwork) Spec() NetworkSpec + func (n *SimulatedNetwork) StartNode(ctx context.Context, id NodeID) error + func (n *SimulatedNetwork) StopNode(ctx context.Context, id NodeID) error + func (n *SimulatedNetwork) UnjailNode(ctx context.Context, node NodeSpec) error + type SimulatedNetworkOptions struct + Behavior ValidatorSetBehavior + InitialActive int + Name string + NodeCount int + NodePowers map[NodeID]int64 + TickOnSnapshot bool + type SimulatedProgramOptions struct + AssertAfterEachStep bool + AssertConvergence bool + IncludePersistentFaults bool + LivenessEvery int + LivenessWithin time.Duration + MaxSteps int + PollInterval time.Duration + RecoverAtEnd bool + type Snapshot struct + Nodes []NodeStatus + ObservedAt time.Time + func (s Snapshot) ByNode(id NodeID) (NodeStatus, bool) + func (s Snapshot) HasValidatorQuorum() bool + func (s Snapshot) MaxHeight() int64 + func (s Snapshot) MaxObservedHeight() int64 + func (s Snapshot) ReachableCount() int + func (s Snapshot) ReadyCount() int + func (s Snapshot) Summary() string + func (s Snapshot) ValidatorPower() (totalPower, livePower int64) + type StaticNetwork struct + func NewStaticNetwork(spec NetworkSpec, reader StatusReader) (*StaticNetwork, error) + func (n *StaticNetwork) Close(context.Context) error + func (n *StaticNetwork) RestartNode(context.Context, NodeID) error + func (n *StaticNetwork) Snapshot(ctx context.Context) (Snapshot, error) + func (n *StaticNetwork) Spec() NetworkSpec + func (n *StaticNetwork) StartNode(context.Context, NodeID) error + func (n *StaticNetwork) StopNode(context.Context, NodeID) error + type StatusReader interface + GetNodeStatus func(ctx context.Context, node NodeSpec) (NodeStatus, error) + type Step struct + Actions []Action + Assertions []Assertion + Name string + Timeout time.Duration + func ActionStep(name string, actions ...Action) Step + func AssertionStep(name string, assertions ...Assertion) Step + type ValidatorChaosController struct + EndpointMutator EndpointMutator + Jailer Jailer + Registrar Registrar + type ValidatorChaosOptions struct + ActionNodeIDs []NodeID + AssertAfterEachStep bool + AssertConvergence bool + IncludePersistentFaults bool + IncludeProcessFaults bool + LivenessEvery int + LivenessWithin time.Duration + NoProcessFaultDelay bool + PollInterval time.Duration + RecoverAtEnd bool + Seed int64 + StartNodes bool + StepTimeout time.Duration + Steps int + type ValidatorLifecycleModel struct + Behavior ValidatorSetBehavior + Events []ModelEvent + Height int64 + Nodes map[NodeID]*ModelNode + Order []NodeID + func NewValidatorLifecycleModel(opts ValidatorModelOptions) *ValidatorLifecycleModel + func (m *ValidatorLifecycleModel) Apply(step int, action ModelAction) error + func (m *ValidatorLifecycleModel) HasOnlineQuorum() bool + func (m *ValidatorLifecycleModel) Power() (totalPower, onlinePower int64) + func (m *ValidatorLifecycleModel) RecentEvents(limit int) []ModelEvent + type ValidatorModelOptions struct + Behavior ValidatorSetBehavior + InitialActive int + NodeCount int + NodePowers map[NodeID]int64 + type ValidatorPowerBaseline struct + type ValidatorSetBehavior int + const ValidatorSetBehaviorBuggyAnyDeregistrationUpdate + const ValidatorSetBehaviorBuggyJailedDeregistration + const ValidatorSetBehaviorBuggyRegisterNoop + const ValidatorSetBehaviorBuggyRegisterWithoutCometUpdate + const ValidatorSetBehaviorBuggyStallWithQuorum + const ValidatorSetBehaviorBuggyStartAbsentOnline + const ValidatorSetBehaviorBuggyTickWithoutQuorum + const ValidatorSetBehaviorCurrent + type VersionSkewMode int + const VersionSkewModeBadEndpointOnRegister + const VersionSkewModeBadEndpointOnStart + const VersionSkewModeBadEndpointOnUnjail + const VersionSkewModeForkLegacyOnAbsentUnjail + const VersionSkewModeForkLegacyOnActiveRegister + const VersionSkewModeForkLegacyOnActiveUnjail + const VersionSkewModeForkLegacyOnDuplicateDeregister + const VersionSkewModeForkLegacyOnDuplicateJail + const VersionSkewModeForkLegacyOnEndpointLie + const VersionSkewModeForkLegacyOnEndpointNoopRepair + const VersionSkewModeForkLegacyOnEndpointRepair + const VersionSkewModeForkLegacyOnInactiveEndpoint + const VersionSkewModeForkLegacyOnInactiveStart + const VersionSkewModeForkLegacyOnJailedDeregister + const VersionSkewModeForkLegacyOnJailedRegister + const VersionSkewModeForkLegacyOnRegister + const VersionSkewModeForkLegacyOnStart + const VersionSkewModeForkLegacyOnUnjail + const VersionSkewModeHaltLegacyOnAbsentUnjail + const VersionSkewModeHaltLegacyOnActiveRegister + const VersionSkewModeHaltLegacyOnActiveUnjail + const VersionSkewModeHaltLegacyOnDuplicateDeregister + const VersionSkewModeHaltLegacyOnDuplicateJail + const VersionSkewModeHaltLegacyOnEndpointLie + const VersionSkewModeHaltLegacyOnEndpointNoopRepair + const VersionSkewModeHaltLegacyOnEndpointRepair + const VersionSkewModeHaltLegacyOnInactiveEndpoint + const VersionSkewModeHaltLegacyOnInactiveStart + const VersionSkewModeHaltLegacyOnJailedDeregister + const VersionSkewModeHaltLegacyOnJailedRegister + const VersionSkewModeHaltLegacyOnRegister + const VersionSkewModeHaltLegacyOnStart + const VersionSkewModeHaltLegacyOnUnjail + const VersionSkewModeKeepBadEndpointOnJailedRepair + const VersionSkewModeKeepBadEndpointOnRegister + const VersionSkewModeKeepBadEndpointOnRepair + const VersionSkewModeNoopOnJailedRegister + const VersionSkewModeNoopOnStart + const VersionSkewModeNoopOnUnjail + const VersionSkewModeReactivateAbsentOnInactiveEndpoint + const VersionSkewModeReactivateAbsentOnStart + const VersionSkewModeReactivateAbsentOnUnjail + const VersionSkewModeReactivateJailedOnInactiveEndpoint + const VersionSkewModeReactivateJailedOnStart + type VersionSkewNetwork struct + func NewVersionSkewNetwork(opts VersionSkewNetworkOptions) (*VersionSkewNetwork, error) + func (n *VersionSkewNetwork) Close(context.Context) error + func (n *VersionSkewNetwork) DeregisterNode(ctx context.Context, node NodeSpec) error + func (n *VersionSkewNetwork) JailNode(ctx context.Context, node NodeSpec) error + func (n *VersionSkewNetwork) RegisterNode(ctx context.Context, node NodeSpec) error + func (n *VersionSkewNetwork) RestartNode(ctx context.Context, id NodeID) error + func (n *VersionSkewNetwork) SetNodeEndpoint(ctx context.Context, node NodeSpec, endpoint string) error + func (n *VersionSkewNetwork) Snapshot(ctx context.Context) (Snapshot, error) + func (n *VersionSkewNetwork) Spec() NetworkSpec + func (n *VersionSkewNetwork) StartNode(ctx context.Context, id NodeID) error + func (n *VersionSkewNetwork) StopNode(ctx context.Context, id NodeID) error + func (n *VersionSkewNetwork) UnjailNode(ctx context.Context, node NodeSpec) error + type VersionSkewNetworkOptions struct + LegacyNodeIDs []NodeID + Mode VersionSkewMode + Name string + NodeCount int + NodePowers map[NodeID]int64