@lodestar/light-client 1.35.0-dev.8689cc3545 → 1.35.0-dev.8b45b1e978

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 (55) hide show
  1. package/package.json +18 -11
  2. package/lib/events.d.ts.map +0 -1
  3. package/lib/index.d.ts.map +0 -1
  4. package/lib/spec/index.d.ts.map +0 -1
  5. package/lib/spec/isBetterUpdate.d.ts.map +0 -1
  6. package/lib/spec/processLightClientUpdate.d.ts.map +0 -1
  7. package/lib/spec/store.d.ts.map +0 -1
  8. package/lib/spec/utils.d.ts.map +0 -1
  9. package/lib/spec/validateLightClientBootstrap.d.ts.map +0 -1
  10. package/lib/spec/validateLightClientUpdate.d.ts.map +0 -1
  11. package/lib/transport/index.d.ts.map +0 -1
  12. package/lib/transport/interface.d.ts.map +0 -1
  13. package/lib/transport/rest.d.ts.map +0 -1
  14. package/lib/transport.d.ts.map +0 -1
  15. package/lib/types.d.ts.map +0 -1
  16. package/lib/utils/api.d.ts.map +0 -1
  17. package/lib/utils/chunkify.d.ts.map +0 -1
  18. package/lib/utils/clock.d.ts.map +0 -1
  19. package/lib/utils/domain.d.ts.map +0 -1
  20. package/lib/utils/index.d.ts.map +0 -1
  21. package/lib/utils/logger.d.ts.map +0 -1
  22. package/lib/utils/map.d.ts.map +0 -1
  23. package/lib/utils/normalizeMerkleBranch.d.ts.map +0 -1
  24. package/lib/utils/update.d.ts.map +0 -1
  25. package/lib/utils/utils.d.ts.map +0 -1
  26. package/lib/utils/verifyMerkleBranch.d.ts.map +0 -1
  27. package/lib/utils.d.ts.map +0 -1
  28. package/lib/validation.d.ts.map +0 -1
  29. package/src/events.ts +0 -17
  30. package/src/index.ts +0 -340
  31. package/src/spec/index.ts +0 -71
  32. package/src/spec/isBetterUpdate.ts +0 -94
  33. package/src/spec/processLightClientUpdate.ts +0 -119
  34. package/src/spec/store.ts +0 -105
  35. package/src/spec/utils.ts +0 -266
  36. package/src/spec/validateLightClientBootstrap.ts +0 -41
  37. package/src/spec/validateLightClientUpdate.ts +0 -154
  38. package/src/transport/index.ts +0 -2
  39. package/src/transport/interface.ts +0 -37
  40. package/src/transport/rest.ts +0 -89
  41. package/src/transport.ts +0 -2
  42. package/src/types.ts +0 -20
  43. package/src/utils/api.ts +0 -19
  44. package/src/utils/chunkify.ts +0 -26
  45. package/src/utils/clock.ts +0 -45
  46. package/src/utils/domain.ts +0 -44
  47. package/src/utils/index.ts +0 -8
  48. package/src/utils/logger.ts +0 -29
  49. package/src/utils/map.ts +0 -20
  50. package/src/utils/normalizeMerkleBranch.ts +0 -15
  51. package/src/utils/update.ts +0 -30
  52. package/src/utils/utils.ts +0 -95
  53. package/src/utils/verifyMerkleBranch.ts +0 -29
  54. package/src/utils.ts +0 -2
  55. package/src/validation.ts +0 -201
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ChainSafe/lodestar/issues"
13
13
  },
14
- "version": "1.35.0-dev.8689cc3545",
14
+ "version": "1.35.0-dev.8b45b1e978",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -46,10 +46,17 @@
46
46
  }
47
47
  },
48
48
  "files": [
49
- "src",
50
- "lib",
51
- "dist",
52
- "!**/*.tsbuildinfo"
49
+ "lib/**/*.d.ts",
50
+ "lib/**/*.js",
51
+ "lib/**/*.js.map",
52
+ "*.d.ts",
53
+ "*.js",
54
+ "dist/**/*.js",
55
+ "dist/**/*.mjs",
56
+ "dist/**/*.cjs",
57
+ "dist/**/*.map",
58
+ "dist/**/*.json",
59
+ "dist/**/*.d.ts"
53
60
  ],
