@xyo-network/chain-orchestration 1.22.0 → 1.23.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.
Files changed (34) hide show
  1. package/dist/browser/index.mjs +14 -0
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/browser/node/config/capabilities/defaultCapabilityRegistry.d.ts.map +1 -1
  4. package/dist/browser/node/config/capabilities/descriptors.d.ts.map +1 -1
  5. package/dist/browser/node/config/locators/index.d.ts +1 -0
  6. package/dist/browser/node/config/locators/index.d.ts.map +1 -1
  7. package/dist/browser/node/config/locators/locatorsFromConfig.d.ts.map +1 -1
  8. package/dist/browser/node/config/locators/sharedLocatorFromConfig.d.ts +68 -0
  9. package/dist/browser/node/config/locators/sharedLocatorFromConfig.d.ts.map +1 -0
  10. package/dist/browser/shared/config/actors/Mempool.d.ts +14 -0
  11. package/dist/browser/shared/config/actors/Mempool.d.ts.map +1 -1
  12. package/dist/neutral/index.mjs +14 -0
  13. package/dist/neutral/index.mjs.map +1 -1
  14. package/dist/neutral/node/config/capabilities/defaultCapabilityRegistry.d.ts.map +1 -1
  15. package/dist/neutral/node/config/capabilities/descriptors.d.ts.map +1 -1
  16. package/dist/neutral/node/config/locators/index.d.ts +1 -0
  17. package/dist/neutral/node/config/locators/index.d.ts.map +1 -1
  18. package/dist/neutral/node/config/locators/locatorsFromConfig.d.ts.map +1 -1
  19. package/dist/neutral/node/config/locators/sharedLocatorFromConfig.d.ts +68 -0
  20. package/dist/neutral/node/config/locators/sharedLocatorFromConfig.d.ts.map +1 -0
  21. package/dist/neutral/shared/config/actors/Mempool.d.ts +14 -0
  22. package/dist/neutral/shared/config/actors/Mempool.d.ts.map +1 -1
  23. package/dist/node/index.mjs +220 -16
  24. package/dist/node/index.mjs.map +1 -1
  25. package/dist/node/node/config/capabilities/defaultCapabilityRegistry.d.ts.map +1 -1
  26. package/dist/node/node/config/capabilities/descriptors.d.ts.map +1 -1
  27. package/dist/node/node/config/locators/index.d.ts +1 -0
  28. package/dist/node/node/config/locators/index.d.ts.map +1 -1
  29. package/dist/node/node/config/locators/locatorsFromConfig.d.ts.map +1 -1
  30. package/dist/node/node/config/locators/sharedLocatorFromConfig.d.ts +68 -0
  31. package/dist/node/node/config/locators/sharedLocatorFromConfig.d.ts.map +1 -0
  32. package/dist/node/shared/config/actors/Mempool.d.ts +14 -0
  33. package/dist/node/shared/config/actors/Mempool.d.ts.map +1 -1
  34. package/package.json +26 -35
