@typeberry/lib 0.5.3 → 0.5.4

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 (149) hide show
  1. package/package.json +8 -4
  2. package/packages/core/hash/hash.d.ts.map +1 -1
  3. package/packages/core/hash/hash.js +1 -0
  4. package/packages/core/networking/certificate.d.ts.map +1 -1
  5. package/packages/core/networking/certificate.js +1 -0
  6. package/packages/core/networking/package.json +1 -1
  7. package/packages/core/networking/setup.d.ts.map +1 -1
  8. package/packages/core/networking/setup.js +16 -12
  9. package/packages/core/numbers/index.d.ts +4 -0
  10. package/packages/core/numbers/index.d.ts.map +1 -1
  11. package/packages/core/numbers/index.js +4 -4
  12. package/packages/core/pvm-host-calls/host-calls-executor.d.ts +23 -17
  13. package/packages/core/pvm-host-calls/host-calls-executor.d.ts.map +1 -1
  14. package/packages/core/pvm-host-calls/host-calls-executor.js +23 -31
  15. package/packages/core/pvm-interpreter/ops/math-consts.d.ts +2 -3
  16. package/packages/core/pvm-interpreter/ops/math-consts.d.ts.map +1 -1
  17. package/packages/core/pvm-interpreter/ops/math-consts.js +2 -3
  18. package/packages/core/pvm-interpreter/ops/math-ops.js +3 -3
  19. package/packages/core/pvm-interpreter/ops/math-utils.js +13 -13
  20. package/packages/core/pvm-interpreter/ops/math-utils.test.js +17 -16
  21. package/packages/core/telemetry/package.json +1 -1
  22. package/packages/extensions/ipc/jamnp/handler.d.ts +5 -4
  23. package/packages/extensions/ipc/jamnp/handler.d.ts.map +1 -1
  24. package/packages/extensions/ipc/jamnp/handler.js +59 -34
  25. package/packages/extensions/ipc/jamnp/stream.d.ts +6 -4
  26. package/packages/extensions/ipc/jamnp/stream.d.ts.map +1 -1
  27. package/packages/jam/block/work-item.d.ts +13 -4
  28. package/packages/jam/block/work-item.d.ts.map +1 -1
  29. package/packages/jam/block/work-package.d.ts +3 -1
  30. package/packages/jam/block/work-package.d.ts.map +1 -1
  31. package/packages/jam/block/work-package.js +6 -2
  32. package/packages/jam/block/work-result.d.ts +3 -5
  33. package/packages/jam/block/work-result.d.ts.map +1 -1
  34. package/packages/jam/block/work-result.js +6 -0
  35. package/packages/jam/block-json/block.d.ts +125 -0
  36. package/packages/jam/block-json/block.d.ts.map +1 -1
  37. package/packages/jam/block-json/block.js +9 -2
  38. package/packages/jam/block-json/work-result.d.ts.map +1 -1
  39. package/packages/jam/block-json/work-result.js +6 -6
  40. package/packages/jam/database-lmdb/states.test.js +4 -3
  41. package/packages/jam/executor/index.d.ts +4 -0
  42. package/packages/jam/executor/index.d.ts.map +1 -0
  43. package/packages/jam/executor/index.js +2 -0
  44. package/packages/jam/{transition/accumulate → executor}/pvm-executor.d.ts +19 -16
  45. package/packages/jam/executor/pvm-executor.d.ts.map +1 -0
  46. package/packages/jam/{transition/accumulate → executor}/pvm-executor.js +46 -3
  47. package/packages/jam/fuzz-proto/v1/handler.d.ts +1 -1
  48. package/packages/jam/fuzz-proto/v1/handler.d.ts.map +1 -1
  49. package/packages/jam/fuzz-proto/v1/handler.js +43 -19
  50. package/packages/jam/in-core/externalities/refine.d.ts +24 -0
  51. package/packages/jam/in-core/externalities/refine.d.ts.map +1 -0
  52. package/packages/jam/in-core/externalities/refine.js +36 -0
  53. package/packages/jam/in-core/in-core.d.ts +60 -0
  54. package/packages/jam/in-core/in-core.d.ts.map +1 -0
  55. package/packages/jam/in-core/in-core.js +294 -0
  56. package/packages/jam/in-core/in-core.test.d.ts +2 -0
  57. package/packages/jam/in-core/in-core.test.d.ts.map +1 -0
  58. package/packages/jam/in-core/in-core.test.js +81 -0
  59. package/packages/jam/in-core/index.d.ts +2 -0
  60. package/packages/jam/in-core/index.d.ts.map +1 -0
  61. package/packages/jam/in-core/index.js +1 -0
  62. package/packages/jam/jam-host-calls/accumulate/bless.test.js +4 -5
  63. package/packages/jam/jamnp-s/peers.d.ts.map +1 -1
  64. package/packages/jam/jamnp-s/peers.js +10 -0
  65. package/packages/jam/jamnp-s/protocol/ce-128-block-request.d.ts +1 -1
  66. package/packages/jam/jamnp-s/protocol/ce-128-block-request.d.ts.map +1 -1
  67. package/packages/jam/jamnp-s/protocol/ce-128-block-request.js +10 -8
  68. package/packages/jam/jamnp-s/protocol/ce-129-state-request.d.ts.map +1 -1
  69. package/packages/jam/jamnp-s/protocol/ce-129-state-request.js +11 -9
  70. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.d.ts +3 -3
  71. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.d.ts.map +1 -1
  72. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.js +2 -2
  73. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts +5 -5
  74. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts.map +1 -1
  75. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.js +2 -2
  76. package/packages/jam/jamnp-s/protocol/ce-134-work-package-sharing.d.ts.map +1 -1
  77. package/packages/jam/jamnp-s/protocol/ce-134-work-package-sharing.js +8 -6
  78. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.d.ts +3 -3
  79. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.d.ts.map +1 -1
  80. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.js +2 -2
  81. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.test.js +2 -2
  82. package/packages/jam/jamnp-s/protocol/stream.d.ts +13 -7
  83. package/packages/jam/jamnp-s/protocol/stream.d.ts.map +1 -1
  84. package/packages/jam/jamnp-s/protocol/stream.js +5 -4
  85. package/packages/jam/jamnp-s/protocol/test-utils.d.ts +1 -1
  86. package/packages/jam/jamnp-s/protocol/test-utils.d.ts.map +1 -1
  87. package/packages/jam/jamnp-s/protocol/test-utils.js +9 -12
  88. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.d.ts +1 -1
  89. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.d.ts.map +1 -1
  90. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.js +1 -1
  91. package/packages/jam/jamnp-s/stream-manager.d.ts.map +1 -1
  92. package/packages/jam/jamnp-s/stream-manager.js +7 -5
  93. package/packages/jam/jamnp-s/stream-manager.test.js +8 -5
  94. package/packages/jam/jamnp-s/tasks/sync.js +1 -1
  95. package/packages/jam/node/jam-config.d.ts +4 -1
  96. package/packages/jam/node/jam-config.d.ts.map +1 -1
  97. package/packages/jam/node/jam-config.js +6 -2
  98. package/packages/jam/node/main.d.ts.map +1 -1
  99. package/packages/jam/node/main.js +5 -4
  100. package/packages/jam/node/package.json +1 -1
  101. package/packages/jam/rpc-validation/types.d.ts +7 -3
  102. package/packages/jam/rpc-validation/types.d.ts.map +1 -1
  103. package/packages/jam/rpc-validation/validation.d.ts +254 -36
  104. package/packages/jam/rpc-validation/validation.d.ts.map +1 -1
  105. package/packages/jam/rpc-validation/validation.js +20 -2
  106. package/packages/jam/state/in-memory-state.d.ts.map +1 -1
  107. package/packages/jam/state/in-memory-state.js +2 -3
  108. package/packages/jam/state/test.utils.d.ts.map +1 -1
  109. package/packages/jam/state/test.utils.js +2 -3
  110. package/packages/jam/state-vectors/index.d.ts +377 -5
  111. package/packages/jam/state-vectors/index.d.ts.map +1 -1
  112. package/packages/jam/state-vectors/index.js +3 -3
  113. package/packages/jam/transition/accumulate/accumulate-data.d.ts.map +1 -1
  114. package/packages/jam/transition/accumulate/accumulate-data.js +1 -2
  115. package/packages/jam/transition/accumulate/accumulate-queue.test.js +2 -2
  116. package/packages/jam/transition/accumulate/accumulate-utils.test.js +2 -2
  117. package/packages/jam/transition/accumulate/accumulate.d.ts.map +1 -1
  118. package/packages/jam/transition/accumulate/accumulate.js +8 -13
  119. package/packages/jam/transition/accumulate/accumulate.test.js +2 -2
  120. package/packages/jam/transition/accumulate/accumulation-result-merge-utils.d.ts.map +1 -1
  121. package/packages/jam/transition/accumulate/accumulation-result-merge-utils.js +1 -2
  122. package/packages/jam/transition/accumulate/accumulation-result-merge-utils.test.js +1 -2
  123. package/packages/jam/transition/accumulate/deferred-transfers.d.ts +1 -1
  124. package/packages/jam/transition/accumulate/deferred-transfers.d.ts.map +1 -1
  125. package/packages/jam/transition/accumulate/deferred-transfers.js +6 -7
  126. package/packages/jam/transition/disputes/disputes.test.data2.js +2 -2
  127. package/packages/jam/transition/externalities/fetch-externalities.d.ts +7 -1
  128. package/packages/jam/transition/externalities/fetch-externalities.d.ts.map +1 -1
  129. package/packages/jam/transition/externalities/fetch-externalities.js +4 -0
  130. package/packages/jam/transition/externalities/fetch-externalities.test.js +2 -2
  131. package/packages/jam/transition/hasher.test.js +2 -2
  132. package/packages/jam/transition/reports/error.d.ts +3 -1
  133. package/packages/jam/transition/reports/error.d.ts.map +1 -1
  134. package/packages/jam/transition/reports/error.js +2 -0
  135. package/packages/jam/transition/reports/test.utils.d.ts.map +1 -1
  136. package/packages/jam/transition/reports/test.utils.js +2 -2
  137. package/packages/jam/transition/reports/verify-basic.d.ts.map +1 -1
  138. package/packages/jam/transition/reports/verify-basic.js +10 -0
  139. package/packages/jam/transition/reports/verify-basic.test.js +29 -0
  140. package/packages/workers/block-authorship/main.d.ts.map +1 -1
  141. package/packages/workers/block-authorship/main.js +23 -4
  142. package/packages/workers/block-authorship/package.json +1 -1
  143. package/packages/workers/block-authorship/protocol.d.ts +3 -1
  144. package/packages/workers/block-authorship/protocol.d.ts.map +1 -1
  145. package/packages/workers/block-authorship/protocol.js +6 -3
  146. package/packages/workers/importer/importer.d.ts.map +1 -1
  147. package/packages/workers/importer/importer.js +0 -1
  148. package/packages/workers/importer/package.json +1 -1
  149. package/packages/jam/transition/accumulate/pvm-executor.d.ts.map +0 -1
