-
Notifications
You must be signed in to change notification settings - Fork 592
feat: Node snapshot sync #12927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Node snapshot sync #12927
Changes from 6 commits
ddfbc1f
1db0742
bddb037
099f134
c40b6f9
104c922
7d86243
919d34c
921ab19
a75b713
b8b457d
f1c5658
c509f28
9162861
0384eac
7e08a5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ import { type LogFilter, PrivateLog, type TxScopedL2Log } from '@aztec/stdlib/lo | |
| import type { InboxLeaf } from '@aztec/stdlib/messaging'; | ||
| import type { BlockHeader, TxHash, TxReceipt } from '@aztec/stdlib/tx'; | ||
|
|
||
| import { join } from 'path'; | ||
|
|
||
| import type { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js'; | ||
| import type { DataRetrieval } from '../structs/data_retrieval.js'; | ||
| import type { PublishedL2Block } from '../structs/published.js'; | ||
|
|
@@ -26,11 +28,13 @@ import { ContractInstanceStore } from './contract_instance_store.js'; | |
| import { LogStore } from './log_store.js'; | ||
| import { MessageStore } from './message_store.js'; | ||
|
|
||
| export const ARCHIVER_DB_VERSION = 1; | ||
|
|
||
| /** | ||
| * LMDB implementation of the ArchiverDataStore interface. | ||
| */ | ||
| export class KVArchiverDataStore implements ArchiverDataStore { | ||
| public static readonly SCHEMA_VERSION = 1; | ||
| public static readonly SCHEMA_VERSION = ARCHIVER_DB_VERSION; | ||
|
|
||
| #blockStore: BlockStore; | ||
| #logStore: LogStore; | ||
|
|
@@ -49,6 +53,15 @@ export class KVArchiverDataStore implements ArchiverDataStore { | |
| this.#contractInstanceStore = new ContractInstanceStore(db); | ||
| } | ||
|
|
||
| public async backupTo(path: string, compress = true): Promise<string> { | ||
| await this.db.backupTo(path, compress); | ||
| return join(path, 'data.mdb'); | ||
| } | ||
|
|
||
|
Comment on lines
+56
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not something for this PR but we should consider bundling the rollup address/schema version into the backup to avoid restoring incompatible versions?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot to go back and update this comment: this is handled already. This info is part of the snapshot index
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm adding it to the snapshot metadata. We could write those as entries of the db itself though, and completely do away with the |
||
| public close() { | ||
| return this.db.close(); | ||
| } | ||
|
|
||
| // TODO: These function names are in memory only as they are for development/debugging. They require the full contract | ||
| // artifact supplied to the node out of band. This should be reviewed and potentially removed as part of | ||
| // the node api cleanup process. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.