-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Separate Prover and Server DAL #1334
Conversation
# Conflicts: # core/lib/dal/.sqlx/query-204cfd593c62a5a1582215a5f0f4d3648b75bf01ff336bbd77d15f9aa5fd6443.json # core/lib/dal/.sqlx/query-23be43bf705d679ca751c89353716065fcad42c6b621efb3a135a16b477dcfd9.json # core/lib/dal/.sqlx/query-2a2680234c38904e5c19df45193a8c13d04079683e09c65f7f4e76a9987e2ab4.json # core/lib/dal/.sqlx/query-5659480e5d79dab3399e35539b240e7eb9f598999c28015a504605f88bf84b33.json # core/lib/dal/.sqlx/query-6692ff6c0fbb2fc94f5cd2837a43ce80f9b2b27758651ccfc09df61a4ae8a363.json # core/lib/dal/.sqlx/query-75f6eaa518e7840374c4e44b0788bf92c7f2c55386c8208e3a82b30456abd5b4.json # core/lib/dal/.sqlx/query-c02f404ce9b0f92b8052ef6f3eaabda70cb9c56ae3e30dc0a8257e43d6714155.json # core/lib/dal/.sqlx/query-cb0a9f6137fb6bee5d17d644714b3b22ea2cd184932fcd59f5931239c7a78003.json # core/lib/dal/.sqlx/query-d6b70256793417a949081899eccf75260c7afaf110870656061a04079c35c2d8.json # core/lib/dal/.sqlx/query-e3479d12d9dc97001cf03dc42d9b957e92cd375ec33fe16f855f319ffc0b208e.json # core/lib/dal/.sqlx/query-fe06e06c04466429bb85709e6fe8dd6c2ad2793c06071f4a067dcc31306adebc.json # core/lib/dal/Cargo.toml # core/lib/dal/src/consensus_dal.rs # core/lib/dal/src/system_dal.rs # core/lib/db_connection/src/lib.rs # prover/prover_dal/src/fri_scheduler_dependency_tracker_dal.rs
Although the PR is pretty big, here are some main points for reviewing(because PR is big mostly because of renaming/import changes):
|
Also a few points worth discussion:
|
# Conflicts: # core/lib/state/src/postgres/mod.rs
I gave it a diagonal look. The split overall makes sense, but something still rubs me the wrong way. It feels more complicated than it has to be. That said, I see no alternative. Will leave it up to @popzxc to figure out how to make this interface nicer. Also, let's fix conflicts and what not so we can be merge ready. |
The problem with merges is that I need to fix it every few hours, because PR itself touches a lot of places and almost every merge to main causes conflicts. I will merge it for now, but I think will do it once a day if it will take much time for this one to merge |
Oh, I see. No need. Let's give Igor a bit of time and only do a merge when we're ready to fully merge. Keeping it up to date might be more pain than necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, don't want to nitpick too much given the huge scope.
This certainly feels like a good starting point, well done 👍
# Conflicts: # core/lib/dal/Cargo.toml # core/lib/zksync_core/src/consensus/storage/mod.rs # core/lib/zksync_core/src/consensus/testonly.rs # core/lib/zksync_core/src/utils/testonly.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's in a good enough state to merge it. Minor things will get polished over time (hehe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good. Let's get it merged!
🤖 I have created a release *beep* *boop* --- ## [22.0.0](core-v21.1.0...core-v22.0.0) (2024-03-21) ### ⚠ BREAKING CHANGES * Use protocol version v22 as latest ([#1432](#1432)) ### Features * add docs for Dal ([#1273](#1273)) ([66ceb0b](66ceb0b)) * adds debug_traceBlockByNumber.callFlatTracer ([#1413](#1413)) ([d2a5e36](d2a5e36)) * **api:** introduce mempool cache ([#1460](#1460)) ([c5d6c4b](c5d6c4b)) * **commitment-generator:** `events_queue` shadow mode ([#1138](#1138)) ([9bb47fa](9bb47fa)) * **contract-verifier:** Allow sc code reverification ([#1455](#1455)) ([5a37b42](5a37b42)) * **database:** add an optional master replica max connections settings ([#1472](#1472)) ([e5c8127](e5c8127)) * **db:** Configurable maximum number of open RocksDB files ([#1401](#1401)) ([b00c052](b00c052)) * **en:** Check recipient contract and function selector in consistency checker ([#1367](#1367)) ([ea5c684](ea5c684)) * Follow-up for DAL split ([#1464](#1464)) ([c072288](c072288)) * **node_framework:** Ergonomic improvements ([#1453](#1453)) ([09b6887](09b6887)) * **node_framework:** Only store each wiring layer once ([#1468](#1468)) ([4a393dc](4a393dc)) * **node_framework:** Support for preconditions and oneshot tasks ([#1398](#1398)) ([65ea881](65ea881)) * **node-framework:** Add eth sender layer ([#1390](#1390)) ([0affdf8](0affdf8)) * **node-framework:** Add housekeeper layer ([#1409](#1409)) ([702e739](702e739)) * Remove batch dry_run ([#1076](#1076)) ([b82d093](b82d093)) * Separate Prover and Server DAL ([#1334](#1334)) ([103a56b](103a56b)) * **storage:** Make the storage caches task cancellation aware ([#1430](#1430)) ([ab532bb](ab532bb)) * support running consensus from snapshot (BFT-418) ([#1429](#1429)) ([f9f4d38](f9f4d38)) * **tx-sender:** Limit concurrent tx submissions ([#1473](#1473)) ([4bdf3ca](4bdf3ca)) * Use protocol version v22 as latest ([#1432](#1432)) ([1757412](1757412)) * **vm:** Prestate tracer implementation ([#1306](#1306)) ([c36be65](c36be65)) ### Bug Fixes * **core:** drop correct index of proof_generation_details table during database migration ([#1199](#1199)) ([76a6821](76a6821)) * **dal:** correct `tx_index_in_l1_batch` in `get_vm_events_for_l1_batch` ([#1463](#1463)) ([8bf37ac](8bf37ac)) * **node_framework:** Fix main node example ([#1470](#1470)) ([ac4a744](ac4a744)) * **protocol:** Remove verifier address from protocol upgrade ([#1443](#1443)) ([90dee73](90dee73)) * **reth:** use reth instead of geth ([#1410](#1410)) ([bd98dc7](bd98dc7)) * **verified sources fetcher:** Use correct `contact_name` for `SolSingleFile` ([#1433](#1433)) ([0764227](0764227)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [22.0.0](core-v21.1.0...core-v22.0.0) (2024-03-21) ### ⚠ BREAKING CHANGES * Use protocol version v22 as latest ([#1432](#1432)) ### Features * add docs for Dal ([#1273](#1273)) ([66ceb0b](66ceb0b)) * adds debug_traceBlockByNumber.callFlatTracer ([#1413](#1413)) ([d2a5e36](d2a5e36)) * **api:** introduce mempool cache ([#1460](#1460)) ([c5d6c4b](c5d6c4b)) * **commitment-generator:** `events_queue` shadow mode ([#1138](#1138)) ([9bb47fa](9bb47fa)) * **contract-verifier:** Allow sc code reverification ([#1455](#1455)) ([5a37b42](5a37b42)) * **database:** add an optional master replica max connections settings ([#1472](#1472)) ([e5c8127](e5c8127)) * **db:** Configurable maximum number of open RocksDB files ([#1401](#1401)) ([b00c052](b00c052)) * **en:** Check recipient contract and function selector in consistency checker ([#1367](#1367)) ([ea5c684](ea5c684)) * Follow-up for DAL split ([#1464](#1464)) ([c072288](c072288)) * **node_framework:** Ergonomic improvements ([#1453](#1453)) ([09b6887](09b6887)) * **node_framework:** Only store each wiring layer once ([#1468](#1468)) ([4a393dc](4a393dc)) * **node_framework:** Support for preconditions and oneshot tasks ([#1398](#1398)) ([65ea881](65ea881)) * **node-framework:** Add eth sender layer ([#1390](#1390)) ([0affdf8](0affdf8)) * **node-framework:** Add housekeeper layer ([#1409](#1409)) ([702e739](702e739)) * Remove batch dry_run ([#1076](#1076)) ([b82d093](b82d093)) * Separate Prover and Server DAL ([#1334](#1334)) ([103a56b](103a56b)) * **storage:** Make the storage caches task cancellation aware ([#1430](#1430)) ([ab532bb](ab532bb)) * support running consensus from snapshot (BFT-418) ([#1429](#1429)) ([f9f4d38](f9f4d38)) * **tx-sender:** Limit concurrent tx submissions ([#1473](#1473)) ([4bdf3ca](4bdf3ca)) * Use protocol version v22 as latest ([#1432](#1432)) ([1757412](1757412)) * **vm:** Prestate tracer implementation ([#1306](#1306)) ([c36be65](c36be65)) ### Bug Fixes * **core:** drop correct index of proof_generation_details table during database migration ([#1199](#1199)) ([76a6821](76a6821)) * **dal:** correct `tx_index_in_l1_batch` in `get_vm_events_for_l1_batch` ([#1463](#1463)) ([8bf37ac](8bf37ac)) * **node_framework:** Fix main node example ([#1470](#1470)) ([ac4a744](ac4a744)) * **protocol:** Remove verifier address from protocol upgrade ([#1443](#1443)) ([90dee73](90dee73)) * **reth:** use reth instead of geth ([#1410](#1410)) ([bd98dc7](bd98dc7)) * **verified sources fetcher:** Use correct `contact_name` for `SolSingleFile` ([#1433](#1433)) ([0764227](0764227)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [12.2.0](prover-v12.1.0...prover-v12.2.0) (2024-03-28) ### Features * **api:** introduce mempool cache ([#1460](#1460)) ([c5d6c4b](c5d6c4b)) * **commitment-generator:** `events_queue` shadow mode ([#1138](#1138)) ([9bb47fa](9bb47fa)) * Drop prover tables in core database ([#1436](#1436)) ([0d78122](0d78122)) * Follow-up for DAL split ([#1464](#1464)) ([c072288](c072288)) * **prover:** export prover traces through OTLP ([#1427](#1427)) ([16dce75](16dce75)) * **prover:** File-info tool to help prover debugging ([#1216](#1216)) ([9759907](9759907)) * Separate Prover and Server DAL ([#1334](#1334)) ([103a56b](103a56b)) * support running consensus from snapshot (BFT-418) ([#1429](#1429)) ([f9f4d38](f9f4d38)) ### Bug Fixes * **api:** Fix API server shutdown flow ([#1425](#1425)) ([780f6b0](780f6b0)) * **prover:** Remove FriProtocolVersionId ([#1510](#1510)) ([6aa51b0](6aa51b0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: Roman Brodetski <[email protected]>
What ❔
db_connection
crate, which contains all the main logic for managingConnectionPool
andStorageProcessor
prover_dal
crateConnectionPool
s andStorageProcessor
s, to use appropriateConnectionPool
there are 2 options:ConnectionPool<Server>
,ConnectionPool<Prover>
- which will return appropriateStorageProcessor
with corresponding methods accessible only by this connection pool.vm_version
,prover_dal
and part ofprotocol_version
types were moved tobasic_types
crateFurther steps:
Why ❔
To separate logic of prover and server. To prevent accessing wrong database with one
ConnectionPool
.Checklist
zk fmt
andzk lint
.zk spellcheck
.zk linkcheck
.