-
Notifications
You must be signed in to change notification settings - Fork 162
Description
Asset Hub Migration: Remaining Tasks for Single Instance Multi Chain Support
Overview
Complete the remaining work for Asset Hub Migration support in substrate-api-sidecar. The goal is to ensure everything is reachable from a single instance of sidecar. Currently, everything works with the exception of staking progress when using 2 instances. These tasks address historical data access and cross-chain query capabilities needed for a seamless transition to single-instance operation.
Tasks
1. Add Historical Support for Staking Progress Endpoint (#1695)
Endpoint: /pallets/staking/progress?at={height}
Problem: Currently lacks historical support for querying staking progress at specific block heights.
Solution:
- Hardcode BABE information for epochs and sessions
- Eliminate the need for multi-chain queries by using static configuration
- Enable historical lookups without cross-chain dependencies
Acceptance Criteria:
- Endpoint supports
at={height}parameter for historical queries - BABE epoch and session data is hardcoded and accessible
- No multi-chain queries required for historical staking progress (with the exception of skippedEpochs)
2. Implement useRcBlock Query Parameter Support
Goal: Enable cross-chain state queries by allowing Asset Hub endpoints to query state at specific relay chain block heights using the useRcBlock parameter in conjunction with the existing at parameter.
Implementation:
- Add
useRcBlockparameter support across all relevant endpoints - When
useRcBlock=true, treat theatparameter as a relay chain block identifier - Ensure responses include additional metadata (
rcBlockNumber,ahTimestamp) - Maintain backward compatibility with existing functionality
Acceptance Criteria:
-
useRcBlockparameter implemented across all applicable endpoints - Responses include relay chain block number and Asset Hub timestamp metadata
- Smart block mapping handles 2:1 RC-to-AH block ratio
- Multi-block scenarios handled when Asset Hub produces multiple blocks per RC block
- Documentation updated with parameter usage and examples
3. Implement useRcBlock Query Parameter Support for Block Endpoints
Goal: Enable block endpoints to accept relay chain block identifiers instead of Asset Hub block identifiers.
Implementation:
- Add
useRcBlockparameter to all block-related endpoints - Implement relay chain to Asset Hub block mapping
- Include enhanced response metadata when parameter is used
Acceptance Criteria:
-
useRcBlockparameter implemented on all block endpoints - Block identifier mapping from relay chain to Asset Hub blocks
- Range endpoints skip RC blocks without corresponding AH blocks
- Enhanced responses include
rcBlockNumberandahTimestampfields - Backward compatibility maintained (defaults to
false) - OpenAPI specifications updated with new parameter
4. Cross-Chain Historical Data Handling
Problem: When endpoints require era fields or need to retrieve historical data that spans the migration boundary (Asset Hub → Relay Chain), sidecar needs intelligent handling.
Requirements:
- Determine migration start and end points
- Map relay chain blocks to corresponding parachain block numbers
- Handle historical queries that cross the migration boundary
Implementation Strategy:
- Identify the exact migration start/end blocks
- Create a mapping system between relay chain and parachain block numbers
- Implement logic to route historical queries to the appropriate chain
Acceptance Criteria:
- Migration start/end blocks are identified and stored
- Block number mapping between relay chain and parachain is implemented
- Historical queries automatically route to correct chain based on block height
- Era-based queries work seamlessly across migration boundary
5. Create Mirrored Relay Chain Endpoints
Goal: Enable a single Asset Hub sidecar instance to access both Asset Hub and Relay Chain historical data.
Implementation:
- Create mirrored endpoints that proxy relay chain requests
- Allow Asset Hub sidecar to serve historical relay chain data
- Maintain API consistency while supporting dual-chain access
Acceptance Criteria:
- Asset Hub sidecar instance can serve relay chain historical data
- Mirrored endpoints maintain consistent API structure
- Single sidecar deployment supports both chains
- Documentation updated with new endpoint capabilities
Substrate API Sidecar Endpoints
Accounts Endpoints (#1701)
-
/accounts/{accountId}/asset-balances-
useRcBlockparameter
-
-
/accounts/{accountId}/asset-approvals-
useRcBlockparameter
-
-
/accounts/{accountId}/balance-info- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/accounts/{accountId}/pool-asset-balances-
useRcBlockparameter
-
-
/accounts/{accountId}/pool-asset-approvals-
useRcBlockparameter
-
-
/accounts/{accountId}/proxy-info- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/accounts/{accountId}/staking-info-
useRcBlockparameter
-
-
/accounts/{accountId}/staking-payouts-
useRcBlockparameter
-
-
/accounts/{accountId}/vesting-info-
useRcBlockparameter
-
Blocks Endpoints (#1702)
-
/blocks- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/{blockId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/{blockId}/header- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/{blockId}/extrinsics/{extrinsicIndex}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/head- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/head/header- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/blocks/{blockId}/extrinsics-raw- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
Node Endpoints
-
/node/network- Mirrored
/rcendpoint
- Mirrored
-
/node/transaction-pool- Mirrored
/rcendpoint
- Mirrored
-
/node/version- Mirrored
/rcendpoint
- Mirrored
Runtime Endpoints
-
/runtime/metadata- Mirrored
/rcendpoint
- Mirrored
-
/runtime/metadata/{metadataVersion}- Mirrored
/rcendpoint
- Mirrored
-
/runtime/metadata/versions- Mirrored
/rcendpoint
- Mirrored
-
/runtime/spec- Mirrored
/rcendpoint
- Mirrored
-
/runtime/code- Mirrored
/rcendpoint
- Mirrored
Pallets Endpoints
-
/pallets/assets/{assetId}/asset-info-
useRcBlockparameter
-
-
/pallets/asset-conversion/liquidity-pools-
useRcBlockparameter
-
-
/pallets/asset-conversion/next-available-id-
useRcBlockparameter
-
-
/pallets/foreign-assets-
useRcBlockparameter
-
-
/pallets/nomination-pools/info-
useRcBlockparameter
-
-
/pallets/nomination-pools/{poolId}-
useRcBlockparameter
-
-
/pallets/on-going-referenda- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/consts- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/consts/{constantItemId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/dispatchables- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/dispatchables/{dispatchableItemId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/errors- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/errors/{errorItemId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/events- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/events/{eventItemId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/storage- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/{palletId}/storage/{storageItemId}- Mirrored
/rcendpoint -
useRcBlockparameter
- Mirrored
-
/pallets/pool-assets/{assetId}/asset-info-
useRcBlockparameter
-
-
/pallets/staking/progress-
useRcBlockparameter (#1700)
-
-
/pallets/staking/validators-
useRcBlockparameter
-