Skip to content
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

db: move LocalState/RemoteState to execution, StateReader to kv #2557

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

battlmonstr
Copy link
Contributor

db/state module is being repurposed for the low level e3 state implementation. It contains the eth state implementation that is not generic enough to be in db/datastore (akin SharedDomains vs Aggregator split in erigon). "low level" means that db/state must not depend on db/kv API.

In relation to this 2 refactorings are made:

  1. move StateReader from db/state to db/kv. Rationale: StateReader is a client on top of the kv API exposing a particular facet the kv API (similar to what db/kv/StateChangesStream is doing as well).
  2. move LocalState/RemoteState to execution. Rationale: LocalState/RemoteState are also clients on top of the kv API (or a lower level direct API) that adapt it to the core State interface abstraction used in relation to the EVM execution. The db::kv::api::Transaction::create_state method is replaced with execution::StateFactory. Now kv::api::Transaction is more decoupled from the EVM execution needs, and more closely represents the temporal KV API.

As a result, db/state does not depend on db/kv anymore. On the contrary, it is now possible to put code in db/kv that depends on db/state as needed.

@battlmonstr battlmonstr added the erigon3 Erigon3 feature label Dec 4, 2024
@battlmonstr battlmonstr requested a review from canepat December 4, 2024 10:48
@canepat canepat added the maintenance Some maintenance work (fix, refactor, rename, test...) label Dec 4, 2024
@canepat canepat merged commit 67d00bd into master Dec 4, 2024
5 checks passed
@canepat canepat deleted the pr/db_refac branch December 4, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erigon3 Erigon3 feature maintenance Some maintenance work (fix, refactor, rename, test...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants