A TypeScript implementation for detecting multiple core assignments using Polkadot API (PAPI).
- Core-to-Task Mapping: Shows which tasks are assigned to each core (ordered by core ID)
- Duplicate Detection: Identifies tasks assigned to multiple cores
- Current & Future Workloads: Analyzes both current and upcoming core assignments
- Lease Information: Displays current lease data from the coretime chain
npm installnpm run devnpm run build
npm start=== CORE TO TASK MAPPING (Current Workload) ===
Core 0: [4509]
Core 1: No tasks
Core 2: [4605]
...
=== DUPLICATE ANALYSIS (Current Workload) ===
Task 1111: [14, 51]
Task 2034: [30, 31]
Task 2043: [35, 47]
...
The script connects to:
- Relay Chain:
wss://rpc.ibp.network/paseo - Coretime Chain:
wss://sys.ibp.network/coretime-paseo
You can modify these URLs in src/index.ts if needed.
- Proper Core ID Querying: Uses PAPI's
getValue(coreId)method to query individual cores by actual ID - Type Safety: Full TypeScript typing for better development experience
- Modern Async/Await: Clean promise-based API calls
- Lightweight: Uses PAPI's efficient light client approach
- Better Error Handling: Graceful handling of failed queries per core
The script:
- Connects to the Paseo relay chain
- Gets the total number of cores from
CoreDescriptors.getEntries() - Queries each core individually by ID (0 to numCores-1)
- Extracts task assignments from each core's
current_work.assignments - Creates both core→task and task→core mappings
- Identifies and displays duplicate task assignments