@leofcoin/chain 1.10.16 → 1.10.18

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 (31) hide show
  1. package/exports/beacon-envelope.js +6 -6
  2. package/exports/beacon-epoch.js +1 -1
  3. package/exports/beacon-lifecycle.js +1 -1
  4. package/exports/beacon-round.js +1 -1
  5. package/exports/beacon.js +15 -14
  6. package/exports/browser/_commonjsHelpers-B85MJLTf.js +5 -0
  7. package/exports/browser/beacon-envelope.js +61 -150
  8. package/exports/browser/beacon-epoch.js +2 -2
  9. package/exports/browser/beacon-lifecycle.js +3 -3
  10. package/exports/browser/beacon-round.js +2 -2
  11. package/exports/browser/beacon-wire.js +3 -3
  12. package/exports/browser/beacon.js +2483 -1228
  13. package/exports/browser/{browser-CCfR9KOM-CvhDZrGu.js → browser-CCfR9KOM-CpStHgTj.js} +4 -4
  14. package/exports/browser/{browser-crypto-CeE-yId5.js → browser-crypto-CH0ua22L.js} +1 -1
  15. package/exports/browser/chain.js +151 -81
  16. package/exports/browser/{client-CAC7RVMf-Dmz_2A_5.js → client-C_pBoi1g-_pfKzCvX.js} +256 -80
  17. package/exports/browser/{connection-monitor-Cmv00mwl.js → connection-monitor-D-krNiRH.js} +1 -1
  18. package/exports/browser/{hkdf-CnZvwpZ9.js → hkdf-BUHINPFj.js} +2 -94
  19. package/exports/browser/{index-BC-KRBgE.js → index-DmuI-29u.js} +1 -1
  20. package/exports/browser/{index-dTQVgkpf-CuHJWO2l.js → index-dTQVgkpf-BbdshWB0.js} +4 -4
  21. package/exports/browser/index.browser-CFfJpgKV.js +857 -0
  22. package/exports/browser/{messages-Dw86z0zq-DrPw_nlZ.js → messages-BGHaihSi-eHZVl0y9.js} +4 -4
  23. package/exports/browser/{node-browser-DWSdi-XP.js → node-browser-BNe-en1l.js} +5 -5
  24. package/exports/browser/node-browser.js +4 -4
  25. package/exports/browser/{sha2-piimb6xL.js → sha2-BKcEJzgd.js} +144 -3
  26. package/exports/browser/weierstrass-BVfhtHbl.js +3596 -0
  27. package/exports/browser/workers/machine-worker.js +61 -19
  28. package/exports/chain.js +146 -73
  29. package/exports/workers/machine-worker.js +61 -19
  30. package/package.json +14 -13
  31. package/exports/browser/weierstrass-Q0QND1ZT.js +0 -2156
@@ -1,16 +1,16 @@
1
1
  import { E as EasyWorker, j as jsonStringifyBigInt$1, b as jsonParseBigInt$1, F as FormatInterface, c as proto$1, f as proto } from './worker-BDTWOCzS-COrAszCt.js';
2
2
 
3
3
  // This file was generated. Do not modify manually!
4
- var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
4
+ var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 31, 4, 33, 15, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 7, 0, 259, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 481, 1, 61, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 12, 2, 9, 1, 3, 0, 33, 1, 1357, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
5
5
 
6
6
  // This file was generated. Do not modify manually!
7
- var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
7
+ var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 13, 65, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 18, 21, 18, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 18, 0, 182, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 22, 0, 239, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 111, 6, 206, 13, 310, 2314, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7386, 37, 33, 96, 114, 14, 913, 15, 50, 7710, 3, 2, 6, 2, 1, 2, 296, 10, 0, 30, 2, 3, 0, 15, 4, 8, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 340, 2, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 129, 15, 6, 55, 50, 49, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4382, 2, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489, 39815, 11327];
8
8
 
9
9
  // This file was generated. Do not modify manually!
10
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
10
+ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7-\u05c9\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b53-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1af0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
11
11
 
12
12
  // This file was generated. Do not modify manually!
13
- var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
13
+ var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0558\u0559\u0560-\u0588\u058b\u058c\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u208f-\u209f\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dd\ua7e2\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab6c\uab6d\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
14
14
 
