ci / gate (push) Waiting to run
`ChainManager::start(profile)` spawns a supervisor that tries the profile's endpoints in order, refuses a node whose genesis is not the profile's (by name, so a typo in an override file cannot quietly sign for the wrong chain), records the runtime version at connect, follows finalized heads, applies subxt's runtime updates as the chain upgrades, and on any failure rotates to the next endpoint after an exponential backoff with full jitter, capped at a minute. A head that fails to arrive for two minutes counts as a failure. `status()` reports the endpoint in use, spec and transaction version, finalized height, head age, the last error and the failure count. Backoff is a pure type with the schedule pinned in tests. The live test gives Planck's profile a dead first endpoint and the real second one: it connects to the second at spec 148 with zero failures, and mainnet's profile pointed at Planck's node is refused with "is not quantus". Supervisors start on demand from `chain_connect`, never at boot, because a profile whose endpoint does not exist yet (#53) would otherwise retry forever for nobody. `chain_status` reads without starting anything. Not yet exercised: a stream dropping mid-session and a runtime upgrade arriving while connected. Both go through the same loop and will be driven on the dev node in #24. Closes #20 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ftBXYuba8ARhQeF74oUgW
25 lines
820 B
TypeScript
25 lines
820 B
TypeScript
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
import type { ChainId } from "./ChainId";
|
|
|
|
/**
|
|
* The wallet's view of its connection to one chain. Everything here is
|
|
* observed, not configured; the UI shows it and decides nothing from it.
|
|
*/
|
|
export type ChainStatus = { chain: ChainId, connected: boolean,
|
|
/**
|
|
* The endpoint currently in use, or the last one tried.
|
|
*/
|
|
endpoint: string | null, spec_version: number | null, transaction_version: number | null, finalized_number: bigint | null,
|
|
/**
|
|
* Seconds since the last finalized head arrived; `None` when never.
|
|
*/
|
|
head_age_seconds: bigint | null,
|
|
/**
|
|
* The last error, when disconnected.
|
|
*/
|
|
last_error: string | null,
|
|
/**
|
|
* How many consecutive attempts have failed.
|
|
*/
|
|
failures: number, };
|