Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/protocol/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ async function initDirectMode(): Promise<void> {
resolveOwner,
resolveRootManifest,
setResolverAssetHubProvider,
waitForPeopleFinalized,
} = resolve;
const { terminateSmoldot, onSmoldotFatal } = smoldotMod;

Expand Down Expand Up @@ -718,6 +719,13 @@ async function initDirectMode(): Promise<void> {
onWarmup: async () => {
getSmoldot();
await getRelayChain();
// Warm People in the background so legacy-account auth reads do not race
// a cold parachain warp sync. Not needed for resolution, so do not await.
void waitForPeopleFinalized().catch((err: unknown) => {
log.warn(
`[dot.li protocol] People chain warm failed (retried on demand): ${String(err)}`,
);
});
},
resolveDotName,
resolveOwner,
Expand Down
19 changes: 19 additions & 0 deletions apps/protocol/src/protocol-shared-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
resolveRootManifest,
setResolverAssetHubProvider,
waitForAssetHubFinalized,
waitForPeopleFinalized,
} from "@dotli/resolver/resolve";
import { onSmoldotFatal } from "@dotli/resolver/smoldot";
import { m } from "@dotli/metrics/metrics";
Expand Down Expand Up @@ -214,6 +215,24 @@ async function presync(): Promise<void> {
port.postMessage(readyMsg);
}
pendingPorts.length = 0;

// Warm the People chain in the background. Legacy-account auth reads the
// username -> account map on People, and on a cold start that read races
// the parachain warp sync (the source of the intermittent failures). Start
// syncing it now so it is ready by the time auth runs. People is not needed
// for resolution, so this must not gate the ready signal above.
swLog("Warming People chain in background...");
void waitForPeopleFinalized((msg) => {
swLog(`People warm status: ${msg}`);
})
.then(() => {
swLog("People chain warmed");
})
.catch((err: unknown) => {
swLog(
`People chain warm failed (retried on demand): ${serializeError(err)}`,
);
});
} catch (err: unknown) {
const msg = serializeError(err);
swError(`Pre-sync failed: ${msg}`);
Expand Down
36 changes: 18 additions & 18 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"@dotli/resolver": "workspace:*",
"@dotli/shared": "workspace:*",
"@noble/hashes": "^2.2.0",
"@novasamatech/host-api": "0.8.7",
"@novasamatech/host-papp": "0.8.7",
"@novasamatech/host-api": "0.8.8",
"@novasamatech/host-papp": "0.8.8",
"@novasamatech/sdk-statement": "^0.6.0",
"@novasamatech/statement-store": "0.8.7",
"@novasamatech/storage-adapter": "0.8.7",
"@novasamatech/statement-store": "0.8.8",
"@novasamatech/storage-adapter": "0.8.8",
"@scure/sr25519": "^2.2.0",
"neverthrow": "^8.2.0",
"polkadot-api": "^2.1.6",
Expand Down
9 changes: 9 additions & 0 deletions packages/auth/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ const ss58Codec = AccountId();
export const productPublicKeyToAddress = (publicKey: Uint8Array): string =>
ss58Codec.dec(publicKey);

/**
* Inverse of `productPublicKeyToAddress`: decode an SS58 address string back to
* its 32-byte public key. Used to turn a legacy account's `signer` address
* (the wire format products send) into the `AccountId` bytes host-papp's
* `signRawLegacy` expects. Throws on a malformed address.
*/
export const productAddressToPublicKey = (address: string): Uint8Array =>
ss58Codec.enc(address);

// NOTE: Uncomment when derived product accounts get their own network
// allowance (quota) on People Chain. Currently only the root session account
// has allowance, so createProof signs with the root ssSecret directly.
Expand Down
Loading
Loading