Skip to content

Commit

Permalink
feat(bank)!: Move the bank module SendEnabled info into state (from P…
Browse files Browse the repository at this point in the history
…arams). (#11977)

* go mod tidy everything.

* Add some third_party proto files that are imported but not included.

* [11859]: Add a new key for the SendEnabled flags and keeper methods for getting, setting, and deleting them.

* [11859]: Remove the send_enabled field from the bank Params proto.

* Revert "Add some third_party proto files that are imported but not included."

This reverts commit 8b7acf8.

* [11859]: Regenerate the bank params stuff from the changed proto.

* [11859]: Add a send_enabled field to the bank genesis proto.

* Revert "[11859]: Remove the send_enabled field from the bank Params proto."

This reverts commit 0bd904c.

* Revert "[11859]: Regenerate the bank params stuff from the changed proto."

This reverts commit 33d4652.

* [11859]: Deprecate the bank Params send_enabled field.

* [11859]: Regenerate the bank go code from the updated protos.

* [11859]: Reduce the number of times the store is recreated during IsSendEnabledCoins. Store creation has some overhead.

* [11859]: Add the SendEnabled stuff to the genesis methods. Make a couple TODO notes. Create a way to iterate over the SendEnabled entries and get all of them.

* [11859]: Update the bank sim genesis stuff to create random SendEnabled entries similar to when they were params.

* Remove some of the bank params methods that are no longer meaningful.

* Add a comment about why we're calling a mutation method in a Validate function.

* [11859]: Add some more TODO notes and make the SendEnabled.String() function significantlly simpler.

* [11859]: Get rid of the SendEnabledParams type.

* Fix up a few comments.

* [11859]: Update the bank keeper test due to recent changes.

* [11859]: Tweak the bank Params and SendEnabled String funcs. Params no longer returns {} when there aren't any SendEnabled entries and the default is false. SendEnabled is back to outputting a yaml format.

* [11859]: Fix the params tests and add some new ones to it and key_test.

* [11859]: Create a 1-store method for updating several SendEnabled entries at once.

* [11859]: Create a migration for both the module and genesis state.

* [11859]: Create a new MsgSetSendEnabled for governanance proposals to set SendEnabled.

* [11859]: Add SetAllSendEnabled to the SendKeeper interface.

* [11859]: Add an authority to the bank keeper and create the handler for MsgSetSendEnabled.

* [11859]: Add an rpc endpoint for querying SendEnabled.

* [11859]: Implement the SendEnabled query.

* [11859]: Add a function for decoding a --page-key base64 value so that pagination can work as expected.

* [11859]: Implement a CLI command for querying SendEnabled.

* [11859]: Move the v047 store migration stuff into Migrate3to4 directly to prevent a circular dependency between 047 and the keeper. Not using the keeper for that would be a significant pain in the butt.

* [11869]: Implement the Msg interface for MsgSetSendEnabled.

* [11859]: Fix some unit tests that I broke along the way.

* [11859]: Reorg the funcs added to the SendKeeper interface.

* [11859]: Fix the return values of a couple of the MsgSetSendEnabled LegacyMsg funcs.

* [11859]: Tweak MigrateSendEnabled to add stuff to the existing slice (if there's anything to add). And then use that in the MigrateGenState function.

* [11859]: Don't set the Pagination field when looking up specific entries.

* [11859]: Put validateSendEnabledParams back to the way it was to allow reading the old Params without error.

* [11859]: Write up a bunch of unit tests.

* [11859]: Update the MsgSetSendEnabled.ValidateBasic() function with some extra failure points. Write up some tests.

* Update a test I fixed then broke.

* [11859]: Have the run-tests make target exit with a non-zero status if any of the tests fail.

* [11859]: Add changelog entries.

* [11859]: Add a missing func comment.

* [11859]: Only do a couple assertions if the elements exist to do so.

* [11859]: Add some more missing function comments.

* [11859]: Update the bank spec documentation.

* [11859]: Change name of WithPageKeyDecoded to FlagSetWithPageKeyDecoded, have it return an error and make MustFlagSetWithPageKeyDecoded for the one-liner.

* [11859]: Update the documentation on the SendEnabled query.

* [11859]: Add final newline to query.proto.

* [11859]: Remove the SetSendEnabled msg and endpoint.

* [11859]: Use nil instead of an empty slice of SendEnabled for defaults and where called for.

* [11859]: Update SetParams to migrate entries too.

* [11859]: Remove the spec doc info about the MsgSetSendEnabled that's part of another PR.

* [11859]: Update the changelog.

* Revert "[11859]: Update the changelog."

This reverts commit 85052b8.

* [11859]: Rename the QuerySendEnabled message to QuerySendEnabledRequest to match the other messages in that proto.

* [11859]: Remove the authority field that is only needed for governance stuff (in the other PR).

* [11859]: Add a version to the deprecation message.

* [11859]: Update the comment on the now-deprecated SendEnabled params proto field to reference 0.46 instead of 0.47.

* Add some spacing to GetCmdQuerySendEnabled -> RunE.

* [11859]: Create banktypes.GenesisState.GetAllSendEnabled() to house the combination logic of the SendEnabled field and Params.SendEnabled. Have MigrateSendEnabled() use that. Remove some calls to MigrateSendEnabled and use GetAllSendEnabled in those cases.

* [11859]: Update Bank's ConsensusVersion to 4.

* [11859]: Add 'Since' comments to the new proto stuff.

* [11859]: Fix a unit test that broke because it assumed the bank module's version was 3.

* [11859]: Remove an empty line.

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>

* [11859]: Remove movement of SendEnabled from the `ExportGenesis` function too.

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>

* [11859]: Add a function for getting an entry so that users can differentiate between a missing entry and one that's using the default value.

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
  • Loading branch information
dwedul-figure and alexanderbez authored Jun 10, 2022
1 parent 05966fe commit 7feae9c
Show file tree
Hide file tree
Showing 48 changed files with 4,469 additions and 608 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [\#11334](https://github.com/cosmos/cosmos-sdk/pull/11334) Move `x/gov/types/v1beta2` to `x/gov/types/v1`.
* (x/auth/middleware) [#11413](https://github.com/cosmos/cosmos-sdk/pull/11413) Refactor tx middleware to be extensible on tx fee logic. Merged `MempoolFeeMiddleware` and `TxPriorityMiddleware` functionalities into `DeductFeeMiddleware`, make the logic extensible using the `TxFeeChecker` option, the current fee logic is preserved by the default `checkTxFeeWithValidatorMinGasPrices` implementation. Change `RejectExtensionOptionsMiddleware` to `NewExtensionOptionsMiddleware` which is extensible with the `ExtensionOptionChecker` option. Unpack the tx extension options `Any`s to interface `TxExtensionOptionI`.
* (migrations) [#11556](https://github.com/cosmos/cosmos-sdk/pull/11556#issuecomment-1091385011) Remove migration code from 0.42 and below. To use previous migrations, checkout previous versions of the cosmos-sdk.
* (x/bank) [\#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) Move the SendEnabled information out of the Params and into the state store directly.
The information can now be accessed using the BankKeeper.
Setting can be done using MsgSetSendEnabled as a governance proposal.
A SendEnabled query has been added to both GRPC and CLI.


### Client Breaking Changes

Expand Down Expand Up @@ -337,11 +342,16 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/authz,x/feegrant) [\#11214](https://github.com/cosmos/cosmos-sdk/pull/11214) Fix Amino JSON encoding of authz and feegrant Msgs to be consistent with other modules.
* (authz)[\#11060](https://github.com/cosmos/cosmos-sdk/pull/11060) Support grant with no expire time.
* (x/gov) [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868) Bump gov to v1.
* (x/bank) [\#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) Move the SendEnabled information out of the Params and into the state store directly.

### Deprecated

* (x/upgrade) [\#9906](https://github.com/cosmos/cosmos-sdk/pull/9906) Deprecate `UpgradeConsensusState` gRPC query since this functionality is only used for IBC, which now has its own [IBC replacement](https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54)
* (types) [\#10948](https://github.com/cosmos/cosmos-sdk/issues/10948) Deprecate the types.DBBackend variable and types.NewLevelDB function. They are replaced by a new entry in `app.toml`: `app-db-backend` and `tendermint/tm-db`s `NewDB` function. If `app-db-backend` is defined, then it is used. Otherwise, if `types.DBBackend` is defined, it is used (until removed: [\#11241](https://github.com/cosmos/cosmos-sdk/issues/11241)). Otherwise, Tendermint config's `db-backend` is used.
* (x/bank) [\#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) The Params.SendEnabled field is deprecated and unusable.
The information can now be accessed using the BankKeeper.
Setting can be done using MsgSetSendEnabled as a governance proposal.
A SendEnabled query has been added to both GRPC and CLI.

## [v0.45.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.3) - 2022-04-12

Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,26 @@ CURRENT_DIR = $(shell pwd)
run-tests:
ifneq (,$(shell which tparse 2>/dev/null))
@echo "Starting unit tests"; \
finalec=0; \
for module in $(SUB_MODULES); do \
cd ${CURRENT_DIR}/$$module; \
echo "Running unit tests for module $$module"; \
go test -mod=readonly -json $(ARGS) $(TEST_PACKAGES) ./... | tparse; \
done
ec=$$?; \
if [ "$$ec" -ne '0' ]; then finalec=$$ec; fi; \
done; \
exit $$finalec
else
@echo "Starting unit tests"; \
finalec=0; \
for module in $(SUB_MODULES); do \
cd ${CURRENT_DIR}/$$module; \
echo "Running unit tests for module $$module"; \
go test -mod=readonly $(ARGS) $(TEST_PACKAGES) ./... ; \
done
ec=$$?; \
if [ "$$ec" -ne '0' ]; then finalec=$$ec; fi; \
done; \
exit $$finalec
endif

.PHONY: run-tests test test-all $(TEST_TARGETS)
Expand Down
166 changes: 87 additions & 79 deletions api/cosmos/bank/v1beta1/bank.pulsar.go

Large diffs are not rendered by default.

223 changes: 189 additions & 34 deletions api/cosmos/bank/v1beta1/genesis.pulsar.go

Large diffs are not rendered by default.

Loading

0 comments on commit 7feae9c

Please sign in to comment.