15
15
  // These are a run-length and offset encoded representation of the
16
16
  // >0xffff code points that are a valid part of identifiers. The
@@ -719,7 +719,9 @@ pp$9.strictDirective = function(start) {
719
719
  var next = this.input.charAt(end);
720
720
  return next === ";" || next === "}" ||
721
721
  (lineBreak.test(spaceAfter[0]) &&
722
- !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
722
+ !(/[(`.[+\-/*%<>=,?^&]/.test(next) ||
723
+ next === "!" && this.input.charAt(end + 1) === "=" ||
724
+ next === "i" && keywordOpAt(this, end)))
723
725
  }
724
726
  start += match[0].length;
725
727
 
@@ -731,6 +733,19 @@ pp$9.strictDirective = function(start) {
731
733
  }
732
734
  };
733
735
 
736
+ // Scan for `in` or `instanceof` at the given position, knowing that
737
+ // there's an `i` there.
738
+ function keywordOpAt(parser, pos) {
739
+ var end = pos + 1, stop = Math.min(parser.input.length, pos + 11);
740
+ while (end < stop) {
741
+ var ch = parser.fullCharCodeAt(end);
742
+ if (!isIdentifierChar(ch, true)) { break }
743
+ end += ch <= 0xffff ? 1 : 2;
744
+ }
745
+ return end === pos + 2 && parser.input.slice(pos, end) === "in" ||
746
+ end === pos + 10 && parser.input.slice(pos, end) === "instanceof"
747
+ }
748
+
734
749
  // Predicate that tests whether the next token is of the given
735
750
  // type, and if yes, consumes it as a side effect.
736
751
 
@@ -2766,10 +2781,11 @@ pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse
2766
2781
  if (this.type === types$1.eq)
2767
2782
  { left = this.toAssignable(left, false, refDestructuringErrors); }
2768
2783
  if (!ownDestructuringErrors) {
2769
- refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
2784
+ refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
2785
+ // reset these when detected inside this expression
2786
+ if (refDestructuringErrors.shorthandAssign >= left.start) { refDestructuringErrors.shorthandAssign = -1; }
2787
+ if (refDestructuringErrors.doubleProto >= left.start) { refDestructuringErrors.doubleProto = -1; }
2770
2788
  }
2771
- if (refDestructuringErrors.shorthandAssign >= left.start)
2772
- { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
2773
2789
  if (this.type === types$1.eq)
2774
2790
  { this.checkLValPattern(left); }
2775
2791
  else
@@ -2922,14 +2938,25 @@ function isPrivateFieldAccess(node) {
2922
2938
 
2923
2939
  pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
2924
2940
  var startPos = this.start, startLoc = this.startLoc;
2941
+ var oldDoubleProto = -1, oldShorthandAssign = -1;
2942
+ if (refDestructuringErrors) {
2943
+ oldDoubleProto = refDestructuringErrors.doubleProto;
2944
+ oldShorthandAssign = refDestructuringErrors.shorthandAssign;
2945
+ refDestructuringErrors.doubleProto = refDestructuringErrors.shorthandAssign = -1;
2946
+ }
2925
2947
  var expr = this.parseExprAtom(refDestructuringErrors, forInit);
2926
2948
  if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
2927
2949
  { return expr }
2928
2950
  var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
2929
- if (refDestructuringErrors && result.type === "MemberExpression") {
2930
- if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
2931
- if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
2932
- if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
2951
+ if (refDestructuringErrors) {
2952
+ if (result.end > expr.end) {
2953
+ this.checkExpressionErrors(refDestructuringErrors, true);
2954
+ if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
2955
+ if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
2956
+ if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
2957
+ }
2958
+ if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
2959
+ if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; }
2933
2960
  }
2934
2961
  return result
2935
2962
  };
@@ -2944,7 +2971,7 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
2944
2971
  var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
2945
2972
 
2946
2973
  if (element.optional) { optionalChained = true; }
2947
- if (element === base || element.type === "ArrowFunctionExpression") {
2974
+ if (element.end === base.end || element.type === "ArrowFunctionExpression") {
2948
2975
  if (optionalChained) {
2949
2976
  var chainNode = this.startNodeAt(startPos, startLoc);
2950
2977
  chainNode.expression = element;
@@ -2954,6 +2981,7 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
2954
2981
  }
2955
2982
 
2956
2983
  base = element;
2984
+ maybeAsyncArrow = false;
2957
2985
  }
2958
2986
  };
2959
2987
 
@@ -6263,7 +6291,7 @@ pp.readWord = function() {
6263
6291
  // [ghbt]: https://github.com/acornjs/acorn/issues
6264
6292
 
6265
6293
 
6266
- var version$1 = "8.18.0";
6294
+ var version$1 = "8.19.0";
6267
6295
 
6268
6296
  Parser.acorn = {
6269
6297
  Parser: Parser,
@@ -8819,11 +8847,25 @@ const _ = {
8819
8847
  addLoadedBlock: (block) => {
8820
8848
  const size = formatBytes(block.length);
8821
8849
  block = JSON.parse(block, jsonParseBigInt$1);
8822
- // if (block.decoded) block = { ...block.decoded, hash: await new BlockMessage(block).hash() }
8823
- // if (blocks[block.index - 1]) {
8824
- // console.warn(`block ${block.index} already loaded, skipping`)
8825
- // return false
8826
- // }
8850
+ const index = Number(block.index);
8851
+ const tipIndex = Number(lastBlock.index);
8852
+ if (!['number', 'bigint'].includes(typeof block.index) ||
8853
+ !Number.isSafeInteger(index) || index < 0 || typeof block.hash !== 'string' || !block.hash) {
8854
+ throw new Error('Invalid loaded block identity');
8855
+ }
8856
+ if (lastBlock.hash !== '0x0') {
8857
+ if (index < tipIndex)
8858
+ return false;
8859
+ if (index === tipIndex) {
8860
+ if (block.hash === lastBlock.hash)
8861
+ return false;
8862
+ throw new Error(`Loaded block conflict at index ${index}`);
8863
+ }
8864
+ }
8865
+ const expectedIndex = lastBlock.hash === '0x0' ? 0 : tipIndex + 1;
8866
+ if (index !== expectedIndex || block.previousHash !== lastBlock.hash) {
8867
+ throw new Error(`Loaded block does not extend canonical tip at index ${index}`);
8868
+ }
8827
8869
  blocks[block.index.toString()] = block;
8828
8870
  lastBlock = blocks[blocks.length - 1];
8829
8871
  totalBlocks += 1n;
package/exports/chain.js CHANGED
@@ -659,6 +659,12 @@ class Machine {
659
659
  pubsub.publish(data.id, { error: data.message });
660
660
  break;
661
661
  }
662
+ case "addLoadedBlockError":
663
+ case "collectFeeError":
664
+ case "settleRewardsError": {
665
+ pubsub.publish(data.id, { error: new Error(data.message) });
666
+ break;
667
+ }
662
668
  case "debug": {
663
669
  if (data.message.includes("loaded transactions for block:")) {
664
670
  pubsub.publish("block-loaded", data.message.replace("loaded transactions for block: ", "").split(" @")[0]);
@@ -708,9 +714,9 @@ class Machine {
708
714
  }
709
715
  }
710
716
  }
711
- async updateState() {
717
+ async updateState(strict = false) {
712
718
  try {
713
- const lastBlock = await this.lastBlock;
719
+ const lastBlock = strict ? await this.getCanonicalTip() : await this.lastBlock;
714
720
  const lastBlockIndex = Number(lastBlock.index);
715
721
  const statesLastBlockIndex = Number(this.states.lastBlock.index);
716
722
  if (lastBlockIndex > statesLastBlockIndex || lastBlock.hash !== this.states.lastBlock.hash && Number(lastBlockIndex) === 0) {
@@ -769,7 +775,7 @@ class Machine {
769
775
  return JSON.stringify(sorted, replacer);
770
776
  };
771
777
  const tasks = [
772
- stateStore.put("lastBlock", sortedStringify(await this.lastBlock, jsonStringifyBigInt)),
778
+ stateStore.put("lastBlock", sortedStringify(lastBlock, jsonStringifyBigInt)),
773
779
  stateStore.put("states", sortedStringify(state, jsonStringifyBigInt)),
774
780
  stateStore.put("accounts", sortedStringify(accounts, jsonStringifyBigInt)),
775
781
  stateStore.put(
@@ -796,6 +802,7 @@ class Machine {
796
802
  }
797
803
  } catch (error) {
798
804
  console.error(error);
805
+ if (strict) throw error;
799
806
  }
800
807
  }
801
808
  async #init(blocks) {
@@ -1062,6 +1069,9 @@ ${error.message}`);
1062
1069
  return this.states.lastBlock;
1063
1070
  });
1064
1071
  }
1072
+ getCanonicalTip() {
1073
+ return this.#askWorker("lastBlock");
1074
+ }
1065
1075
  get lastBlockHeight() {
1066
1076
  return this.#askWorker("lastBlockHeight").catch((error) => {
1067
1077
  debug$2("lastBlockHeight fallback after worker timeout:", error?.message ?? error);
@@ -1206,6 +1216,56 @@ const decodeResponsePayload = async (result, depth = 0) => {
1206
1216
  return result;
1207
1217
  };
1208
1218
 
1219
+ class CanonicalStateQueue {
1220
+ #tail = Promise.resolve();
1221
+ #failed = false;
1222
+ #failure;
1223
+ run(operation) {
1224
+ const result = this.#tail.then(async () => {
1225
+ if (this.#failed) {
1226
+ throw new Error("Canonical state application halted after a failed mutation; restart and recover state", {
1227
+ cause: this.#failure
1228
+ });
1229
+ }
1230
+ let mutating = false;
1231
+ try {
1232
+ return await operation({ markMutating: () => {
1233
+ mutating = true;
1234
+ } });
1235
+ } catch (error) {
1236
+ if (mutating) {
1237
+ this.#failed = true;
1238
+ this.#failure = error;
1239
+ }
1240
+ throw error;
1241
+ }
1242
+ });
1243
+ this.#tail = result.then(() => void 0, () => void 0);
1244
+ return result;
1245
+ }
1246
+ }
1247
+
1248
+ const validateChainLink = (localTip, incoming) => {
1249
+ const localHash = localTip?.hash || "0x0";
1250
+ const localIndex = Number(localTip?.index ?? -1);
1251
+ const hasCanonicalTip = localHash !== "0x0";
1252
+ if (hasCanonicalTip && incoming.index < localIndex) return "stale";
1253
+ if (hasCanonicalTip && incoming.index === localIndex) {
1254
+ if (incoming.hash === localHash) return "duplicate";
1255
+ throw new Error(`Block conflict detected at index ${incoming.index}`);
1256
+ }
1257
+ const expectedIndex = hasCanonicalTip ? localIndex + 1 : 0;
1258
+ if (incoming.index !== expectedIndex) {
1259
+ throw new Error(`Unexpected block index ${incoming.index}; expected ${expectedIndex}`);
1260
+ }
1261
+ if (incoming.previousHash !== localHash) {
1262
+ throw new Error(
1263
+ `previousHash mismatch at index ${incoming.index}: expected ${localHash}, got ${incoming.previousHash}`
1264
+ );
1265
+ }
1266
+ return "append";
1267
+ };
1268
+
1209
1269
  const debug$1 = createDebugger("leofcoin/state");
