Skip to content

refactor: extract chain-state coordinator into provider-coordinator (2) - #336

Open
danielbui12 wants to merge 5 commits into
provider_coordinatorfrom
wire_provider_coordinator_with_subxt
Open

refactor: extract chain-state coordinator into provider-coordinator (2)#336
danielbui12 wants to merge 5 commits into
provider_coordinatorfrom
wire_provider_coordinator_with_subxt

Conversation

@danielbui12

@danielbui12 danielbui12 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Changes

  • Read chain state via storage-subxt in provider-coordinator
  • Replace all subxt dynamic call by storage-subxt

- Read `Providers` and `ProviderReplayStates` through typed static storage
  addresses, mapping the runtime `ProviderInfo` into the crate's flattened one
- Read the `RequestTimeout` constant through its generated address, probing
  metadata first so an absent constant still reports as absent, not as a
  decode failure
- Fetch the anchor block via the generated `StorageProviderApi` payload instead
  of `call_raw` plus a hand-written `u32::decode`
- Decode the six provider-lifecycle events through the generated event structs,
  matching the approach already used in `provider-chain`
- Drop the scale_value walkers this replaces and move `codec` to dev-dependencies
- All 13 `ProviderInfo` fields now fail loudly on a shape mismatch; `multiaddr`,
  `replica_sync_price`, `deregister_at` and the two stats counters previously
  fell back to defaults without an error
…ordinator`

- Drop `unvalidated()` from the `Providers` and `ProviderReplayStates` reads,
  the `RequestTimeout` constant, and the anchor-block runtime API call, so each
  address is hash-checked against the runtime metadata the node serves
- Replace the hand-rolled metadata probe in `fetch_request_timeout` with a match
  on subxt's own `ConstantNameNotFound` / `PalletNameNotFound`; validation
  raises those directly, so the absent-constant case no longer needs its own
  lookup and still reports as `Ok(None)`
- Runtime drift now fails at fetch time rather than surfacing later as a decode
  error; the coordinator tests confirm the paseo-generated hashes match the
  local runtime
@danielbui12 danielbui12 self-assigned this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant