Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: Add support for storage and bytecode fetching (#2345)
* Add account fetcher base Add accountfetcher import Add AccountFetcher as possible type for Synchronizer.fetcher Place call to getAccountRange inside of fetcher Place call to getAccountRange() in accountfetcher and comment it out Add account fetcher base Add accountfetcher import add account fetcher getter setter in snapsync Change order of importing accountfetcher in index file Change bytes parameter to be per task Remove root and bytes from task inputs and make them fetcher variables Correct log message Add debug console log statement Fix linting issues Add account to mpt and check validity with root and proof Set root of trie Add checks to fetcher.request() client/snap: fix getAccountRange return type client/snap: pass first proof client/snap: add utility to convert slim account to a normal RLPd account client/snap: implement account range db dump Update to use verifyRangeProof Correct some messages Update verifyProofRange input for first account hash to be fetcher origin Fix linting issues Store accounts in store phase Add logic for dividing hash ranges and adding them as tasks Increment count by 1 before next iteration client/snap: remove unnecessary account fetcher logic client/snap: correctly feed the right values to verifyRangeProof lint fixes small cleanup fix account fetcher with previous fixes overhaul and simplify the fetcher and add partial results handling cleanup comments fix fetch spec tests Experiment with putting accounts into DefaultStateManager and CheckpointTrie Use return value of verifyRangeProof for checking if there are more accounts left to fetch in the range Remove unused function Export storage data Create storage fetcher Remove comment Modify debug message Update comments to reflect specs Modify comments and change storage fetcher to fetch only single account WIP: Queue storage fetches when accounts are received WIP: Continue work on storage fetcher Add storage fetcher tests Comment out storage fetcher integration until multi-fetcher sync support is added WIP: Initialize and run storage fetcher in account fetcher Add account field to JobTask type for storage fetcher and add enqueueByAccountList Add accounts for storage fetching in account fetcher Enable single account fetches in storage fetcher Save changes so far Index account body for storageRoot for use with storageFetcher Update comments and print statements Add custom debuggers to new fetchers Add limit check for continueing a task after partial resluts Add limit check for continueing a task after partial resluts and clean up comments Optimize by removing invalidated tasks; Terminate using new conditions Update comments WIP: Implement multi-account storage requests WIP: Continue development of multi-account fetches and optimizing storage fetcher WIP: Impelemnt multi-account fetching WIP: Debug task null error Add some checks for peer storage response Switch structure of post-fetch validation Debug storage fetcher: Set starting origin to 0 and troubleshoot request logic Aggregate partial results in embedded array Use larger task ranges for storage fetcher Set first and count in each task request Debug range logic Cleanup code and fix task generation loop Fix one-off error Clean up comments and logging in accountfetcher Improve logging Refactor and clean up storagefetcher Add commented code snippet for demo Use config value for maxRangeBytes Return results in the case of a single, no-proof slot payload Only enqueue storageRequests if more than 0 exist Run account fetcher in syncWithPeer Fix linting issues * Update tests * Bufferize storage root if it is not a buffer already * Update storage fetcher tests * Move storage request processing in account fetcher into store phase * Update comments * Fix linting issues * Update comments * Update comments * Use config value for maxAccountRange * Update comment * Add tests for requests and proof verification * Initialize chain using helper * Setup to dev/test snapsync with sim architecture * modfiy single-run to setup a lodestar<>geth node to snapsync from * setup an ethereumjs inline client and get it to peer with geth * cleanup setup a bit * snapsync run spec * get the snap testdev sim working * finalize the test infra and update usage doc * enhance coverage * Fix lint error * Setup to dev/test snapsync with sim architecture * modfiy single-run to setup a lodestar<>geth node to snapsync from * setup an ethereumjs inline client and get it to peer with geth * cleanup setup a bit * snapsync run spec * get the snap testdev sim working * finalize the test infra and update usage doc * enhance coverage * Use geth RPC to connect to ethJS * refac wait for snap sync completion * Emit snap sync completion event in accountfetcher * Modify fetcher termination condition * Cluster snap config items together * Index account range starting from 0 * Sync fetchers using helper * Put storage slots into tries * Use destroyWhenDone to terminate storage fetcher * End fetcher if finished tasks is greater than or equal to total * setup writer just once if fetcher not destroyed * cleanup and codeflow simplification * cleanup * fix accountspec * increase coverage * add some more coverage * lint * increase storagefetcher coverage * further enhance storagefetcher coverage * improve cov --------- Co-authored-by: harkamal <[email protected]> Co-authored-by: acolytec3 <[email protected]>
- Loading branch information