@typeberry/lib 0.11.0-6310ba4 → 0.11.0-829b7ea

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.
Files changed (48) hide show
  1. package/package.json +1 -3
  2. package/packages/jam/config-node/node-config.d.ts +1 -11
  3. package/packages/jam/config-node/node-config.d.ts.map +1 -1
  4. package/packages/jam/config-node/node-config.js +3 -25
  5. package/packages/jam/config-node/node-config.test.js +3 -7
  6. package/packages/jam/database/states.d.ts +1 -8
  7. package/packages/jam/database/states.d.ts.map +1 -1
  8. package/packages/jam/database/value-refs.d.ts +4 -5
  9. package/packages/jam/database/value-refs.d.ts.map +1 -1
  10. package/packages/jam/node/export.d.ts.map +1 -1
  11. package/packages/jam/node/export.js +8 -17
  12. package/packages/jam/node/main-fuzz.d.ts.map +1 -1
  13. package/packages/jam/node/main-fuzz.js +3 -5
  14. package/packages/jam/node/main-importer.d.ts +2 -6
  15. package/packages/jam/node/main-importer.d.ts.map +1 -1
  16. package/packages/jam/node/main-importer.js +12 -27
  17. package/packages/jam/node/main.d.ts.map +1 -1
  18. package/packages/jam/node/main.js +6 -16
  19. package/packages/jam/rpc/test/e2e-server.d.ts.map +1 -1
  20. package/packages/jam/rpc/test/e2e-server.js +3 -5
  21. package/packages/jam/rpc/test/e2e.js +1 -1
  22. package/packages/jam/state-merkleization/index.d.ts +1 -1
  23. package/packages/jam/state-merkleization/index.js +1 -1
  24. package/packages/workers/api-node/config.d.ts +6 -40
  25. package/packages/workers/api-node/config.d.ts.map +1 -1
  26. package/packages/workers/api-node/config.js +6 -82
  27. package/packages/workers/api-node/config.test.js +26 -63
  28. package/packages/jam/database-lmdb/blocks.d.ts +0 -24
  29. package/packages/jam/database-lmdb/blocks.d.ts.map +0 -1
  30. package/packages/jam/database-lmdb/blocks.js +0 -82
  31. package/packages/jam/database-lmdb/hybrid-states.d.ts +0 -56
  32. package/packages/jam/database-lmdb/hybrid-states.d.ts.map +0 -1
  33. package/packages/jam/database-lmdb/hybrid-states.js +0 -149
  34. package/packages/jam/database-lmdb/hybrid-states.test.d.ts +0 -2
  35. package/packages/jam/database-lmdb/hybrid-states.test.d.ts.map +0 -1
  36. package/packages/jam/database-lmdb/hybrid-states.test.js +0 -180
  37. package/packages/jam/database-lmdb/index.d.ts +0 -5
  38. package/packages/jam/database-lmdb/index.d.ts.map +0 -1
  39. package/packages/jam/database-lmdb/index.js +0 -4
  40. package/packages/jam/database-lmdb/root.d.ts +0 -26
  41. package/packages/jam/database-lmdb/root.d.ts.map +0 -1
  42. package/packages/jam/database-lmdb/root.js +0 -53
  43. package/packages/jam/database-lmdb/states.d.ts +0 -76
  44. package/packages/jam/database-lmdb/states.d.ts.map +0 -1
  45. package/packages/jam/database-lmdb/states.js +0 -145
  46. package/packages/jam/database-lmdb/states.test.d.ts +0 -2
  47. package/packages/jam/database-lmdb/states.test.d.ts.map +0 -1
  48. package/packages/jam/database-lmdb/states.test.js +0 -202
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/lib",
3
- "version": "0.11.0-6310ba4",
3
+ "version": "0.11.0-829b7ea",
4
4
  "description": "Typeberry Library",
5
5
  "main": "./bin/lib/index.js",
6
6
  "types": "./bin/lib/index.d.ts",
@@ -214,8 +214,6 @@
214
214
  "#@typeberry/database/*": "./packages/jam/database/*",
215
215
  "#@typeberry/database-fjall": "./packages/jam/database-fjall/index.js",
216
216
  "#@typeberry/database-fjall/*": "./packages/jam/database-fjall/*",
217
- "#@typeberry/database-lmdb": "./packages/jam/database-lmdb/index.js",
218
- "#@typeberry/database-lmdb/*": "./packages/jam/database-lmdb/*",
219
217
  "#@typeberry/executor": "./packages/jam/executor/index.js",
220
218
  "#@typeberry/executor/*": "./packages/jam/executor/*",
221
219
  "#@typeberry/fuzz-proto": "./packages/jam/fuzz-proto/index.js",
@@ -20,21 +20,13 @@ export declare enum KnownChainSpec {
20
20
  /** Full chain spec. */
21
21
  Full = "full"
22
22
  }
23
- /** Persistent regular-node database backend. */
24
- export declare enum RegularStateBackend {
25
- /** @deprecated lmdb remains available as an explicit fallback, but fjall is the default backend. */
26
- Lmdb = "lmdb",
27
- Fjall = "fjall"
28
- }
29
23
  export declare const knownChainSpecFromJson: FromJson<KnownChainSpec>;
