Merged
Conversation
3afe3de to
2d4d95f
Compare
4f4803b to
4ec74dd
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2606 +/- ##
==========================================
+ Coverage 53.38% 53.46% +0.08%
==========================================
Files 302 307 +5
Lines 103403 102898 -505
==========================================
- Hits 55198 55012 -186
+ Misses 48205 47886 -319 ☔ View full report in Codecov by Sentry. |
4ec74dd to
bc29e16
Compare
tzemanovic
added a commit
that referenced
this pull request
Feb 23, 2024
tzemanovic
added a commit
that referenced
this pull request
Feb 23, 2024
2293352 to
b3cdf30
Compare
tzemanovic
added a commit
that referenced
this pull request
Feb 23, 2024
* tomas/refactor-state: changelog: add #2606 benches: update for new state API test/wasm: update for new state API tests: update for new state API test/PoS: update for new state API apps: update for new state API namada: update for new state API, refactor tx and VP host envs sdk: update for new state API eth_bridge: update for new state API ibc: update for new state API state: refactor everything
Collaborator
Author
|
there's an issue with loading merkle tree after node restart, looking into it |
grarco
reviewed
Feb 23, 2024
grarco
reviewed
Feb 23, 2024
grarco
reviewed
Feb 23, 2024
grarco
reviewed
Feb 23, 2024
Collaborator
Author
fixed in 1519e71 |
grarco
reviewed
Feb 23, 2024
grarco
reviewed
Feb 23, 2024
grarco
reviewed
Feb 23, 2024
0c98d6d to
daffb53
Compare
Collaborator
Author
tzemanovic
added a commit
that referenced
this pull request
Feb 26, 2024
* tomas/refactor-state: changelog: add #2606 benches: update for new state API test/wasm: update for new state API tests: update for new state API test/PoS: update for new state API apps: update for new state API namada: update for new state API, refactor tx and VP host envs sdk: update for new state API eth_bridge: update for new state API ibc: update for new state API state: refactor everything
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
closes #2486
High-level
struct Statetostruct InMemoryand removed its fielddb: Dtogether withDtype paramStatethat were using thedbare moved totrait Stateand prefixed withdb_(e.g.State::readbecomesState::db_read)struct WlStorage,struct TempWlStorageandtrait WriteLogAndStoragetrait Stategeneric over DB and hasher, comprised of a write log, DB andInMemorystate.struct FullAccessState(implsState,StorageReadandStorageWrite) - this is owned by shell which has full access to everything (DB, write log andInMemorystate)struct WlState(implsState,StorageReadandStorageWrite) - DB is read only, write/delete can only be done via write logstruct TempWlState(implsState,StorageReadandStorageWrite) - replacesTempWlStorage- for prepare and process proposal and dry-run txs which use a temporary write logstruct VpHostEnvState(implsStateandStorageRead) - state for VP exec, everything is read-only (except for gas meter which is held in aRefCellto allow mutation in immutable methods)struct TxHostEnvState(implsState,StorageReadandStorageWrite) - state for tx exec, can only write to write log, cannot modify in-memory state. Includes gas accounting (gas meter also in aRefCell).struct TxCtxnow hold reference to a generic mutableState'staticlifetime so anything that contains a non-static reference is a no-go. Instead, theTxCtxnow has astate()method, which returns aTxHostEnvStatethat allows to useStorageRead + StorageWritein host env with gas accounting included (replaces temporary implementation we've added for IBC tx workaround)'staticto be able to use them inwasm_importsstruct VpCtxandnative_vp::Ctxnow hold a reference to a generic immutableStateVpCtxhas astate()method that returnsVpHostEnvStatestruct TestWlStoragebytype TestState = FullAccessState<MockDB, Sha256Hasher>Usage
FullAccessState::restrict_writes_to_write_log- returns&mut WlStatefor transactions and other state changes in a blockFullAccessState::read_only- returns&WlStatefor VPs and queriestrait Statecomponents accessState::write_log(),State::write_log_mut(),State::db(),State::in_mem()(InMemorystate)State::split_borrowto use all 3 at the same timetrait Statein place ofWlStorageto simplify the verbose bounds:Next steps
For sub-system modules envisioned in #2111 we'll want to replace the usage of
WlStorage/WlState/Statewith the more abstractStorageRead + StorageWritewith additional traits that add access to individual parts of the state that are being used but not covered byStorageReadorStorageWrite(e.g. things fromInMemorystate - for shielded token we havetrait WithConversionStatethat provides mutable access to conversion state (in the concreteFullAccessStatethis is held instruct InMemory). The only places that directly use the state will be:These are
governance,ethereum_bridgeandibc.TODOs
StorageReadandStorageWriteimpl forTxCtxincrates/namada/src/vm/host_env.rswith a impl provided by the state crate (must account for gas)Indicate on which release or other PRs this topic is based on
#2507 - diff https://github.com/anoma/namada/pull/2606/files/d44bf1e2c242e076ca96e23c1e27dfba663c12b2..daffb53860531bf589f00259c3e12d4e5ee3b395
Checklist before merging to
draft