fix(agent): reconcile Random Sampling sharding membership - #2511
Conversation
|
Fixed both PR-specific CI failures in 751a2ac: the offline adapter now implements typed availability without a parity exemption, and the five lifecycle admission cases observe the owned runtime instead of spying on the removed factory. Unexpected readiness/capability exceptions become indeterminate outcomes, with a recovery assertion. Validation: 29 chain availability/parity + 48 runtime/proof-repair/outbox + five Hardhat-backed admission cases pass (82 total); agent/CLI builds, registered declaration and fixture checks, lint, inventory and SPARQL pass. The previous agent shard 6 failure has the empty identity response followed by a 60-second negative-admission cache signature tracked in #2507; its independent repair is #2508. Fresh CI is running. |
# Conflicts: # packages/agent/src/dkg-agent.ts # packages/chain/src/mock-adapter.ts
Core nodes recheck Random Sampling identity and sharding-table membership every 30 seconds. A node admitted after startup can start proving without a daemon restart. Confirmed removal retires the prover; readmission starts a fresh handle. Transient lookup failures retain the active prover.
A feature runtime owns waiting, disabled, binding, running, retiring and stopped states, including timer ownership and retry transitions. The chain adapter refreshes invalidated RandomSampling bindings and returns typed membership, missing-deployment or indeterminate facts. Previously observed deployments remain retryable across rotation. Initially absent or unsupported deployments remain disabled. Only missing RandomSampling, RandomSamplingStorage or ShardingTableStorage bindings are classified as a missing sampling deployment; unrelated mandatory Hub-contract initialization errors remain indeterminate with their original typed error.
ChainAdapterowns each capability declaration once; required resolver and legacy-probe types derive from it, and the compatibility reader preserves older optional probes and their receiver.The public
createRandomSamplingHandle()method continues returning a directly usableRandomSamplingHandle, including disabled no-op handles. The lifecycle uses a separate protected binding-result path to decide resource ownership and retries. Shutdown fences new work immediately, then joins construction and physical close before store/network teardown. A timeout retains physical ownership until cleanup settles; a settled close rejection is logged and permits teardown or later readmission.Status preserves the existing disabled-reason values. Pending cleanup reports
enabled: false,disabledReason: not_startedand optionalretiring: true; the CLI explains this diagnostic, and it clears after physical retirement. Existing exhaustive reason maps and status literals remain compatible.Validation:
Closes #1642.