@typeberry/lib 0.5.3-fb6e98a → 0.5.4-472e282

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 (162) hide show
  1. package/package.json +1 -1
  2. package/packages/core/networking/certificate.d.ts.map +1 -1
  3. package/packages/core/networking/certificate.js +1 -0
  4. package/packages/core/networking/package.json +1 -1
  5. package/packages/core/networking/setup.d.ts.map +1 -1
  6. package/packages/core/networking/setup.js +16 -12
  7. package/packages/core/telemetry/package.json +1 -1
  8. package/packages/core/utils/compatibility.d.ts +0 -1
  9. package/packages/core/utils/compatibility.d.ts.map +1 -1
  10. package/packages/core/utils/compatibility.js +1 -2
  11. package/packages/core/utils/compatibility.test.js +6 -10
  12. package/packages/extensions/ipc/jamnp/handler.d.ts +5 -4
  13. package/packages/extensions/ipc/jamnp/handler.d.ts.map +1 -1
  14. package/packages/extensions/ipc/jamnp/handler.js +59 -34
  15. package/packages/extensions/ipc/jamnp/stream.d.ts +6 -4
  16. package/packages/extensions/ipc/jamnp/stream.d.ts.map +1 -1
  17. package/packages/jam/block/index.d.ts +11 -11
  18. package/packages/jam/block/index.d.ts.map +1 -1
  19. package/packages/jam/block/index.js +11 -11
  20. package/packages/jam/block/work-package.d.ts +3 -1
  21. package/packages/jam/block/work-package.d.ts.map +1 -1
  22. package/packages/jam/block/work-package.js +6 -2
  23. package/packages/jam/block-json/block.d.ts +125 -0
  24. package/packages/jam/block-json/block.d.ts.map +1 -1
  25. package/packages/jam/block-json/block.js +9 -2
  26. package/packages/jam/database-lmdb/states.test.js +3 -5
  27. package/packages/jam/fuzz-proto/v1/handler.d.ts +1 -1
  28. package/packages/jam/fuzz-proto/v1/handler.d.ts.map +1 -1
  29. package/packages/jam/fuzz-proto/v1/handler.js +43 -19
  30. package/packages/jam/fuzz-proto/v1/types.d.ts +1 -1
  31. package/packages/jam/jam-host-calls/accumulate/bless.d.ts.map +1 -1
  32. package/packages/jam/jam-host-calls/accumulate/bless.js +6 -10
  33. package/packages/jam/jam-host-calls/accumulate/bless.test.js +32 -72
  34. package/packages/jam/jam-host-calls/accumulate/new.d.ts.map +1 -1
  35. package/packages/jam/jam-host-calls/accumulate/new.js +2 -4
  36. package/packages/jam/jam-host-calls/accumulate/new.test.js +4 -5
  37. package/packages/jam/jam-host-calls/general/fetch.d.ts +1 -57
  38. package/packages/jam/jam-host-calls/general/fetch.d.ts.map +1 -1
  39. package/packages/jam/jam-host-calls/general/fetch.js +6 -29
  40. package/packages/jam/jam-host-calls/general/fetch.test.js +2 -58
  41. package/packages/jam/jamnp-s/peers.d.ts.map +1 -1
  42. package/packages/jam/jamnp-s/peers.js +10 -0
  43. package/packages/jam/jamnp-s/protocol/ce-128-block-request.d.ts +1 -1
  44. package/packages/jam/jamnp-s/protocol/ce-128-block-request.d.ts.map +1 -1
  45. package/packages/jam/jamnp-s/protocol/ce-128-block-request.js +10 -8
  46. package/packages/jam/jamnp-s/protocol/ce-129-state-request.d.ts.map +1 -1
  47. package/packages/jam/jamnp-s/protocol/ce-129-state-request.js +11 -9
  48. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.d.ts +3 -3
  49. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.d.ts.map +1 -1
  50. package/packages/jam/jamnp-s/protocol/ce-131-ce-132-safrole-ticket-distribution.js +2 -2
  51. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts +6 -6
  52. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts.map +1 -1
  53. package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.js +2 -2
  54. package/packages/jam/jamnp-s/protocol/ce-134-work-package-sharing.d.ts.map +1 -1
  55. package/packages/jam/jamnp-s/protocol/ce-134-work-package-sharing.js +8 -6
  56. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.d.ts +16 -16
  57. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.d.ts.map +1 -1
  58. package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.js +2 -2
  59. package/packages/jam/jamnp-s/protocol/stream.d.ts +13 -7
  60. package/packages/jam/jamnp-s/protocol/stream.d.ts.map +1 -1
  61. package/packages/jam/jamnp-s/protocol/stream.js +5 -4
  62. package/packages/jam/jamnp-s/protocol/test-utils.d.ts +1 -1
  63. package/packages/jam/jamnp-s/protocol/test-utils.d.ts.map +1 -1
  64. package/packages/jam/jamnp-s/protocol/test-utils.js +9 -12
  65. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.d.ts +2 -2
  66. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.d.ts.map +1 -1
  67. package/packages/jam/jamnp-s/protocol/up-0-block-announcement.js +1 -1
  68. package/packages/jam/jamnp-s/stream-manager.d.ts.map +1 -1
  69. package/packages/jam/jamnp-s/stream-manager.js +7 -5
  70. package/packages/jam/jamnp-s/stream-manager.test.js +8 -5
  71. package/packages/jam/jamnp-s/tasks/sync.js +1 -1
  72. package/packages/jam/node/jam-config.d.ts +4 -1
  73. package/packages/jam/node/jam-config.d.ts.map +1 -1
  74. package/packages/jam/node/jam-config.js +6 -2
  75. package/packages/jam/node/main.d.ts.map +1 -1
  76. package/packages/jam/node/main.js +5 -4
  77. package/packages/jam/node/package.json +1 -1
  78. package/packages/jam/node/reader.d.ts +25 -25
  79. package/packages/jam/node/workers.d.ts +183 -183
  80. package/packages/jam/state/accumulation-queue.d.ts +26 -26
  81. package/packages/jam/state/assurances.d.ts +26 -26
  82. package/packages/jam/state/privileged-services.d.ts +1 -1
  83. package/packages/jam/state/privileged-services.d.ts.map +1 -1
  84. package/packages/jam/state/privileged-services.js +1 -6
  85. package/packages/jam/state/service.d.ts +1 -1
  86. package/packages/jam/state/service.d.ts.map +1 -1
  87. package/packages/jam/state/statistics.d.ts +0 -8
  88. package/packages/jam/state/statistics.d.ts.map +1 -1
  89. package/packages/jam/state/statistics.js +14 -44
  90. package/packages/jam/state/statistics.test.js +1 -8
  91. package/packages/jam/state/test.utils.d.ts +1 -1
  92. package/packages/jam/state/test.utils.d.ts.map +1 -1
  93. package/packages/jam/state/test.utils.js +4 -22
  94. package/packages/jam/state-json/accounts.d.ts +10 -0
  95. package/packages/jam/state-json/accounts.d.ts.map +1 -1
  96. package/packages/jam/state-json/accounts.js +47 -19
  97. package/packages/jam/state-json/dump.d.ts.map +1 -1
  98. package/packages/jam/state-json/dump.js +5 -9
  99. package/packages/jam/state-json/dump.test.js +2 -10
  100. package/packages/jam/state-json/statistics.d.ts +1 -1
  101. package/packages/jam/state-json/statistics.d.ts.map +1 -1
  102. package/packages/jam/state-json/statistics.js +1 -13
  103. package/packages/jam/state-merkleization/in-memory-state-codec.d.ts +29 -31
  104. package/packages/jam/state-merkleization/in-memory-state-codec.d.ts.map +1 -1
  105. package/packages/jam/state-merkleization/serialize.d.ts +4 -4
  106. package/packages/jam/state-merkleization/serialize.d.ts.map +1 -1
  107. package/packages/jam/state-merkleization/serialize.js +5 -8
  108. package/packages/jam/state-merkleization/serialized-state-view.d.ts.map +1 -1
  109. package/packages/jam/state-merkleization/state-entries.test.js +1 -7
  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-state.d.ts +1 -2
  114. package/packages/jam/transition/accumulate/accumulate-state.d.ts.map +1 -1
  115. package/packages/jam/transition/accumulate/accumulate-utils.d.ts.map +1 -1
  116. package/packages/jam/transition/accumulate/accumulate-utils.js +2 -6
  117. package/packages/jam/transition/accumulate/accumulate-utils.test.js +2 -4
  118. package/packages/jam/transition/accumulate/accumulate.d.ts.map +1 -1
  119. package/packages/jam/transition/accumulate/accumulate.js +11 -20
  120. package/packages/jam/transition/accumulate/index.d.ts +0 -1
  121. package/packages/jam/transition/accumulate/index.d.ts.map +1 -1
  122. package/packages/jam/transition/accumulate/index.js +0 -1
  123. package/packages/jam/transition/accumulate/operand.d.ts +7 -7
  124. package/packages/jam/transition/chain-stf.d.ts +3 -5
  125. package/packages/jam/transition/chain-stf.d.ts.map +1 -1
  126. package/packages/jam/transition/chain-stf.js +5 -29
  127. package/packages/jam/transition/disputes/disputes.test.data2.d.ts +3 -3
  128. package/packages/jam/transition/disputes/disputes.test.data2.d.ts.map +1 -1
  129. package/packages/jam/transition/externalities/accumulate-externalities.d.ts.map +1 -1
  130. package/packages/jam/transition/externalities/accumulate-externalities.js +22 -49
  131. package/packages/jam/transition/externalities/accumulate-externalities.test.js +8 -72
  132. package/packages/jam/transition/externalities/fetch-externalities.d.ts +3 -22
  133. package/packages/jam/transition/externalities/fetch-externalities.d.ts.map +1 -1
  134. package/packages/jam/transition/externalities/fetch-externalities.js +3 -55
  135. package/packages/jam/transition/externalities/fetch-externalities.test.js +199 -112
  136. package/packages/jam/transition/reports/error.d.ts +3 -1
  137. package/packages/jam/transition/reports/error.d.ts.map +1 -1
  138. package/packages/jam/transition/reports/error.js +2 -0
  139. package/packages/jam/transition/reports/verify-basic.d.ts.map +1 -1
  140. package/packages/jam/transition/reports/verify-basic.js +10 -0
  141. package/packages/jam/transition/reports/verify-basic.test.js +29 -0
  142. package/packages/jam/transition/statistics.d.ts +0 -7
  143. package/packages/jam/transition/statistics.d.ts.map +1 -1
  144. package/packages/jam/transition/statistics.js +2 -11
  145. package/packages/jam/transition/statistics.test.js +0 -40
  146. package/packages/workers/block-authorship/generator.test.d.ts +2 -0
  147. package/packages/workers/block-authorship/generator.test.d.ts.map +1 -0
  148. package/packages/workers/block-authorship/generator.test.js +200 -0
  149. package/packages/workers/block-authorship/main.d.ts.map +1 -1
  150. package/packages/workers/block-authorship/main.js +23 -4
  151. package/packages/workers/block-authorship/package.json +1 -1
  152. package/packages/workers/block-authorship/protocol.d.ts +53 -51
  153. package/packages/workers/block-authorship/protocol.d.ts.map +1 -1
  154. package/packages/workers/block-authorship/protocol.js +6 -3
  155. package/packages/workers/importer/importer.d.ts.map +1 -1
  156. package/packages/workers/importer/importer.js +0 -1
  157. package/packages/workers/importer/package.json +1 -1
  158. package/packages/workers/importer/protocol.d.ts +54 -54
  159. package/packages/workers/jam-network/protocol.d.ts +79 -79
  160. package/packages/jam/transition/accumulate/deferred-transfers.d.ts +0 -36
  161. package/packages/jam/transition/accumulate/deferred-transfers.d.ts.map +0 -1
  162. package/packages/jam/transition/accumulate/deferred-transfers.js +0 -94