@@ -0,0 +1,68 @@
1
+ import type { ActorConfig, CachingContext, Config, ProviderFactoryLocatorInstance } from '@xyo-network/xl1-sdk';
2
+ /**
3
+ * Names of the actors this builder supports. Outside this set, `locatorsFromConfig`
4
+ * routes to the legacy per-actor child-locator path.
5
+ */
6
+ export declare const SHARED_LOCATOR_SUPPORTED_ACTORS: readonly string[];
7
+ /**
8
+ * Returns true iff the configured actors are exactly the full canary trio
9
+ * (`api`, `mempool`, `finalizer`) running in one process AND the run is
10
+ * in-memory (no `remote.rpc`) AND no actor opts into stateless mode.
11
+ *
12
+ * The shared path was designed for the canary case where all three actors
13
+ * co-locate and share a single registry, so each provider is instantiated
14
+ * exactly once. Any subset has a transitive-dependency problem the union
15
+ * of `ACTOR_MIRRORS` cannot satisfy:
16
+ *
17
+ * - Solo `api` — `SimpleXyoConnectionRunner` (chosen for `XyoConnection`)
18
+ * requires a local `MempoolRunner`, only registered when `mempool` is in
19
+ * the union. Crash:
20
+ * "No provider instance for the supplied config moniker [MempoolRunner]"
21
+ * - Solo `mempool` — `SimpleMempoolRunner` requires a local
22
+ * `BlockValidationViewer`, only registered when `finalizer` is in the
23
+ * union. Crash:
24
+ * "No provider instance for the supplied config moniker [BlockValidationViewer]"
25
+ * - Solo `finalizer` and `[api, finalizer]` etc. — same class of mismatch.
26
+ *
27
+ * Multi-process deployments (`xl1 start api` in one proc, `xl1 start mempool`
28
+ * in another) fall under "subset" and must therefore route to the legacy
29
+ * `_root` path. `localLocatorFromConfig` registers `LOCAL_LEGACY_NEEDS`
30
+ * (every canary moniker) on `_root`, which the per-actor child locators
31
+ * inherit — so each subset finds its transitive deps via `_root`.
32
+ */
33
+ export declare function canUseSharedLocator(actors: readonly ActorConfig[], config: Omit<Config, 'actors'>): boolean;
34
+ export interface SharedLocatorFromConfigResult {
35
+ /**
36
+ * Per-actor view locators. Each is a thin wrapper that shares `shared`'s
37
+ * registry by reference (`registry === shared.registry`) but has its own
38
+ * `context` carrying the actor-specific config block. Hand these to the
39
+ * actor constructors — `getApiActor`, `getMempoolActor`, `getFinalizerActor`
40
+ * pull their actor-specific config from `locator.context.config`.
41
+ */
42
+ readonly perActor: Record<string, ProviderFactoryLocatorInstance>;
43
+ /**
44
+ * The single underlying locator that owns the shared registry. Tests and
45
+ * the dump tool can introspect this directly to see the unique factory set.
46
+ */
47
+ readonly shared: ProviderFactoryLocatorInstance;
48
+ }
49
+ export interface SharedLocatorFromConfigOptions {
50
+ readonly onInsecureGenesisConfirm?: () => Promise<void>;
51
+ }
52
+ /**
53
+ * Builds a single shared locator driven by the union of the configured actors'
54
+ * declared `needs`, plus the EVM/memory contract+stake providers from
55
+ * `initEvmProvidersIfAvailable`. Each actor receives a thin view locator that
56
+ * shares the registry by reference, so every provider exists exactly once
57
+ * per process.
58
+ *
59
+ * Replaces the legacy `_root` + per-actor child-locator layering for the
60
+ * canary actor combos (api+mempool+finalizer subset). Eliminates Symptoms 2
61
+ * and 3 from the double-loading findings: no cross-locator duplicates, no
62
+ * empty actor-locator shells.
63
+ *
64
+ * Stateless API and remote-RPC paths are NOT supported here — the caller
65
+ * (`locatorsFromConfig`) routes those to the existing builders.
66
+ */
67
+ export declare function sharedLocatorFromConfig(context: CachingContext, actors: readonly ActorConfig[], config: Omit<Config, 'actors'>, options?: SharedLocatorFromConfigOptions): Promise<SharedLocatorFromConfigResult>;
68
+ //# sourceMappingURL=sharedLocatorFromConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedLocatorFromConfig.d.ts","sourceRoot":"","sources":["../../../../../src/node/config/locators/sharedLocatorFromConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACd,MAAM,EACN,8BAA8B,EAC/B,MAAM,sBAAsB,CAAA;AAgJ7B;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAAoC,CAAA;AAEjG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,OAAO,CAgB3G;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;IACjE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAA;CAChD;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC9B,OAAO,GAAE,8BAAmC,GAC3C,OAAO,CAAC,6BAA6B,CAAC,CA2DxC"}
@@ -3,6 +3,8 @@ import type { BaseConfigContext } from '@xyo-network/xl1-sdk';
3
3
  import { z } from 'zod';
4
4
  export declare const DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1000;
5
5
  export declare const DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1000;