@@ -4,7 +4,7 @@ import { tryAsCoreIndex, tryAsServiceGas, tryAsServiceId, tryAsTimeSlot } from "
4
4
  import { RefineContext } from "#@typeberry/block/refine-context.js";
5
5
  import { tryAsWorkItemsCount } from "#@typeberry/block/work-package.js";
6
6
  import { WorkPackageSpec, WorkReport } from "#@typeberry/block/work-report.js";
7
- import { WorkExecResult, WorkExecResultKind, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
7
+ import { WorkExecResult, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
8
8
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
9
9
  import { FixedSizeArray, HashSet } from "#@typeberry/collections";
10
10
  import { tinyChainSpec } from "#@typeberry/config";
@@ -52,7 +52,7 @@ describe("accumulate-utils", () => {
52
52
  importedSegments: tryAsU32(0),
53
53
  }),
54
54
  payloadHash: Bytes.zero(HASH_SIZE).asOpaque(),
55
- result: new WorkExecResult(WorkExecResultKind.ok, BytesBlob.empty()),
55
+ result: WorkExecResult.ok(BytesBlob.empty()),
56
56
  serviceId: tryAsServiceId(0),
57
57
  }),
58
58
  ], tryAsWorkItemsCount(1)),
@@ -1 +1 @@
1
- {"version":3,"file":"accumulate.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,iBAAiB,CAAC;AAmB3E,OAAO,EAAyC,MAAM,EAAa,MAAM,kBAAkB,CAAC;AAM5F,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGtD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AA2B3D,qBAAa,UAAU;aAEH,SAAS,EAAE,SAAS;aACpB,OAAO,EAAE,OAAO;aAChB,KAAK,EAAE,eAAe;aACtB,OAAO,EAAE,iBAAi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AO,kBAAkB,CAAC;AA2B3D,qBAAa,UAAU;aAEH,SAAS,EAAE,SAAS;aACpB,OAAO,EAAE,OAAO;aAChB,KAAK,EAAE,eAAe;aACtB,OAAO,EAAE,iBAAiB;gBAH1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,iBAAiB;IAO5C;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAkB7B;;;;OAIG;YACW,uBAAuB;IAqGrC;;;;OAIG;YACW,uBAAuB;IAoDrC;;;;;;;OAOG;YACW,4BAA4B;IA8D1C;;;;;;;OAOG;YACW,sBAAsB;IAsEpC,OAAO,CAAC,gBAAgB;IAuCxB,OAAO,CAAC,kBAAkB;IAsB1B;;;;;;;;;OASG;YACW,oBAAoB;IA6ClC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAkDlC;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAcnB;;;;;;OAMG;IACI,6BAA6B,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO;IAKhE,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;CAwGrH"}
@@ -3,12 +3,11 @@ import { W_C } from "#@typeberry/block/gp-constants.js";
3
3
  import { Bytes } from "#@typeberry/bytes";
4
4
  import { codec, Encoder } from "#@typeberry/codec";
5
5
  import { ArrayView, HashSet, SortedArray } from "#@typeberry/collections";
6
+ import { PvmExecutor, ReturnStatus } from "#@typeberry/executor";
6
7
  import { HASH_SIZE } from "#@typeberry/hash";
7
8
  import { AccumulationStateUpdate, PartiallyUpdatedState, } from "#@typeberry/jam-host-calls/externalities/state-update.js";
8
9
  import { Logger } from "#@typeberry/logger";
9
- import { sumU64, tryAsU32 } from "#@typeberry/numbers";
10
- import { Status, tryAsGas } from "#@typeberry/pvm-interface";
11
- import { MAX_VALUE_U64 } from "#@typeberry/pvm-interpreter/ops/math-consts.js";
10
+ import { MAX_VALUE_U64, sumU64, tryAsU32 } from "#@typeberry/numbers";
12
11
  import { accumulationOutputComparator, hashComparator, ServiceAccountInfo, tryAsPerCore, } from "#@typeberry/state";
13
12
  import { assertEmpty, Compatibility, GpVersion, Result, TestSuite } from "#@typeberry/utils";
14
13
  import { AccumulateExternalities } from "../externalities/accumulate-externalities.js";
@@ -18,7 +17,6 @@ import { AccumulateQueue, pruneQueue } from "./accumulate-queue.js";
18
17
  import { GAS_TO_INVOKE_WORK_REPORT, } from "./accumulate-state.js";
19
18
  import { generateNextServiceId, getWorkPackageHashes } from "./accumulate-utils.js";
20
19
  import { mergePerallelAccumulationResults, } from "./accumulation-result-merge-utils.js";
21
- import { PvmExecutor } from "./pvm-executor.js";
22
20
  export const ACCUMULATION_ERROR = "duplicate service created";
23
21
  var PvmInvocationError;
24
22
  (function (PvmInvocationError) {
@@ -102,28 +100,25 @@ export class Accumulate {
102
100
  serviceId,
103
101
  argsLength: tryAsU32(transfers.length + operands.length),
104
102
  });
105
- const result = await executor.run(invocationArgs, tryAsGas(gas));
103
+ const result = await executor.run(invocationArgs, gas);
106
104
  const [newState, checkpoint] = partialState.getStateUpdates();
107
105
  /**
108
106
  * PVM invocation returned and error so we return the checkpoint
109
107
  *
110
108
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/300002300002?v=0.6.7
111
109
  */
112
- if (result.hasStatus()) {
113
- const status = result.status;
114
- if (status === Status.OOG || status === Status.PANIC) {
115
- logger.trace `[${serviceId}] accumulate finished with ${Status[status]} reverting to checkpoint.`;
116
- return Result.ok({ stateUpdate: checkpoint, consumedGas: tryAsServiceGas(result.consumedGas) });
117
- }
118
- logger.trace `[${serviceId}] accumulate finished with ${Status[status]}`;
110
+ if (result.status !== ReturnStatus.OK) {
111
+ logger.trace `[${serviceId}] accumulate finished with ${ReturnStatus[result.status]} reverting to checkpoint.`;
112
+ return Result.ok({ stateUpdate: checkpoint, consumedGas: tryAsServiceGas(result.consumedGas) });
119
113
  }
114
+ logger.trace `[${serviceId}] accumulate finished with ${ReturnStatus[result.status]}`;
120
115
  /**
121
116
  * PVM invocation returned a hash so we override whatever `yield` host call
122
117
  * provided.
123
118
  *
124
119
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/301202301202?v=0.6.7
125
120
  */
126
- if (result.hasMemorySlice() && result.memorySlice.length === HASH_SIZE) {
121
+ if (result.memorySlice.length === HASH_SIZE) {
127
122
  const memorySlice = Bytes.fromBlob(result.memorySlice, HASH_SIZE);
128
123
  newState.yieldedRoot = memorySlice.asOpaque();
129
124
  }
@@ -5,7 +5,7 @@ import { MIN_PUBLIC_SERVICE_INDEX } from "#@typeberry/block/gp-constants.js";
5
5
  import { RefineContext } from "#@typeberry/block/refine-context.js";
6
6
  import { tryAsWorkItemsCount } from "#@typeberry/block/work-package.js";
7
7
  import { WorkPackageSpec, WorkReport } from "#@typeberry/block/work-report.js";
8
- import { WorkExecResult, WorkExecResultKind, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
8
+ import { WorkExecResult, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
9
9
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
10
10
  import { asKnownSize, FixedSizeArray, HashDictionary, HashSet } from "#@typeberry/collections";
11
11
  import { PvmBackend, PvmBackendNames, tinyChainSpec } from "#@typeberry/config";
@@ -266,7 +266,7 @@ const createWorkReport = (workPackageHash, prerequisites = [], serviceId = tryAs
266
266
  importedSegments: tryAsU32(0),
267
267
  }),
268
268
  payloadHash: Bytes.zero(HASH_SIZE).asOpaque(),
269
- result: new WorkExecResult(WorkExecResultKind.ok, BytesBlob.empty()),
269
+ result: WorkExecResult.ok(BytesBlob.empty()),
270
270
  serviceId,
271
271
  }),
272
272
  ], tryAsWorkItemsCount(1)),
