Skip to content

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

Open
MaksymMalicki wants to merge 36 commits intomainfrom
maksym/integrate-common-interface-rawdb
Open

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

Conversation

@MaksymMalicki
Copy link
Copy Markdown
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. It introduces the new state backend for the blockchain package, which utilises database for reads and Batch for writes

Some adapting had to be also done for the prove logic inside of storage.go and storage_test.go to support both trie and trie2 packages.

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

  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
	JUNO_NEW_STATE=true go test $(GO_TAGS) -v ./...

NOTE:

  • The only expected linter errors are related to the use of the IndexedBatch() in the diff, which is Deprecated.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 25.94697% with 391 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.07%. Comparing base (026d019) to head (5bc5cd6).

Files with missing lines Patch % Lines
blockchain/statebackend/statebackend.go 0.00% 128 Missing ⚠️
rpc/v10/storage.go 29.03% 62 Missing and 4 partials ⚠️
rpc/v8/storage.go 28.26% 62 Missing and 4 partials ⚠️
rpc/v9/storage.go 28.57% 61 Missing and 4 partials ⚠️
genesis/genesis.go 33.33% 7 Missing and 1 partial ⚠️
db/memory/db.go 0.00% 7 Missing ⚠️
db/pebble/db.go 0.00% 7 Missing ⚠️
db/pebblev2/db.go 0.00% 7 Missing ⚠️
blockchain/state_version.go 77.77% 3 Missing and 3 partials ⚠️
db/remote/db.go 0.00% 6 Missing ⚠️
... and 9 more

❌ Your patch check has failed because the patch coverage (25.94%) 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             @@
##             main    #3187      +/-   ##
==========================================
- Coverage   75.76%   75.07%   -0.69%     
==========================================
  Files         386      387       +1     
  Lines       33748    34125     +377     
==========================================
+ Hits        25569    25621      +52     
- Misses       6394     6712     +318     
- Partials     1785     1792       +7     

☔ 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.

Comment thread consensus/p2p/validator/fixtures_test.go Outdated
Comment thread blockchain/blockchain_test.go
Comment thread blockchain/blockchain_test.go
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain_test.go Outdated
Comment thread blockchain/blockchain.go Outdated
Comment thread blockchain/blockchain.go Outdated
@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 and others added 26 commits April 18, 2026 16:04
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
Comment thread vm/vm_test.go
}, map[felt.Felt]core.ClassDefinition{
*classHash: simpleClass,
}, false))
require.NoError(t, batch.Write())
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new state can't read its own writes - database is used for reads. The changes applied to the batch by state.Update need to be applied to the DB.

@MaksymMalicki MaksymMalicki force-pushed the maksym/integrate-common-interface-rawdb branch from efa09d5 to 5bc5cd6 Compare April 18, 2026 15:15
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.

3 participants