6
+ export declare const DEFAULT_MEMPOOL_DEMOTION_THRESHOLD = 3;
7
+ export declare const DEFAULT_MEMPOOL_MAX_PENDING_TRANSACTIONS = 0;
6
8
  export declare const MempoolConfigZod: z.ZodObject<{
7
9
  chain: z.ZodDefault<z.ZodObject<{
8
10
  id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@xylabs/sdk-js").BrandedHex, string>>>;
@@ -90,6 +92,8 @@ export declare const MempoolConfigZod: z.ZodObject<{
90
92
  port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
91
93
  enabled: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>, z.ZodTransform<boolean, string | boolean>>;
92
94
  blockPruneInterval: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
95
+ demotionThreshold: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
96
+ maxPendingTransactions: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
93
97
  transactionPruneInterval: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
94
98
  }, z.core.$strip>;
95
99
  export type MempoolConfig = z.infer<typeof MempoolConfigZod>;
@@ -171,6 +175,8 @@ export declare const isMempoolConfig: <T>(value: T) => value is T & {
171
175
  port: number;
172
176
  enabled: boolean;
173
177
  blockPruneInterval: number;
178
+ demotionThreshold: number;
179
+ maxPendingTransactions: number;
174
180
  transactionPruneInterval: number;
175
181
  dataLake?: import("@xyo-network/xl1-sdk").DataLakeConfig | undefined;
176
182
  accountPath?: string | undefined;
@@ -255,6 +261,8 @@ export declare const asMempoolConfig: {
255
261
  port: number;
256
262
  enabled: boolean;
257
263
  blockPruneInterval: number;
264
+ demotionThreshold: number;
265
+ maxPendingTransactions: number;
258
266
  transactionPruneInterval: number;
259
267
  dataLake?: import("@xyo-network/xl1-sdk").DataLakeConfig | undefined;
260
268
  accountPath?: string | undefined;
@@ -338,6 +346,8 @@ export declare const asMempoolConfig: {
338
346
  port: number;
339
347
  enabled: boolean;
340
348
  blockPruneInterval: number;
349
+ demotionThreshold: number;
350
+ maxPendingTransactions: number;
341
351
  transactionPruneInterval: number;
342
352
  dataLake?: import("@xyo-network/xl1-sdk").DataLakeConfig | undefined;
343
353
  accountPath?: string | undefined;
@@ -423,6 +433,8 @@ export declare const toMempoolConfig: {
423
433
  port: number;
424
434
  enabled: boolean;
425
435
  blockPruneInterval: number;
436
+ demotionThreshold: number;
437
+ maxPendingTransactions: number;
426
438
  transactionPruneInterval: number;
427
439
  dataLake?: import("@xyo-network/xl1-sdk").DataLakeConfig | undefined;
428
440
  accountPath?: string | undefined;
@@ -506,6 +518,8 @@ export declare const toMempoolConfig: {
506
518
  port: number;
507
519
  enabled: boolean;
508
520
  blockPruneInterval: number;
521
+ demotionThreshold: number;
522
+ maxPendingTransactions: number;
509
523
  transactionPruneInterval: number;
510
524
  dataLake?: import("@xyo-network/xl1-sdk").DataLakeConfig | undefined;
511
525
  accountPath?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Mempool.d.ts","sourceRoot":"","sources":["../../../../../src/shared/config/actors/Mempool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAAgB,YAAY,EACzC,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC,eAAO,MAAM,oCAAoC,OAAO,CAAA;AACxD,eAAO,MAAM,0CAA0C,OAAO,CAAA;AAE9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4B3B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE5D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAiC,CAAA;AAC7D,eAAO,MAAM,eAAe;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C,KAAK,KAAK,IAAI,CAAC,GAAG,oBAAyD,CAAA;AAC5H,eAAO,MAAM,sBAAsB,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,oBAAoB,CAAC,CAAgE,CAAA;AACzJ,eAAO,MAAM,sBAAsB,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,oBAAoB,CAAC,CAAgE,CAAA"}
@@ -484,6 +484,8 @@ import { BaseConfigContextZod as BaseConfigContextZod4, HostActorConfigZod as Ho
484
484
  import { globalRegistry as globalRegistry3, z as z5 } from "zod";
485
485
  var DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1e3;
486
486
  var DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1e3;
487
+ var DEFAULT_MEMPOOL_DEMOTION_THRESHOLD = 3;
488
+ var DEFAULT_MEMPOOL_MAX_PENDING_TRANSACTIONS = 0;
487
489
  var MempoolConfigZod = HostActorConfigZod4.extend({
488
490
  enabled: z5.union([
489
491
  z5.string(),
@@ -520,6 +522,16 @@ var MempoolConfigZod = HostActorConfigZod4.extend({
520
522
  title: "mempool.blockPruneInterval",
521
523
  type: "number"
522
524
  }),
525
+ demotionThreshold: z5.coerce.number().int().positive().default(DEFAULT_MEMPOOL_DEMOTION_THRESHOLD).register(globalRegistry3, {
526
+ description: "Number of times a transaction may be handed out to producers without being included in a block before it is considered demoted",
527
+ title: "mempool.demotionThreshold",
528
+ type: "number"
529
+ }),
530
+ maxPendingTransactions: z5.coerce.number().int().nonnegative().default(DEFAULT_MEMPOOL_MAX_PENDING_TRANSACTIONS).register(globalRegistry3, {
531
+ description: "Maximum number of pending transactions in the pool. When exceeded, demoted transactions are evicted first, then oldest by sequence. 0 disables the cap.",
532
+ title: "mempool.maxPendingTransactions",
533
+ type: "number"
534
+ }),
523
535
  transactionPruneInterval: z5.coerce.number().default(DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL).register(globalRegistry3, {
524
536
  description: "The interval time (in milliseconds) between pending transaction prune attempts",
525
537
  title: "mempool.transactionPruneInterval",
@@ -1258,6 +1270,8 @@ export {
1258
1270
  DEFAULT_ACTOR_ACCOUNT_PATH,
1259
1271
  DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL,
1260
1272
  DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL,
1273
+ DEFAULT_MEMPOOL_DEMOTION_THRESHOLD,
1274
+ DEFAULT_MEMPOOL_MAX_PENDING_TRANSACTIONS,
1261
1275
  DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL,
1262
1276
  DefaultServiceProvider,
1263
1277
  DerivationPathCollisionError,