Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d58db5d
define StorageProvider interface
haikoschol May 29, 2025
8738a48
implement StorageProvider on ClientAdapter
haikoschol May 29, 2025
0adb5c9
implement read-only StorageState methods on ClientAdapter
haikoschol May 29, 2025
9dda3ce
lint
haikoschol Jun 12, 2025
a05706a
Merge branch 'development' into haiko/read-only-storage-state
haikoschol Jun 12, 2025
a5dd729
Merge branch 'development' into haiko/read-only-storage-state
haikoschol Jun 18, 2025
ad9e065
address some review feedback
haikoschol Jun 18, 2025
80028fa
correctly set IterArgs.StartAtExclusive
haikoschol Jun 18, 2025
9ddac63
Merge branch 'development' into haiko/read-only-storage-state
haikoschol Jun 20, 2025
c3e7a71
use updated TrieLayout types/API
haikoschol Jun 20, 2025
2cd321d
use storage.StorageKey instead of statemachine.StorageKey in StorageP…
haikoschol Jun 20, 2025
37dd38d
use local KeysIter/PairsIter in StorageProvider
haikoschol Jun 20, 2025
2b5ef15
remove unused methods from BlockState and ClientAdapter
haikoschol Jun 20, 2025
ec5f7d0
move StorageProvider impl from ClientAdapter to Client
haikoschol Jun 20, 2025
545acd8
Merge branch 'development' into haiko/read-only-storage-state
haikoschol Jun 21, 2025
d05af3e
remove another unused method from BlockState
haikoschol Jun 21, 2025
5b016e5
implement ClientAdapter.Leaves()
haikoschol Jun 21, 2025
e6f4a0e
implement ClientAdapter.TrieState()
haikoschol Jun 21, 2025
2196b5d
Revert "remove another unused method from BlockState"
haikoschol Jun 21, 2025
c9c2bb0
maybe fix mock
haikoschol Jun 21, 2025
9aa715c
more mock fixery
haikoschol Jun 21, 2025
96a0c2e
update a bazillion BlockState mocks
haikoschol Jun 21, 2025
9ee8088
WIP GenerateTrieProof()
haikoschol Jun 25, 2025
65615ce
use statemachine.KeysIter in StorageProvider
haikoschol Jun 26, 2025
3a71c45
fix(state): Change StorageState methods to always expect a block hash…
haikoschol Jul 5, 2025
9026510
update StorageState impl on ClientAdapter
haikoschol Jul 5, 2025
20c6080
Merge branch 'development' into haiko/read-only-storage-state
haikoschol Jul 5, 2025
f7fc05e
remove duplicate StorageProvider definition
haikoschol Jul 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions dot/core/mock_state_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions dot/mock_block_state_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions dot/network/mock_block_state_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions dot/rpc/modules/mock_block_state_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions dot/state/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
ReceiptPrefix = []byte("rcp") // ReceiptPrefix + hash -> receipt
MessageQueuePrefix = []byte("mqp") // MessageQueuePrefix + hash -> message queue
JustificationPrefix = []byte("jcp") // JustificationPrefix + hash -> justification
firstSlotNumberKey = []byte("fsn") // firstSlotNumberKey -> First slot number
FirstSlotNumberKey = []byte("fsn") // FirstSlotNumberKey -> First slot number

errNilBlockTree = errors.New("blocktree is nil")
errNilBlockBody = errors.New("block body is nil")
Expand Down Expand Up @@ -84,7 +84,6 @@ type BlockState interface {
GetReceipt(hash common.Hash) ([]byte, error)
GetMessageQueue(hash common.Hash) ([]byte, error)
GetTries() *Tries
GetBlockHashesBySlot(slotNum uint64) ([]common.Hash, error)
GetAllBlocksAtNumber(num uint) ([]common.Hash, error)

GetNonFinalisedBlocks() []common.Hash
Expand All @@ -102,7 +101,6 @@ type BlockState interface {
SetHeader(header *types.Header) error
SetJustification(hash common.Hash, data []byte) error
SetHighestRoundAndSetID(round, setID uint64) error
GetRoundAndSetID() (uint64, uint64)

GetRuntime(blockHash common.Hash) (instance runtime.Instance, err error)
UnregisterRuntimeUpdatedChannel(id uint32) bool
Expand Down Expand Up @@ -589,12 +587,12 @@ func (bs *DefaultBlockState) SetBlockBody(hash common.Hash, body *types.Body) er
func (bs *DefaultBlockState) SetFirstNonOriginSlotNumber(slotNumber uint64) error {
buf := make([]byte, 8)
binary.LittleEndian.PutUint64(buf, slotNumber)
return bs.db.Put(firstSlotNumberKey, buf)
return bs.db.Put(FirstSlotNumberKey, buf)
}

// GetFirstNonOriginSlotNumber returns the slot number of the first non origin block
func (s *DefaultBlockState) GetFirstNonOriginSlotNumber() (uint64, error) {
slotVal, err := s.db.Get(firstSlotNumberKey)
slotVal, err := s.db.Get(FirstSlotNumberKey)
if err != nil {
if errors.Is(err, database.ErrNotFound) {
return 0, nil
Expand Down
2 changes: 1 addition & 1 deletion dot/state/storage_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type StorageState interface {
GenerateTrieProof(stateRoot common.Hash, keys [][]byte) ([][]byte, error)
GetStorage(root *common.Hash, key []byte) ([]byte, error)
GetStorageByBlockHash(bhash *common.Hash, key []byte) ([]byte, error)
StorageRoot() (common.Hash, error) // best block state root, use HeaderBackend
StorageRoot() (common.Hash, error)
Entries(root *common.Hash) (map[string][]byte, error) // should be overhauled to iterate
GetKeysWithPrefix(root *common.Hash, prefix []byte) ([][]byte, error)
GetStorageChild(root *common.Hash, keyToChild []byte) (trie.Trie, error)
Expand Down
30 changes: 0 additions & 30 deletions dot/sync/mock_block_state_maker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading