Commit Graph

76 Commits

Author SHA1 Message Date
Derrick Hammer 19c59eb189
fix: as a properly synced node may never hit the computed period at getCurrentPeriod... need to manually emit synced and call getLatestExecution 2023-09-16 11:04:03 -04:00
Derrick Hammer ec8402714f
fix: if startPeriod is greater than genesisPeriod, try to use latestCommittee falling back to genesisCommittee 2023-09-16 00:39:38 -04:00
Derrick Hammer b9b8b26ea4
fix: bad import 2023-09-15 22:58:05 -04:00
Derrick Hammer ccaca65a90
feat: add syncFromCheckpoint method 2023-09-15 22:43:46 -04:00
Derrick Hammer 9f00d8fec8
fix: IStore should extend EventEmitter 2023-09-15 22:10:36 -04:00
Derrick Hammer 295aed0845
feat: have Store extend EventEmitter so that it can emit set on adding an update and pass the serialized data 2023-09-15 22:06:40 -04:00
Derrick Hammer 7075966227
fix: add try/catch with mutex release on optimisticUpdateCallback 2023-07-24 20:07:04 -04:00
Derrick Hammer d3664c8d23
fix: don't release lock when we have cached optimistic update data, as we never locked it 2023-07-24 11:12:52 -04:00
Derrick Hammer 8b7c85dd61
fix: incorporate upstream https://github.com/lightclients/patronum/pull/23
reverts 91144cb5a2
2023-07-24 10:44:25 -04:00
Derrick Hammer 0321136ac0
feat: add synced event 2023-07-23 12:01:10 -04:00
Derrick Hammer 87e7533dcf
fix: change argument to be the current update, not the 0 index 2023-07-23 10:18:16 -04:00
Derrick Hammer 02412ba934
refactor: change update event to just pass currently processed event and the total number 2023-07-23 10:17:08 -04:00
Derrick Hammer 232af830c9
feat: use event emitter and emit "update" on every light client update processed 2023-07-23 10:06:18 -04:00
Derrick Hammer 11367b9803
refactor: add block cron to node client, but ensure it only runs on boot 2023-07-15 00:21:24 -04:00
Derrick Hammer fbfb9c1e06
refactor: remove block check from isSynced 2023-07-15 00:18:15 -04:00
Derrick Hammer 45b3e884f9
fix; add syncDelay to client factory 2023-07-14 11:18:05 -04:00
Derrick Hammer a901ee76f4
feat: add loggerInfo and loggerErr callbacks to client options 2023-07-14 11:16:38 -04:00
Derrick Hammer 824dcd9633
fix: add a sync delay option so that the bls verification does not hog cpu 2023-07-14 09:21:52 -04:00
Derrick Hammer dc4c6b3f36
fix: compare code against codehash 2023-07-13 13:17:27 -04:00
Derrick Hammer 3e27281a35
fix: add map to return data property 2023-07-13 12:51:34 -04:00
Derrick Hammer 8677bc1294
fix: parse from u, not u.data 2023-07-13 12:45:49 -04:00
Derrick Hammer 91144cb5a2
fix: temporarily disable block hash check as it is bugged 2023-07-13 12:26:41 -04:00
Derrick Hammer 157811b234
fix: use byteArrayEquals 2023-07-13 12:25:21 -04:00
Derrick Hammer b87017eb67
fix: need to use concat not push 2023-07-13 12:23:33 -04:00
Derrick Hammer 6ef18dbc05
fix: Revert "fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize"
This reverts commit d8430b4a11.
2023-07-13 10:40:25 -04:00
Derrick Hammer 07845bf4d0
fix: need to disable useClones in node cache 2023-07-13 08:26:58 -04:00
Derrick Hammer d8430b4a11
fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize 2023-07-13 08:09:00 -04:00
Derrick Hammer cfa1462505
refactor: handle case where returned items are less than the total requested and loop until we have them all 2023-07-13 07:10:48 -04:00
Derrick Hammer e567d5017d
refactor: call getLatestExecution in sync and add an arg to getLatestExecution to skip syncing 2023-07-13 04:35:29 -04:00
Derrick Hammer f68688ab61
refactor: have isSynced check the period and the block 2023-07-13 04:32:18 -04:00
Derrick Hammer 661e146636
feat: add getCurrentBlock and getLastBlock methods 2023-07-13 04:31:55 -04:00
Derrick Hammer 93ab07c5c3
refactor: make getLatestExecution public 2023-07-13 04:05:34 -04:00
Derrick Hammer 391a4f968a
refactor: if we have a _latestOptimisticUpdate, check the estimated current block against the block we have, and return it as cached data if we don't need to fetch again. Also use a mutex to prevent race conditions 2023-07-13 04:00:42 -04:00
Derrick Hammer 36f9f4c910
tidy: unneeded var 2023-07-13 03:47:44 -04:00
Derrick Hammer c5a2dc86e1
refactor: don't run automatic optimistic updates 2023-07-13 03:35:33 -04:00
Derrick Hammer 11791ff08b
refactor: split subscribe into syncToLatestBlock 2023-07-13 03:18:05 -04:00
Derrick Hammer 4836ddb32e
style: reformat 2023-07-13 03:14:06 -04:00
Derrick Hammer b3e5607132
refactor: store optimistic update back into _latestOptimisticUpdate with a getter. 2023-07-13 03:13:22 -04:00
Derrick Hammer a7786fa21c
style: fix typos 2023-07-13 03:12:49 -04:00
Derrick Hammer c3b47e67e7
fix: add optimisticUpdateCallback to client factory 2023-07-13 02:53:23 -04:00
Derrick Hammer 977d33b768
refactor: make optimisticUpdateCallback a dedicated type 2023-07-13 02:53:00 -04:00
Derrick Hammer 464fb21095
fix: add optimisticUpdateCallback to options 2023-07-13 02:33:07 -04:00
Derrick Hammer 4be6c339c7
chore: cleanup imports 2023-07-13 02:32:46 -04:00
Derrick Hammer 51d6d23942
refactor: getLatestExecution needs to actually call optimistic update, but add a callback in the client options to avoid creating a subclass 2023-07-13 02:25:05 -04:00
Derrick Hammer 5aa37d4a61
refactor: don't use un-needed for loop 2023-07-13 01:46:45 -04:00
Derrick Hammer 17cb00231c
fix: simplify logic and use LightClientUpdate.fromJson 2023-07-13 01:45:43 -04:00
Derrick Hammer 76e22fa342
fix: use _client not client 2023-07-13 01:44:26 -04:00
Derrick Hammer 481757e019
fix: pass client to prover after creating client in factory. don't try to parse thr messages 2023-07-13 01:44:25 -04:00
Derrick Hammer baa9562749
fix: fix import 2023-07-12 17:59:56 -04:00
Derrick Hammer 6408098050
refactor: heavily simplify and consolidate implementations to just use light sync updates and not the optimistic_update endpoint, and use a generic callback interface 2023-07-12 17:40:59 -04:00