@@ -1 +1 @@
1
- {"version":3,"file":"accumulate-state.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,YAAc,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,2CAA2C;IAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,6DAA6D;IAC7D,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,KAAK,EACH,UAAU,GACV,yBAAyB,GACzB,YAAY,GACZ,YAAY,GACZ,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,CACvB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,mBAAmB,CAAC,CAAC,GACjE,kBAAkB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,qBAAqB,CAAC;IACnC,sBAAsB,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxD,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,qBAAqB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CACxD,CAAC"}
1
+ {"version":3,"file":"accumulate-state.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,YAAc,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,2CAA2C;IAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,6DAA6D;IAC7D,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,KAAK,EACH,UAAU,GACV,yBAAyB,GACzB,YAAY,GACZ,YAAY,GACZ,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,CACvB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,mBAAmB,CAAC,CAAC,GACjE,kBAAkB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,qBAAqB,CAAC;IACnC,sBAAsB,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxD,qBAAqB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CACxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accumulate-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AAEnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;AAI1D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAQnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAGpF;AAED,KAAK,kBAAkB,GAAG;IACxB,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,sCAAsC;IACtC,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAQF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,kBAAkB,EACpD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GACf,SAAS,CAkBX"}
1
+ {"version":3,"file":"accumulate-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AAEnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;AAG1D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAQnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAGpF;AAED,KAAK,kBAAkB,GAAG;IACxB,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,sCAAsC;IACtC,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAQF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,kBAAkB,EACpD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GACf,SAAS,CAeX"}
@@ -4,7 +4,6 @@ import { codec, Encoder } from "#@typeberry/codec";
4
4
  import { HashSet } from "#@typeberry/collections";