30
- export declare const regularStateBackendFromJson: FromJson<RegularStateBackend>;
31
24
  type NodeConfigurationJson = {
32
25
  $schema: string;
33
26
  version: number;
34
27
  flavor: KnownChainSpec;
35
28
  chain_spec: JipChainSpec;
36
29
  database_base_path?: string;
37
- state_backend?: RegularStateBackend;
38
30
  authorship: AuthorshipOptions;
39
31
  rpc?: RpcOptions;
40
32
  };
@@ -45,13 +37,11 @@ export declare class NodeConfiguration {
45
37
  readonly chainSpec: JipChainSpec;
46
38
  /** If database path is not provided, we load an in-memory db. */
47
39
  readonly databaseBasePath: string | undefined;
48
- /** Persistent database backend used when `databaseBasePath` is set. */
49
- readonly stateBackend: RegularStateBackend;
50
40
  readonly authorship: AuthorshipOptions;
51
41
  /** Optional RPC server configuration. When present, an in-process RPC server is started. */
52
42
  readonly rpc: RpcOptions | undefined;
53
43
  static fromJson: import("@typeberry/json-parser").FromJsonWithParser<unknown, NodeConfiguration>;
54
- static new({ $schema, version, flavor, chain_spec, database_base_path, state_backend, authorship, rpc, }: NodeConfigurationJson): NodeConfiguration;
44
+ static new({ $schema, version, flavor, chain_spec, database_base_path, authorship, rpc }: NodeConfigurationJson): NodeConfiguration;
55
45
  private constructor();
56
46
  }
57
47
  export declare function loadConfig(config: string[], withRelPath: (p: string) => string): NodeConfiguration;
@@ -1 +1 @@
1
- {"version":3,"file":"node-config.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/config-node/node-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CA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AG,CAAC,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,qBAAa,iBAAiB;aA8BV,OAAO,EAAE,MAAM;aACf,OAAO,EAAE,MAAM;aACf,MAAM,EAAE,cAAc;aACtB,SAAS,EAAE,YAAY;IACvC,iEAAiE;aACjD,gBAAgB,EAAE,MAAM,GAAG,SAAS;aACpC,UAAU,EAAE,iBAAiB;IAC7C,4FAA4F;aAC5E,GAAG,EAAE,UAAU,GAAG,SAAS;IArC7C,MAAM,CAAC,QAAQ,kFAWb;IAEF,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,qBAAqB;IAe/G,OAAO;CAWR;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,iBAAiB,CAuDlG"}
@@ -27,13 +27,6 @@ export var KnownChainSpec;
27
27
  /** Full chain spec. */
28
28
  KnownChainSpec["Full"] = "full";
29
29
  })(KnownChainSpec || (KnownChainSpec = {}));