1210
1270
  class State extends Contract {
1211
1271
  constructor(config) {
@@ -1220,6 +1280,7 @@ class State extends Contract {
1220
1280
  this.#blocks = [];
1221
1281
  this.knownBlocks = [];
1222
1282
  this.#totalSize = 0;
1283
+ this.#canonicalStateQueue = new CanonicalStateQueue();
1223
1284
  this.#loaded = false;
1224
1285
  this.#resolvingHashes = /* @__PURE__ */ new Set();
1225
1286
  this._wantList = [];
@@ -1262,6 +1323,13 @@ class State extends Contract {
1262
1323
  #blocks;
1263
1324
  #totalSize;
1264
1325
  #machine;
1326
+ #canonicalStateQueue;
1327
+ withCanonicalState(operation) {
1328
+ return this.#canonicalStateQueue.run(operation);
1329
+ }
1330
+ canonicalTip() {
1331
+ return this.#machine ? this.#machine.getCanonicalTip() : Promise.resolve({ index: -1, hash: "0x0", previousHash: "0x0" });
1332
+ }
1265
1333
  #loaded;
1266
1334
  #resolvingHashes;
1267
1335
  /**
@@ -1414,7 +1482,7 @@ class State extends Contract {
1414
1482
  this.#machine = machine;
1415
1483
  const lastBlock = await this.#machine.lastBlock;
1416
1484
  if (lastBlock.hash !== "0x0") {
1417
- this.updateState(new BlockMessage(lastBlock));
1485
+ await this.updateState(new BlockMessage(lastBlock));
1418
1486
  }
1419
1487
  this.#loaded = true;
1420
1488
  this.#chainState = "loaded";
@@ -1437,9 +1505,10 @@ class State extends Contract {
1437
1505
  await machine.ready;
1438
1506
  this.#machine = machine;
1439
1507
  }
1440
- await this.#machine.updateState();
1508
+ await this.#machine.updateState(true);
1441
1509
  } catch (error) {
1442
1510
  console.error(error);
1511
+ throw error;
1443
1512
  }
1444
1513
  }
1445
1514
  getLatestBlock() {
@@ -1628,11 +1697,16 @@ class State extends Contract {
1628
1697
  console.error(error);
1629
1698
  }
1630
1699
  if (!lastBlock) lastBlock = await this.#getLatestBlock();
1631
- if (globalThis.peernet.peers.length === 0) return "connectionless";
1700
+ if (globalThis.peernet.peers.length === 0) {
1701
+ this.#chainSyncing = false;
1702
+ this.#syncState = "connectionless";
1703
+ return this.#syncState;
1704
+ }
1632
1705
  try {
1633
- await this.#syncChain(lastBlock);
1706
+ await this.withCanonicalState((transition) => this.#syncChain(lastBlock, transition));
1634
1707
  } catch (error) {
1635
1708
  this.#syncErrorCount += 1;
1709
+ this.#chainSyncing = false;
1636
1710
  if (this.#syncErrorCount < 3) return this.syncChain(lastBlock);
1637
1711
  this.#syncErrorCount = 0;
1638
1712
  this.#chainSyncing = false;
@@ -1646,9 +1720,9 @@ class State extends Contract {
1646
1720
  this.#syncState = "synced";
1647
1721
  return this.#syncState;
1648
1722
  }
1649
- async #syncChain(lastBlock) {
1723
+ async #syncChain(lastBlock, transition) {
1650
1724
  try {
1651
- const localBlock = await this.lastBlock;
1725
+ const localBlock = await this.canonicalTip();
1652
1726
  const localIndex = localBlock ? Number(localBlock.index) : -1;
1653
1727
  const remoteIndex = Number(lastBlock.index);
1654
1728
  const remoteBlockHash = lastBlock.hash;
@@ -1670,6 +1744,9 @@ class State extends Contract {
1670
1744
  debug$1(`Remote block hash is 0x0, skipping sync`);
1671
1745
  return;
1672
1746
  }
1747
+ if (localBlock?.hash !== "0x0" && localIndex === remoteIndex && localBlock.hash !== remoteBlockHash) {
1748
+ throw new Error(`Block conflict detected at index ${remoteIndex}`);
1749
+ }
1673
1750
  if (localIndex > remoteIndex) {
1674
1751
  const MAX_REORG_DEPTH = 6;
1675
1752
  const reorgDepth = localIndex - remoteIndex;
@@ -1709,9 +1786,14 @@ class State extends Contract {
1709
1786
  debug$1(`Loading blocks from index ${localIndex + 1} to ${remoteIndex}`);
1710
1787
  const start = localIndex + 1;
1711
1788
  if (this.#machine && blocks.length > start) {
1712
- await this.#loadBlocks(blocks.slice(start));
1789
+ await this.#loadBlocks(blocks.slice(start), transition);
1713
1790
  }
1714
1791
  if (blocks.length > 0) {
1792
+ const appliedTip = await this.canonicalTip();
1793
+ if (appliedTip.hash !== remoteBlockHash || Number(appliedTip.index) !== remoteIndex) {
1794
+ throw new Error(`Sync did not apply canonical target ${remoteBlockHash} at index ${remoteIndex}`);
1795
+ }
1796
+ transition.markMutating();
1715
1797
  await this.updateState(new BlockMessage(blocks[blocks.length - 1]));
1716
1798
  }
1717
1799
  } else {
@@ -1831,14 +1913,14 @@ class State extends Contract {
1831
1913
  console.log(error);
1832
1914
  }
1833
1915
  console.log(error);
1834
- return false;
1916
+ throw error;
1835
1917
  }
1836
1918
  }
1837
1919
  /**
1838
1920
  *
1839
1921
  * @param {Block[]} blocks
1840
1922
  */
1841
- async #loadBlocks(blocks) {
1923
+ async #loadBlocks(blocks, transition) {
1842
1924
  this.#chainState = "loading";
1843
1925
  if (blocks.some((block) => !block)) {
1844
1926
  throw new Error("missing block data during load; chain resolution incomplete");
@@ -1849,10 +1931,21 @@ class State extends Contract {
1849
1931
  for (const block of blocks) {
1850
1932
  if (block && !block.loaded) {
1851
1933
  try {
1934
+ const link = validateChainLink(await this.canonicalTip(), {
1935
+ index: Number(block.index),
1936
+ hash: block.hash,
1937
+ previousHash: String(block.previousHash)
1938
+ });
1939
+ if (link !== "append") {
1940
+ this.#blocks[block.index].loaded = true;
1941
+ debug$1(`Ignoring ${link} loaded block ${block.hash} at height ${block.index}`);
1942
+ continue;
1943
+ }
1852
1944
  debug$1(`loading block: ${Number(block.index)} ${block.hash}`);
1853
1945
  let transactions = await this.#loadBlockTransactions(block.transactions || []);
1854
1946
  const validators = block.validators.map(({ address }) => address);
1855
1947
  debug$1(`loading transactions: ${transactions.length} for block ${block.index}`);
1948
+ transition.markMutating();
1856
1949
  for (const transaction of transactions) {
1857
1950
  const hash = await transaction.hash();
1858
1951
  if (poolTransactionKeys.has(hash)) await globalThis.transactionPoolStore.delete(hash);
@@ -1885,10 +1978,11 @@ class State extends Contract {
1885
1978
  ...distributeAmount(policy.subsidy, validators, Number(block.index) % validators.length)
1886
1979
  ]);
1887
1980
  }
1888
- this.#blocks[block.index].loaded = true;
1889
1981
  debug$1(`executed transactions for block ${block.index}`);
1982
+ const registered = await this.#machine.addLoadedBlock({ ...block, loaded: true });
1983
+ if (registered !== true) throw new Error(`Loaded block registration failed after execution: ${block.hash}`);
1984
+ this.#blocks[block.index].loaded = true;
1890
1985
  if (Number(block.index) === 0) this.#loaded = true;
1891
- await this.#machine.addLoadedBlock(block);
1892
1986
  debug$1(`loaded block: ${block.hash} @${Number(block.index)}`);
1893
1987
  globalThis.pubsub.publish("block-loaded", { ...block });
1894
1988
  } catch (error) {
@@ -1896,6 +1990,7 @@ class State extends Contract {
1896
1990
  for (const transaction of block.transactions) {
1897
1991
  this.wantList.push(transaction);
1898
1992
  }
1993
+ throw error;
1899
1994
  }
1900
1995
  }
1901
1996
  }
@@ -2009,27 +2104,6 @@ class VersionControl extends State {
2009
2104
  }
2010
2105
  }
2011
2106
 
2012
- const validateChainLink = (localTip, incoming) => {
2013
- const localHash = localTip?.hash || "0x0";
2014
- const localIndex = Number(localTip?.index ?? -1);
2015
- const hasCanonicalTip = localHash !== "0x0";
2016
- if (hasCanonicalTip && incoming.index < localIndex) return "stale";
2017
- if (hasCanonicalTip && incoming.index === localIndex) {
2018
- if (incoming.hash === localHash) return "duplicate";
2019
- throw new Error(`Block conflict detected at index ${incoming.index}`);
2020
- }
2021
- const expectedIndex = hasCanonicalTip ? localIndex + 1 : 0;
2022
- if (incoming.index !== expectedIndex) {
2023
- throw new Error(`Unexpected block index ${incoming.index}; expected ${expectedIndex}`);
2024
- }
2025
- if (incoming.previousHash !== localHash) {
2026
- throw new Error(
2027
- `previousHash mismatch at index ${incoming.index}: expected ${localHash}, got ${incoming.previousHash}`
2028
- );
2029
- }
2030
- return "append";
2031
- };
2032
-
2033
2107
  const validateCanonicalValidatorSet = (blockIndex, expectedValidators, validators) => {
2034
2108
  const actualValidators = validators.map(({ address }) => address);
2035
2109
  const canonicalExpected = [...new Set(expectedValidators)].sort();
@@ -2592,7 +2666,9 @@ class Chain extends VersionControl {
2592
2666
  `[consensus] Epoch boundary at block ${blockHeight}: new epoch starts at height ${this.#currentEpochStartHeight}`
2593
2667
  );
2594
2668
  if (this.#participating && !this.#runningEpoch) {
2595
- await this.#runEpoch();
2669
+ void this.#runEpoch().catch((error) => {
2670
+ debug(`epoch scheduling failed: ${error?.message ?? error}`);
2671
+ });
2596
2672
  }
2597
2673
  }
2598
2674
  async #runEpoch() {
@@ -3061,11 +3137,14 @@ class Chain extends VersionControl {
3061
3137
  }
3062
3138
  }
3063
3139
  async #addBlock(block) {
3140
+ return this.withCanonicalState((transition) => this.#applyBlock(block, transition));
3141
+ }
3142
+ async #applyBlock(block, transition) {
3064
3143
  const receivedEncoded = block instanceof BlockMessage ? block.encoded : block;
3065
3144
  const blockMessage = await new BlockMessage(block);
3066
3145
  const hash = await blockMessage.hash();
3067
3146
  const blockIndex = Number(blockMessage.decoded.index);
3068
- const linkResult = validateChainLink(await this.lastBlock, {
3147
+ const linkResult = validateChainLink(await this.canonicalTip(), {
3069
3148
  index: blockIndex,
3070
3149
  hash,
3071
3150
  previousHash: String(blockMessage.decoded.previousHash)
@@ -3094,6 +3173,7 @@ class Chain extends VersionControl {
3094
3173
  console.log(`[chain] \u2705 Block data integrity verified: ${hash}`);
3095
3174
  await this.#validateBlockValidators(blockMessage);
3096
3175
  const transactions = await this.#resolveBlockTransactions(blockMessage);
3176
+ transition.markMutating();
3097
3177
  await Promise.all(
3098
3178
  blockMessage.decoded.transactions.map(async (transactionHash) => {
3099
3179
  if (await transactionPoolStore.has(transactionHash)) await transactionPoolStore.delete(transactionHash);
@@ -3104,9 +3184,6 @@ class Chain extends VersionControl {
3104
3184
  hash,
3105
3185
  ...blockMessage.decoded
3106
3186
  };
3107
- debug(`added block: ${hash}`);
3108
- let promises = [];
3109
- let contracts = [];
3110
3187
  const allTransactions = transactions.sort((a, b) => {
3111
3188
  if (a.decoded.priority !== b.decoded.priority) {
3112
3189
  return (b.decoded.priority ? 1 : 0) - (a.decoded.priority ? 1 : 0);
@@ -3117,7 +3194,6 @@ class Chain extends VersionControl {
3117
3194
  });
3118
3195
  const monetaryPolicy = await this.#monetaryPolicy(blockMessage.decoded.protocolVersion);
3119
3196
  for (const transaction of allTransactions) {
3120
- if (!contracts.includes(transaction.decoded.to)) contracts.push(transaction.decoded.to);
3121
3197
  this.removePendingNonce(transaction.decoded.from, transaction.decoded.nonce);
3122
3198
  const transactionHash = await transaction.hash();
3123
3199
  const validatorAddresses = blockMessage.decoded.validators.map(({ address }) => address);
@@ -3135,36 +3211,36 @@ class Chain extends VersionControl {
3135
3211
  ...distributeAmount(monetaryPolicy.subsidy, validators, blockIndex % validators.length)
3136
3212
  ]);
3137
3213
  }
3138
- try {
3139
- promises = await Promise.allSettled(promises);
3140
- const noncesByAddress = {};
3141
- for (let transaction of transactions) {
3142
- globalThis.pubsub.publish("transaction-processed", transaction.encoded);
3143
- if (transaction.decoded.to === globalThis.peernet.selectedAccount)
3144
- globalThis.pubsub.publish("account-transaction-processed", transaction.encoded);
3145
- if (!noncesByAddress[transaction.decoded.from] || noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
3146
- noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
3147
- }
3148
- }
3149
- await Promise.all(
3150
- Object.entries(noncesByAddress).map(([from, nonce]) => globalThis.accountsStore.put(from, String(nonce)))
3151
- );
3152
- if ((await this.lastBlock).index < Number(blockMessage.decoded.index)) {
3153
- await this.machine.addLoadedBlock({ ...blockMessage.decoded, loaded: true, hash: await blockMessage.hash() });
3154
- try {
3155
- await this.call(addresses.validators, "recordValidatorSnapshot", [blockMessage.decoded.index]);
3156
- } catch (snapshotError) {
3157
- debug(`failed to record validator snapshot: ${snapshotError?.message ?? snapshotError}`);
3158
- }
3159
- await this.#handleEpochBoundary(Number(blockMessage.decoded.index));
3160
- await this.updateState(blockMessage);
3214
+ const noncesByAddress = {};
3215
+ for (let transaction of transactions) {
3216
+ globalThis.pubsub.publish("transaction-processed", transaction.encoded);
3217
+ if (transaction.decoded.to === globalThis.peernet.selectedAccount)
3218
+ globalThis.pubsub.publish("account-transaction-processed", transaction.encoded);
3219
+ if (!noncesByAddress[transaction.decoded.from] || noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
3220
+ noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
3161
3221
  }
3162
- globalThis.pubsub.publish("block-processed", blockMessage.decoded);
3163
- } catch (error) {
3164
- console.log(error.hash);
3165
- console.log("errrrr");
3166
- await transactionPoolStore.delete(error.hash);
3167
3222
  }
3223
+ await Promise.all(
3224
+ Object.entries(noncesByAddress).map(([from, nonce]) => globalThis.accountsStore.put(from, String(nonce)))
3225
+ );
3226
+ if (validateChainLink(await this.canonicalTip(), {
3227
+ index: blockIndex,
3228
+ hash,
3229
+ previousHash: String(blockMessage.decoded.previousHash)
3230
+ }) !== "append") {
3231
+ throw new Error(`Canonical tip changed during block application: ${hash}`);
3232
+ }
3233
+ const registered = await this.machine.addLoadedBlock({ ...blockMessage.decoded, loaded: true, hash });
3234
+ if (registered !== true) throw new Error(`Block registration failed after execution: ${hash}`);
3235
+ try {
3236
+ await this.call(addresses.validators, "recordValidatorSnapshot", [blockMessage.decoded.index]);
3237
+ } catch (snapshotError) {
3238
+ debug(`failed to record validator snapshot: ${snapshotError?.message ?? snapshotError}`);
3239
+ }
3240
+ await this.updateState(blockMessage);
3241
+ debug(`added block: ${hash}`);
3242
+ globalThis.pubsub.publish("block-processed", blockMessage.decoded);
3243
+ await this.#handleEpochBoundary(blockIndex);
3168
3244
  }
3169
3245
  async participate(address) {
3170
3246
  try {
@@ -3228,10 +3304,6 @@ class Chain extends VersionControl {
3228
3304
  executionTimestamp: block?.timestamp ?? transaction.decoded.timestamp,
3229
3305
  feePayments
3230
3306
  });
3231
- if (block) {
3232
- block.transactions.push(hash);
3233
- block.fees = block.fees += await calculateFee(transaction.decoded);
3234
- }
3235
3307
  await globalThis.accountsStore.put(
3236
3308
  transaction.decoded.from,
3237
3309
  new TextEncoder().encode(String(transaction.decoded.nonce))
@@ -3243,6 +3315,7 @@ class Chain extends VersionControl {
3243
3315
  console.log(hash);
3244
3316
  peernet.publish("invalid-transaction", hash);
3245
3317
  await globalThis.transactionPoolStore.delete(e.hash);
3318
+ if (block) throw e;
3246
3319
  }
3247
3320
  }
3248
3321
  // todo filter tx that need to wait on prev nonce