@leofcoin/chain 1.10.22 → 1.11.0

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 (28) hide show
  1. package/README.md +74 -0
  2. package/exports/browser/beacon-wire.js +2 -2
  3. package/exports/browser/{browser-CCfR9KOM-UO9mzy-j.js → browser-CCfR9KOM-CNWKLusu.js} +3 -3
  4. package/exports/browser/{browser-crypto-CH0ua22L.js → browser-crypto-B_UJguhk.js} +453 -35
  5. package/exports/browser/chain.js +1234 -885
  6. package/exports/browser/{client-DbZBfpG6-CYDyUGUC.js → client-DbZBfpG6-C1cXgvfr.js} +4 -4
  7. package/exports/browser/{connection-monitor-DMGAhcC0.js → connection-monitor-BzbeYGEt.js} +46 -26
  8. package/exports/browser/{index-dTQVgkpf-C6SJ0ZYW.js → index-dTQVgkpf-CkoAiRNX.js} +3 -3
  9. package/exports/browser/{index-dxD17Fom.js → index-phv5KvaE.js} +7 -7
  10. package/exports/browser/{messages-DZYCxoZI-D6kIiLKF.js → messages-DZYCxoZI-B472zldo.js} +3 -3
  11. package/exports/browser/{node-browser-BMfelxXV.js → node-browser-BmyPBkL5.js} +36 -8
  12. package/exports/browser/node-browser.js +3 -3
  13. package/exports/browser/workers/block-worker.js +8 -9
  14. package/exports/browser/workers/machine-worker.js +141 -1195
  15. package/exports/{workers/worker-BDTWOCzS-COrAszCt.js → browser/workers/proposal.proto-8zgMfutf-B3So_tnS.js} +910 -398
  16. package/exports/chain.js +248 -960
  17. package/exports/{connection-monitor-h2L8vsS7.js → connection-monitor-BdFLRh-J.js} +33 -3
  18. package/exports/connection-monitor.js +1 -1
  19. package/exports/{constants-Dy9i9S_o.js → constants-BQ6f-_OT.js} +1 -1
  20. package/exports/hash-format-state.js +3 -3
  21. package/exports/machine.js +550 -0
  22. package/exports/node.js +33 -2
  23. package/exports/state-checkpoint-BiQ1EXzo.js +110 -0
  24. package/exports/state-checkpoint.js +3 -0
  25. package/exports/workers/block-worker.js +8 -9
  26. package/exports/workers/machine-worker.js +141 -1195
  27. package/exports/{browser/workers/worker-BDTWOCzS-COrAszCt.js → workers/proposal.proto-8zgMfutf-B3So_tnS.js} +910 -398
  28. package/package.json +7 -5
@@ -1,6 +1,6 @@
1
- import { E as EasyWorker, F as FormatInterface, p as proto$3, e as encodeFrames, d as decodeFrames, a as proto$2 } from './worker-BDTWOCzS-COrAszCt.js';
1
+ import { B as BinaryWorker, a as BinaryFormat, p as proto$2, e as encodeFrames, d as decodeFrames, b as proto$1 } from './proposal.proto-8zgMfutf-B3So_tnS.js';
2
2
 
3
- class ValidatorMessage extends FormatInterface {
3
+ class ValidatorMessage extends BinaryFormat {
4
4
  get messageName() {
5
5
  return 'ValidatorMessage';
6
6
  }
@@ -8,11 +8,11 @@ class ValidatorMessage extends FormatInterface {
8
8
  if (buffer instanceof ValidatorMessage)
9
9
  return buffer;
10
10
  const name = 'validator-message';
11
- super(buffer, proto$2, { name });
11
+ super(buffer, proto$1, { name });
12
12
  }
13
13
  }
14
14
 
15
- class BlockMessage extends FormatInterface {
15
+ class BlockMessage extends BinaryFormat {
16
16
  get messageName() {
17
17
  return 'BlockMessage';
18
18
  }
@@ -20,7 +20,7 @@ class BlockMessage extends FormatInterface {
20
20
  if (buffer instanceof BlockMessage)
21
21
  return buffer;
22
22
  const name = 'block-message';
23
- super(buffer, proto$3, { name });
23
+ super(buffer, proto$2, { name });
24
24
  }
25
25
  encode(decoded) {
26
26
  decoded = decoded || this.decoded;
@@ -40,14 +40,13 @@ class BlockMessage extends FormatInterface {
40
40
  encoded = encoded || this.encoded;
41
41
  super.decode(encoded);
42
42
  // @ts-ignore
43
- // Preserve historical acceptance of padded length prefixes. Tightening
44
- // canonical protocol validation is a separate, versioned decision.
45
- this.decoded.validators = decodeFrames(this.decoded.validators, 0, { canonical: false }).map((validator) => new ValidatorMessage(validator).decoded);
43
+ // Binary-only protocol also requires canonical validator frame lengths.
44
+ this.decoded.validators = decodeFrames(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
46
45
  return this.decoded;
47
46
  }
48
47
  }
49
48
 
50
- const worker = new EasyWorker();
49
+ const worker = new BinaryWorker();
51
50
  globalThis.BigNumber = BigNumber;
52
51
  globalThis.contracts = {};
53
52
  const run = async (blocks) => {