30
- /** Persistent regular-node database backend. */
31
- export var RegularStateBackend;
32
- (function (RegularStateBackend) {
33
- /** @deprecated lmdb remains available as an explicit fallback, but fjall is the default backend. */
34
- RegularStateBackend["Lmdb"] = "lmdb";
35
- RegularStateBackend["Fjall"] = "fjall";
36
- })(RegularStateBackend || (RegularStateBackend = {}));
37
30
  export const knownChainSpecFromJson = json.fromString((input, ctx) => {
38
31
  switch (input) {
39
32
  case KnownChainSpec.Tiny:
@@ -44,23 +37,12 @@ export const knownChainSpecFromJson = json.fromString((input, ctx) => {
44
37
  throw Error(`unknown network flavor: ${input} at ${ctx}`);
45
38
  }
46
39
  });
47
- export const regularStateBackendFromJson = json.fromString((input, ctx) => {
48
- switch (input) {
49
- case RegularStateBackend.Lmdb:
50
- return RegularStateBackend.Lmdb;
51
- case RegularStateBackend.Fjall:
52
- return RegularStateBackend.Fjall;
53
- default:
54
- throw Error(`unknown state backend: ${input} at ${ctx}`);
55
- }
56
- });
57
40
  export class NodeConfiguration {
58
41
  $schema;
59
42
  version;
60
43
  flavor;
61
44
  chainSpec;
62
45
  databaseBasePath;
63
- stateBackend;
64
46
  authorship;
65
47
  rpc;
66
48
  static fromJson = json.object({
@@ -69,21 +51,18 @@ export class NodeConfiguration {
69
51
  flavor: knownChainSpecFromJson,
70
52
  chain_spec: JipChainSpec.fromJson,
71
53
  database_base_path: json.optional("string"),
72
- state_backend: json.optional(regularStateBackendFromJson),
73
54
  authorship: AuthorshipOptions.fromJson,
74
55
  rpc: json.optional(RpcOptions.fromJson),
75
56
  }, NodeConfiguration.new);
76
- static new({ $schema, version, flavor, chain_spec, database_base_path, state_backend, authorship, rpc, }) {
57
+ static new({ $schema, version, flavor, chain_spec, database_base_path, authorship, rpc }) {
77
58
  if (version !== 1) {
78
59
  throw new Error("Only version=1 config is supported.");
79
60
  }
80
- return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, state_backend ?? RegularStateBackend.Fjall, authorship, rpc ?? undefined);
61
+ return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, authorship, rpc ?? undefined);
81
62
  }
82
63
  constructor($schema, version, flavor, chainSpec,
83
64
  /** If database path is not provided, we load an in-memory db. */
84
- databaseBasePath,
85
- /** Persistent database backend used when `databaseBasePath` is set. */
86
- stateBackend, authorship,
65
+ databaseBasePath, authorship,
87
66
  /** Optional RPC server configuration. When present, an in-process RPC server is started. */
88
67
  rpc) {
89
68
  this.$schema = $schema;
@@ -91,7 +70,6 @@ export class NodeConfiguration {
91
70
  this.flavor = flavor;
92
71
  this.chainSpec = chainSpec;
93
72
  this.databaseBasePath = databaseBasePath;
94
- this.stateBackend = stateBackend;
95
73
  this.authorship = authorship;
96
74
  this.rpc = rpc;
97
75
  }
@@ -5,7 +5,7 @@ import { configs } from "#@typeberry/configs";
5
5
  import polkajamConfig from "#@typeberry/configs/typeberry-polkajam-dev.json" with { type: "json" };
6
6
  import { parseFromJson } from "#@typeberry/json-parser";
7
7
  import { workspacePathFix } from "#@typeberry/utils";
8
- import { KnownChainSpec, loadConfig, NodeConfiguration, RegularStateBackend } from "./node-config.js";
8
+ import { KnownChainSpec, loadConfig, NodeConfiguration } from "./node-config.js";
9
9
  import { RpcOptions } from "./rpc.js";
10
10
  const withRelPath = workspacePathFix(`${import.meta.dirname}/../..`);
11
11
  const NODE_CONFIG_TEST = {
@@ -41,9 +41,6 @@ describe("Importing Node Configuration", () => {
41
41
  it("should read the database base path", () => {
42
42
  assert.deepStrictEqual(config.databaseBasePath, "/tmp/jam-node-db");
43
43
  });
44
- it("defaults to the fjall state backend", () => {
45
- assert.deepStrictEqual(config.stateBackend, RegularStateBackend.Fjall);
46
- });
47
44
  it("defaults to no rpc config", () => {
48
45
  assert.deepStrictEqual(config.rpc, undefined);
49
46
  });
@@ -51,9 +48,8 @@ describe("Importing Node Configuration", () => {
51
48
  const withRpc = parseFromJson({ ...NODE_CONFIG_TEST, rpc: { port: 9999 } }, NodeConfiguration.fromJson);
52
49
  assert.deepStrictEqual(withRpc.rpc, RpcOptions.new({ port: 9999 }));
53
50
  });
54
- it("should read the state backend", () => {
55
- const lmdbConfig = parseFromJson({ ...NODE_CONFIG_TEST, state_backend: "lmdb" }, NodeConfiguration.fromJson);
56
- assert.deepStrictEqual(lmdbConfig.stateBackend, RegularStateBackend.Lmdb);
51
+ it("should reject unknown config keys", () => {
52
+ assert.throws(() => parseFromJson({ ...NODE_CONFIG_TEST, state_backend: "fjall" }, NodeConfiguration.fromJson));
57
53
  });
58
54
  it("should read the chain spec", () => {
59
55
  assert.deepStrictEqual(config.chainSpec.id, "testnet");
@@ -14,14 +14,7 @@ export interface InitStatesDb<T = State> {
14
14
  /** Insert a pre-defined initial state directly into the database. */
15
15
  insertInitialState(headerHash: HeaderHash, initialState: T): Promise<Result<OK, StateUpdateError>>;
16
16
  }
17
- /**
18
- * Interface for accessing states stored in the database.
19
- *
20
- * NOTE that the design of this interface is heavily influenced
21
- * by the LMDB implementation, so that we can implement it efficiently.
22
- *
23
- * See the documentation there for more detailed reasoning.
24
- */
17
+ /** Interface for accessing states stored in the database. */
25
18
  export interface StatesDb<T extends State = State> {
26
19
  /** Compute a state root for given state. */
27
20
  getStateRoot(state: T): Promise<StateRootHash>;
@@ -1 +1 @@
1
- {"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/database/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAE/F,OAAO,EAAe,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE3D,0DAA0D;AAC1D,oBAAY,gBAAgB;IAC1B,oDAAoD;IACpD,QAAQ,IAAI;IACZ,iDAAiD;IACjD,MAAM,IAAI;CACX;AAED,wFAAwF;AACxF,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,KAAK;IACrC,qEAAqE;IACrE,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;CACpG;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK;IAC/C,4CAA4C;IAC5C,YAAY,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAE/C;;;;OAIG;IACH,iBAAiB,CACf,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,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,4EAA4E;IAC5E,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAErC;;;;;OAKG;IACH,eAAe,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC;IAElC,6CAA6C;IAC7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,qBAAa,cAAe,YAAW,QAAQ,CAAC,aAAa,CAAC;IAQxC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPzC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmE;IACtF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAE3C,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS;IAI1B,OAAO;IAID,iBAAiB,CACrB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;IAgBlC,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAKhE,6CAA6C;IACvC,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;IAM7G,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,GAAG,IAAI;IAStD,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI;IAI7C,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAI9B,KAAK;CACZ"}
@@ -10,10 +10,9 @@ export interface ValueDelta {
10
10
  /**
11
11
  * Synchronous, read-only view of the persisted refcounting state.
12
12
  *
13
- * Both LMDB and fjall offer synchronous reads, so reads can go straight
14
- * to the backing store. All writes go through `ValueRefsUpdate` batches
15
- * instead, since persistent backends can only write asynchronously
16
- * (LMDB transactions, fjall inserts + persist).
13
+ * fjall offers synchronous reads, so reads can go straight to the backing
14
+ * store. All writes go through `ValueRefsUpdate` batches instead, since
15
+ * persistent backends can only write asynchronously (fjall inserts + persist).
17
16
  */
18
17
  export interface ValueRefsReader {
19
18
  /** How many leaves of the finalized-tip state reference the value. Missing keys read as `0`. */
@@ -28,7 +27,7 @@ export interface ValueRefsReader {
28
27
  *
29
28
  * The backend is responsible for applying the batch using its own write
30
29
  * primitive - ideally atomically with the state write that triggered it
31
- * (one LMDB transaction, one fjall persist).
30
+ * (one fjall persist).
32
31
  *
33
32
  * Counts are absolute values rather than increments, so applying the same
34
33
  * update more than once (e.g. on crash-replay) is harmless.
@@ -1 +1 @@
1
- {"version":3,"file":"value-refs.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/database/value-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,sEAAsE;IACtE,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,gGAAgG;IAChG,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3C,iGAAiG;IACjG,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzC,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;CACtD;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;IACvC,gFAAgF;IAChF,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAA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;IACH,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,eAAe;IAoBvD;;;;;;;OAOG;IACH,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe;CAYxD;AA0ED;;;;;;GAMG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2D;IACrF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2D;IACnF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgE;IAEvF,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAI1C,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIxC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS;IAIpD,KAAK,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;CAUrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/export.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,YAAY,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,iBAoG9G"}
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/export.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAsB,YAAY,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,iBA2F9G"}
@@ -3,10 +3,9 @@ import path from "node:path";
3
3
  import { Block as BlockCodec } from "#@typeberry/block";
4
4
  import { Bytes } from "#@typeberry/bytes";
5
5
  import { Encoder } from "#@typeberry/codec";
6
- import { RegularStateBackend } from "#@typeberry/config-node";
7
6
  import { Blake2b, HASH_SIZE } from "#@typeberry/hash";
8
7
  import { Logger } from "#@typeberry/logger";
9
- import { FjallWorkerConfig, LmdbWorkerConfig } from "#@typeberry/workers-api-node";
8
+ import { FjallWorkerConfig } from "#@typeberry/workers-api-node";
10
9
  import { getChainSpec, getDatabasePath } from "./common.js";
11
10
  export async function exportBlocks(jamNodeConfig, output, withRelPath) {
12
11
  const logger = Logger.new(import.meta.filename, "export");
@@ -30,21 +29,13 @@ export async function exportBlocks(jamNodeConfig, output, withRelPath) {
30
29
  const blake2b = await Blake2b.createHasher();
31
30
  const chainSpec = getChainSpec(jamNodeConfig.node.flavor);
32
31
  const { dbPath } = getDatabasePath(blake2b, jamNodeConfig.nodeName, jamNodeConfig.node.chainSpec.genesisHeader, withRelPath(jamNodeConfig.node.databaseBasePath));
33
- const config = jamNodeConfig.node.stateBackend === RegularStateBackend.Fjall
34
- ? FjallWorkerConfig.new({
35
- nodeName: jamNodeConfig.nodeName,
36
- chainSpec,
37
- blake2b,
38
- dbPath,
39
- workerParams: undefined,
40
- })
41
- : LmdbWorkerConfig.new({
42
- nodeName: jamNodeConfig.nodeName,
43
- chainSpec,
44
- blake2b,
45
- dbPath,
46
- workerParams: undefined,
47
- });
32
+ const config = FjallWorkerConfig.new({
33
+ nodeName: jamNodeConfig.nodeName,
34
+ chainSpec,
35
+ blake2b,
36
+ dbPath,
37
+ workerParams: undefined,
38
+ });
48
39
  const rootDb = await config.openDatabase();
49
40
  const blocks = rootDb.getBlocksDb();
50
41
  logger.info `📖 Gathering blocks...`;
@@ -1 +1 @@
1
- {"version":3,"file":"main-fuzz.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/main-fuzz.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIrD,OAAO,EAAE,KAAK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U,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASpF;AAED,iFAAiF;AACjF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5D;AAED,wBAAgB,cAAc;;;;EAM7B;AAED,wBAAsB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA6LrH"}
@@ -15,8 +15,7 @@ const logger = Logger.new(import.meta.filename, "fuzztarget");
15
15
  /** Dedicated subdirectory under the configured base path that the fuzzer owns and wipes. */
16
16
  const FUZZ_DB_SUBDIR = "typeberry-fuzz-db";
17
17
  const FUZZ_DB_FJALL = "fjall-hybrid";
18
- const FUZZ_DB_LMDB = "lmdb-hybrid";
19
- const FUZZ_DB_OPTIONS = [FUZZ_DB_FJALL, FUZZ_DB_LMDB, "fjall", "lmdb"];
18
+ const FUZZ_DB_OPTIONS = [FUZZ_DB_FJALL, "fjall"];
20
19
  /** Subdirectory (under the fuzzer's db dir) holding the reused fjall values keyspace. */
21
20
  const FUZZ_FJALL_VALUES_SUBDIR = "values-session";
22
21
  /**
@@ -64,7 +63,6 @@ export async function mainFuzz(fuzzConfig, withRelPath) {
64
63
  const { jamNodeConfig: config } = fuzzConfig;
65
64
  const fuzzDbBase = resolveFuzzDbBase(config.node.databaseBasePath);
66
65
  const rawFuzzDb = process.env.JAM_FUZZ_DB?.trim() ?? "";
67
- // Using experimental fjall-hybrid by default, with an option to test lmdb as well.
68
66
  const hybridStateBackend = rawFuzzDb === "" ? FUZZ_DB_FJALL : rawFuzzDb;
69
67
  if (!isValidStateBackend(hybridStateBackend)) {
70
68
  throw new Error(`JAM_FUZZ_DB must be one of: ${FUZZ_DB_OPTIONS} (got: "${rawFuzzDb}").`);
@@ -144,7 +142,7 @@ export async function mainFuzz(fuzzConfig, withRelPath) {
144
142
  // also turns on compression further down, so the big values do not grow the
145
143
  // db too much. Tiny stays uncompressed, its db is small and speed matters more.
146
144
  ephemeral: isPersistent,
147
- stateBackend: isPersistent ? hybridStateBackend : "lmdb",
145
+ stateBackend: isPersistent ? hybridStateBackend : "fjall",
148
146
  // Reuse the session keyspace (fjall-hybrid only, other backends
149
147
  // ignore it). Nothing to pass for the in-memory fallback.
150
148
  sharedFjallSession: hybridStateBackend === "fjall-hybrid" ? (fjallSession ?? undefined) : undefined,
@@ -182,7 +180,7 @@ export async function mainFuzz(fuzzConfig, withRelPath) {
182
180
  }
183
181
  }
184
182
  else {
185
- // All other backends ("fjall", "lmdb", "lmdb-hybrid"): wipe and reopen on every reset.
183
+ // Other backends ("fjall"): wipe and reopen on every reset.
186
184
  await wipeFuzzDb(fuzzDbBase);
187
185
  }
188
186
  runningNode = await buildNode(fuzzDbBase);
@@ -1,18 +1,14 @@
1
1
  import { type FjallValuesSession } from "#@typeberry/workers-api-node";
2
2
  import type { JamConfig } from "./jam-config.js";
3
3
  import type { NodeApi } from "./main.js";
4
- export type StateBackend = "lmdb" | "fjall" | "lmdb-hybrid" | "fjall-hybrid";
4
+ export type StateBackend = "fjall" | "fjall-hybrid";
5
5
  export type ImporterOptions = {
6
6
  initGenesisFromAncestry?: boolean;
7
7
  dummyFinalityDepth?: number;
8
8
  pruneBlocks?: boolean;
9
9
  /** Open the database without fsync/compression. Only safe for throwaway dbs (e.g. fuzzing). */
10
10
  ephemeral?: boolean;
11
- /**
12
- * Persistent backend used when `databaseBasePath` is set. Defaults to config's backend (fjall unless overridden).
13
- *
14
- * lmdb and lmdb-hybrid are deprecated and retained as explicit fallbacks.
15
- */
11
+ /** Persistent backend used when `databaseBasePath` is set. Defaults to fjall. */
16
12
  stateBackend?: StateBackend;
17
13
  /**
18
14
  * Reuse an already-open fjall values session instead of opening a fresh
@@ -1 +1 @@
1
- {"version":3,"file":"main-importer.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/main-importer.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,cAAc,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+FAA+F;IAC/F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAoHlB"}
1
+ {"version":3,"file":"main-importer.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/main-importer.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,cAAc,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+FAA+F;IAC/F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAoGlB"}
@@ -1,12 +1,12 @@
1
1
  import { Bytes } from "#@typeberry/bytes";
2
2
  import { PvmBackend } from "#@typeberry/config";
3
- import { KnownChainSpec, RegularStateBackend } from "#@typeberry/config-node";
3
+ import { KnownChainSpec } from "#@typeberry/config-node";
4
4
  import { bandersnatch, initWasm } from "#@typeberry/crypto";
5
5
  import { Blake2b, HASH_SIZE } from "#@typeberry/hash";
6
6
  import { createImporter, ImporterConfig } from "#@typeberry/importer";
7
7
  import { tryAsU16 } from "#@typeberry/numbers";
8
8
  import { CURRENT_SUITE, CURRENT_VERSION, Result, resultToString, version } from "#@typeberry/utils";
9
- import { FjallWorkerConfig, HybridWorkerConfig, InMemWorkerConfig, LmdbWorkerConfig, } from "#@typeberry/workers-api-node";
9
+ import { FjallWorkerConfig, HybridWorkerConfig, InMemWorkerConfig, } from "#@typeberry/workers-api-node";
10
10
  import { getChainSpec, getDatabasePath, initializeDatabase, logger } from "./common.js";
11
11
  const zeroHash = Bytes.zero(HASH_SIZE).asOpaque();
12
12
  export async function mainImporter(config, withRelPath, options = {}) {
@@ -18,13 +18,8 @@ export async function mainImporter(config, withRelPath, options = {}) {
18
18
  logger.info `🐇 Bandersnatch ${bandesnatchNative.isOk ? "native 🚀" : `using wasm: ${bandesnatchNative.error}`}`;
19
19
  // Single source of truth for the states db backend: drives both the log line
20
20
  // below and the worker config picked further down.
21
- const dbBackend = config.node.databaseBasePath === undefined
22
- ? "in-memory"
23
- : (options.stateBackend ?? config.node.stateBackend ?? RegularStateBackend.Fjall);
21
+ const dbBackend = config.node.databaseBasePath === undefined ? "in-memory" : (options.stateBackend ?? "fjall");
24
22
  logger.info `🗄️ States DB: ${dbBackend}.`;
25
- if (dbBackend === "lmdb" || dbBackend === "lmdb-hybrid") {
26
- logger.warn `🗄️ The ${dbBackend} state backend is deprecated. Use fjall unless you need a temporary fallback.`;
27
- }
28
23
  const chainSpec = getChainSpec(config.node.flavor);
29
24
  const blake2b = await Blake2b.createHasher();
30
25
  const nodeName = config.nodeName;
@@ -44,7 +39,7 @@ export async function mainImporter(config, withRelPath, options = {}) {
44
39
  blake2b,
45
40
  workerParams,
46
41
  })
47
- : dbBackend === "lmdb-hybrid" || dbBackend === "fjall-hybrid"
42
+ : dbBackend === "fjall-hybrid"
48
43
  ? await HybridWorkerConfig.new({
49
44
  nodeName,
50
45
  chainSpec,
@@ -53,26 +48,16 @@ export async function mainImporter(config, withRelPath, options = {}) {
53
48
  workerParams,
54
49
  ephemeral,
55
50
  compression,
56
- backend: dbBackend === "lmdb-hybrid" ? "lmdb" : "fjall",
57
51
  sharedFjallSession: options.sharedFjallSession,
58
52
  })
59
- : dbBackend === "fjall"
60
- ? FjallWorkerConfig.new({
61
- nodeName,
62
- chainSpec,
63
- blake2b,
64
- dbPath,
65
- workerParams,
66
- ephemeral,
67
- })
68
- : LmdbWorkerConfig.new({
69
- nodeName,
70
- chainSpec,
71
- blake2b,
72
- dbPath,
73
- workerParams,
74
- ephemeral,
75
- });
53
+ : FjallWorkerConfig.new({
54
+ nodeName,
55
+ chainSpec,
56
+ blake2b,
57
+ dbPath,
58
+ workerParams,
59
+ ephemeral,
60
+ });
76
61
  // Initialize the database with genesis state and block if there isn't one.
77
62
  logger.info `🛢️ Opening database at ${dbPath}`;
78
63
  const rootDb = await workerConfig.openDatabase({ readonly: false });
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/node/main.ts"],"names":[],"mappings":"AACA,OAAO,KA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C,MAAM,EAAW,MAAM,kBAAkB,CAAC;AAWnF,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAWhE,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAChE,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC;AAEF,wBAAsB,IAAI,CACxB,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,SAAS,EAAE,SAAS,GAAG,IAAI,GAC1B,OAAO,CAAC,OAAO,CAAC,CAuLlB"}
@@ -1,7 +1,6 @@
1
1
  import { isMainThread } from "node:worker_threads";
2
2
  import { AUTHORSHIP_NETWORK_PORT } from "#@typeberry/comms-authorship-network";
3
3
  import { PvmBackend } from "#@typeberry/config";
4
- import { RegularStateBackend } from "#@typeberry/config-node";
5
4
  import { initWasm } from "#@typeberry/crypto";
6
5
  import { deriveBandersnatchSecretKey, deriveEd25519SecretKey, trivialSeed, } from "#@typeberry/crypto/key-derivation.js";
7
6
  import { Blake2b } from "#@typeberry/hash";
@@ -11,7 +10,7 @@ import { Listener } from "#@typeberry/listener";
11
10
  import { tryAsU16, tryAsU32 } from "#@typeberry/numbers";
12
11
  import { CURRENT_SUITE, CURRENT_VERSION, Result, version } from "#@typeberry/utils";
13
12
  import { DirectPort, DirectWorkerConfig } from "#@typeberry/workers-api";
14
- import { FjallWorkerConfig, InMemWorkerConfig, LmdbWorkerConfig, logHostEnvironment, ThreadPort, } from "#@typeberry/workers-api-node";
13
+ import { FjallWorkerConfig, InMemWorkerConfig, logHostEnvironment, ThreadPort, } from "#@typeberry/workers-api-node";
15
14
  import { getChainSpec, getDatabasePath, initializeDatabase, logger } from "./common.js";
16
15
  import { initializeExtensions } from "./extensions.js";
17
16
  import * as metrics from "./metrics.js";
@@ -30,12 +29,9 @@ export async function main(config, withRelPath, telemetry) {
30
29
  const blake2b = await Blake2b.createHasher();
31
30
  const nodeName = config.nodeName;
32
31
  const isInMemory = config.node.databaseBasePath === undefined;
33
- logger.info `🗄️ States DB: ${isInMemory ? "in-memory" : config.node.stateBackend}.`;
34
- if (!isInMemory && config.node.stateBackend === RegularStateBackend.Lmdb) {
35
- logger.warn `🗄️ The lmdb state backend is deprecated. Use state_backend="fjall" unless you need a temporary fallback.`;
36
- }
32
+ logger.info `🗄️ States DB: ${isInMemory ? "in-memory" : "fjall"}.`;
37
33
  const { dbPath, genesisHeaderHash } = getDatabasePath(blake2b, nodeName, config.node.chainSpec.genesisHeader, withRelPath(config.node.databaseBasePath ?? "<in-memory>"));
38
- const baseConfig = { nodeName, chainSpec, blake2b, dbPath, stateBackend: config.node.stateBackend };
34
+ const baseConfig = { nodeName, chainSpec, blake2b, dbPath };
39
35
  const importerParams = {
40
36
  ...baseConfig,
41
37
  workerParams: ImporterConfig.create({
@@ -63,9 +59,8 @@ export async function main(config, withRelPath, telemetry) {
63
59
  throw e;
64
60
  }
65
61
  // fjall-js shares the engine explicitly and requires every handle to close.
66
- // Keep lmdb's historical main-thread handle open until shutdown.
67
62
  let mainRootDb = rootDb;
68
- if (!importerConfig.isInMemory && config.node.stateBackend === RegularStateBackend.Fjall) {
63
+ if (!importerConfig.isInMemory) {
69
64
  await rootDb.close();
70
65
  mainRootDb = null;
71
66
  }
@@ -241,11 +236,6 @@ const initNetwork = async (importer, params, baseConfig, genesisHeaderHash, netw
241
236
  });
242
237
  return { closeNetwork: finish, networkApi: network, networkWorker: worker };
243
238
  };
244
- function createPersistentWorkerConfig({ stateBackend, ...params }) {
245
- switch (stateBackend) {
246
- case RegularStateBackend.Fjall:
247
- return FjallWorkerConfig.new(params);
248
- case RegularStateBackend.Lmdb:
249
- return LmdbWorkerConfig.new(params);
250
- }
239
+ function createPersistentWorkerConfig(params) {
240
+ return FjallWorkerConfig.new(params);
251
241
  }
@@ -1 +1 @@
1
- {"version":3,"file":"e2e-server.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/rpc/test/e2e-server.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,SAAe,sBA6B/E"}
1
+ {"version":3,"file":"e2e-server.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/rpc/test/e2e-server.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,SAAe,sBA0B/E"}
@@ -1,10 +1,10 @@
1
1
  import { PvmBackend } from "#@typeberry/config";
2
- import { loadConfig, NODE_DEFAULTS, RegularStateBackend } from "#@typeberry/config-node";
2
+ import { loadConfig, NODE_DEFAULTS } from "#@typeberry/config-node";
3
3
  import { Blake2b } from "#@typeberry/hash";
4
4
  import { getChainSpec, getDatabasePath } from "#@typeberry/node";
5
5
  import { validation } from "#@typeberry/rpc-validation";
6
6
  import { workspacePathFix } from "#@typeberry/utils";
7
- import { FjallWorkerConfig, LmdbWorkerConfig } from "#@typeberry/workers-api-node";
7
+ import { FjallWorkerConfig } from "#@typeberry/workers-api-node";
8
8
  import { handlers } from "../src/handlers.js";
9
9
  import { RpcServer } from "../src/server.js";
10
10
  const DEFAULT_PORT = 19800;
@@ -25,8 +25,6 @@ export async function startTestRpcServer(configPath, port = DEFAULT_PORT) {
25
25
  dbPath,
26
26
  blake2b,
27
27
  };
28
- const rootDb = nodeConfig.stateBackend === RegularStateBackend.Fjall
29
- ? await FjallWorkerConfig.new(dbConfigParams).openDatabase({ readonly: true })
30
- : await LmdbWorkerConfig.new(dbConfigParams).openDatabase({ readonly: true });
28
+ const rootDb = await FjallWorkerConfig.new(dbConfigParams).openDatabase({ readonly: true });
31
29
  return RpcServer.new(port, rootDb, spec, blake2b, PvmBackend.Ananas, handlers, validation.schemas);
32
30
  }
@@ -94,7 +94,7 @@ describe("JSON RPC Client-Server E2E", { concurrency: false }, () => {
94
94
  // TODO [ToDr] We should probably do a little bit better in terms of
95
95
  // tracking recently active services. Some options for the future:
96
96
  // 1. Use InMemoryDb for RPC E2E tests.
97
- // 2. Store additional service metadata in LMDB
97
+ // 2. Store additional service metadata in the database.
98
98
  // 3. Cache the state object, so that accessed services would be returned here.
99
99
  assert.deepStrictEqual(result, []);
100
100
  });
@@ -19,7 +19,7 @@
19
19
  * (incomplete in-memory view).
20
20
  * - `SerializedState<LeafDb>`: Disk-backed trie storage-leaf nodes live on
21
21
  * disk and load on demand; cheap to update (no data duplication) and re-compute
22
- * the `stateRoot`. Used in LMDB.
22
+ * the `stateRoot`.
23
23
  * - `SerializedState<StateEntries>`: serialized state represented as a simple in-memory
24
24
  * hashmap of `key -> value` entries.
25
25
  */
@@ -19,7 +19,7 @@
19
19
  * (incomplete in-memory view).
20
20
  * - `SerializedState<LeafDb>`: Disk-backed trie storage-leaf nodes live on
21
21
  * disk and load on demand; cheap to update (no data duplication) and re-compute
22
- * the `stateRoot`. Used in LMDB.
22
+ * the `stateRoot`.
23
23
  * - `SerializedState<StateEntries>`: serialized state represented as a simple in-memory
24
24
  * hashmap of `key -> value` entries.
25
25
  */
@@ -8,40 +8,9 @@ import type { WorkerConfig } from "#@typeberry/workers-api";
8
8
  import { ThreadPort, type TransferablePort } from "./port.js";
9
9
  export { FjallValuesSession };
10
10
  /** Persistent regular-node backend. */
11
- export type PersistentBackend = "lmdb" | "fjall";
11
+ export type PersistentBackend = "fjall";
12
12
  /** Transferable worker config for persistent regular-node workers. */
13
- export type PersistentWorkerConfig<T> = LmdbWorkerConfig<T> | FjallWorkerConfig<T>;
14
- /**
15
- * Worker config for node.js, backed by the LMDB database.
16
- *
17
- * @deprecated lmdb is retained as an explicit fallback. Use `FjallWorkerConfig` for regular nodes.
18
- */
19
- export declare class LmdbWorkerConfig<T = void> implements WorkerConfig<T, BlocksDb, SerializedStatesDb> {
20
- readonly nodeName: string;
21
- readonly chainSpec: ChainSpec;
22
- readonly workerParams: T;
23
- readonly dbPath: string;
24
- readonly blake2b: Blake2b;
25
- readonly ports: Map<string, ThreadPort>;
26
- readonly ephemeral: boolean;
27
- static new<T>({ nodeName, chainSpec, workerParams, dbPath, blake2b, ports, ephemeral, }: {
28
- nodeName: string;
29
- chainSpec: ChainSpec;
30
- workerParams: T;
31
- dbPath: string;
32
- blake2b: Blake2b;
33
- ports?: Map<string, ThreadPort>;
34
- ephemeral?: boolean;
35
- }): LmdbWorkerConfig<T>;
36
- /** Restore node config from a transferable config object. */
37
- static fromTransferable<T>(decodeParams: Decode<T>, config: TransferableConfig): Promise<LmdbWorkerConfig<T>>;
38
- private constructor();
39
- openDatabase(options?: {
40
- readonly: boolean;
41
- }): Promise<RootDb<BlocksDb, SerializedStatesDb>>;
42
- /** Convert this config into a thread-transferable object. */
43
- intoTransferable(paramsCodec: Encode<T>): TransferableConfig;
44
- }
13
+ export type PersistentWorkerConfig<T> = FjallWorkerConfig<T>;
45
14
  /** Worker config for node.js, backed by a shared fjall engine. */
46
15
  export declare class FjallWorkerConfig<T = void> implements WorkerConfig<T, BlocksDb, SerializedStatesDb> {
47
16
  readonly nodeName: string;
@@ -115,11 +84,10 @@ export declare class InMemWorkerConfig<T = undefined> implements WorkerConfig<T,
115
84
  }): Promise<RootDb<BlocksDb, SerializedStatesDb>>;
116
85
  }
117
86
  /** Persistent values store backing the hybrid config. */
118
- export type HybridBackend = "lmdb" | "fjall";
87
+ export type HybridBackend = "fjall";
119
88
  /**
120
89
  * Hybrid worker config for the fuzz target: in-memory blocks and leaf sets,
121
- * but large values persisted to disk. The `backend` picks where the values go
122
- * (lmdb or fjall).
90
+ * but large values persisted to disk via fjall.
123
91
  *
124
92
  * fjall opens its keyspace asynchronously, that is why `new` here is async.
125
93
  *
@@ -141,7 +109,7 @@ export declare class HybridWorkerConfig<T = undefined> implements WorkerConfig<T
141
109
  readonly ephemeral: boolean;
142
110
  readonly compression: boolean;
143
111
  private readonly states;
144
- static new<T>({ nodeName, chainSpec, workerParams, blake2b, dbPath, ephemeral, compression, backend, sharedFjallSession, }: {
112
+ static new<T>({ nodeName, chainSpec, workerParams, blake2b, dbPath, ephemeral, compression, sharedFjallSession, }: {
145
113
  nodeName: string;
146
114
  chainSpec: ChainSpec;
147
115
  workerParams: T;
@@ -149,12 +117,10 @@ export declare class HybridWorkerConfig<T = undefined> implements WorkerConfig<T
149
117
  dbPath: string;
150
118
  ephemeral?: boolean;
151
119
  compression?: boolean;
152
- backend?: HybridBackend;
153
120
  /**
154
121
  * Reuse an already-open fjall values session instead of opening a fresh
155
122
  * keyspace. The fuzz target opens one per run and passes it on every reset,
156
- * so only the in-memory blocks/leaf sets are rebuilt per vector. Ignored
157
- * unless `backend === "fjall"`.
123
+ * so only the in-memory blocks/leaf sets are rebuilt per vector.
158
124
  */
159
125
  sharedFjallSession?: FjallValuesSession;
160
126
  }): Promise<HybridWorkerConfig<T>>;