5
5
  import { HASH_SIZE } from "#@typeberry/hash";
6
6
  import { leBytesAsU32 } from "#@typeberry/numbers";
7
- import { Compatibility, GpVersion } from "#@typeberry/utils";
8
7
  /**
9
8
  * A function that removes duplicates but does not change order - it keeps the first occurence.
10
9
  */
@@ -44,9 +43,6 @@ export function generateNextServiceId({ serviceId, entropy, timeslot }, chainSpe
44
43
  }, chainSpec);
45
44
  const result = blake2b.hashBytes(encoded).raw.subarray(0, 4);
46
45
  const number = leBytesAsU32(result) >>> 0;
47
- const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
48
- ? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
49
- : 2 ** 32 - 2 ** 9;
50
- const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
51
- return tryAsServiceId((number % mod) + offset);
46
+ const mod = 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8;
47
+ return tryAsServiceId((number % mod) + MIN_PUBLIC_SERVICE_INDEX);
52
48
  }
@@ -10,7 +10,7 @@ import { FixedSizeArray, HashSet } from "#@typeberry/collections";
10
10
  import { tinyChainSpec } from "#@typeberry/config";
11
11
  import { Blake2b, HASH_SIZE } from "#@typeberry/hash";
12
12
  import { tryAsU16, tryAsU32 } from "#@typeberry/numbers";
13
- import { Compatibility, deepEqual, GpVersion } from "#@typeberry/utils";
13
+ import { deepEqual } from "#@typeberry/utils";
14
14
  import { generateNextServiceId, getWorkPackageHashes, uniquePreserveOrder } from "./accumulate-utils.js";
15
15
  let blake2b;