54
61
  "scripts": {
55
62
  "clean": "rm -rf lib && rm -rf dist && rm -f *.tsbuildinfo",
@@ -72,11 +79,11 @@
72
79
  "@chainsafe/blst": "^2.2.0",
73
80
  "@chainsafe/persistent-merkle-tree": "^1.2.1",
74
81
  "@chainsafe/ssz": "^1.2.2",
75
- "@lodestar/api": "1.35.0-dev.8689cc3545",
76
- "@lodestar/config": "1.35.0-dev.8689cc3545",
77
- "@lodestar/params": "1.35.0-dev.8689cc3545",
78
- "@lodestar/types": "1.35.0-dev.8689cc3545",
79
- "@lodestar/utils": "1.35.0-dev.8689cc3545",
82
+ "@lodestar/api": "1.35.0-dev.8b45b1e978",
83
+ "@lodestar/config": "1.35.0-dev.8b45b1e978",
84
+ "@lodestar/params": "1.35.0-dev.8b45b1e978",
85
+ "@lodestar/types": "1.35.0-dev.8b45b1e978",
86
+ "@lodestar/utils": "1.35.0-dev.8b45b1e978",
80
87
  "mitt": "^3.0.0"
81
88
  },
82
89
  "devDependencies": {
@@ -93,5 +100,5 @@
93
100
  "light-client",
94
101
  "blockchain"
95
102
  ],
