Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Refactor state into refs and tree. #912

Merged
merged 5 commits into from
Sep 19, 2018

Conversation

silasdavis
Copy link
Contributor

@silasdavis silasdavis commented Sep 14, 2018

This prepares the way for various state manipulations and introduces a top-level storage package that takes makes some steps towards Cosmos SDK compatibility. Changes included:

  • Prefix and KeyFormat types for handling prefixed lexicographic keys consistently
  • A CacheDB that wraps all changes within a block into a single DB transaction - i.e. Batch
  • A separate 'tree' and 'refs' storage in state. The former describes those values that contribute to the state hash and the latter does not - this gives us more latitude in disabling, for example, block storage or running nodes that opt to store somewhat different derived data whilst agreeing the the core account state.
  • Upgrade IAVL dependency to version including: Use 8 bytes to store int64 components of database keys  cosmos/iavl#107

Some changes that may follow in a future PR:

  • Content address account code for some deduplication
  • Content address blocks to allow their hash to be stored in main tree for consistency (not sure about this one)
  • Make block storage configurable
  • Consider using a Trie implementation in various places including caches for some reduced string -> []byte copying.

Also try to strengthen abstractions around prefixes and atomic commits.

Signed-off-by: Silas Davis <[email protected]>
@seanyoung
Copy link
Contributor

storage/cache_db.go line 45 contains a bug statement.
as @silasdavis is away let's merge anyway and I will fix up afterwards.

@seanyoung seanyoung merged commit 1422631 into hyperledger-archives:develop Sep 19, 2018
@silasdavis silasdavis deleted the state branch January 4, 2019 11:42
silasdavis pushed a commit to silasdavis/burrow that referenced this pull request Mar 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants