Snapshot Generation
Snapshot Computation Modules
As briefly introduced in the section on Snapshotter implementations that leverage Git Submodules for specific computation logic, the modules are specified in the configuration for project types under the key processor
.
https://github.com/Powerloom/snapshotter-configs/blob/39e4713cdd96fff99d100f1dea7fb7332df9e491/projects.example.json#L15-L28
Let's take the example of the snapshot builder configured for the project type zkevm:owlto_bridge
and locate it in the snapshotter-computes
repo, in the zkevm_quests
branch
https://github.com/Powerloom/snapshotter-computes/blob/29199feab449ad0361b5867efcaae9854992966f/owlto_bridge.py#L1-L31
As observed, it implements the compute()
interface expected from Snapshotter implementations inheriting GenericProcessorSnapshot
.
https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d03/snapshotter/utils/callback_helpers.py#L179-L196
Base Snapshots
Callback workers calculate base snapshots against an epochId
, corresponding to collections of state observations and event logs between the blocks at heights in the range begin, end
. They invoke the use case-specific computation logic as configured in the computation modules section.
The data sources are specified against the projects
key in the configuration shown in the section above.
Data Source Specification: Non-bulk Mode
- If
bulk_mode
is set toFalse
and an empty array is assigned to theprojects
:
The Snapshotter node attempts to retrieve data sources corresponding to the projects
key from the protocol state.
https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d03/snapshotter/processor_distributor.py#L321-L332
- If the
projects
key is non-existent- data sources can also be dynamically added on the protocol state contract which the processor distributor syncs with
https://github.com/Powerloom/pooler/blob/634610801a7fcbd8d863f2e72a04aa8204d27d03/snapshotter/processor_distributor.py#L738-L751
- Else, we can have a static list of contracts