@typeberry/convert 0.5.1-31343a9 → 0.5.1-45102d3

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 (3) hide show
  1. package/index.js +32 -1
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -20335,7 +20335,14 @@ const SUPPORTED_TYPES = [
20335
20335
  decode: StateTransition.Codec,
20336
20336
  json: () => StateTransition.fromJson,
20337
20337
  process: {
20338
- options: ["as-pre-state", "as-post-state", "as-fuzz-message", "as-block"],
20338
+ options: [
20339
+ "as-pre-state",
20340
+ "as-post-state",
20341
+ "as-fuzz-message",
20342
+ "as-block-fuzz-message",
20343
+ "as-state-fuzz-message",
20344
+ "as-block",
20345
+ ],
20339
20346
  run(spec, data, option, blake2b) {
20340
20347
  const test = data;
20341
20348
  if (option === "as-pre-state") {
@@ -20355,6 +20362,10 @@ const SUPPORTED_TYPES = [
20355
20362
  });
20356
20363
  }
20357
20364
  if (option === "as-fuzz-message") {
20365
+ // biome-ignore lint/suspicious/noConsole: deprecation warning
20366
+ console.warn("⚠️ Warning: 'as-fuzz-message' is deprecated and will be removed in version 0.6.0. Use 'as-block-fuzz-message' instead.");
20367
+ }
20368
+ if (option === "as-block-fuzz-message" || option === "as-fuzz-message") {
20358
20369
  const encoded = encoder_Encoder.encodeObject(Block.Codec, test.block, spec);
20359
20370
  const blockView = decoder_Decoder.decodeObject(Block.Codec.View, encoded, spec);
20360
20371
  const msg = {
@@ -20366,6 +20377,26 @@ const SUPPORTED_TYPES = [
20366
20377
  encode: types_messageCodec,
20367
20378
  });
20368
20379
  }
20380
+ if (option === "as-state-fuzz-message") {
20381
+ const init = Initialize.create({
20382
+ header: header_Header.empty(),
20383
+ keyvals: test.pre_state.keyvals,
20384
+ ancestry: [
20385
+ AncestryItem.create({
20386
+ headerHash: test.block.header.parentHeaderHash,
20387
+ slot: common_tryAsTimeSlot(Math.max(0, test.block.header.timeSlotIndex - 1)),
20388
+ }),
20389
+ ],
20390
+ });
20391
+ const msg = {
20392
+ type: types_MessageType.Initialize,
20393
+ value: init,
20394
+ };
20395
+ return looseType({
20396
+ value: msg,
20397
+ encode: types_messageCodec,
20398
+ });
20399
+ }
20369
20400
  throw new Error(`Invalid processing option: ${option}`);
20370
20401
  },
20371
20402
  },