-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Context
Stateful compression was introduced in StarkNet v0.13.4. This feature relies on data from previous blocks, making its integration non-trivial.
📖 Full details: https://community.starknet.io/t/starknet-v0-13-4-pre-release-notes/115257
Steps for Integration
-
Propose an Architecture
Since stateful compression has dependencies on historical state, the architecture needs to be thoughtfully designed. Below are a few ideas:-
On-the-fly
get_storage_atlookups
For every key missing in the current squashed state diff, useget_storage_at(specifically for address0x2).- ✅ Pros: Easy and quick to implement
- ❌ Cons: Potentially slow, especially if there are many keys
-
Maintain a Historical DB
- Use block info from the blob to build a local state DB incrementally.
- Decompress blobs using this DB.
- Take periodic snapshots (e.g., upload/download from S3).
- Allow updates via cron jobs or manual uploads.
- ✅ Pros: Fast decompression once setup
- ❌ Cons: Significant initial complexity and infra overhead
-
Open to other proposals
-
-
Implement the Chosen Architecture
Implementation will depend on the selected strategy from above. -
Add Tests
Validate correctness using real-world data (i.e. from mainnet or Sepolia).
Other Information
some part of the code is already being implemented here: https://github.com/Mohiiit/orch-compression