refactor: move HistoryLastUpdateBlock logic to the state#3486
Merged
MaksymMalicki merged 22 commits intomainfrom Mar 20, 2026
Merged
refactor: move HistoryLastUpdateBlock logic to the state#3486MaksymMalicki merged 22 commits intomainfrom
MaksymMalicki merged 22 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3486 +/- ##
==========================================
- Coverage 75.05% 73.78% -1.27%
==========================================
Files 385 385
Lines 34950 35168 +218
==========================================
- Hits 26231 25949 -282
- Misses 6762 6944 +182
- Partials 1957 2275 +318 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rodrodros
reviewed
Mar 18, 2026
Contributor
rodrodros
left a comment
There was a problem hiding this comment.
Looks good – some stylistic changes
…e + deprecatedStateHistory types
…pdatedBlock method + update tests
…thod for the PendingState type
[no ci]
…state types [no ci]
…ed block + enhance PendingState tests
… felt.Address type - Changed address parameter types in ContractStorageLastUpdatedBlock and related methods to felt.Address. - Updated tests to reflect changes in address handling, ensuring compatibility with new address type. - Enhanced clarity in comments regarding the behavior of ContractStorageLastUpdatedBlock. [no ci]
…r clarity + remove feltOne global variable [no ci]
…single shared var [no ci]
d8e6e7a to
4645467
Compare
MaksymMalicki
approved these changes
Mar 20, 2026
brbrr
pushed a commit
that referenced
this pull request
Mar 20, 2026
* refactor: move the HistoryLastUpdateBlock logic to the DeprecatedState + deprecatedStateHistory types * refactor: update StorageAt method to use the new ContractStorageLastUpdatedBlock method + update tests * feat: add the ContractStorageLastUpdatedBlock logic to the State + stateHistory types * feat: add pending block number and ContractStorageLastUpdatedBlock method for the PendingState type * chore: regenerate mocks [no ci] * test: implement ContractStorageLastUpdatedBlock tests across various state types [no ci] * ci: fix linter * chore: rename param to 'pendingBlockNumber' in the NewPendingState func * test: refactor TestPendingState * test: fix TestStorageAt test * test: fix Pending tests * feat: add case for deployed contract with unchanged storage key in PendingState * fix: avoid contract not found errors for new contracts in pre_confirmed block + enhance PendingState tests * refactor: update address handling in state and history methods to use felt.Address type - Changed address parameter types in ContractStorageLastUpdatedBlock and related methods to felt.Address. - Updated tests to reflect changes in address handling, ensuring compatibility with new address type. - Enhanced clarity in comments regarding the behavior of ContractStorageLastUpdatedBlock. [no ci] * refactor: rename pendingBlockNumber to blockNumber in PendingState for clarity + remove feltOne global variable [no ci] * test: use local stateDiff variable in the TestStorageAt instead of a single shared var [no ci] * test: add new test case for deployment height retrieval in state history * ci: fix linter * test: fix TestStorageAt due to the address parameter being a felt.Address now * ci: fix linter * refactor: remove unused return flag in the ContractStorageLastUpdatedBlock method --------- Co-authored-by: MaksymMalicki <81577596+MaksymMalicki@users.noreply.github.com>
brbrr
pushed a commit
that referenced
this pull request
Mar 20, 2026
* refactor: move the HistoryLastUpdateBlock logic to the DeprecatedState + deprecatedStateHistory types * refactor: update StorageAt method to use the new ContractStorageLastUpdatedBlock method + update tests * feat: add the ContractStorageLastUpdatedBlock logic to the State + stateHistory types * feat: add pending block number and ContractStorageLastUpdatedBlock method for the PendingState type * chore: regenerate mocks * test: implement ContractStorageLastUpdatedBlock tests across various state types * ci: fix linter * chore: rename param to 'pendingBlockNumber' in the NewPendingState func * test: refactor TestPendingState * test: fix TestStorageAt test * test: fix Pending tests * feat: add case for deployed contract with unchanged storage key in PendingState * fix: avoid contract not found errors for new contracts in pre_confirmed block + enhance PendingState tests * refactor: update address handling in state and history methods to use felt.Address type - Changed address parameter types in ContractStorageLastUpdatedBlock and related methods to felt.Address. - Updated tests to reflect changes in address handling, ensuring compatibility with new address type. - Enhanced clarity in comments regarding the behavior of ContractStorageLastUpdatedBlock. * refactor: rename pendingBlockNumber to blockNumber in PendingState for clarity + remove feltOne global variable * test: use local stateDiff variable in the TestStorageAt instead of a single shared var * test: add new test case for deployment height retrieval in state history * ci: fix linter * test: fix TestStorageAt due to the address parameter being a felt.Address now * ci: fix linter * refactor: remove unused return flag in the ContractStorageLastUpdatedBlock method --------- Co-authored-by: MaksymMalicki <81577596+MaksymMalicki@users.noreply.github.com>
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.
Follow-up PR for the #3470 feat.
Summary
HistoryLastUpdateBlocklogic from thedbpackage into the state layer, replacing it with aContractStorageLastUpdatedBlock(addr, key *felt.Felt) (uint64, bool, error)method added to theStateReaderinterfaceContractStorageLastUpdatedBlockon all state types:DeprecatedState,deprecatedStateHistory,State,stateHistory, andPendingStatePendingStatereturns the pending block number when the key is present in the pending diff, otherwise delegates to the head staterpc/v10/storage.goto callContractStorageLastUpdatedBlockthrough theStateReaderinterface instead of going directly to thedbpackagedb.HistoryLastUpdateBlockanddb/schema_test.go; test coverage is migrated into each state package