@leofcoin/messages 1.6.3 → 1.6.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.
@@ -1,8 +1,7 @@
1
1
  import proto from '../protos/block.proto.js';
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
3
  import ValidatorMessage from './validator.js';
4
- import smartConcat from '@vandeurenglenn/typed-array-smart-concat';
5
- import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat';
4
+ import { encodeFrames, decodeFrames } from '@leofcoin/binary';
6
5
  export default class BlockMessage extends FormatInterface {
7
6
  get messageName() {
8
7
  return 'BlockMessage';
@@ -24,14 +23,16 @@ export default class BlockMessage extends FormatInterface {
24
23
  }
25
24
  return super.encode({
26
25
  ...decoded,
27
- validators: smartConcat(validators)
26
+ validators: encodeFrames(validators)
28
27
  });
29
28
  }
30
29
  decode(encoded) {
31
30
  encoded = encoded || this.encoded;
32
31
  super.decode(encoded);
33
32
  // @ts-ignore
34
- this.decoded.validators = smartDeconcat(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
33
+ // Preserve historical acceptance of padded length prefixes. Tightening
34
+ // canonical protocol validation is a separate, versioned decision.
35
+ this.decoded.validators = decodeFrames(this.decoded.validators, 0, { canonical: false }).map((validator) => new ValidatorMessage(validator).decoded);
35
36
  return this.decoded;
36
37
  }
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/messages",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "exports": {
@@ -280,10 +280,9 @@
280
280
  "typescript": "npm:@typescript/typescript6@^6.0.2"
281
281
  },
282
282
  "dependencies": {
283
+ "@leofcoin/binary": "^1.0.1",
283
284
  "@leofcoin/codec-format-interface": "^1.8.2",
284
- "@leofcoin/utils": "^1.1.45",
285
- "@vandeurenglenn/typed-array-smart-concat": "^1.0.4",
286
- "@vandeurenglenn/typed-array-smart-deconcat": "^1.0.3"
285
+ "@leofcoin/utils": "^1.1.45"
287
286
  },
288
287
  "repository": {
289
288
  "type": "git",