@@ -1 +1 @@
1
- {"version":3,"file":"accumulation-result-merge-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulation-result-merge-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,uBAAuB,EACnC,OAAO,EAAE,0BAA0B,GAClC,WAAW,CAab;AAED,KAAK,SAAS,GAAG,SAAS,CAAC;AAC3B,KAAK,WAAW,GAAG;IAAE,WAAW,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,uBAAuB,CAAA;CAAE,CAAC;AAGrF,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"accumulation-result-merge-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulation-result-merge-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,uBAAuB,EACnC,OAAO,EAAE,0BAA0B,GAClC,WAAW,CAab;AAED,KAAK,SAAS,GAAG,SAAS,CAAC;AAC3B,KAAK,WAAW,GAAG;IAAE,WAAW,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,uBAAuB,CAAA;CAAE,CAAC;AAGrF,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { tryAsServiceGas } from "#@typeberry/block";
2
2
  import { AccumulationStateUpdate } from "#@typeberry/jam-host-calls";
3
- import { sumU64 } from "#@typeberry/numbers";
4
- import { MAX_VALUE_U64 } from "#@typeberry/pvm-interpreter/ops/math-consts.js";
3
+ import { MAX_VALUE_U64, sumU64 } from "#@typeberry/numbers";
5
4
  import { PrivilegedServices, tryAsPerCore, UpdatePreimageKind } from "#@typeberry/state";
6
5
  export function mergePerallelAccumulationResults(chainSpec, state, inputState, results) {
7
6
  const mergeContext = createMergeContext(chainSpec, state, inputState, results);
@@ -7,8 +7,7 @@ import { BANDERSNATCH_KEY_BYTES, BLS_KEY_BYTES, ED25519_KEY_BYTES } from "#@type
7
7
  import { HASH_SIZE } from "#@typeberry/hash";
8
8
  import { AccumulationStateUpdate, PendingTransfer } from "#@typeberry/jam-host-calls";
9
9
  import { TRANSFER_MEMO_BYTES } from "#@typeberry/jam-host-calls/externalities/partial-state.js";
10
- import { tryAsU32, tryAsU64 } from "#@typeberry/numbers";
11
- import { MAX_VALUE_U64 } from "#@typeberry/pvm-interpreter/ops/math-consts.js";
10
+ import { MAX_VALUE_U64, tryAsU32, tryAsU64 } from "#@typeberry/numbers";
12
11
  import { AUTHORIZATION_QUEUE_SIZE, InMemoryState, PreimageItem, PrivilegedServices, ServiceAccountInfo, StorageItem, tryAsPerCore, UpdatePreimage, UpdateService, UpdateStorage, VALIDATOR_META_BYTES, ValidatorData, } from "#@typeberry/state";
13
12
  import { deepEqual } from "#@typeberry/utils";
14
13
  import { mergePerallelAccumulationResults } from "./accumulation-result-merge-utils.js";
@@ -1,7 +1,7 @@
1
1
  import { type EntropyHash, type ServiceId, type TimeSlot } from "#@typeberry/block";
2
2
  import type { ChainSpec, PvmBackend } from "#@typeberry/config";
3
3
  import type { Blake2b } from "#@typeberry/hash";
4
- import type { PendingTransfer } from "#@typeberry/jam-host-calls/externalities/pending-transfer.js";
4
+ import type { PendingTransfer } from "#@typeberry/jam-host-calls";
5
5
  import { type ServicesUpdate, type State } from "#@typeberry/state";
6
6
  import { Result } from "#@typeberry/utils";
7
7
  import type { CountAndGasUsed } from "../statistics.js";
@@ -1 +1 @@
1
- {"version":3,"file":"deferred-transfers.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/deferred-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAmB,MAAM,kBAAkB,CAAC;AAGpG,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAQnG,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxD,KAAK,sBAAsB,GAAG;IAC5B,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,6DAA6D;IAC7D,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,oBAAoB,CAAC,CAAC;AAEnG,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;CACrD,CAAC;AAQF,oBAAY,0BAA0B;IACpC,sBAAsB,IAAI;IAC1B,mBAAmB,IAAI;CACxB;AAGD;;GAEG;AACH,qBAAa,iBAAiB;aAEV,SAAS,EAAE,SAAS;aACpB,OAAO,EAAE,OAAO;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAHJ,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EACf,KAAK,EAAE,sBAAsB,EAC7B,GAAG,EAAE,UAAU;IAG5B,UAAU,CAAC,EACf,gBAAgB,EAChB,QAAQ,EACR,cAAc,EAAE,mBAAmB,EACnC,OAAO,GACR,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC;CAuFjG"}
1
+ {"version":3,"file":"deferred-transfers.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/deferred-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAmB,MAAM,kBAAkB,CAAC;AAGpG,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE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ry/codec";
4
- import { AccumulationStateUpdate, PartiallyUpdatedState, } from "#@typeberry/jam-host-calls/externalities/state-update.js";
4
+ import { PvmExecutor } from "#@typeberry/executor";
5
+ import { AccumulationStateUpdate, PartiallyUpdatedState } from "#@typeberry/jam-host-calls";
5
6
  import { Logger } from "#@typeberry/logger";
6
7
  import { sumU64, tryAsU32 } from "#@typeberry/numbers";
7
- import { tryAsGas } from "#@typeberry/pvm-interface";
8
8
  import { ServiceAccountInfo } from "#@typeberry/state";
9
9
  import { Result } from "#@typeberry/utils";
10
10
  import { AccumulateExternalities } from "../externalities/accumulate-externalities.js";
11
11
  import { FetchExternalities } from "../externalities/fetch-externalities.js";
12
12
  import { uniquePreserveOrder } from "./accumulate-utils.js";
13
- import { PvmExecutor } from "./pvm-executor.js";
14
13
  const ARGS_CODEC = codec.object({
15
14
  timeslot: codec.varU32.asOpaque(),
16
15
  serviceId: codec.varU32.asOpaque(),
@@ -61,7 +60,7 @@ export class DeferredTransfers {
61
60
  partiallyUpdatedState.updateServiceInfo(serviceId, newInfo);
62
61
  const partialState = new AccumulateExternalities(this.chainSpec, this.blake2b, partiallyUpdatedState, serviceId, serviceId, timeslot);
63
62
  const fetchExternalities = FetchExternalities.createForOnTransfer({ entropy, transfers }, this.chainSpec);
64
- let consumedGas = tryAsGas(0);
63
+ let consumedGas = tryAsServiceGas(0);
65
64
  const hasTransfers = transfers.length > 0;
66
65
  const isCodeCorrect = code !== null && code.length <= W_C;
67
66
  if (!hasTransfers || !isCodeCorrect) {
@@ -78,10 +77,10 @@ export class DeferredTransfers {
78
77
  else {
79
78
  const executor = await PvmExecutor.createOnTransferExecutor(serviceId, code, { partialState, fetchExternalities }, this.pvm);
80
79
  const args = Encoder.encodeObject(ARGS_CODEC, { timeslot, serviceId, transfersLength: tryAsU32(transfers.length) }, this.chainSpec);
81
- const gas = transfers.reduce((acc, item) => acc + item.gas, 0n);
82
- consumedGas = (await executor.run(args, tryAsGas(gas))).consumedGas;
80
+ const gas = tryAsServiceGas(transfers.reduce((acc, item) => acc + item.gas, 0n));
81
+ consumedGas = (await executor.run(args, gas)).consumedGas;
83
82
  }
84
- transferStatistics.set(serviceId, { count: tryAsU32(transfers.length), gasUsed: tryAsServiceGas(consumedGas) });
83
+ transferStatistics.set(serviceId, { count: tryAsU32(transfers.length), gasUsed: consumedGas });
85
84
  const [updatedState] = partialState.getStateUpdates();
86
85
  currentStateUpdate = updatedState;
87
86
  }
@@ -2,7 +2,7 @@
2
2
  import { tryAsCoreIndex, tryAsPerValidator, tryAsServiceGas, tryAsServiceId, tryAsTimeSlot } from "#@typeberry/block";
3
3
  import { RefineContext } from "#@typeberry/block/refine-context.js";
4
4
  import { WorkPackageSpec, WorkReport } from "#@typeberry/block/work-report.js";
5
- import { WorkExecResult, WorkExecResultKind, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
5
+ import { WorkExecResult, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
6
6
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
7
7
  import { FixedSizeArray } from "#@typeberry/collections";
8
8
  import { tinyChainSpec } from "#@typeberry/config";
@@ -174,7 +174,7 @@ export function workReport(packageHash, coreIndex) {
174
174
  codeHash: Bytes.zero(HASH_SIZE).asOpaque(),
175
175
  payloadHash: Bytes.zero(HASH_SIZE).asOpaque(),
176
176
  gas: tryAsServiceGas(42),
177
- result: new WorkExecResult(WorkExecResultKind.ok, BytesBlob.parseBlob("0x010203")),
177
+ result: WorkExecResult.ok(BytesBlob.parseBlob("0x010203")),
178
178
  load: WorkRefineLoad.create({
179
179
  gasUsed: tryAsServiceGas(0),
180
180
  importedSegments: tryAsU32(0),
@@ -20,7 +20,8 @@ declare enum FetchContext {
20
20
  /** @deprecated since 0.7.1 */
21
21
  LegacyAccumulate = 1,
22
22
  /** @deprecated since 0.7.1 */
23
- LegacyOnTransfer = 2
23
+ LegacyOnTransfer = 2,
24
+ Refine = 3
24
25
  }
25
26
  type LegacyAccumulateFetchData = {
26
27
  context: FetchContext.LegacyAccumulate;
@@ -38,6 +39,10 @@ type AccumulateFetchData = {
38
39
  transfers: PendingTransfer[];
39
40
  operands: Operand[];
40
41
  };
42
+ type RefineFetchData = {
43
+ context: FetchContext.Refine;
44
+ entropy: undefined;
45
+ };
41
46
  export declare class FetchExternalities implements general.IFetchExternalities {
42
47
  private fetchData;
43
48
  private chainSpec;
@@ -45,6 +50,7 @@ export declare class FetchExternalities implements general.IFetchExternalities {
45
50
  static createForPre071Accumulate(fetchData: Omit<LegacyAccumulateFetchData, "context">, chainSpec: ChainSpec): FetchExternalities;
46
51
  static createForAccumulate(fetchData: Omit<AccumulateFetchData, "context">, chainSpec: ChainSpec): FetchExternalities;
47
52
  static createForOnTransfer(fetchData: Omit<LegacyOnTransferFetchData, "context">, chainSpec: ChainSpec): FetchExternalities;
53
+ static createForRefine(fetchData: Omit<RefineFetchData, "context">, chainSpec: ChainSpec): FetchExternalities;
48
54
  constants(): BytesBlob;
49
55
  entropy(): BytesBlob | null;
50
56
  authorizerTrace(): BytesBlob | null;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/fetch-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAQ5E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAInD,aAAK,mBAAmB;IACtB,OAAO,IAAI;IACX,QAAQ,IAAI;CACb;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,mBAAm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B,SAAS,IAAI,SAAS;IAItB,OAAO,IAAI,SAAS,GAAG,IAAI;IAS3B,eAAe,IAAI,SAAS,GAAG,IAAI;IAInC,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAIvE,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAIpE,WAAW,IAAI,SAAS,GAAG,IAAI;IAI/B,UAAU,IAAI,SAAS,GAAG,IAAI;IAI9B,kBAAkB,IAAI,SAAS,GAAG,IAAI;IAItC,aAAa,IAAI,SAAS,GAAG,IAAI;IAIjC,YAAY,IAAI,SAAS,GAAG,IAAI;IAIhC,WAAW,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAI7C,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAIjD,WAAW,IAAI,SAAS,GAAG,IAAI;IAU/B,UAAU,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAoB/C,YAAY,IAAI,SAAS,GAAG,IAAI;IAUhC,WAAW,CAAC,aAAa,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAoBjD,uBAAuB,IAAI,SAAS,GAAG,IAAI;IAa3C,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;CAuBnD"}
1
+ {"version":3,"file":"fetch-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/fetch-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAE,eAAe,EAAE,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UhC,WAAW,CAAC,aAAa,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;IAoBjD,uBAAuB,IAAI,SAAS,GAAG,IAAI;IAa3C,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,GAAG,IAAI;CAuBnD"}
@@ -106,6 +106,7 @@ var FetchContext;
106
106
  FetchContext[FetchContext["LegacyAccumulate"] = 1] = "LegacyAccumulate";
107
107
  /** @deprecated since 0.7.1 */
108
108
  FetchContext[FetchContext["LegacyOnTransfer"] = 2] = "LegacyOnTransfer";
109
+ FetchContext[FetchContext["Refine"] = 3] = "Refine";
109
110
  })(FetchContext || (FetchContext = {}));
110
111
  export class FetchExternalities {
111
112
  fetchData;
@@ -123,6 +124,9 @@ export class FetchExternalities {
123
124
  static createForOnTransfer(fetchData, chainSpec) {
124
125
  return new FetchExternalities({ context: FetchContext.LegacyOnTransfer, ...fetchData }, chainSpec);
125
126
  }
127
+ static createForRefine(fetchData, chainSpec) {
128
+ return new FetchExternalities({ context: FetchContext.Refine, ...fetchData }, chainSpec);
129
+ }
126
130
  constants() {
127
131
  return getEncodedConstants(this.chainSpec);
128
132
  }
@@ -1,7 +1,7 @@
1
1
  import assert from "node:assert";
2
2
  import { describe, it } from "node:test";
3
3
  import { tryAsServiceGas, tryAsServiceId } from "#@typeberry/block";
4
- import { WorkExecResult, WorkExecResultKind } from "#@typeberry/block/work-result.js";
4
+ import { WorkExecResult } from "#@typeberry/block/work-result.js";
5
5
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
6
6
  import { codec, Encoder } from "#@typeberry/codec";
7
7
  import { fullChainSpec, tinyChainSpec } from "#@typeberry/config";
@@ -21,7 +21,7 @@ describe("fetch-externalities", () => {
21
21
  exportsRoot: Bytes.fill(HASH_SIZE, i + 2).asOpaque(),
22
22
  hash: Bytes.fill(HASH_SIZE, i + 4).asOpaque(),
23
23
  payloadHash: Bytes.fill(HASH_SIZE, i + 5).asOpaque(),
24
- result: new WorkExecResult(WorkExecResultKind.ok, BytesBlob.empty()),
24
+ result: WorkExecResult.ok(BytesBlob.empty()),
25
25
  gas: tryAsServiceGas(1_000),
26
26
  }));
27
27
  }
@@ -4,7 +4,7 @@ import { Credential, ReportGuarantee } from "#@typeberry/block/guarantees.js";
4
4
  import { RefineContext, WorkPackageInfo } from "#@typeberry/block/refine-context.js";
5
5
  import { SignedTicket, tryAsTicketAttempt } from "#@typeberry/block/tickets.js";
6
6
  import { WorkPackageSpec, WorkReport } from "#@typeberry/block/work-report.js";
7
- import { WorkExecResult, WorkExecResultKind, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
7
+ import { WorkExecResult, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
8
8
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
9
9
  import { Decoder, Encoder } from "#@typeberry/codec";
10
10
  import { asKnownSize } from "#@typeberry/collections";
@@ -77,7 +77,7 @@ describe("TransitionHasher", () => {
77
77
  importedSegments: tryAsU32(result.refine_load.imports),
78
78
  }),
79
79
  payloadHash: Bytes.parseBytes(result.payload_hash, HASH_SIZE).asOpaque(),
80
- result: new WorkExecResult(WorkExecResultKind.ok, BytesBlob.parseBlob(result.result.ok)),
80
+ result: WorkExecResult.ok(BytesBlob.parseBlob(result.result.ok)),
81
81
  serviceId: tryAsServiceId(result.service_id),
82
82
  }))),
83
83
  segmentRootLookup: report.segment_root_lookup.map((l) => WorkPackageInfo.create(l)),
@@ -47,6 +47,8 @@ export declare enum ReportsError {
47
47
  /** Size of authorizer output and all work-item successful output blobs is too big. */
48
48
  WorkReportTooBig = 22,
49
49
  /** Contains guarantee from validator that is proven to be an offender. */
50
- BannedValidator = 23
50
+ BannedValidator = 23,
51
+ /** Number of work items/results is invalid. */
52
+ InvalidWorkItemsCount = 24
51
53
  }
52
54
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/reports/error.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,oBAAY,YAAY;IACtB,gEAAgE;IAChE,YAAY,IAAI;IAChB,8DAA8D;IAC9D,gBAAgB,IAAI;IACpB,0CAA0C;IAC1C,qBAAqB,IAAI;IACzB,gDAAgD;IAChD,sBAAsB,IAAI;IAC1B,oDAAoD;IACpD,mBAAmB,IAAI;IACvB,0DAA0D;IAC1D,2BAA2B,IAAI;IAC/B,gEAAgE;IAChE,eAAe,IAAI;IACnB,mEAAmE;IACnE,WAAW,IAAI;IACf,kDAAkD;IAClD,eAAe,IAAI;IACnB,yBAAyB;IACzB,YAAY,IAAI;IAChB,wDAAwD;IACxD,WAAW,KAAK;IAChB,yFAAyF;IACzF,iBAAiB,KAAK;IACtB,gEAAgE;IAChE,gBAAgB,KAAK;IACrB,wFAAwF;IACxF,YAAY,KAAK;IACjB,qCAAqC;IACrC,eAAe,KAAK;IACpB,qEAAqE;IACrE,gBAAgB,KAAK;IACrB,gEAAgE;IAChE,iBAAiB,KAAK;IACtB,4CAA4C;IAC5C,oBAAoB,KAAK;IACzB,oFAAoF;IACpF,oBAAoB,KAAK;IACzB,wFAAwF;IACxF,mBAAmB,KAAK;IACxB,2FAA2F;IAC3F,wBAAwB,KAAK;IAC7B,2CAA2C;IAC3C,YAAY,KAAK;IACjB,sFAAsF;IACtF,gBAAgB,KAAK;IACrB,0EAA0E;IAC1E,eAAe,KAAK;CACrB"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/reports/error.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,oBAAY,YAAY;IACtB,gEAAgE;IAChE,YAAY,IAAI;IAChB,8DAA8D;IAC9D,gBAAgB,IAAI;IACpB,0CAA0C;IAC1C,qBAAqB,IAAI;IACzB,gDAAgD;IAChD,sBAAsB,IAAI;IAC1B,oDAAoD;IACpD,mBAAmB,IAAI;IACvB,0DAA0D;IAC1D,2BAA2B,IAAI;IAC/B,gEAAgE;IAChE,eAAe,IAAI;IACnB,mEAAmE;IACnE,WAAW,IAAI;IACf,kDAAkD;IAClD,eAAe,IAAI;IACnB,yBAAyB;IACzB,YAAY,IAAI;IAChB,wDAAwD;IACxD,WAAW,KAAK;IAChB,yFAAyF;IACzF,iBAAiB,KAAK;IACtB,gEAAgE;IAChE,gBAAgB,KAAK;IACrB,wFAAwF;IACxF,YAAY,KAAK;IACjB,qCAAqC;IACrC,eAAe,KAAK;IACpB,qEAAqE;IACrE,gBAAgB,KAAK;IACrB,gEAAgE;IAChE,iBAAiB,KAAK;IACtB,4CAA4C;IAC5C,oBAAoB,KAAK;IACzB,oFAAoF;IACpF,oBAAoB,KAAK;IACzB,wFAAwF;IACxF,mBAAmB,KAAK;IACxB,2FAA2F;IAC3F,wBAAwB,KAAK;IAC7B,2CAA2C;IAC3C,YAAY,KAAK;IACjB,sFAAsF;IACtF,gBAAgB,KAAK;IACrB,0EAA0E;IAC1E,eAAe,KAAK;IACpB,+CAA+C;IAC/C,qBAAqB,KAAK;CAC3B"}
@@ -49,4 +49,6 @@ export var ReportsError;
49
49
  ReportsError[ReportsError["WorkReportTooBig"] = 22] = "WorkReportTooBig";
50
50
  /** Contains guarantee from validator that is proven to be an offender. */
51
51
  ReportsError[ReportsError["BannedValidator"] = 23] = "BannedValidator";
52
+ /** Number of work items/results is invalid. */
53
+ ReportsError[ReportsError["InvalidWorkItemsCount"] = 24] = "InvalidWorkItemsCount";
52
54
  })(ReportsError || (ReportsError = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"test.utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/reports/test.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,QAAQ,EAOd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,UAAU,EAEV,KAAK,uBAAuB,EAE5B,eAAe,EAChB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,oCA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,CAC9B,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,EAAE,4BAAoC,EAAE,GAAE;IAAE,4BAA4B,CAAC,EAAE,OAAO,CAAA;CAAO,GACxF,uBAAuB,CAwBzB;AAED,wBAAsB,UAAU,CAAC,OAAO,GAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAM,oBAUnF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,gBAAgB,cAKxE;AAED,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/C,sBAAsB,CAAC,EAAE,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAC1E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,kBAA0B,EAC1B,QAAoB,EACpB,iBAAsB,EACtB,mBAAmC,EACnC,sBAA6C,EAC7C,uBAA+B,GAChC,GAAE,kBAAuB,GAAG,YAAY,CAqExC;AAsCD,eAAO,MAAM,iBAAiB,QAAO,sBAAsB,EAG1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,aAAa,EA0BxB,CAAC;AAE3B,eAAO,MAAM,eAAe,GAAI;;CAAkC,KAAG,GAAG,CAAC,SAAS,EAAE,eAAe,CA6BlG,CAAC"}
@@ -4,7 +4,7 @@ import { Credential, GuaranteesExtrinsicBounds, guaranteesExtrinsicCodec, Report
4
4
  import { RefineContext } from "#@typeberry/block/refine-context.js";
5
5
  import { testWorkReportHex } from "#@typeberry/block/test-helpers.js";
6
6
  import { WorkReport } from "#@typeberry/block/work-report.js";
7
- import { WorkExecResult, WorkExecResultKind, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
7
+ import { WorkExecResult, WorkRefineLoad, WorkResult } from "#@typeberry/block/work-result.js";
8
8
  import { Bytes, BytesBlob } from "#@typeberry/bytes";
9
9
  import { codec, Decoder } from "#@typeberry/codec";
10
10
  import { asKnownSize, FixedSizeArray, HashDictionary } from "#@typeberry/collections";
@@ -41,7 +41,7 @@ export function newWorkReport({ core, authorizer, anchorBlock, stateRoot, beefyR
41
41
  codeHash: x.codeHash,
42
42
  payloadHash: x.payloadHash,
43
43
  gas: x.gas,
44
- result: resultSize !== undefined ? new WorkExecResult(WorkExecResultKind.ok, Bytes.fill(resultSize, 0)) : x.result,
44
+ result: resultSize !== undefined ? WorkExecResult.ok(Bytes.fill(resultSize, 0)) : x.result,
45
45
  load: WorkRefineLoad.create({
46
46
  gasUsed: tryAsServiceGas(5),
47
47
  importedSegments: tryAsU32(0),
@@ -1 +1 @@
1
- {"version":3,"file":"verify-basic.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/reports/verify-basic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAe,CAAC;AAEvD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,CAkD3F"}
1
+ {"version":3,"file":"verify-basic.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/reports/verify-basic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAe,CAAC;AAEvD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,CA8D3F"}
@@ -1,4 +1,5 @@
1
1
  import { MAX_REPORT_DEPENDENCIES } from "#@typeberry/block/gp-constants.js";
2
+ import { isWorkItemsCount, MAX_NUMBER_OF_WORK_ITEMS, MIN_NUMBER_OF_WORK_ITEMS } from "#@typeberry/block/work-package.js";
2
3
  import { WorkExecResultKind } from "#@typeberry/block/work-result.js";
3
4
  import { OK, Result } from "#@typeberry/utils";
4
5
  import { ReportsError } from "./error.js";
@@ -11,6 +12,15 @@ export const MAX_WORK_REPORT_SIZE_BYTES = 48 * 2 ** 10;
11
12
  export function verifyReportsBasic(input) {
12
13
  for (const guarantee of input) {
13
14
  const reportView = guarantee.view().report.view();
15
+ /**
16
+ * Make sure number of results is within correct range.
17
+ */
18
+ if (!isWorkItemsCount(reportView.results.view().length)) {
19
+ return Result.error(ReportsError.InvalidWorkItemsCount, () => `Number of work results is invalid.
20
+ Got: ${reportView.results.view().length},
21
+ expected between ${MIN_NUMBER_OF_WORK_ITEMS} and ${MAX_NUMBER_OF_WORK_ITEMS}
22
+ `);
23
+ }
14
24
  /**
15
25
  * We limit the sum of the number of items in the
16
26
  * segment-root lookup dictionary and the number of
@@ -2,8 +2,10 @@ import { describe, it } from "node:test";
2
2
  import { tryAsTimeSlot } from "#@typeberry/block";
3
3
  import { ReportGuarantee } from "#@typeberry/block/guarantees.js";
4
4
  import { Bytes } from "#@typeberry/bytes";
5
+ import { FixedSizeArray } from "#@typeberry/collections";
5
6
  import { tinyChainSpec } from "#@typeberry/config";
6
7
  import { HASH_SIZE } from "#@typeberry/hash";
8
+ import { tryAsU8 } from "#@typeberry/numbers";
7
9
  import { asOpaqueType, deepEqual, OK } from "#@typeberry/utils";
8
10
  import { ReportsError } from "./error.js";
9
11
  import { guaranteesAsView, newCredential, newWorkReport } from "./test.utils.js";
@@ -44,6 +46,33 @@ describe("Reports.verifyReportsBasic", () => {
44
46
  details: () => "Work report at 0 too big. Got 0 + 49153, max: 49152",
45
47
  });
46
48
  });
49
+ it("should reject if report has invalid number of work results (0)", () => {
50
+ // Create a minimal work report with 0 results by manually constructing it
51
+ const emptyResults = FixedSizeArray.new([], tryAsU8(0));
52
+ const report = newWorkReport({ core: 0 });
53
+ // Bypass the type system to set 0 results
54
+ const invalidReport = {
55
+ ...report,
56
+ results: emptyResults,
57
+ };
58
+ const guarantees = guaranteesAsView(tinyChainSpec, [
59
+ ReportGuarantee.create({
60
+ slot: tryAsTimeSlot(10),
61
+ report: invalidReport,
62
+ credentials: asOpaqueType([0, 3].map((x) => newCredential(x))),
63
+ }),
64
+ ]);
65
+ const result = verifyReportsBasic(guarantees);
66
+ deepEqual(result, {
67
+ isOk: false,
68
+ isError: true,
69
+ error: ReportsError.InvalidWorkItemsCount,
70
+ details: () => `Number of work results is invalid.
71
+ Got: 0,
72
+ expected between 1 and 16
73
+ `,
74
+ });
75
+ });
47
76
  it("should verify correctly", () => {
48
77
  const guarantees = guaranteesAsView(tinyChainSpec, [
49
78
  ReportGuarantee.create({
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/block-authorship/main.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAI9E,KAAK,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAkBlD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,iBAyIlE"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/block-authorship/main.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAI9E,KAAK,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAkBlD,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,iBAgKlE"}
@@ -86,6 +86,8 @@ export async function main(config, comms) {
86
86
  }
87
87
  return Result.ok(state.sealingKeySeries);
88
88
  }
89
+ const isFastForward = config.workerParams.isFastForward;
90
+ let lastGeneratedSlot = startTimeSlot;
89
91
  while (!isFinished) {
90
92
  const hash = blocks.getBestHeaderHash();
91
93
  const state = states.getState(hash);
@@ -93,10 +95,20 @@ export async function main(config, comms) {
93
95
  if (state === null) {
94
96
  continue;
95
97
  }
96
- const time = getTime();
97
- /** Assuming `slotDuration` is 6 sec it is safe till year 2786. If `slotDuration` is 1 sec then it is safe till 2106 */
98
- const timeSlot = tryAsTimeSlot(Number(time / 1000n / BigInt(chainSpec.slotDuration)));
99
98
  const lastTimeSlot = state.timeslot;
99
+ /**
100
+ * In fastForward mode, use simulated time (next slot after current state).
101
+ * In normal mode, use wall clock time.
102
+ * Assuming `slotDuration` is 6 sec it is safe till year 2786.
103
+ * If `slotDuration` is 1 sec then it is safe till 2106.
104
+ */
105
+ const timeSlot = isFastForward === true
106
+ ? tryAsTimeSlot(lastTimeSlot + 1)
107
+ : tryAsTimeSlot(Number(getTime() / 1000n / BigInt(chainSpec.slotDuration)));
108
+ // In fastForward mode, skip if we already generated for this slot (waiting for import)
109
+ if (isFastForward === true && timeSlot <= lastGeneratedSlot) {
110
+ continue;
111
+ }
100
112
  const isNewEpoch = isEpochChanged(lastTimeSlot, timeSlot);
101
113
  const selingKeySeriesResult = await getSealingKeySeries(isNewEpoch, timeSlot, state);
102
114
  if (selingKeySeriesResult.isError) {
@@ -113,10 +125,17 @@ export async function main(config, comms) {
113
125
  const sealPayload = getSealPayload(selingKeySeriesResult.ok, entropy);
114
126
  const newBlock = await generator.nextBlockView(validatorIndex, key.bandersnatchSecret, sealPayload, timeSlot);
115
127
  counter += 1;
128
+ lastGeneratedSlot = timeSlot;
116
129
  logger.trace `Sending block ${counter}`;
117
130
  await comms.sendBlock(newBlock);
118
131
  }
119
- await setTimeout(chainSpec.slotDuration * 1000);
132
+ else if (isFastForward === true) {
133
+ // In fast-forward mode, if this slot is not ours, wait briefly for other validators to produce blocks
134
+ await setTimeout(10);
135
+ }
136
+ if (isFastForward === false) {
137
+ await setTimeout(chainSpec.slotDuration * 1000);
138
+ }
120
139
  }
121
140
  logger.info `🎁 Block Authorship finished. Closing channel.`;
122
141
  await db.close();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/block-authorship",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "A test block generator simulating blocks received over the network.",
5
5
  "main": "index.ts",
6
6
  "dependencies": {
@@ -275,13 +275,15 @@ export declare class ValidatorSecrets {
275
275
  }
276
276
  export declare class BlockAuthorshipConfig {
277
277
  readonly keys: ValidatorSecrets[];
278
+ readonly isFastForward: boolean;
278
279
  static Codec: import("@typeberry/codec").Descriptor<BlockAuthorshipConfig, import("@typeberry/codec").ViewOf<BlockAuthorshipConfig, {
279
280
  keys: import("@typeberry/codec").Descriptor<ValidatorSecrets[], import("@typeberry/codec").SequenceView<ValidatorSecrets, import("@typeberry/codec").ViewOf<ValidatorSecrets, {
280
281
  bandersnatch: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32> & import("@typeberry/utils").WithOpaque<"BandersnatchSecretSeed">, import("@typeberry/bytes").Bytes<32>>;
281
282
  ed25519: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32> & import("@typeberry/utils").WithOpaque<"Ed25519SecretSeed">, import("@typeberry/bytes").Bytes<32>>;
282
283
  }>>>;
284
+ isFastForward: import("@typeberry/codec").Descriptor<boolean, boolean>;
283
285
  }>>;
284
- static create({ keys }: CodecRecord<BlockAuthorshipConfig>): BlockAuthorshipConfig;
286
+ static create({ keys, isFastForward }: CodecRecord<BlockAuthorshipConfig>): BlockAuthorshipConfig;
285
287
  private constructor();
286
288
  }
287
289
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/block-authorship/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEL,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,GAAG,EAAkB,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAanB,CAAC;AAEH,qBAAa,gBAAgB;aAWT,YAAY,EAAE,sBAAsB;aACpC,OAAO,EAAE,iBAAiB;IAX5C,MAAM,CAAC,KAAK;;;QAGT;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,OAAO,E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AY,EAAE,OAAO,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC;IAItE,OAAO;CAIR;AAED,qBAAa,qBAAqB;aAWd,IAAI,EAAE,gBAAgB,EAAE;aACxB,aAAa,EAAE,OAAO;IAXxC,MAAM,CAAC,KAAK;;;;;;QAGT;IAEH,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,WAAW,CAAC,qBAAqB,CAAC;IAIzE,OAAO;CAIR"}
@@ -33,13 +33,16 @@ export class ValidatorSecrets {
33
33
  }
34
34
  export class BlockAuthorshipConfig {
35
35
  keys;
36
+ isFastForward;
36
37
  static Codec = codec.Class(BlockAuthorshipConfig, {
37
38
  keys: codec.sequenceVarLen(ValidatorSecrets.Codec),
39
+ isFastForward: codec.bool,
38
40
  });
39
- static create({ keys }) {
40
- return new BlockAuthorshipConfig(keys);
41
+ static create({ keys, isFastForward }) {
42
+ return new BlockAuthorshipConfig(keys, isFastForward);
41
43
  }
42
- constructor(keys) {
44
+ constructor(keys, isFastForward) {
43
45
  this.keys = keys;
46
+ this.isFastForward = isFastForward;
44
47
  }
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/importer/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AACvH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gC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oB;IAMpB,gBAAgB;IAIhB,eAAe,CAAC,UAAU,EAAE,UAAU;IAKhC,KAAK;CAIZ"}
@@ -52,7 +52,6 @@ export class Importer {
52
52
  this.logger.error `Unable to prepare for next epoch: ${e}`;
53
53
  }
54
54
  }
55
- // TODO [ToDr] import block and get state root
56
55
  async importBlockWithStateRoot(block) {
57
56
  const res = await this.importBlock(block);
58
57
  if (res.isOk) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/importer",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "A JAM block importer queue.",
5
5
  "main": "index.ts",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"pvm-executor.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/pvm-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAc,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0DAA0D,CAAC;AAM7F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAkBpD,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAChD,oBAAoB,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CACpH,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CA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