-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(store): upgrade iavl to v0.19.0 (#12626)
## Description Closes: #XXXX Upgrading IAVL to v0.19. This version includes the fast index optimization and errors propagated up top. Currently, SDK panics on any db error, leaving the proper error handling and refactoring to future work. Similar change in Osmosis fork, ref: osmosis-labs#108 ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit 6f63115) # Conflicts: # UPGRADING.md # go.mod # go.sum # store/tools/ics23/go.mod
- Loading branch information
1 parent
5aa0614
commit 4c278c3
Showing
16 changed files
with
221 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Upgrading Cosmos SDK | ||
|
||
This guide provides instructions for upgrading to specific versions of Cosmos SDK. | ||
|
||
## v0.46 | ||
|
||
### Client Changes | ||
|
||
### `x/gov` v1 | ||
|
||
The `gov` module has been greatly improved. The previous API has been moved to `v1beta1` while the new implementation is called `v1`. | ||
|
||
In order to submit a proposal with `submit-proposal` you now need to pass a `proposal.json` file. | ||
You can still use the old way by using `submit-legacy-proposal`. This is not recommended. | ||
More information can be found in the gov module [client documentation](https://docs.cosmos.network/v0.46/modules/gov/07_client.html). | ||
|
||
### Keyring | ||
|
||
The keyring has been refactored in v0.46. | ||
|
||
* The `Unsafe*` interfaces have been removed from the keyring package. Please use interface casting if you wish to access those unsafe functions. | ||
* The keys' implementation has been refactored to be serialized as proto. | ||
* `keyring.NewInMemory` and `keyring.New` takes now a `codec.Codec`. | ||
* Take `keyring.Record` instead of `Info` as first argument in: | ||
* `MkConsKeyOutput` | ||
* `MkValKeyOutput` | ||
* `MkAccKeyOutput` | ||
* Rename: | ||
* `SavePubKey` to `SaveOfflineKey` and remove the `algo` argument. | ||
* `NewMultiInfo`, `NewLedgerInfo` to `NewLegacyMultiInfo`, `newLegacyLedgerInfo` respectively. | ||
* `NewOfflineInfo` to `newLegacyOfflineInfo` and move it to `migration_test.go`. | ||
|
||
### Go API Changes | ||
|
||
The `replace google.golang.org/grpc` directive can be removed from the `go.mod`, it is no more required to block the version. | ||
|
||
A few packages that were deprecated in the previous version are now removed. | ||
|
||
For instance, the REST API, deprecated in v0.45, is now removed. If you have not migrated yet, please follow the [instructions](https://docs.cosmos.network/v0.45/migrations/rest.html). | ||
|
||
To improve clarity of the API, some renaming and improvements has been done: | ||
|
||
| Package | Previous | Current | | ||
| --------- | ---------------------------------- | ------------------------------------ | | ||
| `simapp` | `encodingConfig.Marshaler` | `encodingConfig.Codec` | | ||
| `simapp` | `FundAccount`, `FundModuleAccount` | Functions moved to `x/bank/testutil` | | ||
| `types` | `AccAddressFromHex` | `AccAddressFromHexUnsafe` | | ||
| `x/auth` | `MempoolFeeDecorator` | Use `DeductFeeDecorator` instead | | ||
| `x/bank` | `AddressFromBalancesStore` | `AddressAndDenomFromBalancesStore` | | ||
| `x/gov` | `keeper.DeleteDeposits` | `keeper.DeleteAndBurnDeposits` | | ||
| `x/gov` | `keeper.RefundDeposits` | `keeper.RefundAndDeleteDeposits` | | ||
| `x/{mod}` | package `legacy` | package `migrations` | | ||
|
||
For the exhaustive list of API renaming, please refer to the [CHANGELOG](https://github.com/cosmos/cosmos-sdk/blob/main/CHANGELOG.md). | ||
|
||
### new packages | ||
|
||
Additionally, new packages have been introduced in order to further split the codebase. Aliases are available for a new API breaking migration, but it is encouraged to migrate to this new packages: | ||
|
||
* `errors` should replace `types/errors` when registering errors or wrapping SDK errors. | ||
* `math` contains the `Int` or `Uint` types that are used in the SDK. | ||
|
||
### `x/authz` | ||
|
||
* `authz.NewMsgGrant` `expiration` is now a pointer. When `nil` is used, then no expiration will be set (grant won't expire). | ||
* `authz.NewGrant` takes a new argument: block time, to correctly validate expire time. | ||
|
||
### State Machine Changes | ||
|
||
#### PostHandler | ||
|
||
`postHandler` is like an `antehandler`, but is run _after_ the `runMsgs` execution. It is in the same store branch that `runMsgs`, meaning that both `runMsgs` and `postHandler`. This allows to run a custom logic after the execution of the messages. | ||
|
||
### IAVL | ||
|
||
v0.19.0 IAVL introduces a new "fast" index. This index represents the latest state of the | ||
IAVL laid out in a format that preserves data locality by key. As a result, it allows for faster queries and iterations | ||
since data can now be read in lexicographical order that is frequent for Cosmos-SDK chains. | ||
|
||
The first time the chain is started after the upgrade, the aforementioned index is created. The creation process | ||
might take time and depends on the size of the latest state of the chain. For example, Osmosis takes around 15 minutes to rebuild the index. | ||
|
||
While the index is being created, node operators can observe the following in the logs: | ||
"Upgrading IAVL storage for faster queries + execution on the live state. This may take a while". The store | ||
key is appended to the message. The message is printed for every module that has a non-transient store. | ||
As a result, it gives a good indication of the progress of the upgrade. | ||
|
||
There is also downgrade and re-upgrade protection. If a node operator chooses to downgrade to IAVL pre-fast index, and then upgrade again, the index is rebuilt from scratch. This implementation detail should not be relevant in most cases. It was added as a safeguard against operator | ||
mistakes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.