@ar.io/sdk 4.0.0-solana.28 → 4.0.0-solana.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2420,16 +2420,26 @@ export class SolanaARIOWriteable extends SolanaARIOReadable {
|
|
|
2420
2420
|
// currentIndex is the NEXT epoch to create; the live one is currentIndex-1.
|
|
2421
2421
|
const targetEpochIndex = currentIndex > 0 ? currentIndex - 1 : 0;
|
|
2422
2422
|
const nextEpochStart = settings.genesisTimestamp + currentIndex * settings.epochDuration;
|
|
2423
|
-
|
|
2424
|
-
|
|
2423
|
+
const epoch = await this.getEpochRaw(targetEpochIndex);
|
|
2424
|
+
// Cold start: the live epoch (targetEpochIndex) doesn't exist yet. Two cases,
|
|
2425
|
+
// handled identically — `create_epoch` always creates epoch[currentIndex] and
|
|
2426
|
+
// then increments the counter, so the NEXT crank finds it live at currentIndex-1:
|
|
2427
|
+
// 1. Genesis: currentIndex === 0 → create epoch 0.
|
|
2428
|
+
// 2. AO→Solana continuity cold start: `admin_set_current_epoch_index` jumped
|
|
2429
|
+
// currentIndex to e.g. 454 with NO prior epochs on-chain (the AO-side
|
|
2430
|
+
// epochs were never created on Solana). targetEpochIndex (453) points at
|
|
2431
|
+
// an epoch that will never exist, so the old `currentIndex === 0`-only
|
|
2432
|
+
// bootstrap deadlocked here ('waiting_for_epoch' forever). Create
|
|
2433
|
+
// epoch[currentIndex] (454) directly — its start was re-anchored to ≈now.
|
|
2434
|
+
if (!epoch) {
|
|
2425
2435
|
if (now < nextEpochStart)
|
|
2426
|
-
return {
|
|
2436
|
+
return {
|
|
2437
|
+
action: 'idle',
|
|
2438
|
+
reason: currentIndex === 0 ? 'waiting_for_genesis' : 'waiting_for_epoch',
|
|
2439
|
+
};
|
|
2427
2440
|
const { id } = await this.createEpoch();
|
|
2428
|
-
return { action: 'create', epochIndex:
|
|
2441
|
+
return { action: 'create', epochIndex: currentIndex, txId: id };
|
|
2429
2442
|
}
|
|
2430
|
-
const epoch = await this.getEpochRaw(targetEpochIndex);
|
|
2431
|
-
if (!epoch)
|
|
2432
|
-
return { action: 'idle', reason: 'waiting_for_epoch' };
|
|
2433
2443
|
// Tally (batched). activeGatewayCount===0 still needs one tx to flip the flag.
|
|
2434
2444
|
if (epoch.weightsTallied === 0) {
|
|
2435
2445
|
const gatewayAccounts = epoch.activeGatewayCount > 0
|
package/lib/esm/version.js
CHANGED
package/lib/types/version.d.ts
CHANGED