96
- "gitHead": "449ee7fae124e34a70536ffec343c7447830e2e6"
103
+ "gitHead": "e4e26243cc36efb4945ca948c3cf34a3fb1ffb18"
97
104
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,oBAAY,gBAAgB;IAC1B,2BAA2B,mCAAmC;IAC9D,yBAAyB,iCAAiC;IAC1D,YAAY,+BAA+B;CAC5C;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACvF,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrF,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,kBAA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iBAAiB,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,IAAI,EACL,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,iBAAiB,EAAqD,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAC,iBAAiB,EAAoB,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAGvF,YAAY,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAC,cAAc,EAAE,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAEpD,qBAAa,eAAe;IAMxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IALvB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;gBAG5B,MAAM,EAAE,YAAY,EACH,IAAI,EAAE,iBAAiB,GAAG,sBAAsB,EACjE,SAAS,EAAE,oBAAoB;IAMjC,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAI5D,gBAAgB,CAAC,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,yBAAyB,GAAG,IAAI;IAYpF,kBAAkB,CAAC,WAAW,EAAE,IAAI,EAAE,gBAAgB,EAAE,2BAA2B,GAAG,IAAI;IAY1F,WAAW,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI;CAWrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isBetterUpdate.d.ts","sourceRoot":"","sources":["../../src/spec/isBetterUpdate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAIxD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,IAAI,CAAC;IACzB,aAAa,EAAE,IAAI,CAAC;IACpB,mBAAmB,EAAE,IAAI,CAAC;IAC1B,iHAAiH;IACjH,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iGAAiG;IACjG,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,wBAAwB,GAAG,OAAO,CAoDhH;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAIjF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,iBAAiB,GAAG,wBAAwB,CAS9F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"processLightClientUpdate.d.ts","sourceRoot":"","sources":["../../src/spec/processLightClientUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAGpE,OAAO,EAAC,wBAAwB,EAA6C,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAC,iBAAiB,EAA0B,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAIxF,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,iBAAiB,EACxB,WAAW,EAAE,IAAI,EACjB,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,iBAAiB,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9C,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,QAAQ,EACpB,cAAc,EAAE,yBAAyB,GACxC,yBAAyB,CAS3B;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,QAAQ,EACpB,gBAAgB,EAAE,2BAA2B,GAC5C,2BAA2B,CAI7B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,IAAI,GAClB,gBAAgB,CAelB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateLightClientBootstrap.d.ts","sourceRoot":"","sources":["../../src/spec/validateLightClientBootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,oBAAoB,EAAE,IAAI,EAAM,MAAM,iBAAiB,CAAC;AAUhE,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,IAAI,EACtB,SAAS,EAAE,oBAAoB,GAC9B,IAAI,CAuBN"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateLightClientUpdate.d.ts","sourceRoot":"","sources":["../../src/spec/validateLightClientUpdate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAcjD,OAAO,EAAC,iBAAiB,EAAwC,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAU7C,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,iBAAiB,GAC/B,IAAI,CA0FN"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/transport/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,oBAAoB;IACnC,UAAU,CACR,WAAW,EAAE,UAAU,EACvB,KAAK,EAAE,MAAM,GACZ,OAAO,CACR;QACE,OAAO,EAAE,QAAQ,CAAC;QAClB,IAAI,EAAE,iBAAiB,CAAC;KACzB,EAAE,CACJ,CAAC;IACF;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,2BAA2B,CAAA;KAAC,CAAC,CAAC;IACvF,iBAAiB,IAAI,OAAO,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,yBAAyB,CAAA;KAAC,CAAC,CAAC;IACnF;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,oBAAoB,CAAA;KAAC,CAAC,CAAC;IAG1F,kBAAkB,CAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,2BAA2B,KAAK,IAAI,GAAG,IAAI,CAAC;IAE3F,gBAAgB,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE,yBAAyB,KAAK,IAAI,GAAG,IAAI,CAAC;CACtF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/transport/rest.ts"],"names":[],"mappings":"AAAA,OAAa,EAAC,OAAO,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AAyB,CAAA;KAAC,CAAC;IAKlF,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,oBAAoB,CAAA;KAAC,CAAC;IAK/F,kBAAkB,CAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,2BAA2B,KAAK,IAAI,GAAG,IAAI;IAK1F,gBAAgB,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE,yBAAyB,KAAK,IAAI,GAAG,IAAI;IAKpF,OAAO,CAAC,oBAAoB;CAsB7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,0BAA0B;IAC1B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kDAAkD;IAClD,oBAAoB,EAAE,iBAAiB,CAAC;IACxC,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,eAAe,EAAE,SAAS,CAAC;CAC5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,cAAc,EAAY,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,eAAe,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAC,WAAW,EAAsB,MAAM,2BAA2B,CAAC;AAE3E,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAMjG;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAMnF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunkify.d.ts","sourceRoot":"","sources":["../../src/utils/chunkify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAclG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/utils/clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAExD,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAG5G;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAEpD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,CAE9D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAEjE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ7G"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/utils/domain.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAEtF;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,GAAG,UAAU,CAMlH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAEvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,GAAG,UAAU,CAMpG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAM7F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;KAGK;AACL,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAEjF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAC,GAAG,SAAS,CAOvE;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/utils/map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAexF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeMerkleBranch.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeMerkleBranch.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAIvF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/utils/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAErC,MAAM,MAAM,sBAAs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CAAC,aAAa,CAK7F;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAGhE;AAGD,eAAO,MAAM,MAAM,SACkF,CAAC;AAEtG,wBAAsB,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAOzF;AAED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"verifyMerkleBranch.d.ts","sourceRoot":"","sources":["../../src/utils/verifyMerkleBranch.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,UAAU,GACf,OAAO,CAUT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAa9C,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,IAAI,EACJ,IAAI,EACJ,MAAM,EAIP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAK7C;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,iBAAiB,EAChC,MAAM,EAAE,iBAAiB,GACxB,IAAI,CA6BN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAyBhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAY7E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,gBAAgB,EAAE,IAAI,EACtB,gBAAgB,EAAE,IAAI,GACrB,IAAI,CAiBN"}
package/src/events.ts DELETED
@@ -1,17 +0,0 @@
1
- import {Emitter as MittEmitter} from "mitt";
2
- import {LightClientHeader} from "@lodestar/types";
3
- import {RunStatusCode} from "./index.js";
4
-
5
- export enum LightclientEvent {
6
- lightClientOptimisticHeader = "light_client_optimistic_header",
7
- lightClientFinalityHeader = "light_client_finality_header",
8
- statusChange = "light_client_status_change",
9
- }
10
-
11
- export type LightclientEmitterEvents = {
12
- [LightclientEvent.lightClientOptimisticHeader]: (newHeader: LightClientHeader) => void;
13
- [LightclientEvent.lightClientFinalityHeader]: (newHeader: LightClientHeader) => void;
14
- [LightclientEvent.statusChange]: (code: RunStatusCode) => void;
15
- };
16
-
17
- export type LightclientEmitter = MittEmitter<LightclientEmitterEvents>;
package/src/index.ts DELETED
@@ -1,340 +0,0 @@
1
- import mitt from "mitt";
2
- import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config";
3
- import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD} from "@lodestar/params";
4
- import {
5
- LightClientBootstrap,
6
- LightClientFinalityUpdate,
7
- LightClientHeader,
8
- LightClientOptimisticUpdate,
9
- LightClientUpdate,
10
- RootHex,
11
- Slot,
12
- SyncPeriod,
13
- phase0,
14
- } from "@lodestar/types";
15
- import {fromHex, isErrorAborted, sleep, toRootHex} from "@lodestar/utils";
16
- import {LightclientEmitter, LightclientEvent} from "./events.js";
17
- import {LightclientSpec} from "./spec/index.js";
18
- import {ProcessUpdateOpts} from "./spec/processLightClientUpdate.js";
19
- import {validateLightClientBootstrap} from "./spec/validateLightClientBootstrap.js";
20
- import {LightClientTransport} from "./transport/interface.js";
21
- import {chunkifyInclusiveRange} from "./utils/chunkify.js";
22
- import {
23
- computeEpochAtSlot,
24
- computeSyncPeriodAtEpoch,
25
- computeSyncPeriodAtSlot,
26
- getCurrentSlot,
27
- slotWithFutureTolerance,
28
- timeUntilNextEpoch,
29
- } from "./utils/clock.js";
30
- import {ILcLogger, getConsoleLogger} from "./utils/logger.js";
31
-
32
- // Re-export types
33
- export {LightclientEvent} from "./events.js";
34
- export {upgradeLightClientFinalityUpdate, upgradeLightClientOptimisticUpdate} from "./spec/utils.js";
35
- export type {SyncCommitteeFast} from "./types.js";
36
-
37
- export type GenesisData = {
38
- genesisTime: number;
39
- genesisValidatorsRoot: RootHex | Uint8Array;
40
- };
41
-
42
- export type LightclientOpts = ProcessUpdateOpts;
43
-
44
- export type LightclientInitArgs = {
45
- config: ChainForkConfig;
46
- logger?: ILcLogger;
47
- opts?: LightclientOpts;
48
- genesisData: GenesisData;
49
- transport: LightClientTransport;
50
- bootstrap: LightClientBootstrap;
51
- };
52
-
53
- /** Provides some protection against a server client sending header updates too far away in the future */
54
- const MAX_CLOCK_DISPARITY_SEC = 10;
55
- /** Prevent responses that are too big and get truncated. No specific reasoning for 32 */
56
- const MAX_PERIODS_PER_REQUEST = 32;
57
- /** For mainnet preset 8 epochs, for minimal preset `EPOCHS_PER_SYNC_COMMITTEE_PERIOD / 2` */
58
- const LOOKAHEAD_EPOCHS_COMMITTEE_SYNC = Math.min(8, Math.ceil(EPOCHS_PER_SYNC_COMMITTEE_PERIOD / 2));
59
- /** Prevent infinite loops caused by sync errors */
60
- const ON_ERROR_RETRY_MS = 1000;
61
-
62
- // TODO: Customize with option
63
- const ALLOW_FORCED_UPDATES = true;
64
-
65
- export enum RunStatusCode {
66
- uninitialized,
67
- started,
68
- syncing,
69
- stopped,
70
- }
71
- type RunStatus =
72
- | {code: RunStatusCode.uninitialized}
73
- | {code: RunStatusCode.started; controller: AbortController}
74
- | {code: RunStatusCode.syncing}
75
- | {code: RunStatusCode.stopped};
76
-
77
- /**
78
- * Server-based Lightclient. Current architecture diverges from the spec's proposed updated splitting them into:
79
- * - Sync period updates: To advance to the next sync committee
80
- * - Header updates: To get a more recent header signed by a known sync committee
81
- *
82
- * To stay synced to the current sync period it needs:
83
- * - GET lightclient/committee_updates at least once per period.
84
- *
85
- * To get continuous header updates:
86
- * - subscribe to SSE type lightclient_update
87
- *
88
- * To initialize, it needs:
89
- * - GenesisData: To initialize the clock and verify signatures
90
- * - For known networks it's hardcoded in the source
91
- * - For unknown networks it can be provided by the user with a manual input
92
- * - For unknown test networks it can be queried from a trusted node at GET beacon/genesis
93
- * - `beaconApiUrl`: To connect to a trustless beacon node
94
- * - `LightclientStore`: To have an initial trusted SyncCommittee to start the sync
95
- * - For new lightclient instances, it can be queries from a trustless node at GET lightclient/bootstrap
96
- * - For existing lightclient instances, it should be retrieved from storage
97
- *
98
- * When to trigger a committee update sync:
99
- *
100
- * period 0 period 1 period 2
101
- * -|----------------|----------------|----------------|-> time
102
- * | now
103
- * - active current_sync_committee
104
- * - known next_sync_committee, signed by current_sync_committee
105
- *
106
- * - No need to query for period 0 next_sync_committee until the end of period 0
107
- * - During most of period 0, current_sync_committee known, next_sync_committee unknown
108
- * - At the end of period 0, get a sync committee update, and populate period 1's committee
109
- *
110
- * syncCommittees: Map<SyncPeriod, SyncCommittee>, limited to max of 2 items
111
- */
112
- export class Lightclient {
113
- readonly emitter: LightclientEmitter = mitt();
114
- readonly config: BeaconConfig;
115
- readonly logger: ILcLogger;
116
- readonly genesisValidatorsRoot: Uint8Array;
117
- readonly genesisTime: number;
118
- private readonly transport: LightClientTransport;
119
-
120
- private readonly lightclientSpec: LightclientSpec;
121
-
122
- private runStatus: RunStatus = {code: RunStatusCode.stopped};
123
-
124
- constructor({config, logger, genesisData, bootstrap, transport}: LightclientInitArgs) {
125
- this.genesisTime = genesisData.genesisTime;
126
- this.genesisValidatorsRoot =
127
- typeof genesisData.genesisValidatorsRoot === "string"
128
- ? fromHex(genesisData.genesisValidatorsRoot)
129
- : genesisData.genesisValidatorsRoot;
130
-
131
- this.config = createBeaconConfig(config, this.genesisValidatorsRoot);
132
- this.logger = logger ?? getConsoleLogger();
133
- this.transport = transport;
134
- this.runStatus = {code: RunStatusCode.uninitialized};
135
-
136
- this.lightclientSpec = new LightclientSpec(
137
- this.config,
138
- {
139
- allowForcedUpdates: ALLOW_FORCED_UPDATES,
140
- onSetFinalizedHeader: (header) => {
141
- this.emitter.emit(LightclientEvent.lightClientFinalityHeader, header);
142
- this.logger.debug("Updated state.finalizedHeader", {slot: header.beacon.slot});
143
- },
144
- onSetOptimisticHeader: (header) => {
145
- this.emitter.emit(LightclientEvent.lightClientOptimisticHeader, header);
146
- this.logger.debug("Updated state.optimisticHeader", {slot: header.beacon.slot});
147
- },
148
- },
149
- bootstrap
150
- );
151
- }
152
-
153
- get status(): RunStatusCode {
154
- return this.runStatus.code;
155
- }
156
-
157
- // Embed lightweight clock. The epoch cycles are handled with `this.runLoop()`
158
- get currentSlot(): number {
159
- return getCurrentSlot(this.config, this.genesisTime);
160
- }
161
-
162
- static async initializeFromCheckpointRoot(
163
- args: Omit<LightclientInitArgs, "bootstrap"> & {
164
- checkpointRoot: phase0.Checkpoint["root"];
165
- }
166
- ): Promise<Lightclient> {
167
- const {transport, checkpointRoot} = args;
168
-
169
- // Fetch bootstrap state with proof at the trusted block root
170
- const {data: bootstrap} = await transport.getBootstrap(toRootHex(checkpointRoot));
171
-
172
- validateLightClientBootstrap(args.config, checkpointRoot, bootstrap);
173
-
174
- return new Lightclient({...args, bootstrap});
175
- }
176
-
177
- /**
178
- * @returns a `Promise` that will resolve once `runStatus` equals `RunStatusCode.started`
179
- */
180
- start(): Promise<void> {
181
- const startPromise = new Promise<void>((resolve) => {
182
- const resolveAndStopListening = (status: RunStatusCode): void => {
183
- if (status === RunStatusCode.started) {
184
- this.emitter.off(LightclientEvent.statusChange, resolveAndStopListening);
185
- resolve();
186
- }
187
- };
188
- this.emitter.on(LightclientEvent.statusChange, resolveAndStopListening);
189
-
190
- // If already started, resolve immediately
191
- // Checking after the event registration to remove potential for race conditions
192
- resolveAndStopListening(this.runStatus.code);
193
- });
194
-
195
- // Do not block the event loop
196
- void this.runLoop();
197
-
198
- return startPromise;
199
- }
200
-
201
- stop(): void {
202
- if (this.runStatus.code !== RunStatusCode.started) return;
203
-
204
- this.runStatus.controller.abort();
205
- this.updateRunStatus({code: RunStatusCode.stopped});
206
- }
207
-
208
- getHead(): LightClientHeader {
209
- return this.lightclientSpec.store.optimisticHeader;
210
- }
211
-
212
- getFinalized(): LightClientHeader {
213
- return this.lightclientSpec.store.finalizedHeader;
214
- }
215
-
216
- async sync(fromPeriod: SyncPeriod, toPeriod: SyncPeriod): Promise<void> {
217
- const periodRanges = chunkifyInclusiveRange(fromPeriod, toPeriod, MAX_PERIODS_PER_REQUEST);
218
-
219
- for (const [fromPeriodRng, toPeriodRng] of periodRanges) {
220
- const count = toPeriodRng + 1 - fromPeriodRng;
221
- const updates = await this.transport.getUpdates(fromPeriodRng, count);
222
- for (const update of updates) {
223
- this.processSyncCommitteeUpdate(update.data);
224
- this.logger.debug("processed sync update", {slot: update.data.attestedHeader.beacon.slot});
225
-
226
- // Yield to the macro queue, verifying updates is somewhat expensive and we want responsiveness
227
- await new Promise((r) => setTimeout(r, 0));
228
- }
229
- }
230
- }
231
-
232
- private async runLoop(): Promise<void> {
233
- while (true) {
234
- const currentPeriod = computeSyncPeriodAtSlot(this.currentSlot);
235
- // Check if we have a sync committee for the current clock period
236
- if (!this.lightclientSpec.store.syncCommittees.has(currentPeriod)) {
237
- // Stop head tracking
238
- if (this.runStatus.code === RunStatusCode.started) {
239
- this.runStatus.controller.abort();
240
- }
241
-
242
- // Go into sync mode
243
- this.updateRunStatus({code: RunStatusCode.syncing});
244
- const headPeriod = computeSyncPeriodAtSlot(this.getHead().beacon.slot);
245
- this.logger.debug("Syncing", {lastPeriod: headPeriod, currentPeriod});
246
-
247
- try {
248
- await this.sync(headPeriod, currentPeriod);
249
- this.logger.debug("Synced", {currentPeriod});
250
- } catch (e) {
251
- this.logger.error("Error sync", {}, e as Error);
252
-
253
- // Retry in 1 second
254
- await new Promise((r) => setTimeout(r, ON_ERROR_RETRY_MS));
255
- continue;
256
- }
257
- }
258
-
259
- // After successfully syncing, track head if not already
260
- if (this.runStatus.code !== RunStatusCode.started) {
261
- const controller = new AbortController();
262
- this.updateRunStatus({code: RunStatusCode.started, controller});
263
- this.logger.debug("Started tracking the head");
264
-
265
- // Fetch latest optimistic head to prevent a potential 12 seconds lag between syncing and getting the first head,
266
- // Don't retry, this is a non-critical UX improvement
267
- try {
268
- const update = await this.transport.getOptimisticUpdate();
269
- this.processOptimisticUpdate(update.data);
270
- } catch (e) {
271
- this.logger.error("Error fetching getLatestHeadUpdate", {currentPeriod}, e as Error);
272
- }
273
-
274
- this.transport.onOptimisticUpdate(this.processOptimisticUpdate.bind(this));
275
- this.transport.onFinalityUpdate(this.processFinalizedUpdate.bind(this));
276
- }
277
-
278
- // When close to the end of a sync period poll for sync committee updates
279
- // Limit lookahead in case EPOCHS_PER_SYNC_COMMITTEE_PERIOD is configured to be very short
280
-
281
- const currentEpoch = computeEpochAtSlot(this.currentSlot);
282
- const epochsIntoPeriod = currentEpoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD;
283
- // Start fetching updates with some lookahead
284
- if (EPOCHS_PER_SYNC_COMMITTEE_PERIOD - epochsIntoPeriod <= LOOKAHEAD_EPOCHS_COMMITTEE_SYNC) {
285
- const period = computeSyncPeriodAtEpoch(currentEpoch);
286
- try {
287
- await this.sync(period, period);
288
- } catch (e) {
289
- this.logger.error("Error re-syncing period", {period}, e as Error);
290
- }
291
- }
292
-
293
- // Wait for the next epoch
294
- try {
295
- const runStatus = this.runStatus as {code: RunStatusCode.started; controller: AbortController}; // At this point, client is started
296
- await sleep(timeUntilNextEpoch(this.config, this.genesisTime), runStatus.controller.signal);
297
- } catch (e) {
298
- if (isErrorAborted(e)) {
299
- return;
300
- }
301
- throw e;
302
- }
303
- }
304
- }
305
-
306
- /**
307
- * Processes new optimistic header updates in only known synced sync periods.
308
- * This headerUpdate may update the head if there's enough participation.
309
- */
310
- private processOptimisticUpdate(optimisticUpdate: LightClientOptimisticUpdate): void {
311
- this.lightclientSpec.onOptimisticUpdate(this.currentSlotWithTolerance(), optimisticUpdate);
312
- }
313
-
314
- /**
315
- * Processes new header updates in only known synced sync periods.
316
- * This headerUpdate may update the head if there's enough participation.
317
- */
318
- private processFinalizedUpdate(finalizedUpdate: LightClientFinalityUpdate): void {
319
- this.lightclientSpec.onFinalityUpdate(this.currentSlotWithTolerance(), finalizedUpdate);
320
- }
321
-
322
- private processSyncCommitteeUpdate(update: LightClientUpdate): void {
323
- this.lightclientSpec.onUpdate(this.currentSlotWithTolerance(), update);
324
- }
325
-
326
- private currentSlotWithTolerance(): Slot {
327
- return slotWithFutureTolerance(this.config, this.genesisTime, MAX_CLOCK_DISPARITY_SEC);
328
- }
329
-
330
- private updateRunStatus(runStatus: RunStatus): void {
331
- this.runStatus = runStatus;
332
- this.emitter.emit(LightclientEvent.statusChange, this.runStatus.code);
333
- }
334
- }
335
-
336
- import * as transport from "./transport.js";
337
- // To export these name spaces to the bundle JS
338
- import * as utils from "./utils.js";
339
- import * as validation from "./validation.js";
340
- export {utils, validation, transport};
package/src/spec/index.ts DELETED
@@ -1,71 +0,0 @@
1
- import {BeaconConfig} from "@lodestar/config";
2
- import {UPDATE_TIMEOUT} from "@lodestar/params";
3
- import {
4
- LightClientBootstrap,
5
- LightClientFinalityUpdate,
6
- LightClientOptimisticUpdate,
7
- LightClientUpdate,
8
- Slot,
9
- } from "@lodestar/types";
10
- import {computeSyncPeriodAtSlot} from "../utils/index.js";
11
- import {ProcessUpdateOpts, getSyncCommitteeAtPeriod, processLightClientUpdate} from "./processLightClientUpdate.js";
12
- import {ILightClientStore, LightClientStore, LightClientStoreEvents} from "./store.js";
13
- import {ZERO_HEADER, ZERO_SYNC_COMMITTEE, getZeroFinalityBranch, getZeroSyncCommitteeBranch} from "./utils.js";
14
-
15
- export type {LightClientUpdateSummary} from "./isBetterUpdate.js";
16
- export {isBetterUpdate, toLightClientUpdateSummary} from "./isBetterUpdate.js";
17
- export {upgradeLightClientHeader} from "./utils.js";
18
-
19
- export class LightclientSpec {
20
- readonly store: ILightClientStore;
21
- readonly config: BeaconConfig;
22
-
23
- constructor(
24
- config: BeaconConfig,
25
- private readonly opts: ProcessUpdateOpts & LightClientStoreEvents,
26
- bootstrap: LightClientBootstrap
27
- ) {
28
- this.store = new LightClientStore(config, bootstrap, opts);
29
- this.config = config;
30
- }
31
-
32
- onUpdate(currentSlot: Slot, update: LightClientUpdate): void {
33
- processLightClientUpdate(this.config, this.store, currentSlot, this.opts, update);
34
- }
35
-
36
- onFinalityUpdate(currentSlot: Slot, finalityUpdate: LightClientFinalityUpdate): void {
37
- this.onUpdate(currentSlot, {
38
- attestedHeader: finalityUpdate.attestedHeader,
39
- nextSyncCommittee: ZERO_SYNC_COMMITTEE,
40
- nextSyncCommitteeBranch: getZeroSyncCommitteeBranch(this.config.getForkName(finalityUpdate.signatureSlot)),
41
- finalizedHeader: finalityUpdate.finalizedHeader,
42
- finalityBranch: finalityUpdate.finalityBranch,
43
- syncAggregate: finalityUpdate.syncAggregate,
44
- signatureSlot: finalityUpdate.signatureSlot,
45
- });
46
- }
47
-
48
- onOptimisticUpdate(currentSlot: Slot, optimisticUpdate: LightClientOptimisticUpdate): void {
49
- this.onUpdate(currentSlot, {
50
- attestedHeader: optimisticUpdate.attestedHeader,
51
- nextSyncCommittee: ZERO_SYNC_COMMITTEE,
52
- nextSyncCommitteeBranch: getZeroSyncCommitteeBranch(this.config.getForkName(optimisticUpdate.signatureSlot)),
53
- finalizedHeader: {beacon: ZERO_HEADER},
54
- finalityBranch: getZeroFinalityBranch(this.config.getForkName(optimisticUpdate.signatureSlot)),
55
- syncAggregate: optimisticUpdate.syncAggregate,
56
- signatureSlot: optimisticUpdate.signatureSlot,
57
- });
58
- }
59
-
60
- forceUpdate(currentSlot: Slot): void {
61
- for (const bestValidUpdate of this.store.bestValidUpdates.values()) {
62
- if (currentSlot > bestValidUpdate.update.finalizedHeader.beacon.slot + UPDATE_TIMEOUT) {
63
- const updatePeriod = computeSyncPeriodAtSlot(bestValidUpdate.update.signatureSlot);
64
- // Simulate process_light_client_store_force_update() by forcing to apply a bestValidUpdate
65
- // https://github.com/ethereum/consensus-specs/blob/a57e15636013eeba3610ff3ade41781dba1bb0cd/specs/altair/light-client/sync-protocol.md?plain=1#L394
66
- // Call for `updatePeriod + 1` to force the update at `update.signatureSlot` to be applied
67
- getSyncCommitteeAtPeriod(this.store, updatePeriod + 1, this.opts);
68
- }
69
- }
70
- }
71
- }