@typeberry/jam 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,11 @@ Typeberry is a TypeScript implementation of [JAM protocol](https://graypaper.com
8
8
  PRs unless the contributor waives any claims to the prize and copy rights for
9
9
  the submitted code. By creating the PR you accept this requirement.**
10
10
 
11
+ ## Links
12
+
13
+ - [Documentation](https://fluffylabs.dev/typeberry)
14
+ - [Performance Charts](https://typeberry.fluffylabs.dev)
15
+
11
16
  ## Implementation status
12
17
 
13
18
  Gray Paper compliance can be controlled via `GP_VERSION` environment variable.
@@ -2878,7 +2878,11 @@ var TestSuite;
2878
2878
  })(TestSuite || (TestSuite = {}));
2879
2879
  const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
2880
2880
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
2881
- const DEFAULT_VERSION = GpVersion.V0_7_2;
2881
+ /**
2882
+ * Current version is set to track the jam-conformance testing.
2883
+ * Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
2884
+ */
2885
+ const DEFAULT_VERSION = GpVersion.V0_7_1;
2882
2886
  const env = typeof process === "undefined" ? {} : process.env;
2883
2887
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
2884
2888
  let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
@@ -2937,8 +2941,8 @@ class Compatibility {
2937
2941
  /**
2938
2942
  * Allows selecting different values for different Gray Paper versions from one record.
2939
2943
  *
2940
- * @param fallback The default value to return if no value is found for the current.
2941
- * @param record A record mapping versions to values, checking if the version is greater or equal to the current version.
2944
+ * fallback The default value to return if no value is found for the current.
2945
+ * versions A record mapping versions to values, checking if the version is greater or equal to the current version.
2942
2946
  * @returns The value for the current version, or the default value.
2943
2947
  */
2944
2948
  static selectIfGreaterOrEqual({ fallback, versions, }) {
@@ -3101,7 +3105,7 @@ const workspacePathFix = dev_env.NODE_ENV === "development"
3101
3105
 
3102
3106
  ;// CONCATENATED MODULE: ./packages/core/utils/opaque.ts
3103
3107
  /**
3104
- * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
3108
+ * `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
3105
3109
  * specified unique token Token. It means that base type cannot be assigned to unique type by accident.
3106
3110
  * Good examples of opaque types include:
3107
3111
  * - JWTs or other tokens - these are special kinds of string used for authorization purposes.
@@ -9024,11 +9028,9 @@ function reencodeAsView(codec, object, chainSpec) {
9024
9028
 
9025
9029
  /** Helper function to create most used hashes in the block */
9026
9030
  class TransitionHasher {
9027
- context;
9028
9031
  keccakHasher;
9029
9032
  blake2b;
9030
- constructor(context, keccakHasher, blake2b) {
9031
- this.context = context;
9033
+ constructor(keccakHasher, blake2b) {
9032
9034
  this.keccakHasher = keccakHasher;
9033
9035
  this.blake2b = blake2b;
9034
9036
  }
@@ -10202,11 +10204,32 @@ const ENTROPY_ENTRIES = 4;
10202
10204
 
10203
10205
  var UpdatePreimageKind;
10204
10206
  (function (UpdatePreimageKind) {
10205
- /** Insert new preimage and optionally update it's lookup history. */
10207
+ /**
10208
+ * Insert new preimage and optionally update it's lookup history.
10209
+ *
10210
+ * Used in: `provide`
10211
+ *
10212
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/383904383904?v=0.7.2
10213
+ */
10206
10214
  UpdatePreimageKind[UpdatePreimageKind["Provide"] = 0] = "Provide";
10207
- /** Remove a preimage and it's lookup history. */
10215
+ /**
10216
+ * Remove a preimage and it's lookup history.
10217
+ *
10218
+ * Used in: `forget` and `eject`
10219
+ *
10220
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/38c701380202?v=0.7.2
10221
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/379102379302?v=0.7.2
10222
+ */
10208
10223
  UpdatePreimageKind[UpdatePreimageKind["Remove"] = 1] = "Remove";
10209
- /** update or add lookup history for preimage hash/len to given value. */
10224
+ /**
10225
+ * Update or add lookup history for preimage hash/len to given value.
10226
+ *
10227
+ * Used in: `solicit` and `forget`
10228
+ *
10229
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/382802382802?v=0.7.2
10230
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/384002384b02?v=0.7.2
10231
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/38c60038ea00?v=0.7.2
10232
+ */
10210
10233
  UpdatePreimageKind[UpdatePreimageKind["UpdateOrAdd"] = 2] = "UpdateOrAdd";
10211
10234
  })(UpdatePreimageKind || (UpdatePreimageKind = {}));
10212
10235
  /**
@@ -10214,7 +10237,7 @@ var UpdatePreimageKind;
10214
10237
  *
10215
10238
  * Can be one of the following cases:
10216
10239
  * 1. Provide a new preimage blob and set the lookup history to available at `slot`.
10217
- * 2. Remove (expunge) a preimage and it's lookup history.
10240
+ * 2. Remove (forget) a preimage and it's lookup history.
10218
10241
  * 3. Update `LookupHistory` with given value.
10219
10242
  */
10220
10243
  class state_update_UpdatePreimage {
@@ -10965,7 +10988,7 @@ class Generator {
10965
10988
  // select validator for block
10966
10989
  const validatorId = tryAsValidatorIndex(newTimeSlot % 6);
10967
10990
  // retriev data from previous block
10968
- const hasher = new TransitionHasher(this.chainSpec, this.keccakHasher, this.blake2b);
10991
+ const hasher = new TransitionHasher(this.keccakHasher, this.blake2b);
10969
10992
  const parentHeaderHash = this.lastHeaderHash;
10970
10993
  const stateRoot = this.states.getStateRoot(this.lastState);
10971
10994
  // create extrinsic