16
16
  before(async () => {
@@ -78,9 +78,7 @@ describe("accumulate-utils", () => {
78
78
  const serviceId = tryAsServiceId(5);
79
79
  const entropy = Bytes.fill(HASH_SIZE, 4).asOpaque();
80
80
  const timeslot = tryAsTimeSlot(6);
81
- const expectedServiceId = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
82
- ? tryAsServiceId(2596254713)
83
- : tryAsServiceId(2596189433);
81
+ const expectedServiceId = tryAsServiceId(2596254713);
84
82
  const result = generateNextServiceId({ serviceId, entropy, timeslot }, tinyChainSpec, blake2b);
85
83
  assert.strictEqual(result, expectedServiceId);
86
84
  });
@@ -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;AAEnD,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,iBAAiB,CAAC;AAiB3E,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;AAEtD,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,iBAAiB;gBAH1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,iBAAiB;IAO5C;;;;OAIG;IACH,OAAO,CAAC,q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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;IAmGrC;;;;OAIG;YACW,uBAAuB;IAiDrC;;;;;;;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;CA0FrH"}
@@ -86,9 +86,7 @@ export class Accumulate {
86
86
  }
87
87
  const nextServiceId = generateNextServiceId({ serviceId, entropy, timeslot: slot }, this.chainSpec, this.blake2b);
88
88
  const partialState = new AccumulateExternalities(this.chainSpec, this.blake2b, updatedState, serviceId, nextServiceId, slot);
89
- const fetchExternalities = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
90
- ? FetchExternalities.createForAccumulate({ entropy, transfers, operands }, this.chainSpec)
91
- : FetchExternalities.createForPre071Accumulate({ entropy, operands }, this.chainSpec);
89
+ const fetchExternalities = FetchExternalities.createForAccumulate({ entropy, transfers, operands }, this.chainSpec);
92
90
  const externalities = {
93
91
  partialState,
94
92
  serviceExternalities: partialState,
@@ -137,19 +135,16 @@ export class Accumulate {
137
135
  async accumulateSingleService(serviceId, transfers, operands, gasCost, slot, entropy, inputStateUpdate) {
138
136
  logger.log `Accumulating service ${serviceId}, transfers: ${transfers.length} operands: ${operands.length} at slot: ${slot}`;
139
137
  const updatedState = new PartiallyUpdatedState(this.state, inputStateUpdate);
140
- // update service balance from incoming transfers
141
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
142
- const serviceInfo = updatedState.getServiceInfo(serviceId);
143
- if (serviceInfo !== null) {
144
- // update the balance from incoming tranfsers
145
- const newBalance = sumU64(serviceInfo.balance, ...transfers.map((item) => item.amount));
146
- if (newBalance.overflow) {
147
- logger.log `Accumulation failed because of overflowing balance ${serviceId}.`;
148
- return { stateUpdate: null, consumedGas: tryAsServiceGas(0n) };
149
- }
150
- const newInfo = ServiceAccountInfo.create({ ...serviceInfo, balance: newBalance.value });
151
- updatedState.updateServiceInfo(serviceId, newInfo);
138
+ const serviceInfo = updatedState.getServiceInfo(serviceId);
139
+ if (serviceInfo !== null) {
140
+ // update the balance from incoming transfers
141
+ const newBalance = sumU64(serviceInfo.balance, ...transfers.map((item) => item.amount));
142
+ if (newBalance.overflow) {
143
+ logger.log `Accumulation failed because of overflowing balance ${serviceId}.`;
144
+ return { stateUpdate: null, consumedGas: tryAsServiceGas(0n) };
152
145
  }
146
+ const newInfo = ServiceAccountInfo.create({ ...serviceInfo, balance: newBalance.value });
147
+ updatedState.updateServiceInfo(serviceId, newInfo);
153
148
  }
154
149
  const result = await this.pvmAccumulateInvocation(slot, serviceId, transfers, operands, gasCost, entropy, updatedState);
155
150
  if (result.isError) {
@@ -384,7 +379,6 @@ export class Accumulate {
384
379
  }
385
380
  async transition({ reports, slot, entropy }) {
386
381
  const statistics = new Map();
387
- const legacyTransfers = [];
388
382
  const yieldedRoots = new Map();
389
383
  const accumulateQueue = new AccumulateQueue(this.chainSpec, this.state);
390
384
  const toAccumulateImmediately = accumulateQueue.getWorkReportsToAccumulateImmediately(reports);
@@ -395,9 +389,7 @@ export class Accumulate {
395
389
  const accumulatableReports = ArrayView.from(toAccumulateImmediately.concat(queue));
396
390
  const gasLimit = this.getGasLimit();
397
391
  const autoAccumulateServices = this.state.privilegedServices.autoAccumulateServices;
398
- const { accumulatedReports, gasCost, state, ...rest } = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
399
- ? await this.accumulateSequentially(gasLimit, accumulatableReports, [], slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots)
400
- : await this.accumulateSequentiallyLegacy(gasLimit, accumulatableReports, slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots, legacyTransfers);
392
+ const { accumulatedReports, gasCost, state, ...rest } = await this.accumulateSequentially(gasLimit, accumulatableReports, [], slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots);
401
393
  // we can safely ignore top-level gas cost from accSequentially.
402
394
  const _gasCost = gasCost;
403
395
  assertEmpty(rest);
@@ -434,7 +426,6 @@ export class Accumulate {
434
426
  ...authQueues,
435
427
  },
436
428
  accumulationStatistics: statistics,
437
- pendingTransfers: legacyTransfers,
438
429
  accumulationOutputLog: accumulationOutput,
439
430
  });
440
431
  }
@@ -1,5 +1,4 @@
1
1
  export * from "./accumulate.js";
2
2
  export * from "./accumulate-state.js";
3
- export * from "./deferred-transfers.js";
4
3
  export * from "./options.js";
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export * from "./accumulate.js";
2
2
  export * from "./accumulate-state.js";
3
- export * from "./deferred-transfers.js";
4
3
  export * from "./options.js";
@@ -18,20 +18,20 @@ export declare class Operand extends WithDebug {
18
18
  payloadHash: import("@typeberry/codec").Descriptor<import("@typeberry/bytes").Bytes<32>, import("@typeberry/bytes").Bytes<32>>;
19
19
  gas: import("@typeberry/codec").Descriptor<bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">, import("@typeberry/numbers").U64>;
20
20
  result: import("@typeberry/codec").Descriptor<WorkExecResult, {
21
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.ok;
21
+ kind: import("@typeberry/block").WorkExecResultKind.ok;
22
22
  okBlob: BytesBlob;
23
23
  } | {
24
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.outOfGas;
24
+ kind: import("@typeberry/block").WorkExecResultKind.outOfGas;
25
25
  } | {
26
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.panic;
26
+ kind: import("@typeberry/block").WorkExecResultKind.panic;
27
27
  } | {
28
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.incorrectNumberOfExports;
28
+ kind: import("@typeberry/block").WorkExecResultKind.incorrectNumberOfExports;
29
29
  } | {
30
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.digestTooBig;
30
+ kind: import("@typeberry/block").WorkExecResultKind.digestTooBig;
31
31
  } | {
32
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.badCode;
32
+ kind: import("@typeberry/block").WorkExecResultKind.badCode;
33
33
  } | {
34
- kind: import("@typeberry/block/work-result.js").WorkExecResultKind.codeOversize;
34
+ kind: import("@typeberry/block").WorkExecResultKind.codeOversize;
35
35
  }>;
36
36
  authorizationOutput: import("@typeberry/codec").Descriptor<BytesBlob, BytesBlob>;
37
37
  }>>;
@@ -7,7 +7,7 @@ import type { SafroleErrorCode, SafroleStateUpdate } from "#@typeberry/safrole/s
7
7
  import { type SafroleSealError } from "#@typeberry/safrole/safrole-seal.js";
8
8
  import type { State, WithStateView } from "#@typeberry/state";
9
9
  import { type ErrorResult, Result, type TaggedError } from "#@typeberry/utils";
10
- import { type ACCUMULATION_ERROR, type AccumulateOptions, type AccumulateStateUpdate, type DeferredTransfersErrorCode } from "./accumulate/index.js";
10
+ import { type ACCUMULATION_ERROR, type AccumulateOptions, type AccumulateStateUpdate } from "./accumulate/index.js";
11
11
  import { type AssurancesError, type AssurancesStateUpdate } from "./assurances.js";
12
12
  import { type AuthorizationStateUpdate } from "./authorization.js";
13
13
  import type { TransitionHasher } from "./hasher.js";
@@ -32,10 +32,9 @@ export declare enum StfErrorKind {
32
32
  Preimages = 4,
33
33
  SafroleSeal = 5,
34
34
  Accumulate = 6,
35
- DeferredTransfers = 7,
36
- Offenders = 8
35
+ Offenders = 7
37
36
  }
38
- export type StfError = TaggedError<StfErrorKind.Assurances, AssurancesError> | TaggedError<StfErrorKind.Reports, ReportsError> | TaggedError<StfErrorKind.Disputes, DisputesErrorCode> | TaggedError<StfErrorKind.Safrole, SafroleErrorCode> | TaggedError<StfErrorKind.Preimages, PreimagesErrorCode> | TaggedError<StfErrorKind.SafroleSeal, SafroleSealError> | TaggedError<StfErrorKind.Accumulate, ACCUMULATION_ERROR> | TaggedError<StfErrorKind.DeferredTransfers, DeferredTransfersErrorCode> | TaggedError<StfErrorKind.Offenders, OFFENDERS_ERROR>;
37
+ export type StfError = TaggedError<StfErrorKind.Assurances, AssurancesError> | TaggedError<StfErrorKind.Reports, ReportsError> | TaggedError<StfErrorKind.Disputes, DisputesErrorCode> | TaggedError<StfErrorKind.Safrole, SafroleErrorCode> | TaggedError<StfErrorKind.Preimages, PreimagesErrorCode> | TaggedError<StfErrorKind.SafroleSeal, SafroleSealError> | TaggedError<StfErrorKind.Accumulate, ACCUMULATION_ERROR> | TaggedError<StfErrorKind.Offenders, OFFENDERS_ERROR>;
39
38
  export declare const stfError: <Kind extends StfErrorKind, Err extends StfError["error"]>(kind: Kind, nested: ErrorResult<Err>) => Result<Ok, {
40
39
  readonly kind: Kind;
41
40
  readonly error: Err;
@@ -55,7 +54,6 @@ export declare class OnChain {
55
54
  private readonly assurances;
56
55
  private readonly accumulate;
57
56
  private readonly accumulateOutput;
58
- private readonly deferredTransfers;
59
57
  private readonly preimages;
60
58
  private readonly recentHistory;
61
59
  private readonly authorization;
@@ -1 +1 @@
1
- {"version":3,"file":"chain-stf.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/transition/chain-stf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,UAAU,EAAa,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAIpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,KAAK,EAAkB,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAIL,KAAK,WAAW,EAIhB,MAAM,EACN,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE1B,KAAK,0BAA0B,EAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAa,KAAK,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,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAqNzF,OAAO,CAAC,uBAAuB;CAWhC"}
@@ -5,9 +5,9 @@ import { Logger } from "#@typeberry/logger";
5
5
  import { Safrole } from "#@typeberry/safrole";
6
6
  import { BandernsatchWasm } from "#@typeberry/safrole/bandersnatch-wasm.js";
7
7
  import { SafroleSeal } from "#@typeberry/safrole/safrole-seal.js";
8
- import { assertEmpty, Compatibility, check, GpVersion, measure, OK, Result, } from "#@typeberry/utils";
8
+ import { assertEmpty, measure, OK, Result } from "#@typeberry/utils";
9
9
  import { AccumulateOutput } from "./accumulate/accumulate-output.js";
10
- import { Accumulate, DeferredTransfers, } from "./accumulate/index.js";
10
+ import { Accumulate, } from "./accumulate/index.js";
11
11
  import { Assurances } from "./assurances.js";
12
12
  import { Authorization } from "./authorization.js";
13
13
  import { Preimages } from "./preimages.js";
@@ -53,8 +53,7 @@ export var StfErrorKind;
53
53
  StfErrorKind[StfErrorKind["Preimages"] = 4] = "Preimages";
54
54
  StfErrorKind[StfErrorKind["SafroleSeal"] = 5] = "SafroleSeal";
55
55
  StfErrorKind[StfErrorKind["Accumulate"] = 6] = "Accumulate";
56
- StfErrorKind[StfErrorKind["DeferredTransfers"] = 7] = "DeferredTransfers";
57
- StfErrorKind[StfErrorKind["Offenders"] = 8] = "Offenders";
56
+ StfErrorKind[StfErrorKind["Offenders"] = 7] = "Offenders";
58
57
  })(StfErrorKind || (StfErrorKind = {}));
59
58
  export const stfError = (kind, nested) => {
60
59
  return Result.taggedError(StfErrorKind, kind, nested);
@@ -75,8 +74,6 @@ export class OnChain {
75
74
  // chapter 12: https://graypaper.fluffylabs.dev/#/68eaa1f/159f02159f02?v=0.6.4
76
75
  accumulate;
77
76
  accumulateOutput;
78
- // chapter 12.3: https://graypaper.fluffylabs.dev/#/68eaa1f/178203178203?v=0.6.4
79
- deferredTransfers;
80
77
  // chapter 12.4: https://graypaper.fluffylabs.dev/#/68eaa1f/18cc0018cc00?v=0.6.4
81
78
  preimages;
82
79
  // after accumulation
@@ -101,7 +98,6 @@ export class OnChain {
101
98
  this.assurances = new Assurances(chainSpec, state, hasher.blake2b);
102
99
  this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state, options);
103
100
  this.accumulateOutput = new AccumulateOutput();
104
- this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, options.pvm);
105
101
  this.preimages = new Preimages(state, hasher.blake2b);
106
102
  this.authorization = new Authorization(chainSpec, state);
107
103
  }
@@ -216,29 +212,10 @@ export class OnChain {
216
212
  if (accumulateResult.isError) {
217
213
  return stfError(StfErrorKind.Accumulate, accumulateResult);
218
214
  }
219
- const { stateUpdate: accumulateUpdate, accumulationStatistics, pendingTransfers, accumulationOutputLog, ...accumulateRest } = accumulateResult.ok;
215
+ const { stateUpdate: accumulateUpdate, accumulationStatistics, accumulationOutputLog, ...accumulateRest } = accumulateResult.ok;
220
216
  assertEmpty(accumulateRest);
221
217
  const { privilegedServices: maybePrivilegedServices, authQueues: maybeAuthorizationQueues, designatedValidatorData: maybeDesignatedValidatorData, preimages: accumulatePreimages, accumulationQueue, recentlyAccumulated, ...servicesUpdateFromAccumulate } = accumulateUpdate;
222
- let transferStatistics = new Map();
223
- let servicesUpdate = { ...servicesUpdateFromAccumulate, preimages: accumulatePreimages };
224
- if (!Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
225
- const deferredTransfersResult = await this.deferredTransfers.transition({
226
- entropy: entropy[0],
227
- pendingTransfers,
228
- servicesUpdate,
229
- timeslot: timeSlot,
230
- });
231
- if (deferredTransfersResult.isError) {
232
- return stfError(StfErrorKind.DeferredTransfers, deferredTransfersResult);
233
- }
234
- const { servicesUpdate: servicesUpdateFromDeferredTransfers, transferStatistics: transferStatisticsFromDeferredTransfers, ...deferredTransfersRest } = deferredTransfersResult.ok;
235
- transferStatistics = transferStatisticsFromDeferredTransfers;
236
- servicesUpdate = servicesUpdateFromDeferredTransfers;
237
- assertEmpty(deferredTransfersRest);
238
- }
239
- else {
240
- check `${pendingTransfers.length === 0} All transfers should be already accumulated.`;
241
- }
218
+ const servicesUpdate = { ...servicesUpdateFromAccumulate, preimages: accumulatePreimages };
242
219
  const accumulateRoot = await this.accumulateOutput.transition({ accumulationOutputLog });
243
220
  // recent history
244
221
  const recentHistoryUpdate = this.recentHistory.transition({
@@ -264,7 +241,6 @@ export class OnChain {
264
241
  incomingReports: extrinsic.guarantees.map((g) => g.report),
265
242
  availableReports,
266
243
  accumulationStatistics,
267
- transferStatistics,
268
244
  reporters: reporters,
269
245
  currentValidatorData,
270
246
  });
@@ -2,8 +2,8 @@ import { type WorkPackageHash } from "#@typeberry/block/refine-context.js";
2
2
  import { WorkReport } from "#@typeberry/block/work-report.js";
3
3
  export declare const currentValidatorData: readonly import("@typeberry/state").ValidatorData[] & import("@typeberry/utils").WithOpaque<"ValidatorsCount">;
4
4
  export declare const previousValidatorData: readonly import("@typeberry/state").ValidatorData[] & import("@typeberry/utils").WithOpaque<"ValidatorsCount">;
5
- export declare const verdicts: import("@typeberry/block/disputes.js").Verdict[];
6
- export declare const culprits: import("@typeberry/block/disputes.js").Culprit[];
7
- export declare const faults: import("@typeberry/block/disputes.js").Fault[];
5
+ export declare const verdicts: import("@typeberry/block").Verdict[];
6
+ export declare const culprits: import("@typeberry/block").Culprit[];
7
+ export declare const faults: import("@typeberry/block").Fault[];
8
8
  export declare function workReport(packageHash: WorkPackageHash, coreIndex: number): WorkReport;
9
9
  //# sourceMappingURL=disputes.test.data2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"disputes.test.data2.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/disputes/disputes.test.data2.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAmB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAS9E,eAAO,MAAM,oBAAoB,gHA4BhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,gHA4BjC,CAAC;AAEF,eAAO,MAAM,QAAQ,kDAyED,CAAC;AAErB,eAAO,MAAM,QAAQ,kDAaD,CAAC;AAErB,eAAO,MAAM,MAAM,gDAQD,CAAC;AAEnB,wBAAgB,UAAU,CAAC,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cA4CzE"}
1
+ {"version":3,"file":"disputes.test.data2.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/disputes/disputes.test.data2.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAmB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAS9E,eAAO,MAAM,oBAAoB,gHA4BhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,gHA4BjC,CAAC;AAEF,eAAO,MAAM,QAAQ,sCAyED,CAAC;AAErB,eAAO,MAAM,QAAQ,sCAaD,CAAC;AAErB,eAAO,MAAM,MAAM,oCAQD,CAAC;AAEnB,wBAAgB,UAAU,CAAC,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cA4CzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"accumulate-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/accumulate-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EAId,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,M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SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,cAAc,CAAC,cAAc,EAAE,wBAAwB,CAAC,EACnE,SAAS,EAAE,SAAS,GAAG,IAAI,GAC1B,MAAM,CAAC,EAAE,EAAE,qBAAqB,CAAC;IA0BpC,wBAAwB,CACtB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAC7B,SAAS,EAAE,SAAS,GAAG,IAAI,EAC3B,SAAS,EAAE,SAAS,GAAG,IAAI,EAC3B,sBAAsB,EAAE,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,GACjD,MAAM,CAAC,EAAE,EAAE,qBAAqB,CAAC;IAiDpC,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK7B,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,EAAE,oBAAoB,CAAC;IAuDnG,KAAK,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI,EAAE,gBAAgB,EAAE,YAAY,GAAG,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC;IA8D5F,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;IAOvE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC;IAyBhF,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;CAO1E"}
1
+ {"version":3,"file":"accumulate-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/accumulate-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAA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AG,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC;IAyBhF,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;CAO1E"}
@@ -6,7 +6,7 @@ import { AccumulationStateUpdate, clampU64ToU32, EjectError, ForgetPreimageError
6
6
  import { Logger } from "#@typeberry/logger";
7
7
  import { maxU64, sumU64, tryAsU32, tryAsU64 } from "#@typeberry/numbers";
8
8
  import { LookupHistoryItem, PreimageItem, PrivilegedServices, ServiceAccountInfo, tryAsLookupHistorySlots, UpdatePreimage, } from "#@typeberry/state";
9
- import { assertNever, Compatibility, check, GpVersion, OK, Result } from "#@typeberry/utils";
9
+ import { assertNever, check, OK, Result } from "#@typeberry/utils";
10
10
  /**
11
11
  * Number of storage items required for ejection of the service.
12
12
  *
@@ -102,10 +102,7 @@ export class AccumulateExternalities {
102
102
  /** `check`: https://graypaper.fluffylabs.dev/#/ab2cdbd/30c60330c603?v=0.7.2 */
103
103
  getNextAvailableServiceId(serviceId) {
104
104
  let currentServiceId = serviceId;
105
- const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
106
- ? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
107
- : 2 ** 32 - 2 ** 9;
108
- const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
105
+ const mod = 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8;
109
106
  for (;;) {
110
107
  const service = this.getServiceInfo(currentServiceId);
111
108
  // we found an empty id
@@ -113,7 +110,7 @@ export class AccumulateExternalities {
113
110
  return currentServiceId;
114
111
  }
115
112
  // keep trying
116
- currentServiceId = tryAsServiceId(((currentServiceId - offset + 1 + mod) % mod) + offset);
113
+ currentServiceId = tryAsServiceId(((currentServiceId - MIN_PUBLIC_SERVICE_INDEX + 1 + mod) % mod) + MIN_PUBLIC_SERVICE_INDEX);
117
114
  }
118
115
  }
119
116
  checkPreimageStatus(hash, length) {
@@ -304,25 +301,23 @@ export class AccumulateExternalities {
304
301
  ...currentService,
305
302
  balance: tryAsU64(balanceLeftForCurrent),
306
303
  });
307
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
308
- if (wantedServiceId < MIN_PUBLIC_SERVICE_INDEX &&
309
- this.currentServiceId === this.updatedState.getPrivilegedServices().registrar) {
310
- // NOTE: It's safe to cast to `Number` here, bcs here service ID cannot be bigger than 2**16
311
- const newServiceId = tryAsServiceId(Number(wantedServiceId));
312
- if (this.getServiceInfo(newServiceId) !== null) {
313
- return Result.error(NewServiceError.RegistrarServiceIdAlreadyTaken, () => `Service ID ${newServiceId} already taken`);
314
- }
315
- // add the new service with selected ID
316
- // https://graypaper.fluffylabs.dev/#/ab2cdbd/36be0336c003?v=0.7.2
317
- this.updatedState.createService(newServiceId, newAccount, newLookupItem);
318
- // update the balance of current service
319
- // https://graypaper.fluffylabs.dev/#/ab2cdbd/36c20336c403?v=0.7.2
320
- this.updatedState.updateServiceInfo(this.currentServiceId, updatedCurrentAccount);
321
- return Result.ok(newServiceId);
304
+ if (wantedServiceId < MIN_PUBLIC_SERVICE_INDEX &&
305
+ this.currentServiceId === this.updatedState.getPrivilegedServices().registrar) {
306
+ // NOTE: It's safe to cast to `Number` here, bcs here service ID cannot be bigger than 2**16
307
+ const newServiceId = tryAsServiceId(Number(wantedServiceId));
308
+ if (this.getServiceInfo(newServiceId) !== null) {
309
+ return Result.error(NewServiceError.RegistrarServiceIdAlreadyTaken, () => `Service ID ${newServiceId} already taken`);
322
310
  }
323
- // NOTE: in case the service is not a registrar or the requested serviceId is out of range,
324
- // we completely ignore the `wantedServiceId` and assign a random one
325
- }
311
+ // add the new service with selected ID
312
+ // https://graypaper.fluffylabs.dev/#/ab2cdbd/36be0336c003?v=0.7.2
313
+ this.updatedState.createService(newServiceId, newAccount, newLookupItem);
314
+ // update the balance of current service
315
+ // https://graypaper.fluffylabs.dev/#/ab2cdbd/36c20336c403?v=0.7.2
316
+ this.updatedState.updateServiceInfo(this.currentServiceId, updatedCurrentAccount);
317
+ return Result.ok(newServiceId);
318
+ }
319
+ // NOTE: in case the service is not a registrar or the requested serviceId is out of range,
320
+ // we completely ignore the `wantedServiceId` and assign a random one
326
321
  const newServiceId = this.nextNewServiceId;
327
322
  // add the new service
328
323
  // https://graypaper.fluffylabs.dev/#/7e6ff6a/36cb0236cb02?v=0.6.7
@@ -367,7 +362,7 @@ export class AccumulateExternalities {
367
362
  logger.trace `Current service id (${this.currentServiceId}) is not an auth manager of core ${coreIndex} (expected: ${currentAssigners}) and cannot update authorization queue.`;
368
363
  return Result.error(UpdatePrivilegesError.UnprivilegedService, () => `Service ${this.currentServiceId} not assigner for core ${coreIndex} (expected: ${currentAssigners})`);
369
364
  }
370
- if (assigners === null && Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
365
+ if (assigners === null) {
371
366
  logger.trace `The new auth manager is not a valid service id.`;
372
367
  return Result.error(UpdatePrivilegesError.InvalidServiceId, () => `New auth manager is null for core ${coreIndex}`);
373
368
  }
@@ -375,25 +370,6 @@ export class AccumulateExternalities {
375
370
  return Result.ok(OK);
376
371
  }
377
372
  updatePrivilegedServices(manager, assigners, delegator, registrar, autoAccumulateServices) {
378
- if (!Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
379
- /** https://graypaper.fluffylabs.dev/#/7e6ff6a/36d90036de00?v=0.6.7 */
380
- const current = this.updatedState.getPrivilegedServices();
381
- const isManager = current.manager === this.currentServiceId;
382
- if (!isManager) {
383
- return Result.error(UpdatePrivilegesError.UnprivilegedService, () => `Service ${this.currentServiceId} is not manager`);
384
- }
385
- if (manager === null || delegator === null) {
386
- return Result.error(UpdatePrivilegesError.InvalidServiceId, () => "Either manager or delegator is not a valid service id.");
387
- }
388
- this.updatedState.stateUpdate.privilegedServices = PrivilegedServices.create({
389
- manager,
390
- assigners,
391
- delegator,
392
- registrar: registrar ?? tryAsServiceId(0),
393
- autoAccumulateServices,
394
- });
395
- return Result.ok(OK);
396
- }
397
373
  if (manager === null || delegator === null || registrar === null) {
398
374
  return Result.error(UpdatePrivilegesError.InvalidServiceId, () => "Either manager or delegator or registrar is not a valid service id.");
399
375
  }
@@ -527,9 +503,6 @@ export class AccumulateExternalities {
527
503
  }
528
504
  }
529
505
  function bumpServiceId(serviceId) {
530
- const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
531
- ? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
532
- : 2 ** 32 - 2 ** 9;
533
- const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
534
- return tryAsServiceId(offset + ((serviceId - offset + 42 + mod) % mod));
506
+ const mod = 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8;
507
+ return tryAsServiceId(MIN_PUBLIC_SERVICE_INDEX + ((serviceId - MIN_PUBLIC_SERVICE_INDEX + 42 + mod) % mod));
535
508
  }