cosmos-sdk/docs/core/store.md

228 lines
14 KiB
Markdown
Raw Normal View History

Docs: hide frontmatter, bugfixes (#5413) * encoding * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * module doc start * finish intro * working * workinnn * add transactions into core * hans comments * add transactions into core * working * gautier comments * clean * working * consolidate intro * querier * workiiiing * refactor for new module interface * karoly review * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * finish intro * workinnn * initial commit after rebase * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * add transactions into core * hans comments * add transactions into core * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * Merge PR #4857: Add Context concept doc * working * working * finish messages and queries * handler * querier * last comments! * punctuation * querier2 * consolidate intro * querier * workiiiing * refactor for new module interface * karoly review * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * finish intro * workinnn * initial commit after rebase * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * keeper * genesis * finish * Apply suggestions from code review Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * hans review * Update docs/core/baseapp.md Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * working * last comment * workin * Apply suggestions from code review * encoding and node * almost finish store * finish docs * fixes * fede comments + permalinks * hans review * add more permalinks * update docs theme version (#5239) * R4R: Docs Cleanup (#5246) * start * work * work * work * remove table of content * links intro * fix links * remove junk * cleanup * cleanup * work * finish cleanup * addback readmes * remove nft * fix links * remove dup * remove dup * remove dup * remove dup * remove dup * fix links * add subscribe events * refine rest * index page * sidebar * theme version * theme version * testing netlify * theme version * tooltip example * version * testing code embedding * reverting back * theme version * version * version * version * readme and version * cleanup * redo app anatomy * modules readme, theme version * theme version * fix modules list * theme version * new snippets * modules readme * update docs readme * modify synopsis * version * fix yaml * version * version * version * version * version * version * version * version * version * version * add hide banner * version * version * version * small fixes * modules readme, version * remove hotkeys dep, version * version * version * version * version * version * version * version * slight notice * fix links and hide * permalinks * small clean * version * resolve conflicts, add google analytics * fix merge remants * version * changelog 1/2 * Changelog: docs UI * version * remove merge conflicts * Code: Update link for Contributing to the docs to docs_readme * HTML/CSS: Update layout of homepage footer to match new layout in Figma * version * final modifs * modules, version * modules readme * link to module list from homepage * version * building modules link * version * version * fonts * version * version * fix link * fix package.json * links in explore sdk section * core concepts * version * change delimeters for frontmatter * frontmatter in comments * version * temp add tiny-cookie * fixed link issues * fixed styling issues, copy * hide frontmatter * hide frontmatter * layout fixes, padded ascii diagram * fira sans font for code
2019-12-17 03:44:44 -08:00
<!--
order: 5
Docs: hide frontmatter, bugfixes (#5413) * encoding * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * module doc start * finish intro * working * workinnn * add transactions into core * hans comments * add transactions into core * working * gautier comments * clean * working * consolidate intro * querier * workiiiing * refactor for new module interface * karoly review * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * finish intro * workinnn * initial commit after rebase * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * add transactions into core * hans comments * add transactions into core * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * Merge PR #4857: Add Context concept doc * working * working * finish messages and queries * handler * querier * last comments! * punctuation * querier2 * consolidate intro * querier * workiiiing * refactor for new module interface * karoly review * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * finish intro * workinnn * initial commit after rebase * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * keeper * genesis * finish * Apply suggestions from code review Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * hans review * Update docs/core/baseapp.md Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * working * last comment * workin * Apply suggestions from code review * encoding and node * almost finish store * finish docs * fixes * fede comments + permalinks * hans review * add more permalinks * update docs theme version (#5239) * R4R: Docs Cleanup (#5246) * start * work * work * work * remove table of content * links intro * fix links * remove junk * cleanup * cleanup * work * finish cleanup * addback readmes * remove nft * fix links * remove dup * remove dup * remove dup * remove dup * remove dup * fix links * add subscribe events * refine rest * index page * sidebar * theme version * theme version * testing netlify * theme version * tooltip example * version * testing code embedding * reverting back * theme version * version * version * version * readme and version * cleanup * redo app anatomy * modules readme, theme version * theme version * fix modules list * theme version * new snippets * modules readme * update docs readme * modify synopsis * version * fix yaml * version * version * version * version * version * version * version * version * version * version * add hide banner * version * version * version * small fixes * modules readme, version * remove hotkeys dep, version * version * version * version * version * version * version * version * slight notice * fix links and hide * permalinks * small clean * version * resolve conflicts, add google analytics * fix merge remants * version * changelog 1/2 * Changelog: docs UI * version * remove merge conflicts * Code: Update link for Contributing to the docs to docs_readme * HTML/CSS: Update layout of homepage footer to match new layout in Figma * version * final modifs * modules, version * modules readme * link to module list from homepage * version * building modules link * version * version * fonts * version * version * fix link * fix package.json * links in explore sdk section * core concepts * version * change delimeters for frontmatter * frontmatter in comments * version * temp add tiny-cookie * fixed link issues * fixed styling issues, copy * hide frontmatter * hide frontmatter * layout fixes, padded ascii diagram * fira sans font for code
2019-12-17 03:44:44 -08:00
-->
# Store
Update docs website (#5827) * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * add transactions into core * hans comments * add transactions into core * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * Merge PR #4857: Add Context concept doc * working * working * finish messages and queries * handler * querier * last comments! * punctuation * querier2 * consolidate intro * querier * workiiiing * refactor for new module interface * karoly review * working on baseapp doc * baseapp work * reorg * almost there * finish first draft * remove old files * finish intro * workinnn * initial commit after rebase * query-lifecycle and started modules-interfaces * query-lifecycle first draft done * module interfaces first draft * rest and intro skeletons * rest and intro done * small edits and links * comments * revisions * cli.md comments * comments * minor edits * better flow for query lifecycle * checkout master-docs files * deleted some * remove modules readme * cli.md comments * comments * module-interfaces comments * keeper * genesis * finish * Apply suggestions from code review Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * hans review * Update docs/core/baseapp.md Co-Authored-By: Hans Schoenburg <hschoenburg@users.noreply.github.com> * working * last comment * workin * Apply suggestions from code review * encoding and node * almost finish store * finish docs * fixes * fede comments + permalinks * hans review * add more permalinks * update docs theme version (#5239) * R4R: Docs Cleanup (#5246) * start * work * work * work * remove table of content * links intro * fix links * remove junk * cleanup * cleanup * work * finish cleanup * addback readmes * remove nft * fix links * remove dup * remove dup * remove dup * remove dup * remove dup * fix links * add subscribe events * refine rest * index page * sidebar * theme version * theme version * testing netlify * theme version * tooltip example * version * testing code embedding * reverting back * theme version * version * version * version * readme and version * cleanup * redo app anatomy * modules readme, theme version * theme version * fix modules list * theme version * new snippets * modules readme * update docs readme * modify synopsis * version * fix yaml * version * version * version * version * version * version * version * version * version * version * add hide banner * version * version * version * small fixes * modules readme, version * remove hotkeys dep, version * version * version * version * version * version * version * version * slight notice * fix links and hide * permalinks * small clean * version * resolve conflicts, add google analytics * fix merge remants * version * changelog 1/2 * Changelog: docs UI * version * remove merge conflicts * Code: Update link for Contributing to the docs to docs_readme * HTML/CSS: Update layout of homepage footer to match new layout in Figma * version * final modifs * modules, version * modules readme * link to module list from homepage * version * building modules link * version * version * fonts * version * version * fix link * fix package.json * links in explore sdk section * core concepts * version * change delimeters for frontmatter * frontmatter in comments * version * temp add tiny-cookie * fixed link issues * fixed styling issues, copy * hide frontmatter * hide frontmatter * layout fixes, padded ascii diagram * fira sans font for code * scrollbar color * move synopsis from frontmatter * move synopsis from frontmatter * code styling in synopsis fix * tutorial link * active headers * 404 fix * homepage links fix * fix link in footer * misc fixes * version * prerequisite links on mobile * version * version * Fix footer links * version * Fix permalink popup * Update version * package-lock.json * Update Questions section in the footer * Config for Algolia Docsearch * Update version * Update to the latest version of the theme * Use docs-staging as a branch for staging website * Update version * Add google analytics * Remove {hide} from Pre-Requisite Readings * Replace Riot with Discord Co-Authored-By: billy rennekamp <billy.rennekamp@gmail.com> * Fix yaml syntax error in docs * Fix formatting in keyring.md Co-authored-by: Gloria Zhao <gzhao408@berkeley.edu> Co-authored-by: gamarin <gautier@tendermint.com> Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com> Co-authored-by: Hans Schoenburg <hschoenburg@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
2020-03-24 09:20:30 -07:00
A store is a data structure that holds the state of the application. {synopsis}
### Pre-requisite Readings
- [Anatomy of an SDK application](../basics/app-anatomy.md) {prereq}
## Introduction to SDK Stores
The Cosmos SDK comes with a large set of stores to persist the state of applications. By default, the main store of SDK applications is a `multistore`, i.e. a store of stores. Developers can add any number of key-value stores to the multistore, depending on their application needs. The multistore exists to support the modularity of the Cosmos SDK, as it lets each module declare and manage their own subset of the state. Key-value stores in the multistore can only be accessed with a specific capability `key`, which is typically held in the [`keeper`](../building-modules/keeper.md) of the module that declared the store.
```
+-----------------------------------------------------+
| |
| +--------------------------------------------+ |
| | | |
| | KVStore 1 - Manage by keeper of Module 1 |
| | | |
| +--------------------------------------------+ |
| |
| +--------------------------------------------+ |
| | | |
| | KVStore 2 - Manage by keeper of Module 2 | |
| | | |
| +--------------------------------------------+ |
| |
| +--------------------------------------------+ |
| | | |
| | KVStore 3 - Manage by keeper of Module 2 | |
| | | |
| +--------------------------------------------+ |
| |
| +--------------------------------------------+ |
| | | |
| | KVStore 4 - Manage by keeper of Module 3 | |
| | | |
| +--------------------------------------------+ |
| |
| +--------------------------------------------+ |
| | | |
| | KVStore 5 - Manage by keeper of Module 4 | |
| | | |
| +--------------------------------------------+ |
| |
| Main Multistore |
| |
+-----------------------------------------------------+
Application's State
```
### Store Interface
At its very core, a Cosmos SDK `store` is an object that holds a `CacheWrapper` and has a `GetStoreType()` method:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L15-L18
The `GetStoreType` is a simple method that returns the type of store, whereas a `CacheWrapper` is a simple interface that implements store read caching and write branching through `Write` method:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L240-L264
Branching and cache is used ubiquitously in the Cosmos SDK and required to be implemented on every store type. A storage branch creates an isolated, ephemeral branch of a store that can be passed around and updated without affecting the main underlying store. This is used to trigger temporary state-transitions that may be reverted later should an error occur. Read more about it in [context](./context.md#Store-branching)
### Commit Store
A commit store is a store that has the ability to commit changes made to the underlying tree or db. The Cosmos SDK differentiates simple stores from commit stores by extending the basic store interfaces with a `Committer`:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L29-L33
The `Committer` is an interface that defines methods to persist changes to disk:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L20-L27
The `CommitID` is a deterministic commit of the state tree. Its hash is returned to the underlying consensus engine and stored in the block header. Note that commit store interfaces exist for various purposes, one of which is to make sure not every object can commit the store. As part of the [object-capabilities model](./ocap.md) of the Cosmos SDK, only `baseapp` should have the ability to commit stores. For example, this is the reason why the `ctx.KVStore()` method by which modules typically access stores returns a `KVStore` and not a `CommitKVStore`.
The Cosmos SDK comes with many types of stores, the most used being [`CommitMultiStore`](#multistore), [`KVStore`](#kvstore) and [`GasKv` store](#gaskv-store). [Other types of stores](#other-stores) include `Transient` and `TraceKV` stores.
## Multistore
### Multistore Interface
Each Cosmos SDK application holds a multistore at its root to persist its state. The multistore is a store of `KVStores` that follows the `Multistore` interface:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L104-L133
If tracing is enabled, then branching the multistore will firstly wrap all the underlying `KVStore` in [`TraceKv.Store`](#tracekv-store).
### CommitMultiStore
The main type of `Multistore` used in the Cosmos SDK is `CommitMultiStore`, which is an extension of the `Multistore` interface:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L141-L184
As for concrete implementation, the [`rootMulti.Store`] is the go-to implementation of the `CommitMultiStore` interface.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/rootmulti/store.go#L43-L61
The `rootMulti.Store` is a base-layer multistore built around a `db` on top of which multiple `KVStores` can be mounted, and is the default multistore store used in [`baseapp`](./baseapp.md).
### CacheMultiStore
Whenever the `rootMulti.Store` needs to be branched, a [`cachemulti.Store`](https://github.com/cosmos/cosmos-sdk/blob/v0.42.1/store/cachemulti/store.go) is used.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/cachemulti/store.go#L17-L28
`cachemulti.Store` branches all substores (creates a virtual store for each substore) in its constructor and hold them in `Store.stores`. Moreover caches all read queries. `Store.GetKVStore()` returns the store from `Store.stores`, and `Store.Write()` recursively calls `CacheWrap.Write()` on all the substores.
## Base-layer KVStores
### `KVStore` and `CommitKVStore` Interfaces
A `KVStore` is a simple key-value store used to store and retrieve data. A `CommitKVStore` is a `KVStore` that also implements a `Committer`. By default, stores mounted in `baseapp`'s main `CommitMultiStore` are `CommitKVStore`s. The `KVStore` interface is primarily used to restrict modules from accessing the committer.
Individual `KVStore`s are used by modules to manage a subset of the global state. `KVStores` can be accessed by objects that hold a specific key. This `key` should only be exposed to the [`keeper`](../building-modules/keeper.md) of the module that defines the store.
`CommitKVStore`s are declared by proxy of their respective `key` and mounted on the application's [multistore](#multistore) in the [main application file](../basics/app-anatomy.md#core-application-file). In the same file, the `key` is also passed to the module's `keeper` that is responsible for managing the store.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/store.go#L189-L219
Apart from the traditional `Get` and `Set` methods, a `KVStore` must provide an `Iterator(start, end)` method which returns an `Iterator` object. It is used to iterate over a range of keys, typically keys that share a common prefix. Below is an example from the bank's module keeper, used to iterate over all account balances:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/x/bank/keeper/view.go#L115-L134
### `IAVL` Store
The default implementation of `KVStore` and `CommitKVStore` used in `baseapp` is the `iavl.Store`.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/iavl/store.go#L37-L40
`iavl` stores are based around an [IAVL Tree](https://github.com/tendermint/iavl), a self-balancing binary tree which guarantees that:
- `Get` and `Set` operations are O(log n), where n is the number of elements in the tree.
- Iteration efficiently returns the sorted elements within the range.
- Each tree version is immutable and can be retrieved even after a commit (depending on the pruning settings).
The documentation on the IAVL Tree is located [here](https://github.com/cosmos/iavl/blob/v0.15.0-rc5/docs/overview.md).
### `DbAdapter` Store
`dbadapter.Store` is a adapter for `dbm.DB` making it fulfilling the `KVStore` interface.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/dbadapter/store.go#L13-L16
`dbadapter.Store` embeds `dbm.DB`, meaning most of the `KVStore` interface functions are implemented. The other functions (mostly miscellaneous) are manually implemented. This store is primarily used within [Transient Stores](#transient-stores)
### `Transient` Store
`Transient.Store` is a base-layer `KVStore` which is automatically discarded at the end of the block.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/transient/store.go#L13-L16
`Transient.Store` is a `dbadapter.Store` with a `dbm.NewMemDB()`. All `KVStore` methods are reused. When `Store.Commit()` is called, a new `dbadapter.Store` is assigned, discarding previous reference and making it garbage collected.
This type of store is useful to persist information that is only relevant per-block. One example would be to store parameter changes (i.e. a bool set to `true` if a parameter changed in a block).
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/x/params/types/subspace.go#L20-L30
Transient stores are typically accessed via the [`context`](./context.md) via the `TransientStore()` method:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/types/context.go#L232-L235
## KVStore Wrappers
### CacheKVStore
`cachekv.Store` is a wrapper `KVStore` which provides buffered writing / cached reading functionalities over the underlying `KVStore`.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/cachekv/store.go#L27-L34
This is the type used whenever an IAVL Store needs to be branched to create an isolated store (typically when we need to mutate a state that might be reverted later).
#### `Get`
`Store.Get()` firstly checks if `Store.cache` has an associated value with the key. If the value exists, the function returns it. If not, the function calls `Store.parent.Get()`, caches the result in `Store.cache`, and returns it.
#### `Set`
`Store.Set()` sets the key-value pair to the `Store.cache`. `cValue` has the field dirty bool which indicates whether the cached value is different from the underlying value. When `Store.Set()` caches a new pair, the `cValue.dirty` is set `true` so when `Store.Write()` is called it can be written to the underlying store.
#### `Iterator`
`Store.Iterator()` have to traverse on both cached items and the original items. In `Store.iterator()`, two iterators are generated for each of them, and merged. `memIterator` is essentially a slice of the `KVPairs`, used for cached items. `mergeIterator` is a combination of two iterators, where traverse happens ordered on both iterators.
### `GasKv` Store
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
Cosmos SDK applications use [`gas`](../basics/gas-fees.md) to track resources usage and prevent spam. [`GasKv.Store`](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/gaskv/store.go) is a `KVStore` wrapper that enables automatic gas consumption each time a read or write to the store is made. It is the solution of choice to track storage usage in Cosmos SDK applications.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/gaskv/store.go#L13-L19
When methods of the parent `KVStore` are called, `GasKv.Store` automatically consumes appropriate amount of gas depending on the `Store.gasConfig`:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/gas.go#L153-L162
By default, all `KVStores` are wrapped in `GasKv.Stores` when retrieved. This is done in the `KVStore()` method of the [`context`](./context.md):
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/types/context.go#L227-L230
In this case, the default gas configuration is used:
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/types/gas.go#L164-L175
### `TraceKv` Store
`tracekv.Store` is a wrapper `KVStore` which provides operation tracing functionalities over the underlying `KVStore`. It is applied automatically by the Cosmos SDK on all `KVStore` if tracing is enabled on the parent `MultiStore`.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/tracekv/store.go#L20-L43
When each `KVStore` methods are called, `tracekv.Store` automatically logs `traceOperation` to the `Store.writer`. `traceOperation.Metadata` is filled with `Store.context` when it is not nil. `TraceContext` is a `map[string]interface{}`.
### `Prefix` Store
`prefix.Store` is a wrapper `KVStore` which provides automatic key-prefixing functionalities over the underlying `KVStore`.
[docs]: Stargate migration guides (#7771) * init * Add page contents * Update migrate a module to stargate * Update links * Add querier * add baseapp migration guide * Add upgrade instructions * Add TODO for missing udpates * Add dependencies * address review comments * remove unused * gaiad => simd * Add ibc state jq cmd * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/README.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Created a modules.md file * Update chain migration guide * Rename to App migration * Add new paragraph * Add some initial sections * Add msg and queries * Finish modules * Add client * Add update guide * Rename title * More tweaks * Update chain upgrade one * Remove useless change * Don't repeat * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Small update * Use rc6 * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/chain-upgrade-guide-040.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * Update docs/migrations/app_and_modules.md Co-authored-by: Robert Zaremba <robert@zaremba.ch> * reviews * Review Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-01-06 03:43:52 -08:00
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0-rc6/store/prefix/store.go#L15-L21
When `Store.{Get, Set}()` is called, the store forwards the call to its parent, with the key prefixed with the `Store.prefix`.
When `Store.Iterator()` is called, it does not simply prefix the `Store.prefix`, since it does not work as intended. In that case, some of the elements are traversed even they are not starting with the prefix.
## Next {hide}
Learn about [encoding](./encoding.md) {hide}