Problem
chainHead_unstable_finalizedDatabase returns a database without runtime code when called shortly after the initialized event from chainHead_v1_follow. The sync service has reached a finalized block, but the runtime service is still downloading :code from a peer.
The returned DB has valid chain info (~43KB) but no runtimeCode, codeMerkleValue, or codeClosestAncestorExcluding. Feeding this back as databaseContent on the next start is useless - smoldot ignores it and does a full warp sync + runtime download anyway.
Reproduction
const client = start({ maxLogLevel: 3 });
const chain = await client.addChain({ chainSpec });
// Subscribe and wait for initialized
chain.sendJsonRpc(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'chainHead_v1_follow', params: [true] }));
// ... wait for initialized event ...
// Call immediately after initialized
chain.sendJsonRpc(JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'chainHead_unstable_finalizedDatabase', params: [] }));
// Returns ~43KB DB with chain info but NO runtimeCode
// Wait 5-10 seconds, call again
chain.sendJsonRpc(JSON.stringify({ jsonrpc: '2.0', id: 3, method: 'chainHead_unstable_finalizedDatabase', params: [] }));
// Returns ~2.3MB DB with chain info AND runtimeCode
Observed on Paseo Asset Hub parachain cold start with smoldot dev/pending-20260423.
Expected behavior
chainHead_unstable_finalizedDatabase should either:
- Wait for the runtime service to have a cached runtime before serializing, or
- Include a
complete: boolean field so callers know whether to retry
Context
This affects the dotli warm-start persistence feature. We save the DB to IndexedDB after initialized fires so users get fast warm starts on return visits. When the DB is incomplete (no runtime), the warm start falls back to a full cold sync - defeating the purpose.
Current workaround: retry the save after 5s if the DB is too small (<100KB).
Problem
chainHead_unstable_finalizedDatabasereturns a database without runtime code when called shortly after theinitializedevent fromchainHead_v1_follow. The sync service has reached a finalized block, but the runtime service is still downloading:codefrom a peer.The returned DB has valid
chaininfo (~43KB) but noruntimeCode,codeMerkleValue, orcodeClosestAncestorExcluding. Feeding this back asdatabaseContenton the next start is useless - smoldot ignores it and does a full warp sync + runtime download anyway.Reproduction
Observed on Paseo Asset Hub parachain cold start with smoldot
dev/pending-20260423.Expected behavior
chainHead_unstable_finalizedDatabaseshould either:complete: booleanfield so callers know whether to retryContext
This affects the dotli warm-start persistence feature. We save the DB to IndexedDB after
initializedfires so users get fast warm starts on return visits. When the DB is incomplete (no runtime), the warm start falls back to a full cold sync - defeating the purpose.Current workaround: retry the save after 5s if the DB is too small (<100KB).