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

datastore: domain put, delete, get latest from kvdb #2614

Merged
merged 6 commits into from
Dec 31, 2024
Merged

Conversation

battlmonstr
Copy link
Contributor

@battlmonstr battlmonstr commented Dec 19, 2024

Implementation of DomainPutQuery, DomainDeleteQuery, DomainGetLatestQuery - an equivalent of SharedDomains DomainPut, DomainDel, DomainGet (GetLatest - getLatestFromDb code path). The CAPI execution will be based on the LocalState class which runs these direct datastore queries.

In Erigon DomainPut is based on SharedDomains.domains (Go map) and domainBufferedWriter-s (ETL collector that is eventually flushed into mdbx tables). In Silkworm it is based on RWTxnManaged which will be created from an in-memory mdbx DB shared between Erigon and Silkworm via the CAPI. The mdbx schema is the same as for Erigon3 state mdbx tables. DomainDeleteQuery is just a DomainPutQuery with an empty bytes value.

Refactorings:

  • move step.hpp to datastore/common for reuse between snapshots and kvdb
  • move codecs to address_codecs, account_codecs, storage_codecs for reuse between domains
  • AccountCodec: Account encoding/decoding is extracted from core to a separate class in db/state
    • encode_for_storage_v3 added
    • from_encoded_storage_v3 rewritten to a more direct logic with stricter input checking

Future work:

  • LocalState: prev_step, initial_code
  • LocalState: deletion
  • DomainGetLatest using snapshots

@battlmonstr battlmonstr added the erigon3 Erigon3 feature label Dec 19, 2024
@battlmonstr battlmonstr force-pushed the pr/domain_put branch 7 times, most recently from 58d53fb to 927719b Compare December 24, 2024 16:43
@battlmonstr battlmonstr marked this pull request as ready for review December 24, 2024 16:43
@battlmonstr battlmonstr changed the title datastore: DomainPutQuery datastore: domain put, delete Dec 25, 2024
@battlmonstr battlmonstr disabled auto-merge December 25, 2024 11:57
@battlmonstr battlmonstr enabled auto-merge (squash) December 25, 2024 11:57
@battlmonstr battlmonstr disabled auto-merge December 25, 2024 11:57
@battlmonstr battlmonstr marked this pull request as draft December 25, 2024 12:06
auto-merge was automatically disabled December 25, 2024 12:06

Pull request was converted to draft

@battlmonstr battlmonstr force-pushed the pr/domain_put branch 2 times, most recently from 3d8a628 to 62946f2 Compare December 25, 2024 14:53
@battlmonstr battlmonstr changed the title datastore: domain put, delete datastore: domain put, delete, get latest Dec 25, 2024
@battlmonstr battlmonstr changed the title datastore: domain put, delete, get latest datastore: domain put, delete, get latest from kvdb Dec 25, 2024
@battlmonstr battlmonstr marked this pull request as ready for review December 25, 2024 15:00
@canepat canepat mentioned this pull request Dec 31, 2024
41 tasks
@battlmonstr battlmonstr merged commit 90a6c09 into master Dec 31, 2024
5 checks passed
@battlmonstr battlmonstr deleted the pr/domain_put branch December 31, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erigon3 Erigon3 feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants