Skip to content

refactor(juno): integrate common interface with rawDB as trieDB engine#3187

Open
MaksymMalicki wants to merge 9 commits intomaksym/state-atomicityfrom
maksym/integrate-common-interface-rawdb
Open

refactor(juno): integrate common interface with rawDB as trieDB engine#3187
MaksymMalicki wants to merge 9 commits intomaksym/state-atomicityfrom
maksym/integrate-common-interface-rawdb

Conversation

@MaksymMalicki
Copy link
Contributor

@MaksymMalicki MaksymMalicki commented Oct 18, 2025

  1. This PR should be reviewed after refactor(state): remove DB writes from the new state to make writes atomic #3360

  2. It integrates the common interfaces across the project, including in utilities and tests. This PR uses rawDB - direct pebbleDB reads/writes - as a trieDB engine. New components of the pathDB engine will be introduced in the follow-up PRs.

  3. Some parts of the logic weren’t straightforward to unify due to the different ways the old and new states interact with PebbleDB. The old state is tightly coupled with IndexedBatch for reads and writes, while the new state is designed to read using raw DB/snapshots and write using regular PebbleDB Batch. As a result, the following methods were "duplicated" and tailored to the way the respective state and trie functionalities are meant to interact with the DB:

  • blockchain.Store

  • blockchain.GetReverseStateDiff

  • blockchain.Finalise

The adapting had to be also done for the prove logic inside of rpc/v8/storage.go, rpc/v8/storage_test.go, rpc/v9/storage.go, rpc/v9/storage_test.go

  1. The experimental --new-state boolean CLI flag is now fully integrated. It can be used via the command line and in the dbcmd utilities.

  2. The new state package includes some minor bug fixes discovered during previous work (#2912) while debugging sync, RPC, and E2E tests.

  3. A new command was added to the Makefile, to run the unit tests strictly with the new state and trie implementations in the future CI/CD:

test-new-state: clean-testcache rustdeps ## Run tests with new state
	USE_NEW_STATE=true go test $(GO_TAGS) -v ./...

@codecov
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 35.49020% with 329 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.93%. Comparing base (beeb202) to head (2b58353).

Files with missing lines Patch % Lines
blockchain/blockchain.go 32.32% 123 Missing and 11 partials ⚠️
rpc/v9/storage.go 31.25% 62 Missing and 4 partials ⚠️
rpc/v8/storage.go 32.63% 60 Missing and 4 partials ⚠️
core/state/history.go 0.00% 9 Missing ⚠️
db/memory/db.go 0.00% 7 Missing ⚠️
db/pebble/db.go 0.00% 7 Missing ⚠️
db/pebblev2/db.go 0.00% 7 Missing ⚠️
db/remote/db.go 0.00% 6 Missing ⚠️
cmd/juno/dbcmd.go 60.00% 2 Missing and 2 partials ⚠️
core/state/state.go 33.33% 4 Missing ⚠️
... and 9 more

❌ Your patch check has failed because the patch coverage (35.49%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@                    Coverage Diff                     @@
##           maksym/state-atomicity    #3187      +/-   ##
==========================================================
- Coverage                   75.53%   74.93%   -0.60%     
==========================================================
  Files                         384      385       +1     
  Lines                       34910    35284     +374     
==========================================================
+ Hits                        26368    26440      +72     
- Misses                       6684     6981     +297     
- Partials                     1858     1863       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaksymMalicki MaksymMalicki changed the base branch from maksym/trie-interface to maksym/rawdb November 18, 2025 20:07
@MaksymMalicki MaksymMalicki changed the base branch from maksym/rawdb to maksym/integrate-common-interfaces-rawdb November 19, 2025 14:40
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from 33d81d5 to dc23482 Compare December 29, 2025 15:11
@MaksymMalicki MaksymMalicki changed the base branch from maksym/integrate-common-interfaces-rawdb to maksym/common-interfaces-integration February 4, 2026 14:52
@MaksymMalicki MaksymMalicki changed the base branch from maksym/common-interfaces-integration to maksym/integrate-common-interfaces-rawdb February 4, 2026 14:55
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from dc23482 to ddded14 Compare February 10, 2026 09:23
@MaksymMalicki MaksymMalicki changed the base branch from maksym/integrate-common-interfaces-rawdb to maksym/common-interfaces-integration February 10, 2026 09:24
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from 374fcf7 to 1ba0bf0 Compare February 10, 2026 21:48
@MaksymMalicki MaksymMalicki force-pushed the maksym/common-interfaces-integration branch 2 times, most recently from 6eb0933 to 386d97c Compare February 25, 2026 15:23
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch 2 times, most recently from 7740498 to 1f4a9a6 Compare February 25, 2026 15:58
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from 1f4a9a6 to b95e87a Compare February 25, 2026 18:05
@MaksymMalicki MaksymMalicki changed the base branch from maksym/common-interfaces-integration to maksym/state-atomicity February 25, 2026 18:07
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from b95e87a to 514d9fa Compare February 25, 2026 21:15
@MaksymMalicki MaksymMalicki force-pushed the maksym/state-atomicity branch 2 times, most recently from 7b87b1c to 98cf47e Compare March 2, 2026 13:51
@MaksymMalicki MaksymMalicki force-pushed the maksym/state-atomicity branch 3 times, most recently from dc41ffd to 417651d Compare March 20, 2026 11:09
@rodrodros rodrodros force-pushed the maksym/state-atomicity branch from 417651d to 8428b18 Compare March 20, 2026 15:56
fix unit tests

cleanups

renames

unit tests

interface modifications

linter

linter

linter
cleanups

Integrate common interfaces into rawdb

fixes after rebase

minor linter changes

clean-up blockchain.go, fix linter

minor cleanups

state atomicity

remove node ordering

fixes after rebase
fix unit tests

cleanups

Integrate common interfaces into rawdb

fixes after rebase

minor linter changes

clean-up blockchain.go, fix linter

unit tests

linter

minor cleanups

linter

linter

fixes after rebase
@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from d5e5028 to 2b58353 Compare March 22, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants