smoldot 2.0.39 → 3.0.0
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.
- package/dist/cjs/internals/bytecode/wasm0.js +1 -1
- package/dist/cjs/internals/bytecode/wasm1.js +1 -1
- package/dist/cjs/internals/bytecode/wasm2.js +1 -1
- package/dist/cjs/internals/client.js +13 -1
- package/dist/cjs/internals/local-instance.d.ts +1 -1
- package/dist/cjs/internals/local-instance.js +2 -2
- package/dist/cjs/internals/remote-instance.js +3 -3
- package/dist/cjs/public-types.d.ts +8 -0
- package/dist/mjs/internals/bytecode/wasm0.js +1 -1
- package/dist/mjs/internals/bytecode/wasm1.js +1 -1
- package/dist/mjs/internals/bytecode/wasm2.js +1 -1
- package/dist/mjs/internals/client.js +13 -1
- package/dist/mjs/internals/local-instance.d.ts +1 -1
- package/dist/mjs/internals/local-instance.js +2 -2
- package/dist/mjs/internals/remote-instance.js +3 -3
- package/dist/mjs/public-types.d.ts +8 -0
- package/package.json +5 -5
|
@@ -295,11 +295,23 @@ export function start(options, wasmModule, platformBindings) {
|
|
|
295
295
|
if (jsonRpcMaxSubscriptions > 0xffffffff) {
|
|
296
296
|
jsonRpcMaxSubscriptions = 0xffffffff;
|
|
297
297
|
}
|
|
298
|
+
// Sanitize `statementStore`.
|
|
299
|
+
let statementStoreMaxSeenStatements = 0;
|
|
300
|
+
if (options.statementStore !== undefined) {
|
|
301
|
+
statementStoreMaxSeenStatements = options.statementStore.maxSeenStatements === undefined ? 65536 : options.statementStore.maxSeenStatements;
|
|
302
|
+
statementStoreMaxSeenStatements = Math.floor(statementStoreMaxSeenStatements);
|
|
303
|
+
if (statementStoreMaxSeenStatements <= 0 || isNaN(statementStoreMaxSeenStatements)) {
|
|
304
|
+
throw new AddChainError("Invalid value for `statementStore.maxSeenStatements`");
|
|
305
|
+
}
|
|
306
|
+
if (statementStoreMaxSeenStatements > 0xffffffff) {
|
|
307
|
+
statementStoreMaxSeenStatements = 0xffffffff;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
298
310
|
// Sanitize `databaseContent`.
|
|
299
311
|
if (options.databaseContent !== undefined && typeof options.databaseContent !== 'string')
|
|
300
312
|
throw new AddChainError("`databaseContent` is not a string");
|
|
301
313
|
const promise = new Promise((resolve) => state.addChainIdAllocations.push(resolve));
|
|
302
|
-
state.instance.instance.addChain(options.chainSpec, options.databaseContent || "", potentialRelayChainsIds, !!options.disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions);
|
|
314
|
+
state.instance.instance.addChain(options.chainSpec, options.databaseContent || "", potentialRelayChainsIds, !!options.disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, statementStoreMaxSeenStatements);
|
|
303
315
|
const outcome = yield promise;
|
|
304
316
|
if (!outcome.success)
|
|
305
317
|
throw new AddChainError(outcome.error);
|
|
@@ -105,7 +105,7 @@ export interface Instance {
|
|
|
105
105
|
* indicate whether the initialization was actually successful. If `success` is `false`, then
|
|
106
106
|
* the `chainId` becomes unallocated.
|
|
107
107
|
*/
|
|
108
|
-
addChain: (chainSpec: string, databaseContent: string, potentialRelayChains: number[], disableJsonRpc: boolean, jsonRpcMaxPendingRequests: number, jsonRpcMaxSubscriptions: number) => void;
|
|
108
|
+
addChain: (chainSpec: string, databaseContent: string, potentialRelayChains: number[], disableJsonRpc: boolean, jsonRpcMaxPendingRequests: number, jsonRpcMaxSubscriptions: number, statementStoreMaxSeenStatements: number) => void;
|
|
109
109
|
removeChain: (chainId: number) => void;
|
|
110
110
|
/**
|
|
111
111
|
* Notifies the background executor that it should stop. Once it has effectively stopped,
|
|
@@ -383,7 +383,7 @@ export function startLocalInstance(config, wasmModule, eventCallback) {
|
|
|
383
383
|
return null;
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
|
-
addChain: (chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions) => {
|
|
386
|
+
addChain: (chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, statementStoreMaxSeenStatements) => {
|
|
387
387
|
if (!state.instance) {
|
|
388
388
|
eventCallback({ ty: "add-chain-id-allocated", chainId: 0 });
|
|
389
389
|
eventCallback({ ty: "add-chain-result", chainId: 0, success: false, error: "Smoldot has crashed" });
|
|
@@ -403,7 +403,7 @@ export function startLocalInstance(config, wasmModule, eventCallback) {
|
|
|
403
403
|
state.bufferIndices[2] = potentialRelayChainsEncoded;
|
|
404
404
|
let chainId;
|
|
405
405
|
try {
|
|
406
|
-
chainId = state.instance.exports.add_chain(0, 1, disableJsonRpc ? 0 : jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, 2);
|
|
406
|
+
chainId = state.instance.exports.add_chain(0, 1, disableJsonRpc ? 0 : jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, 2, statementStoreMaxSeenStatements);
|
|
407
407
|
}
|
|
408
408
|
catch (_error) {
|
|
409
409
|
eventCallback({ ty: "add-chain-id-allocated", chainId: 0 });
|
|
@@ -144,9 +144,9 @@ export function connectToInstanceServer(config) {
|
|
|
144
144
|
config.eventCallback(message);
|
|
145
145
|
};
|
|
146
146
|
return {
|
|
147
|
-
addChain(chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions) {
|
|
147
|
+
addChain(chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, statementStoreMaxSeenStatements) {
|
|
148
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const msg = { ty: "add-chain", chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions };
|
|
149
|
+
const msg = { ty: "add-chain", chainSpec, databaseContent, potentialRelayChains, disableJsonRpc, jsonRpcMaxPendingRequests, jsonRpcMaxSubscriptions, statementStoreMaxSeenStatements };
|
|
150
150
|
portToServer.postMessage(msg);
|
|
151
151
|
});
|
|
152
152
|
},
|
|
@@ -283,7 +283,7 @@ export function startInstanceServer(config, initPortToClient) {
|
|
|
283
283
|
const message = messageEvent.data;
|
|
284
284
|
switch (message.ty) {
|
|
285
285
|
case "add-chain": {
|
|
286
|
-
state.instance.addChain(message.chainSpec, message.databaseContent, message.potentialRelayChains, message.disableJsonRpc, message.jsonRpcMaxPendingRequests, message.jsonRpcMaxSubscriptions);
|
|
286
|
+
state.instance.addChain(message.chainSpec, message.databaseContent, message.potentialRelayChains, message.disableJsonRpc, message.jsonRpcMaxPendingRequests, message.jsonRpcMaxSubscriptions, message.statementStoreMaxSeenStatements);
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
case "remove-chain": {
|
|
@@ -398,4 +398,12 @@ export interface AddChainOptions {
|
|
|
398
398
|
* If this value is not set, it means that there is no maximum.
|
|
399
399
|
*/
|
|
400
400
|
jsonRpcMaxSubscriptions?: number;
|
|
401
|
+
/**
|
|
402
|
+
* If set, enables the Statement Store protocol on this chain.
|
|
403
|
+
*
|
|
404
|
+
* `maxSeenStatements` is the maximum number of seen statements to cache. Defaults to 65536.
|
|
405
|
+
*/
|
|
406
|
+
statementStore?: {
|
|
407
|
+
maxSeenStatements?: number;
|
|
408
|
+
};
|
|
401
409
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smoldot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Light client that connects to Polkadot and Substrate-based blockchains",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Parity Technologies <admin@parity.io>",
|
|
7
7
|
"Pierre Krieger <pierre.krieger1708@gmail.com>"
|
|
8
8
|
],
|
|
9
9
|
"license": "GPL-3.0-or-later WITH Classpath-exception-2.0",
|
|
10
|
-
"homepage": "https://github.com/
|
|
10
|
+
"homepage": "https://github.com/paritytech/smoldot",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/
|
|
13
|
+
"url": "git+https://github.com/paritytech/smoldot.git"
|
|
14
14
|
},
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/paritytech/smoldot/issues"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"buildModules": "tsc -p tsconfig-mjs.json && tsc -p tsconfig-cjs.json && bash fix-package-type.sh",
|
|
68
|
-
"
|
|
68
|
+
"prepack": "node prepare.mjs --release && rm -rf ./dist && npm run buildModules",
|
|
69
69
|
"build": "node prepare.mjs --release && rm -rf ./dist && npm run buildModules",
|
|
70
70
|
"start": "node prepare.mjs --debug && rm -rf ./dist && npm run buildModules && node demo/demo.mjs",
|
|
71
71
|
"test": "node prepare.mjs --debug && rm -rf ./dist && npm run buildModules && deno run ./dist/mjs/index-deno.js && ava --timeout=2m --concurrency 2 --no-worker-threads",
|