diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f691b0c9f60..12968844377a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,8 +94,13 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (crypto) [#19371](https://github.com/cosmos/cosmos-sdk/pull/19371) Avoid cli redundant log in stdout, log to stderr instead. * (client) [#19393](https://github.com/cosmos/cosmos-sdk/pull/19393/) Add `ReadDefaultValuesFromDefaultClientConfig` to populate the default values from the default client config in client.Context without creating a app folder. +### State Machine Breaking + +* (x/staking) [#18841](https://github.com/cosmos/cosmos-sdk/pull/18841) In a undelegation or redelegation if the shares being left delegated correspond to less than 1 token (in base denom) the entire delegation gets removed. + ### API Breaking Changes +* (x/consensus) [#19488](https://github.com/cosmos/cosmos-sdk/pull/19488) Consensus module creation takes `appmodule.Environment` instead of individual services. * (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `x/genutil` now handles the application export. `server.AddCommands` does not take an `AppExporter` but instead `genutilcli.Commands` does. * (x/gov/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/18036) `MsgDeposit` has been removed because of AutoCLI migration. * (x/staking/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/17986) `MsgRedelegateExec`, `MsgUnbondExec` has been removed because of AutoCLI migration. @@ -1233,7 +1238,7 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 * (x/group) [#13214](https://github.com/cosmos/cosmos-sdk/pull/13214) Add `withdraw-proposal` command to group module's CLI transaction commands. * (x/auth) [#13048](https://github.com/cosmos/cosmos-sdk/pull/13048) Add handling of AccountNumberStoreKeyPrefix to the simulation decoder. * (simapp) [#13107](https://github.com/cosmos/cosmos-sdk/pull/13107) Call `SetIAVLCacheSize` with the configured value in simapp. -* [#13301](https://github.com/cosmos/cosmos-sdk/pull/13301) Keep the balance query endpoint compatible with legacy blocks +* [#13301](https://github.com/cosmos/cosmos-sdk/pull/13301) Keep the balance query endpoint compatible with legacy blocks * [#13321](https://github.com/cosmos/cosmos-sdk/pull/13321) Add flag to disable fast node migration and usage. ### Bug Fixes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d21bb1f9d20..3a019201f95c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,14 +62,14 @@ The Cosmos SDK has many stakeholders contributing and shaping the project. The C The developers work in sprints, which are available in a [GitHub Project](https://github.com/orgs/cosmos/projects/26/views/22). The current EPICs are pinned at the top of the [issues list](https://github.com/cosmos/cosmos-sdk/issues). -The important development announcements are shared on [Discord](https://discord.com/invite/cosmosnetwork) in the `#dev-announcements` channel. +The important development announcements are shared on [Discord](https://discord.gg/interchain) in the `#dev-announcements` channel. To synchronize we have few major meetings: * Cosmos SDK Sprint Review on Monday and Thursday at 14:00 UTC (limited participation to core devs). * Cosmos SDK Community Call on Thursday at 16:00 UTC. -If you would like to join one of the community call, then please contact us on [Discord](https://discord.com/invite/cosmosnetwork) or reach out directly to Marko (@tac0turtle). +If you would like to join one of the community call, then please contact us on [Discord](https://discord.gg/interchain) or reach out directly to Marko (@tac0turtle). ## Architecture Decision Records (ADR) diff --git a/README.md b/README.md index c7efd2454a7f..83445d9cd5f2 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@
- + Discord @@ -49,7 +49,7 @@ For more information, see the [Cosmos SDK Documentation](https://docs.cosmos.net ## Contributing See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to contribute and participate in our [dev calls](./CONTRIBUTING.md#teams-dev-calls). -If you want to follow the updates or learn more about the latest design then join our [Discord](https://discord.gg/cosmosnetwork). +If you want to follow the updates or learn more about the latest design then join our [Discord](https://discord.gg/interchain). ## Tools and Frameworks diff --git a/api/cosmos/accounts/interfaces/account_abstraction/v1/interface.pulsar.go b/api/cosmos/accounts/interfaces/account_abstraction/v1/interface.pulsar.go index 2fd8280a1984..d1e34c13b3ed 100644 --- a/api/cosmos/accounts/interfaces/account_abstraction/v1/interface.pulsar.go +++ b/api/cosmos/accounts/interfaces/account_abstraction/v1/interface.pulsar.go @@ -8,7 +8,6 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/anypb" io "io" reflect "reflect" sync "sync" @@ -2018,55 +2017,54 @@ var file_cosmos_accounts_interfaces_account_abstraction_v1_interface_proto_rawDe 0x6f, 0x74, 0x6f, 0x12, 0x31, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa6, 0x01, - 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x06, 0x72, - 0x61, 0x77, 0x5f, 0x74, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x54, 0x78, 0x52, 0x61, 0x77, 0x52, 0x05, 0x72, 0x61, 0x77, 0x54, 0x78, 0x12, 0x25, 0x0a, 0x02, - 0x74, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x52, - 0x02, 0x74, 0x78, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x65, - 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, - 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, - 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x22, - 0x5b, 0x0a, 0x22, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x42, 0x86, 0x03, 0x0a, - 0x35, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x58, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x66, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, - 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x49, 0x41, 0xaa, 0x02, 0x30, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x62, - 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x30, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x3c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x5c, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x34, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x41, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, + 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xa6, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, + 0x12, 0x2f, 0x0a, 0x06, 0x72, 0x61, 0x77, 0x5f, 0x74, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x52, 0x61, 0x77, 0x52, 0x05, 0x72, 0x61, 0x77, 0x54, + 0x78, 0x12, 0x25, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x54, 0x78, 0x52, 0x02, 0x74, 0x78, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x19, 0x0a, 0x17, 0x4d, + 0x73, 0x67, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x73, 0x22, 0x5b, 0x0a, 0x22, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x61, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, 0x61, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x73, 0x42, 0x86, 0x03, 0x0a, 0x35, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, + 0x61, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x58, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, + 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x49, 0x41, 0xaa, 0x02, + 0x30, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x30, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x3c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, + 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x34, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x62, 0x73, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/cosmos/slashing/v1beta1/slashing.pulsar.go b/api/cosmos/slashing/v1beta1/slashing.pulsar.go index 9174c7d15828..8eef3f0b4181 100644 --- a/api/cosmos/slashing/v1beta1/slashing.pulsar.go +++ b/api/cosmos/slashing/v1beta1/slashing.pulsar.go @@ -1418,9 +1418,11 @@ type ValidatorSigningInfo struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Height at which validator was first a candidate OR was un-jailed StartHeight int64 `protobuf:"varint,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` - // Index which is incremented every time a validator is bonded in a block and + // DEPRECATED: Index which is incremented every time a validator is bonded in a block and // _may_ have signed a pre-commit or not. This in conjunction with the // signed_blocks_window param determines the index in the missed block bitmap. + // + // Deprecated: Do not use. IndexOffset int64 `protobuf:"varint,3,opt,name=index_offset,json=indexOffset,proto3" json:"index_offset,omitempty"` // Timestamp until which the validator is jailed due to liveness downtime. JailedUntil *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=jailed_until,json=jailedUntil,proto3" json:"jailed_until,omitempty"` @@ -1467,6 +1469,7 @@ func (x *ValidatorSigningInfo) GetStartHeight() int64 { return 0 } +// Deprecated: Do not use. func (x *ValidatorSigningInfo) GetIndexOffset() int64 { if x != nil { return x.IndexOffset @@ -1578,7 +1581,7 @@ var file_cosmos_slashing_v1beta1_slashing_proto_rawDesc = []byte{ 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x02, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, 0x02, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3b, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x6f, 0x6e, @@ -1586,67 +1589,68 @@ var file_cosmos_slashing_v1beta1_slashing_proto_rawDesc = []byte{ 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x75, 0x6e, 0x74, - 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, - 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, - 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x64, - 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x13, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x8d, 0x04, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x73, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, 0x69, 0x0a, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, - 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, - 0x6d, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x65, 0x72, 0x57, 0x69, 0x6e, 0x64, - 0x6f, 0x77, 0x12, 0x5e, 0x0a, 0x16, 0x64, 0x6f, 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6a, - 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, - 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x14, 0x64, 0x6f, - 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4a, 0x61, 0x69, 0x6c, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x73, 0x0a, 0x1a, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x5f, 0x66, 0x72, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, - 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x17, - 0x73, 0x6c, 0x61, 0x73, 0x68, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x6e, 0x0a, 0x17, 0x73, 0x6c, 0x61, 0x73, 0x68, - 0x5f, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x15, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, - 0x6f, 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x21, 0x8a, 0xe7, 0xb0, 0x2a, 0x1c, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, - 0x69, 0x6e, 0x67, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xe8, 0x01, 0x0a, 0x1b, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, - 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0d, 0x53, 0x6c, 0x61, 0x73, - 0x68, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x17, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, - 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, - 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, - 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, - 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x25, 0x0a, 0x0c, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0b, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x4c, 0x0a, 0x0c, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, + 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, + 0x6e, 0x74, 0x69, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, + 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, + 0x6f, 0x6e, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x13, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, 0x01, 0x22, 0x8d, + 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, + 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, 0x69, 0x0a, 0x15, 0x6d, + 0x69, 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x77, 0x69, + 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x12, 0x6d, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x65, 0x72, + 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, 0x5e, 0x0a, 0x16, 0x64, 0x6f, 0x77, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x5f, 0x6a, 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x14, 0x64, 0x6f, 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4a, 0x61, 0x69, 0x6c, 0x44, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x73, 0x0a, 0x1a, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x5f, + 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x17, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x46, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x6e, 0x0a, 0x17, 0x73, + 0x6c, 0x61, 0x73, 0x68, 0x5f, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x6f, + 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x36, 0xc8, 0xde, + 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, + 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x46, 0x72, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x44, 0x6f, 0x77, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x3a, 0x21, 0x8a, 0xe7, 0xb0, + 0x2a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x73, + 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xe8, + 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0d, + 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x38, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, + 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, + 0x6e, 0x67, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, + 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, + 0x67, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x6c, 0x61, + 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/api/go.mod b/api/go.mod index 77d9175bac3e..90d92f24a44c 100644 --- a/api/go.mod +++ b/api/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/gogoproto v1.4.11 google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe google.golang.org/grpc v1.61.1 diff --git a/api/go.sum b/api/go.sum index a16bcf0ce748..7bd6cea03053 100644 --- a/api/go.sum +++ b/api/go.sum @@ -2,8 +2,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.32.0-20230509103710-5e5 buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.32.0-20230509103710-5e5b9fdd0180.1/go.mod h1:5GqIYthcy/ASmnKcaT26APpxMhZirnIHXHKki69zjWI= buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 h1:VooqQ3rklp3PwMTAE890M76w/8Z01OPa7RdgU9posFE= buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1/go.mod h1:9KmeMJUsSG3IiIwK63Lh1ipZJrwd7KHrWZseJeHukcs= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= diff --git a/client/broadcast.go b/client/broadcast.go index 5598cbcebaa1..d1b773ffa2d5 100644 --- a/client/broadcast.go +++ b/client/broadcast.go @@ -35,14 +35,9 @@ func (ctx Context) BroadcastTx(txBytes []byte) (res *sdk.TxResponse, err error) return res, err } -// Deprecated: Use CheckCometError instead. -func CheckTendermintError(err error, tx cmttypes.Tx) *sdk.TxResponse { - return CheckCometError(err, tx) -} - // CheckCometError checks if the error returned from BroadcastTx is a // CometBFT error that is returned before the tx is submitted due to -// precondition checks that failed. If an CometBFT error is detected, this +// precondition checks that failed. If a CometBFT error is detected, this // function returns the correct code back in TxResponse. // // TODO: Avoid brittle string matching in favor of error matching. This requires diff --git a/client/v2/go.mod b/client/v2/go.mod index 8a3a4f292e52..ba3eeec1c750 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -11,7 +11,7 @@ require ( cosmossdk.io/x/tx v0.13.0 github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/errors v1.11.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/manifoldco/promptui v0.9.0 // indirect github.com/spf13/cobra v1.8.0 diff --git a/client/v2/go.sum b/client/v2/go.sum index 5afc1da5554d..f3959f4afe16 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -136,8 +136,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/collections/go.mod b/collections/go.mod index 7494cd87e094..d8d8d7426004 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -20,7 +20,7 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect diff --git a/collections/go.sum b/collections/go.sum index bac0f9b23bb1..b81e0ddaea56 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -27,8 +27,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAK github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -212,7 +212,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/depinject/go.mod b/depinject/go.mod index 26234f36c467..aaa661a119f2 100644 --- a/depinject/go.mod +++ b/depinject/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( cosmossdk.io/api v0.7.2 github.com/cockroachdb/errors v1.11.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/stretchr/testify v1.8.4 golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb google.golang.org/protobuf v1.32.0 diff --git a/depinject/go.sum b/depinject/go.sum index fedf06ab14ff..b78b698bf443 100644 --- a/depinject/go.sum +++ b/depinject/go.sum @@ -6,8 +6,8 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZe github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/docs/Introduction.md b/docs/Introduction.md index c9d080e54cca..9b42b734a0be 100644 --- a/docs/Introduction.md +++ b/docs/Introduction.md @@ -33,5 +33,5 @@ Check out the docs for the various parts of the Cosmos stack. ## Help & Support * [**GitHub Discussions**](https://github.com/orgs/cosmos/discussions) - Ask questions and discuss SDK development on GitHub. -* [**Discord**](https://discord.gg/cosmosnetwork) - Chat with Cosmos developers on Discord. +* [**Discord**](https://discord.gg/interchain) - Chat with Cosmos developers on Discord. * [**Found an issue?**](https://github.com/cosmos/cosmos-sdk/edit/main/docs/docs/README.md) - Help us improve this page by suggesting edits on GitHub. diff --git a/go.mod b/go.mod index 463d362ced35..2ae568b50cdf 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/cometbft/cometbft v0.38.5 github.com/cosmos/btcutil v1.0.5 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogogateway v1.2.0 github.com/cosmos/gogoproto v1.4.11 diff --git a/go.sum b/go.sum index 94851a0c53d5..16dc645417e5 100644 --- a/go.sum +++ b/go.sum @@ -135,8 +135,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/math/CHANGELOG.md b/math/CHANGELOG.md index 85b04aed1307..5161b86e19d6 100644 --- a/math/CHANGELOG.md +++ b/math/CHANGELOG.md @@ -43,6 +43,9 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j * [#18874](https://github.com/cosmos/cosmos-sdk/pull/18874) Speedup `math.Int.Mul` by removing a duplicate overflow check * [#19386](https://github.com/cosmos/cosmos-sdk/pull/19386) Speedup `math.Int` overflow checks +* [#19466](https://github.com/cosmos/cosmos-sdk/pull/19466) Speedup `math.NewLegacyDec` by one heap allocation +* [#19467](https://github.com/cosmos/cosmos-sdk/pull/19467) Slightly speedup `math.LegacyDec` `Ceil` and `MarshalTo` methods +* [#19479](https://github.com/cosmos/cosmos-sdk/pull/19479) Speedup `math.LegacyDec` functions that involve `math.Int` by removing a heap allocation. (`Ceil`, `TruncateInt`, `NewLegacyDecFromInt`) ### Bug Fixes diff --git a/math/dec.go b/math/dec.go index 58abb9ca1a99..30d5ef464ff1 100644 --- a/math/dec.go +++ b/math/dec.go @@ -102,8 +102,9 @@ func LegacyNewDec(i int64) LegacyDec { // create a new Dec from integer with decimal place at prec // CONTRACT: prec <= Precision func LegacyNewDecWithPrec(i, prec int64) LegacyDec { + bi := big.NewInt(i) return LegacyDec{ - new(big.Int).Mul(big.NewInt(i), precisionMultiplier(prec)), + bi.Mul(bi, precisionMultiplier(prec)), } } @@ -131,7 +132,7 @@ func LegacyNewDecFromInt(i Int) LegacyDec { // CONTRACT: prec <= Precision func LegacyNewDecFromIntWithPrec(i Int, prec int64) LegacyDec { return LegacyDec{ - new(big.Int).Mul(i.BigInt(), precisionMultiplier(prec)), + new(big.Int).Mul(i.BigIntMut(), precisionMultiplier(prec)), } } @@ -350,7 +351,7 @@ func (d LegacyDec) MulInt(i Int) LegacyDec { } func (d LegacyDec) MulIntMut(i Int) LegacyDec { - d.i.Mul(d.i, i.BigInt()) + d.i.Mul(d.i, i.BigIntMut()) if d.i.BitLen() > maxDecBitLen { panic("Int overflow") } @@ -433,7 +434,7 @@ func (d LegacyDec) QuoInt(i Int) LegacyDec { } func (d LegacyDec) QuoIntMut(i Int) LegacyDec { - d.i.Quo(d.i, i.BigInt()) + d.i.Quo(d.i, i.BigIntMut()) return d } @@ -691,7 +692,7 @@ func (d LegacyDec) RoundInt64() int64 { // RoundInt round the decimal using bankers rounding func (d LegacyDec) RoundInt() Int { - return NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i)) + return NewIntFromBigIntMut(chopPrecisionAndRoundNonMutative(d.i)) } // chopPrecisionAndTruncate is similar to chopPrecisionAndRound, @@ -717,7 +718,7 @@ func (d LegacyDec) TruncateInt64() int64 { // TruncateInt truncates the decimals from the number and returns an Int func (d LegacyDec) TruncateInt() Int { - return NewIntFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) + return NewIntFromBigIntMut(chopPrecisionAndTruncateNonMutative(d.i)) } // TruncateDec truncates the decimals from the number and returns a Dec @@ -734,11 +735,9 @@ func (d LegacyDec) Ceil() LegacyDec { quo, rem = quo.QuoRem(tmp, precisionReuse, rem) // no need to round with a zero remainder regardless of sign - if rem.Cmp(zeroInt) == 0 { + if rem.Sign() == 0 { return LegacyNewDecFromBigInt(quo) - } - - if rem.Sign() == -1 { + } else if rem.Sign() == -1 { return LegacyNewDecFromBigInt(quo) } @@ -847,7 +846,7 @@ func (d *LegacyDec) MarshalTo(data []byte) (n int, err error) { i = new(big.Int) } - if i.Cmp(zeroInt) == 0 { + if i.Sign() == 0 { copy(data, []byte{0x30}) return 1, nil } diff --git a/orm/go.mod b/orm/go.mod index 49cb80b09307..5803351256a0 100644 --- a/orm/go.mod +++ b/orm/go.mod @@ -8,7 +8,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.1 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 github.com/iancoleman/strcase v0.3.0 diff --git a/orm/go.sum b/orm/go.sum index 83fc669e8450..1500e3a26a5f 100644 --- a/orm/go.sum +++ b/orm/go.sum @@ -31,8 +31,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAK github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/simapp/app.go b/simapp/app.go index 9931c37a222e..78aa6896baa8 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -280,7 +280,7 @@ func NewSimApp( } // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), logger), authtypes.NewModuleAddress(govtypes.ModuleName).String()) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) addressCodec := authcodec.NewBech32Codec(sdk.Bech32MainPrefix) @@ -305,11 +305,11 @@ func NewSimApp( } app.AccountsKeeper = accountsKeeper - app.AuthKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addressCodec, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger), appCodec, authtypes.ProtoBaseAccount, maccPerms, addressCodec, sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.BankKeeper = bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), logger), appCodec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), app.AuthKeeper, BlockedAddresses(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), @@ -344,7 +344,7 @@ func NewSimApp( appCodec, legacyAmino, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AuthKeeper) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[feegrant.StoreKey]), logger), appCodec, app.AuthKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks @@ -365,7 +365,7 @@ func NewSimApp( config.MaxProposalTitleLen = 255 // example max title length in characters config.MaxProposalSummaryLen = 10200 // example max summary length in characters */ - app.GroupKeeper = groupkeeper.NewKeeper(runtime.NewKVStoreService(keys[group.StoreKey]), appCodec, app.MsgServiceRouter(), app.AuthKeeper, groupConfig) + app.GroupKeeper = groupkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[group.StoreKey]), logger), appCodec, app.MsgServiceRouter(), app.AuthKeeper, groupConfig) // get skipUpgradeHeights from the app options skipUpgradeHeights := map[int64]bool{} @@ -404,7 +404,7 @@ func NewSimApp( // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, app.AuthKeeper.AddressCodec(), + appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), logger), app.StakingKeeper, app.SlashingKeeper, app.AuthKeeper.AddressCodec(), ) // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper diff --git a/simapp/go.mod b/simapp/go.mod index 6c4c9b248562..839abdb66619 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/simapp go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a + cosmossdk.io/api v0.7.3 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 @@ -79,12 +79,12 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/iavl v1.0.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.3 // indirect @@ -98,7 +98,7 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -111,7 +111,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -172,7 +172,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -194,7 +194,7 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect @@ -203,8 +203,8 @@ require ( go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.19.0 // indirect - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect - golang.org/x/mod v0.14.0 // indirect + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect + golang.org/x/mod v0.15.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect @@ -212,7 +212,7 @@ require ( golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.17.0 // indirect + golang.org/x/tools v0.18.0 // indirect google.golang.org/api v0.160.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index d2e1b3909513..91076e4454c0 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -328,8 +328,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft v0.38.5 h1:4lOcK5VTPrfbLOhNHmPYe6c7eDXHtBdMCQuKbAfFJdU= github.com/cometbft/cometbft v0.38.5/go.mod h1:0tqKin+KQs8zDwzYD8rPHzSBIDNPuB4NrwwGDNb/hUg= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -342,8 +342,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -351,8 +351,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= -github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -405,8 +405,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= -github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -499,8 +499,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -900,8 +900,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -1040,8 +1040,8 @@ gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1110,8 +1110,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1139,8 +1139,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1443,8 +1443,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index 0fa7dad846c2..8ac217a9d521 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -120,8 +120,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-3EL4xQsSpovTy/V3gwulybqSDHvuu7bPodBZib9JKAk=" [mod."github.com/cosmos/cosmos-proto"] - version = "v1.0.0-beta.3" - hash = "sha256-V0/ZhRdqK7Cqcv8X30gr33/hlI54bRXeHhI9LZKyLt8=" + version = "v1.0.0-beta.4" + hash = "sha256-5Kn82nsZfiEtuwhhLZqmMxdAY1tX/Fi3HJ0/MEaRohw=" [mod."github.com/cosmos/go-bip39"] version = "v1.0.0" hash = "sha256-Qm2aC2vaS8tjtMUbHmlBSagOSqbduEEDwc51qvQaBmA=" diff --git a/tests/go.mod b/tests/go.mod index 63f9182de75a..13988093c044 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a + cosmossdk.io/api v0.7.3 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 cosmossdk.io/depinject v1.0.0-alpha.4 @@ -20,7 +20,7 @@ require ( cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 @@ -81,11 +81,11 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/iavl v1.0.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.0 // indirect @@ -97,7 +97,7 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -110,7 +110,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -166,7 +166,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -190,7 +190,7 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect @@ -199,8 +199,8 @@ require ( go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.19.0 // indirect - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect - golang.org/x/mod v0.14.0 // indirect + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect + golang.org/x/mod v0.15.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect @@ -208,7 +208,7 @@ require ( golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.17.0 // indirect + golang.org/x/tools v0.18.0 // indirect google.golang.org/api v0.160.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect diff --git a/tests/go.sum b/tests/go.sum index 0d6db1dc7ae7..eb9c0c5e0e17 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -320,8 +320,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft v0.38.5 h1:4lOcK5VTPrfbLOhNHmPYe6c7eDXHtBdMCQuKbAfFJdU= github.com/cometbft/cometbft v0.38.5/go.mod h1:0tqKin+KQs8zDwzYD8rPHzSBIDNPuB4NrwwGDNb/hUg= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -334,8 +334,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -343,8 +343,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= -github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -391,8 +391,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= -github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -489,8 +489,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -884,8 +884,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -1021,8 +1021,8 @@ gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1086,8 +1086,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1114,8 +1114,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1404,8 +1404,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index ae8679236c79..92a9abd7966d 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -77,8 +77,8 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -90,8 +90,9 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { accountKeeper.GetAuthority(): false, } bankKeeper := keeper.NewBaseKeeper( + + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index c20fe78646be..1c65b37cbdf9 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -84,8 +84,8 @@ func initFixture(t *testing.T) *fixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -97,8 +97,8 @@ func initFixture(t *testing.T) *fixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index dea665e70a12..12c6c0b9add0 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -104,8 +104,8 @@ func initFixture(tb testing.TB) *fixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -117,8 +117,8 @@ func initFixture(tb testing.TB) *fixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), @@ -131,7 +131,7 @@ func initFixture(tb testing.TB) *fixture { stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(slashingKeeper.Hooks())) - evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec(sdk.Bech32PrefixAccAddr)) + evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), log.NewNopLogger()), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec(sdk.Bech32PrefixAccAddr)) router := evidencetypes.NewRouter() router = router.AddRoute(evidencetypes.RouteEquivocation, testEquivocationHandler(evidenceKeeper)) evidenceKeeper.SetRouter(router) @@ -203,7 +203,7 @@ func TestHandleDoubleSign(t *testing.T) { consaddrStr, err := f.stakingKeeper.ConsensusAddressCodec().BytesToString(valpubkey.Address()) assert.NilError(t, err) - info := slashingtypes.NewValidatorSigningInfo(consaddrStr, f.sdkCtx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0)) + info := slashingtypes.NewValidatorSigningInfo(consaddrStr, f.sdkCtx.BlockHeight(), time.Unix(0, 0), false, int64(0)) err = f.slashingKeeper.ValidatorSigningInfo.Set(f.sdkCtx, sdk.ConsAddress(valpubkey.Address()), info) assert.NilError(t, err) // handle a signature to set signing info @@ -271,7 +271,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) { t.Parallel() f := initFixture(t) - ctx := f.sdkCtx.WithIsCheckTx(false).WithBlockHeight(1).WithHeaderInfo(header.Info{Time: time.Now()}) + ctx := f.sdkCtx.WithIsCheckTx(false).WithHeaderInfo(header.Info{Height: 1, Time: time.Now()}) populateValidators(t, f) power := int64(100) @@ -306,8 +306,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) { ctx = ctx.WithCometInfo(nci) ctx = ctx.WithConsensusParams(cp) - ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(cp.Evidence.MaxAgeDuration + 1)}) - ctx = ctx.WithBlockHeight(ctx.BlockHeight() + cp.Evidence.MaxAgeNumBlocks + 1) + ctx = ctx.WithHeaderInfo(header.Info{Height: ctx.BlockHeight() + cp.Evidence.MaxAgeNumBlocks + 1, Time: ctx.HeaderInfo().Time.Add(cp.Evidence.MaxAgeDuration + 1)}) assert.NilError(t, f.evidenceKeeper.BeginBlocker(ctx)) diff --git a/tests/integration/example/example_test.go b/tests/integration/example/example_test.go index 1db39ca237dc..8d4fa86aba51 100644 --- a/tests/integration/example/example_test.go +++ b/tests/integration/example/example_test.go @@ -40,8 +40,8 @@ func Example() { newCtx := sdk.NewContext(cms, true, logger) accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encodingCfg.Codec, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, map[string][]string{minttypes.ModuleName: {authtypes.Minter}}, addresscodec.NewBech32Codec("cosmos"), @@ -129,8 +129,8 @@ func Example_oneModule() { newCtx := sdk.NewContext(cms, true, logger) accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encodingCfg.Codec, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, map[string][]string{minttypes.ModuleName: {authtypes.Minter}}, addresscodec.NewBech32Codec("cosmos"), diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index 002fa2e27065..7881ccdf9da7 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -71,8 +71,8 @@ func initFixture(tb testing.TB) *fixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -84,8 +84,8 @@ func initFixture(tb testing.TB) *fixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), diff --git a/tests/integration/slashing/abci_test.go b/tests/integration/slashing/abci_test.go index 0409ea22ec60..51facaf45cbc 100644 --- a/tests/integration/slashing/abci_test.go +++ b/tests/integration/slashing/abci_test.go @@ -90,7 +90,7 @@ func TestBeginBlocker(t *testing.T) { info, err := slashingKeeper.ValidatorSigningInfo.Get(ctx, sdk.ConsAddress(pk.Address())) require.NoError(t, err) require.Equal(t, ctx.HeaderInfo().Height, info.StartHeight) - require.Equal(t, int64(1), info.IndexOffset) + require.Equal(t, int64(0), info.IndexOffset) require.Equal(t, time.Unix(0, 0).UTC(), info.JailedUntil) require.Equal(t, int64(0), info.MissedBlocksCounter) diff --git a/tests/integration/slashing/keeper/keeper_test.go b/tests/integration/slashing/keeper/keeper_test.go index f1e6fbed7ee0..31ddf5de6e73 100644 --- a/tests/integration/slashing/keeper/keeper_test.go +++ b/tests/integration/slashing/keeper/keeper_test.go @@ -72,8 +72,8 @@ func initFixture(tb testing.TB) *fixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -85,8 +85,8 @@ func initFixture(tb testing.TB) *fixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), @@ -127,8 +127,8 @@ func initFixture(tb testing.TB) *fixture { consaddr1, err := stakingKeeper.ConsensusAddressCodec().BytesToString(addrDels[1]) assert.NilError(tb, err) - info1 := slashingtypes.NewValidatorSigningInfo(consaddr0, int64(4), int64(3), time.Unix(2, 0), false, int64(10)) - info2 := slashingtypes.NewValidatorSigningInfo(consaddr1, int64(5), int64(4), time.Unix(2, 0), false, int64(10)) + info1 := slashingtypes.NewValidatorSigningInfo(consaddr0, int64(4), time.Unix(2, 0), false, int64(10)) + info2 := slashingtypes.NewValidatorSigningInfo(consaddr1, int64(5), time.Unix(2, 0), false, int64(10)) err = slashingKeeper.ValidatorSigningInfo.Set(sdkCtx, sdk.ConsAddress(addrDels[0]), info1) assert.NilError(tb, err) @@ -167,7 +167,8 @@ func TestUnJailNotBonded(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(f.ctx.BlockHeight() + 1) + newHeight := f.ctx.BlockHeight() + 1 + f.ctx = f.ctx.WithBlockHeight(newHeight).WithHeaderInfo(coreheader.Info{Height: newHeight}) // create a 6th validator with less power than the cliff validator (won't be bonded) addr, val := f.valAddrs[5], pks[5] @@ -183,7 +184,8 @@ func TestUnJailNotBonded(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(f.ctx.BlockHeight() + 1) + newHeight = f.ctx.BlockHeight() + 1 + f.ctx = f.ctx.WithBlockHeight(newHeight).WithHeaderInfo(coreheader.Info{Height: newHeight}) tstaking.CheckValidator(addr, stakingtypes.Unbonded, false) @@ -193,7 +195,8 @@ func TestUnJailNotBonded(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(f.ctx.BlockHeight() + 1) + newHeight = f.ctx.BlockHeight() + 1 + f.ctx = f.ctx.WithBlockHeight(newHeight).WithHeaderInfo(coreheader.Info{Height: newHeight}) // verify that validator is jailed tstaking.CheckValidator(addr, -1, true) @@ -211,13 +214,15 @@ func TestUnJailNotBonded(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(f.ctx.BlockHeight() + 1) + newHeight = f.ctx.BlockHeight() + 1 + f.ctx = f.ctx.WithBlockHeight(newHeight).WithHeaderInfo(coreheader.Info{Height: newHeight}) // bond to meet minimum self-delegation tstaking.DelegateWithPower(sdk.AccAddress(addr), addr, 1) _, err = f.stakingKeeper.EndBlocker(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(f.ctx.BlockHeight() + 1) + newHeight = f.ctx.BlockHeight() + 1 + f.ctx = f.ctx.WithBlockHeight(newHeight).WithHeaderInfo(coreheader.Info{Height: newHeight}) // verify we can immediately unjail _, err = f.app.RunMsg( @@ -242,15 +247,15 @@ func TestHandleNewValidator(t *testing.T) { tstaking := stakingtestutil.NewHelper(t, f.ctx, f.stakingKeeper) signedBlocksWindow, err := f.slashingKeeper.SignedBlocksWindow(f.ctx) assert.NilError(t, err) - f.ctx = f.ctx.WithBlockHeight(signedBlocksWindow + 1) - + f.ctx = f.ctx.WithBlockHeight(signedBlocksWindow + 1).WithHeaderInfo(coreheader.Info{Height: signedBlocksWindow + 1}) assert.NilError(t, f.slashingKeeper.AddrPubkeyRelation.Set(f.ctx, pks[0].Address(), pks[0])) consaddr, err := f.stakingKeeper.ConsensusAddressCodec().BytesToString(valpubkey.Address()) assert.NilError(t, err) - info := slashingtypes.NewValidatorSigningInfo(consaddr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0)) + info := slashingtypes.NewValidatorSigningInfo(consaddr, f.ctx.BlockHeight(), time.Unix(0, 0), false, int64(0)) assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(valpubkey.Address()), info)) + assert.Equal(t, signedBlocksWindow+1, info.StartHeight) // Validator created acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr)) @@ -274,13 +279,12 @@ func TestHandleNewValidator(t *testing.T) { // Now a validator, for two blocks assert.NilError(t, f.slashingKeeper.HandleValidatorSignature(f.ctx, valpubkey.Address(), 100, comet.BlockIDFlagCommit)) - f.ctx = f.ctx.WithBlockHeight(signedBlocksWindow + 2) + f.ctx = f.ctx.WithBlockHeight(signedBlocksWindow + 2).WithHeaderInfo(coreheader.Info{Height: signedBlocksWindow + 2}) assert.NilError(t, f.slashingKeeper.HandleValidatorSignature(f.ctx, valpubkey.Address(), 100, comet.BlockIDFlagAbsent)) info, found := f.slashingKeeper.ValidatorSigningInfo.Get(f.ctx, sdk.ConsAddress(valpubkey.Address())) assert.Assert(t, found) assert.Equal(t, signedBlocksWindow+1, info.StartHeight) - assert.Equal(t, int64(2), info.IndexOffset) assert.Equal(t, int64(1), info.MissedBlocksCounter) assert.Equal(t, time.Unix(0, 0).UTC(), info.JailedUntil) @@ -309,7 +313,7 @@ func TestHandleAlreadyJailed(t *testing.T) { consaddr, err := f.stakingKeeper.ConsensusAddressCodec().BytesToString(val.Address()) assert.NilError(t, err) - info := slashingtypes.NewValidatorSigningInfo(consaddr, f.ctx.HeaderInfo().Height, int64(0), time.Unix(0, 0), false, int64(0)) + info := slashingtypes.NewValidatorSigningInfo(consaddr, f.ctx.HeaderInfo().Height, time.Unix(0, 0), false, int64(0)) assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(val.Address()), info)) acc := f.accountKeeper.NewAccountWithAddress(f.ctx, sdk.AccAddress(addr)) @@ -393,7 +397,7 @@ func TestValidatorDippingInAndOut(t *testing.T) { consaddrStr, err := f.stakingKeeper.ConsensusAddressCodec().BytesToString(addr) assert.NilError(t, err) - info := slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0)) + info := slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), time.Unix(0, 0), false, int64(0)) assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info)) tstaking.CreateValidatorWithValPower(valAddr, val, power, true) @@ -454,7 +458,7 @@ func TestValidatorDippingInAndOut(t *testing.T) { assert.NilError(t, err) tstaking.CheckValidator(valAddr, stakingtypes.Unbonding, true) - info = slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0)) + info = slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), time.Unix(0, 0), false, int64(0)) err = f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info) assert.NilError(t, err) @@ -469,7 +473,7 @@ func TestValidatorDippingInAndOut(t *testing.T) { height = int64(5000) f.ctx = f.ctx.WithBlockHeight(height).WithHeaderInfo(coreheader.Info{Height: height}) - info = slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0)) + info = slashingtypes.NewValidatorSigningInfo(consaddrStr, f.ctx.BlockHeight(), time.Unix(0, 0), false, int64(0)) err = f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info) assert.NilError(t, err) diff --git a/tests/integration/staking/keeper/common_test.go b/tests/integration/staking/keeper/common_test.go index e65f5d533c64..d4cff3506bad 100644 --- a/tests/integration/staking/keeper/common_test.go +++ b/tests/integration/staking/keeper/common_test.go @@ -121,8 +121,8 @@ func initFixture(tb testing.TB) *fixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -134,8 +134,8 @@ func initFixture(tb testing.TB) *fixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), diff --git a/tests/integration/staking/keeper/deterministic_test.go b/tests/integration/staking/keeper/deterministic_test.go index 7cee04d5cd14..50826745c36f 100644 --- a/tests/integration/staking/keeper/deterministic_test.go +++ b/tests/integration/staking/keeper/deterministic_test.go @@ -85,8 +85,8 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { } accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -98,8 +98,8 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { accountKeeper.GetAuthority(): false, } bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), cdc, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, blockedAddresses, authority.String(), diff --git a/tests/sims/slashing/operations_test.go b/tests/sims/slashing/operations_test.go index 0b052f1734e1..411308c2f06e 100644 --- a/tests/sims/slashing/operations_test.go +++ b/tests/sims/slashing/operations_test.go @@ -167,7 +167,7 @@ func (suite *SimTestSuite) TestSimulateMsgUnjail() { suite.Require().NoError(err) val0ConsAddressStr, err := suite.stakingKeeper.ConsensusAddressCodec().BytesToString(val0ConsAddress) suite.Require().NoError(err) - info := types.NewValidatorSigningInfo(val0ConsAddressStr, int64(4), int64(3), + info := types.NewValidatorSigningInfo(val0ConsAddressStr, int64(4), time.Unix(2, 0), false, int64(10)) err = suite.slashingKeeper.ValidatorSigningInfo.Set(ctx, val0ConsAddress, info) suite.Require().NoError(err) diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 2bcec3db3a92..709733d7cbe5 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -57,7 +57,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a // indirect + cosmossdk.io/api v0.7.3 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.12.1-0.20231114100755-569e3ff6a0d7 // indirect @@ -102,13 +102,13 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft v0.38.5 // indirect - github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.11 // indirect - github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/iavl v1.0.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.0 // indirect @@ -120,7 +120,7 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -133,7 +133,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -194,7 +194,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -220,7 +220,7 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect @@ -229,8 +229,8 @@ require ( go.opentelemetry.io/otel/trace v1.22.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.19.0 // indirect - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect - golang.org/x/mod v0.14.0 // indirect + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect + golang.org/x/mod v0.15.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect @@ -238,7 +238,7 @@ require ( golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.17.0 // indirect + golang.org/x/tools v0.18.0 // indirect google.golang.org/api v0.160.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index 69788e1d572f..602285028b50 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -320,8 +320,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft v0.38.5 h1:4lOcK5VTPrfbLOhNHmPYe6c7eDXHtBdMCQuKbAfFJdU= github.com/cometbft/cometbft v0.38.5/go.mod h1:0tqKin+KQs8zDwzYD8rPHzSBIDNPuB4NrwwGDNb/hUg= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -334,8 +334,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -343,8 +343,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= -github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -391,8 +391,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= -github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -489,8 +489,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -884,8 +884,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -1021,8 +1021,8 @@ gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1086,8 +1086,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1114,8 +1114,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1405,8 +1405,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/testutil/integration/router.go b/testutil/integration/router.go index cbb579823207..fcf147a28820 100644 --- a/testutil/integration/router.go +++ b/testutil/integration/router.go @@ -82,7 +82,7 @@ func NewIntegrationApp( if keys[consensusparamtypes.StoreKey] != nil { // set baseApp param store - consensusParamsKeeper := consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress("gov").String(), runtime.EventService{}) + consensusParamsKeeper := consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), log.NewNopLogger()), authtypes.NewModuleAddress("gov").String()) bApp.SetParamStore(consensusParamsKeeper.ParamsStore) if err := bApp.LoadLatestVersion(); err != nil { diff --git a/tools/confix/go.mod b/tools/confix/go.mod index be06257ebb85..dff5f5c00a96 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -3,18 +3,18 @@ module cosmossdk.io/tools/confix go 1.21 require ( - github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230614103911-b3da8bb4e801 + github.com/cosmos/cosmos-sdk v0.50.4 github.com/creachadair/atomicfile v0.3.3 github.com/creachadair/tomledit v0.0.25 github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 - golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a gotest.tools/v3 v3.5.1 ) require ( - cosmossdk.io/api v0.7.2 // indirect + cosmossdk.io/api v0.7.3 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect @@ -26,8 +26,8 @@ require ( filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect - github.com/armon/go-metrics v0.4.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -40,14 +40,14 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/cometbft/cometbft v0.38.5 // indirect - github.com/cometbft/cometbft-db v0.8.0 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.11 // indirect - github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/iavl v1.0.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -59,7 +59,7 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -70,7 +70,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -115,7 +115,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -136,7 +136,7 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.19.0 // indirect golang.org/x/net v0.21.0 // indirect diff --git a/tools/confix/go.sum b/tools/confix/go.sum index 97d52d3ea1a9..39f445256f17 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= -cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/api v0.7.3 h1:V815i8YOwOAQa1rLCsSMjVG5Gnzs02JLq+l7ks8s1jk= +cosmossdk.io/api v0.7.3/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= @@ -29,6 +29,7 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25 github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -57,8 +58,6 @@ github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= @@ -80,8 +79,8 @@ github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipus github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= -github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -128,8 +127,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft v0.38.5 h1:4lOcK5VTPrfbLOhNHmPYe6c7eDXHtBdMCQuKbAfFJdU= github.com/cometbft/cometbft v0.38.5/go.mod h1:0tqKin+KQs8zDwzYD8rPHzSBIDNPuB4NrwwGDNb/hUg= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -142,10 +141,10 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= -github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230614103911-b3da8bb4e801 h1:Qg0EgcEYtN0RWmxaFWTTCeMDfnbHB6UEzHucafy14i8= -github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230614103911-b3da8bb4e801/go.mod h1:VwFzgpv4z/Mrx+0sQpWwURCHx4h/iAalMdKIe3VEyBw= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-sdk v0.50.4 h1:hQT5/+Z1XXNF7skaPq0i247Ts2dzzqg/j2WO/BPHSto= +github.com/cosmos/cosmos-sdk v0.50.4/go.mod h1:UbShFs6P8Ly29xxJvkNGaNaL/UGj5a686NRtb1Cqra0= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -153,8 +152,8 @@ github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= -github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= @@ -205,8 +204,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= -github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -291,8 +290,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -605,8 +604,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -731,8 +730,8 @@ github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWp github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -766,8 +765,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo= -golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -782,8 +781,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -918,8 +917,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 3a60b2a27cb4..46d90d22cf97 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -45,7 +45,7 @@ require ( github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/cosmos-sdk v0.50.1 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 14c74b650369..865182acf532 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -323,8 +323,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/cosmos-sdk v0.50.1 h1:2SYwAYqd7ZwtrWxu/J8PwbQV/cDcu90bCr/a78g3lVw= github.com/cosmos/cosmos-sdk v0.50.1/go.mod h1:fsLSPGstCwn6MMsFDMAQWGJj8E4sYsN9Gnu1bGE5imA= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 1a1cd43b6ad1..0f7f7546670b 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -43,7 +43,7 @@ require ( github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.11 // indirect diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 4370f5d89284..e7e60aad0f46 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -147,8 +147,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/cosmos-sdk v0.50.4-0.20240118210941-3897926e722e h1:mulHyVrTg+jxQEhnKuT9gdzrB/DXxXfFMW1Ju95yXK0= github.com/cosmos/cosmos-sdk v0.50.4-0.20240118210941-3897926e722e/go.mod h1:tlrkY1sntOt1q0OX/rqF0zRJtmXNoffAS6VFTcky+w8= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 9ed42d153158..480a49c272fb 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -50,7 +50,7 @@ require ( github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.0.0 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index e457fbfddf54..2c761db095c1 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -132,8 +132,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/accounts/interfaces/account_abstraction/v1/interface.pb.go b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go index b37b2378b256..3e6e784b2171 100644 --- a/x/accounts/interfaces/account_abstraction/v1/interface.pb.go +++ b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go @@ -5,7 +5,6 @@ package v1 import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/codec/types" tx "github.com/cosmos/cosmos-sdk/types/tx" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -237,30 +236,29 @@ func init() { } var fileDescriptor_56b360422260e9d1 = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0xe2, 0x30, - 0x1c, 0xc6, 0x31, 0xdc, 0x71, 0xc2, 0xdc, 0xe9, 0xa4, 0x48, 0xdc, 0x85, 0xe8, 0x14, 0xe5, 0x22, - 0x55, 0xca, 0x64, 0x2b, 0xad, 0x3a, 0x74, 0xa4, 0x5b, 0x07, 0x86, 0xa6, 0x4c, 0xed, 0x10, 0x39, - 0x89, 0x09, 0x51, 0xc1, 0x46, 0xf6, 0x3f, 0x60, 0xde, 0xa2, 0x4f, 0xd1, 0x67, 0xe9, 0xc8, 0xd8, - 0xb1, 0x82, 0x17, 0xa9, 0x4a, 0xa0, 0xb4, 0x15, 0x1d, 0x3a, 0xe6, 0xfb, 0x7e, 0xf9, 0xe9, 0xb3, - 0x6c, 0xdc, 0x4b, 0xa5, 0x9e, 0x48, 0x4d, 0x59, 0x9a, 0xca, 0x52, 0x80, 0xa6, 0x85, 0x00, 0xae, - 0x86, 0x2c, 0xe5, 0xaf, 0x59, 0xcc, 0x12, 0x0d, 0x8a, 0xa5, 0x50, 0x48, 0x41, 0x67, 0xe1, 0x9e, - 0x20, 0x53, 0x25, 0x41, 0x5a, 0x61, 0xa5, 0x20, 0x3b, 0x05, 0xd9, 0x2b, 0xc8, 0x01, 0x05, 0x99, - 0x85, 0x4e, 0x37, 0x97, 0x32, 0x1f, 0x73, 0xba, 0x11, 0x24, 0xe5, 0x90, 0x32, 0xb1, 0xa8, 0x6c, - 0x8e, 0xb3, 0x1d, 0x04, 0x86, 0xce, 0xc2, 0x84, 0x03, 0x0b, 0x29, 0x98, 0xaa, 0xf3, 0xef, 0x11, - 0xfe, 0xdd, 0xd7, 0x79, 0xaf, 0x84, 0x11, 0x17, 0x50, 0xa4, 0x0c, 0xb8, 0x65, 0xe3, 0x1f, 0x49, - 0x29, 0xb2, 0x31, 0x57, 0x36, 0xf2, 0x50, 0xd0, 0x8a, 0x76, 0x9f, 0x16, 0xc5, 0x4d, 0xc5, 0xe6, - 0x31, 0x18, 0xbb, 0xee, 0xa1, 0xa0, 0x7d, 0x6c, 0x93, 0xed, 0x50, 0x30, 0x64, 0xab, 0x26, 0x03, - 0x13, 0xb1, 0x79, 0xf4, 0x5d, 0xb1, 0xf9, 0xc0, 0x58, 0x47, 0xb8, 0x0e, 0xc6, 0x6e, 0x6c, 0xe0, - 0xce, 0x61, 0xb8, 0x0e, 0xc6, 0xfa, 0x8f, 0x7f, 0xea, 0x22, 0x17, 0x5c, 0xc5, 0x85, 0xc8, 0xb8, - 0xb1, 0xbf, 0x79, 0x28, 0xf8, 0x15, 0xb5, 0xab, 0xec, 0xe2, 0x25, 0xf2, 0xbb, 0xf8, 0xef, 0x87, - 0x9d, 0x11, 0xd7, 0x53, 0x29, 0x34, 0xf7, 0xff, 0x61, 0xe7, 0xb2, 0xe4, 0x6a, 0xf1, 0xa6, 0x2c, - 0xa4, 0xe8, 0x73, 0x18, 0xc9, 0x4c, 0xfb, 0x37, 0xd8, 0xff, 0xbc, 0xdd, 0x39, 0xac, 0x53, 0xfc, - 0x87, 0xbd, 0x03, 0xe2, 0x49, 0x45, 0xd8, 0xc8, 0x6b, 0x04, 0xad, 0xa8, 0xc3, 0x0e, 0xfd, 0x7e, - 0x7e, 0xf5, 0xb0, 0x72, 0xd1, 0x72, 0xe5, 0xa2, 0xa7, 0x95, 0x8b, 0xee, 0xd6, 0x6e, 0x6d, 0xb9, - 0x76, 0x6b, 0x8f, 0x6b, 0xb7, 0x76, 0x7d, 0x56, 0x1d, 0x56, 0x67, 0xb7, 0xa4, 0x90, 0xd4, 0x7c, - 0xe1, 0x35, 0x24, 0xcd, 0xcd, 0xd5, 0x9c, 0x3c, 0x07, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x1c, 0xbd, - 0x8a, 0x49, 0x02, 0x00, 0x00, + // 338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0xeb, 0xf6, 0xde, 0xa2, 0xba, 0x20, 0xa4, 0x48, 0x85, 0x50, 0xa1, 0x28, 0x44, 0x42, + 0xca, 0x64, 0x2b, 0x20, 0x06, 0xc6, 0xb2, 0x31, 0x74, 0x20, 0x74, 0x82, 0x21, 0x72, 0x12, 0xd3, + 0x5a, 0x50, 0xbb, 0xb2, 0x4f, 0x5a, 0xf3, 0x16, 0x3c, 0x05, 0xcf, 0xc2, 0xd8, 0x91, 0x11, 0xb5, + 0x2f, 0x82, 0x68, 0x5a, 0x0a, 0xa8, 0x0c, 0x8c, 0xfe, 0xcf, 0xe7, 0xcf, 0xc7, 0xfa, 0x71, 0x27, + 0x53, 0x66, 0xa8, 0x0c, 0x65, 0x59, 0xa6, 0x0a, 0x09, 0x86, 0x0a, 0x09, 0x5c, 0xdf, 0xb1, 0x8c, + 0x7f, 0x66, 0x09, 0x4b, 0x0d, 0x68, 0x96, 0x81, 0x50, 0x92, 0x8e, 0xa3, 0x35, 0x41, 0x46, 0x5a, + 0x81, 0x72, 0xa2, 0x52, 0x41, 0x56, 0x0a, 0xb2, 0x56, 0x90, 0x0d, 0x0a, 0x32, 0x8e, 0xda, 0xed, + 0xe5, 0xab, 0x60, 0xe9, 0x38, 0x4a, 0x39, 0xb0, 0x88, 0x82, 0x2d, 0x75, 0xc1, 0x33, 0xc2, 0xbb, + 0x5d, 0xd3, 0xef, 0x14, 0x30, 0xe0, 0x12, 0x44, 0xc6, 0x80, 0x3b, 0x2e, 0xde, 0x4a, 0x0b, 0x99, + 0x3f, 0x70, 0xed, 0x22, 0x1f, 0x85, 0x8d, 0x78, 0x75, 0x74, 0x28, 0xae, 0x6b, 0x36, 0x49, 0xc0, + 0xba, 0x55, 0x1f, 0x85, 0xcd, 0x13, 0x97, 0x2c, 0xb7, 0x01, 0x4b, 0x96, 0x6a, 0xd2, 0xb3, 0x31, + 0x9b, 0xc4, 0xff, 0x35, 0x9b, 0xf4, 0xac, 0x73, 0x8c, 0xab, 0x60, 0xdd, 0xda, 0x02, 0x6e, 0x6d, + 0x86, 0xab, 0x60, 0x9d, 0x23, 0xbc, 0x6d, 0x44, 0x5f, 0x72, 0x9d, 0x08, 0x99, 0x73, 0xeb, 0xfe, + 0xf3, 0x51, 0xb8, 0x13, 0x37, 0xcb, 0xec, 0xf2, 0x23, 0x0a, 0x0e, 0xf0, 0xfe, 0x8f, 0x3d, 0x63, + 0x6e, 0x46, 0x4a, 0x1a, 0x1e, 0x1c, 0xe2, 0xf6, 0x55, 0xc1, 0xf5, 0xe3, 0x97, 0xa1, 0x50, 0xb2, + 0xcb, 0x61, 0xa0, 0x72, 0x13, 0xdc, 0xe2, 0xe0, 0xf7, 0xe9, 0xca, 0xe1, 0x9c, 0xe1, 0x3d, 0xf6, + 0x0d, 0x48, 0x86, 0x25, 0xe1, 0x22, 0xbf, 0x16, 0x36, 0xe2, 0x16, 0xdb, 0x74, 0xfd, 0xe2, 0xfa, + 0x65, 0xe6, 0xa1, 0xe9, 0xcc, 0x43, 0x6f, 0x33, 0x0f, 0x3d, 0xcd, 0xbd, 0xca, 0x74, 0xee, 0x55, + 0x5e, 0xe7, 0x5e, 0xe5, 0xe6, 0xbc, 0xfc, 0xac, 0xc9, 0xef, 0x89, 0x50, 0xd4, 0xfe, 0xa1, 0xf2, + 0xb4, 0xbe, 0xa8, 0xe6, 0xf4, 0x3d, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x1c, 0x3d, 0x0e, 0x2e, 0x02, + 0x00, 0x00, } func (m *MsgAuthenticate) Marshal() (dAtA []byte, err error) { diff --git a/x/accounts/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto b/x/accounts/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto index 76663cc0bea7..d411e6c1e17f 100644 --- a/x/accounts/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto +++ b/x/accounts/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package cosmos.accounts.interfaces.account_abstraction.v1; -import "google/protobuf/any.proto"; import "cosmos/tx/v1beta1/tx.proto"; option go_package = "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1"; diff --git a/x/auth/CHANGELOG.md b/x/auth/CHANGELOG.md index aa4aa5d13c09..e7a346dd6beb 100644 --- a/x/auth/CHANGELOG.md +++ b/x/auth/CHANGELOG.md @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17985](https://github.com/cosmos/cosmos-sdk/pull/17985) Remove `StdTxConfig` * [#19161](https://github.com/cosmos/cosmos-sdk/pull/19161) Remove `simulate` from `SetGasMeter` * [#19363](https://github.com/cosmos/cosmos-sdk/pull/19363) Remove `IterateAccounts` and `GetAllAccounts` methods from the AccountKeeper interface and Keeper. +* [#19290](https://github.com/cosmos/cosmos-sdk/issues/19290) Pass `appmodule.Environment` to NewKeeper instead of passing individual services. ### Consensus Breaking Changes diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index f91434007c47..d412d312827d 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -11,6 +11,7 @@ import ( // ref: https://github.com/cosmos/cosmos-sdk/issues/14647 _ "cosmossdk.io/api/cosmos/bank/v1beta1" _ "cosmossdk.io/api/cosmos/crypto/secp256k1" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/auth" "cosmossdk.io/x/auth/ante" @@ -78,7 +79,7 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { } suite.accountKeeper = keeper.NewAccountKeeper( - suite.encCfg.Codec, runtime.NewKVStoreService(key), types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), + runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(), ) suite.accountKeeper.GetModuleAccount(suite.ctx, types.FeeCollectorName) diff --git a/x/auth/depinject.go b/x/auth/depinject.go index dcd624f99d10..67d75e7c902a 100644 --- a/x/auth/depinject.go +++ b/x/auth/depinject.go @@ -4,7 +4,6 @@ import ( modulev1 "cosmossdk.io/api/cosmos/auth/module/v1" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/auth/keeper" @@ -29,9 +28,9 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - StoreService store.KVStoreService - Cdc codec.Codec + Config *modulev1.Module + Environment appmodule.Environment + Cdc codec.Codec AddressCodec address.Codec RandomGenesisAccountsFn types.RandomGenesisAccountsFn `optional:"true"` @@ -70,7 +69,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { panic(err) } - k := keeper.NewAccountKeeper(in.Cdc, in.StoreService, in.AccountI, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth) + k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth) m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn) return ModuleOutputs{AccountKeeper: k, Module: m} diff --git a/x/auth/go.mod b/x/auth/go.mod index f2cef4e91639..efb84ef0b2d9 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -16,7 +16,7 @@ require ( cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.0 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 diff --git a/x/auth/go.sum b/x/auth/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/auth/keeper/deterministic_test.go b/x/auth/keeper/deterministic_test.go index cfa954aae95d..97074cd677b7 100644 --- a/x/auth/keeper/deterministic_test.go +++ b/x/auth/keeper/deterministic_test.go @@ -9,8 +9,9 @@ import ( "github.com/stretchr/testify/suite" "pgregory.net/rapid" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" - corestore "cosmossdk.io/core/store" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/auth" authcodec "cosmossdk.io/x/auth/codec" @@ -32,7 +33,7 @@ type DeterministicTestSuite struct { accountNumberLanes uint64 key *storetypes.KVStoreKey - storeService corestore.KVStoreService + environment appmodule.Environment ctx sdk.Context queryClient types.QueryClient accountKeeper keeper.AccountKeeper @@ -56,6 +57,7 @@ func (suite *DeterministicTestSuite) SetupTest() { suite.Require() key := storetypes.NewKVStoreKey(types.StoreKey) storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(storeService, log.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) @@ -69,8 +71,8 @@ func (suite *DeterministicTestSuite) SetupTest() { } suite.accountKeeper = keeper.NewAccountKeeper( + env, suite.encCfg.Codec, - storeService, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), @@ -83,7 +85,7 @@ func (suite *DeterministicTestSuite) SetupTest() { suite.queryClient = types.NewQueryClient(queryHelper) suite.key = key - suite.storeService = storeService + suite.environment = env suite.maccPerms = maccPerms suite.accountNumberLanes = 1 } @@ -289,8 +291,8 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccounts() { } ak := keeper.NewAccountKeeper( + suite.environment, suite.encCfg.Codec, - suite.storeService, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), @@ -336,8 +338,8 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() { maccPerms[mName] = mPerms ak := keeper.NewAccountKeeper( + suite.environment, suite.encCfg.Codec, - suite.storeService, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 63e7e0685e3d..6196236df2e7 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -8,7 +8,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/collections/indexes" "cosmossdk.io/core/address" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/x/auth/types" @@ -82,7 +82,7 @@ func (a AccountsIndexes) IndexesList() []collections.Index[sdk.AccAddress, sdk.A type AccountKeeper struct { addressCodec address.Codec - storeService store.KVStoreService + Environment appmodule.Environment cdc codec.BinaryCodec permAddrs map[string]types.PermissionsForAddress bech32Prefix string @@ -111,7 +111,7 @@ var _ AccountKeeperI = &AccountKeeper{} // and don't have to fit into any predefined structure. This auth module does not use account permissions internally, though other modules // may use auth.Keeper to access the accounts permissions map. func NewAccountKeeper( - cdc codec.BinaryCodec, storeService store.KVStoreService, proto func() sdk.AccountI, + env appmodule.Environment, cdc codec.BinaryCodec, proto func() sdk.AccountI, maccPerms map[string][]string, ac address.Codec, bech32Prefix, authority string, ) AccountKeeper { permAddrs := make(map[string]types.PermissionsForAddress) @@ -119,12 +119,12 @@ func NewAccountKeeper( permAddrs[name] = types.NewPermissionsForAddress(name, perms) } - sb := collections.NewSchemaBuilder(storeService) + sb := collections.NewSchemaBuilder(env.KVStoreService) ak := AccountKeeper{ addressCodec: ac, bech32Prefix: bech32Prefix, - storeService: storeService, + Environment: env, proto: proto, cdc: cdc, permAddrs: permAddrs, @@ -154,7 +154,7 @@ func (ak AccountKeeper) AddressCodec() address.Codec { // Logger returns a module-specific logger. func (ak AccountKeeper) Logger(ctx context.Context) log.Logger { - return sdk.UnwrapSDKContext(ctx).Logger().With("module", "x/"+types.ModuleName) + return ak.Environment.Logger.With("module", "x/"+types.ModuleName) } // GetPubKey Returns the PubKey of the account at address diff --git a/x/auth/keeper/keeper_test.go b/x/auth/keeper/keeper_test.go index 57d7c7fd3432..fa85083c0b97 100644 --- a/x/auth/keeper/keeper_test.go +++ b/x/auth/keeper/keeper_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/core/header" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/auth" authcodec "cosmossdk.io/x/auth/codec" @@ -49,6 +50,7 @@ func (suite *KeeperTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(types.StoreKey) storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(storeService, log.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) @@ -62,8 +64,8 @@ func (suite *KeeperTestSuite) SetupTest() { } suite.accountKeeper = keeper.NewAccountKeeper( + env, suite.encCfg.Codec, - storeService, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), diff --git a/x/auth/keeper/migrations.go b/x/auth/keeper/migrations.go index 2951a9d54b35..cad0b5742691 100644 --- a/x/auth/keeper/migrations.go +++ b/x/auth/keeper/migrations.go @@ -42,7 +42,7 @@ func (m Migrator) Migrate3to4(ctx context.Context) error { // It migrates the GlobalAccountNumber from being a protobuf defined value to a // big-endian encoded uint64, it also migrates it to use a more canonical prefix. func (m Migrator) Migrate4To5(ctx context.Context) error { - return v5.Migrate(ctx, m.keeper.storeService, m.keeper.AccountNumber) + return v5.Migrate(ctx, m.keeper.Environment.KVStoreService, m.keeper.AccountNumber) } // V45_SetAccount implements V45_SetAccount @@ -51,7 +51,7 @@ func (m Migrator) Migrate4To5(ctx context.Context) error { // NOTE: This is used for testing purposes only. func (m Migrator) V45SetAccount(ctx context.Context, acc sdk.AccountI) error { addr := acc.GetAddress() - store := m.keeper.storeService.OpenKVStore(ctx) + store := m.keeper.Environment.KVStoreService.OpenKVStore(ctx) bz, err := m.keeper.Accounts.ValueCodec().Encode(acc) if err != nil { diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go index 1e1b4e0953b5..c66785af36c4 100644 --- a/x/auth/keeper/msg_server.go +++ b/x/auth/keeper/msg_server.go @@ -5,8 +5,6 @@ import ( "fmt" "cosmossdk.io/x/auth/types" - - sdk "github.com/cosmos/cosmos-sdk/types" ) var _ types.MsgServer = msgServer{} @@ -22,7 +20,7 @@ func NewMsgServerImpl(ak AccountKeeper) types.MsgServer { } } -func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if ms.ak.authority != msg.Authority { return nil, fmt.Errorf( "expected authority account as only signer for proposal message; invalid authority; expected %s, got %s", @@ -33,7 +31,6 @@ func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdatePara return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) if err := ms.ak.Params.Set(ctx, msg.Params); err != nil { return nil, err } diff --git a/x/auth/vesting/fuzz_test.go b/x/auth/vesting/fuzz_test.go index fb5ad8042643..15d49d0a1df0 100644 --- a/x/auth/vesting/fuzz_test.go +++ b/x/auth/vesting/fuzz_test.go @@ -77,14 +77,13 @@ func FuzzMsgServerCreateVestingAccount(f *testing.F) { } key := storetypes.NewKVStoreKey(authtypes.StoreKey) - storeService := runtime.NewKVStoreService(key) - + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) maccPerms := map[string][]string{} encCfg := moduletestutil.MakeTestEncodingConfig() accountKeeper := authkeeper.NewAccountKeeper( + env, encCfg.Codec, - storeService, authtypes.ProtoBaseAccount, maccPerms, address.NewBech32Codec("cosmos"), @@ -103,12 +102,13 @@ func FuzzMsgServerCreateVestingAccount(f *testing.F) { return } + storeService := runtime.NewKVStoreService(key) ctrl := gomock.NewController(t) authKeeper := banktestutil.NewMockAccountKeeper(ctrl) authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() bankKeeper := keeper.NewBaseKeeper( + runtime.NewEnvironment(storeService, log.NewNopLogger()), encCfg.Codec, - storeService, authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress(banktypes.GovModuleName).String(), diff --git a/x/auth/vesting/msg_server.go b/x/auth/vesting/msg_server.go index 91ddc9d0e934..22588fad5979 100644 --- a/x/auth/vesting/msg_server.go +++ b/x/auth/vesting/msg_server.go @@ -80,8 +80,7 @@ func (s msgServer) CreateVestingAccount(ctx context.Context, msg *types.MsgCreat } else { start := msg.StartTime if msg.StartTime == 0 { - sdkctx := sdk.UnwrapSDKContext(ctx) - start = sdkctx.HeaderInfo().Time.Unix() + start = s.AccountKeeper.Environment.HeaderService.GetHeaderInfo(ctx).Time.Unix() } vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, start) } @@ -194,6 +193,10 @@ func (s msgServer) CreatePeriodicVestingAccount(ctx context.Context, msg *types. totalCoins = totalCoins.Add(period.Amount...) } + if s.BankKeeper.BlockedAddr(to) { + return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress) + } + if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress) } diff --git a/x/auth/vesting/msg_server_test.go b/x/auth/vesting/msg_server_test.go index 0c8b020c38ae..8ad3c9776af6 100644 --- a/x/auth/vesting/msg_server_test.go +++ b/x/auth/vesting/msg_server_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/core/header" + "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authcodec "cosmossdk.io/x/auth/codec" @@ -43,7 +44,8 @@ type VestingTestSuite struct { func (s *VestingTestSuite) SetupTest() { key := storetypes.NewKVStoreKey(authtypes.StoreKey) - storeService := runtime.NewKVStoreService(key) + + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) @@ -54,8 +56,8 @@ func (s *VestingTestSuite) SetupTest() { ctrl := gomock.NewController(s.T()) s.bankKeeper = vestingtestutil.NewMockBankKeeper(ctrl) s.accountKeeper = authkeeper.NewAccountKeeper( + env, encCfg.Codec, - storeService, authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), @@ -136,6 +138,21 @@ func (s *VestingTestSuite) TestCreateVestingAccount() { expErr: true, expErrMsg: "already exists", }, + "create for blocked account": { + preRun: func() { + s.bankKeeper.EXPECT().IsSendEnabledCoins(gomock.Any(), fooCoin).Return(nil) + s.bankKeeper.EXPECT().BlockedAddr(to1Addr).Return(true) + }, + input: vestingtypes.NewMsgCreateVestingAccount( + fromAddr, + to1Addr, + sdk.Coins{fooCoin}, + time.Now().Unix(), + true, + ), + expErr: true, + expErrMsg: "not allowed to receive funds", + }, "create a valid delayed vesting account": { preRun: func() { s.bankKeeper.EXPECT().IsSendEnabledCoins(gomock.Any(), fooCoin).Return(nil) @@ -235,6 +252,22 @@ func (s *VestingTestSuite) TestCreatePermanentLockedAccount() { expErr: true, expErrMsg: "already exists", }, + "create for blocked account": { + preRun: func() { + toAcc := s.accountKeeper.NewAccountWithAddress(s.ctx, to1Addr) + s.bankKeeper.EXPECT().IsSendEnabledCoins(gomock.Any(), fooCoin).Return(nil) + s.bankKeeper.EXPECT().BlockedAddr(to1Addr).Return(true) + s.accountKeeper.SetAccount(s.ctx, toAcc) + }, + input: vestingtypes.NewMsgCreatePermanentLockedAccount( + fromAddr, + to1Addr, + sdk.Coins{fooCoin}, + ), + expErr: true, + expErrMsg: "not allowed to receive funds", + }, + "create a valid permanent locked account": { preRun: func() { s.bankKeeper.EXPECT().IsSendEnabledCoins(gomock.Any(), fooCoin).Return(nil) @@ -359,6 +392,7 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() { { name: "create for existing account", preRun: func() { + s.bankKeeper.EXPECT().BlockedAddr(to1Addr).Return(false) toAcc := s.accountKeeper.NewAccountWithAddress(s.ctx, to1Addr) s.accountKeeper.SetAccount(s.ctx, toAcc) }, @@ -376,10 +410,34 @@ func (s *VestingTestSuite) TestCreatePeriodicVestingAccount() { expErr: true, expErrMsg: "already exists", }, + { + name: "create for blocked address", + preRun: func() { + s.bankKeeper.EXPECT().BlockedAddr(to2Addr).Return(true) + }, + input: vestingtypes.NewMsgCreatePeriodicVestingAccount( + fromAddr, + to2Addr, + time.Now().Unix(), + []vestingtypes.Period{ + { + Length: 10, + Amount: sdk.NewCoins(periodCoin), + }, + { + Length: 20, + Amount: sdk.NewCoins(fooCoin), + }, + }, + ), + expErr: true, + expErrMsg: "not allowed to receive funds", + }, { name: "create a valid periodic vesting account", preRun: func() { s.bankKeeper.EXPECT().IsSendEnabledCoins(gomock.Any(), periodCoin.Add(fooCoin)).Return(nil) + s.bankKeeper.EXPECT().BlockedAddr(to2Addr).Return(false) s.bankKeeper.EXPECT().SendCoins(gomock.Any(), fromAddr, to2Addr, gomock.Any()).Return(nil) }, input: vestingtypes.NewMsgCreatePeriodicVestingAccount( diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 011445350d32..3c1756c59df3 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/core/header" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authcodec "cosmossdk.io/x/auth/codec" "cosmossdk.io/x/auth/keeper" @@ -40,7 +41,7 @@ func (s *VestingAccountTestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig(vesting.AppModuleBasic{}) key := storetypes.NewKVStoreKey(authtypes.StoreKey) - storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) @@ -54,8 +55,8 @@ func (s *VestingAccountTestSuite) SetupTest() { } s.accountKeeper = keeper.NewAccountKeeper( + env, encCfg.Codec, - storeService, authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), diff --git a/x/authz/go.mod b/x/authz/go.mod index 72c9496ec796..2231df1d5dcb 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -14,7 +14,7 @@ require ( cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.0 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/authz/go.sum b/x/authz/go.sum index 0ae096ac47c0..69c0efe215ab 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -132,8 +132,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/bank/CHANGELOG.md b/x/bank/CHANGELOG.md index d8bd6b9e0e43..8a03515679fe 100644 --- a/x/bank/CHANGELOG.md +++ b/x/bank/CHANGELOG.md @@ -40,5 +40,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes * [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name +* [#19477](https://github.com/cosmos/cosmos-sdk/pull/19477) `appmodule.Environment` is passed to bank `NewKeeper` ### Bug Fixes diff --git a/x/bank/depinject.go b/x/bank/depinject.go index ea805a4614b8..43a806d87add 100644 --- a/x/bank/depinject.go +++ b/x/bank/depinject.go @@ -3,7 +3,6 @@ package bank import ( modulev1 "cosmossdk.io/api/cosmos/bank/module/v1" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/log" @@ -28,10 +27,10 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - Cdc codec.Codec - StoreService store.KVStoreService - Logger log.Logger + Config *modulev1.Module + Cdc codec.Codec + Environment appmodule.Environment + Logger log.Logger AccountKeeper types.AccountKeeper } @@ -79,8 +78,8 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } bankKeeper := keeper.NewBaseKeeper( + in.Environment, in.Cdc, - in.StoreService, in.AccountKeeper, blockedAddresses, authStr, diff --git a/x/bank/go.mod b/x/bank/go.mod index 782e3565d58f..67a190e0ec37 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/bank/go.sum b/x/bank/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/bank/keeper/collections_test.go b/x/bank/keeper/collections_test.go index 534fde9a9377..5afe09912386 100644 --- a/x/bank/keeper/collections_test.go +++ b/x/bank/keeper/collections_test.go @@ -30,7 +30,7 @@ func TestBankStateCompatibility(t *testing.T) { ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig() - storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) // gomock initializations ctrl := gomock.NewController(t) @@ -38,8 +38,8 @@ func TestBankStateCompatibility(t *testing.T) { authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() k := keeper.NewBaseKeeper( + env, encCfg.Codec, - storeService, authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress(banktypes.GovModuleName).String(), @@ -56,7 +56,7 @@ func TestBankStateCompatibility(t *testing.T) { ) require.NoError(t, err) // we set the index key to the old value. - require.NoError(t, storeService.OpenKVStore(ctx).Set(rawKey, bankDenomAddressLegacyIndexValue)) + require.NoError(t, env.KVStoreService.OpenKVStore(ctx).Set(rawKey, bankDenomAddressLegacyIndexValue)) // test walking is ok err = k.Balances.Indexes.Denom.Walk(ctx, nil, func(indexingKey string, indexedKey sdk.AccAddress) (stop bool, err error) { @@ -79,7 +79,7 @@ func TestBankStateCompatibility(t *testing.T) { err = k.Balances.Indexes.Denom.Reference(ctx, collections.Join(sdk.AccAddress("test"), "atom"), math.ZeroInt(), nil) require.NoError(t, err) - newRawValue, err := storeService.OpenKVStore(ctx).Get(rawKey) + newRawValue, err := env.KVStoreService.OpenKVStore(ctx).Get(rawKey) require.NoError(t, err) require.Equal(t, []byte{}, newRawValue) } diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index c742c92eb028..22bbcdac580e 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -172,7 +172,7 @@ func (k BaseKeeper) DenomsMetadata(c context.Context, req *types.QueryDenomsMeta if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - kvStore := runtime.KVStoreAdapter(k.storeService.OpenKVStore(c)) + kvStore := runtime.KVStoreAdapter(k.environment.KVStoreService.OpenKVStore(c)) store := prefix.NewStore(kvStore, types.DenomMetadataPrefix) metadatas := []types.Metadata{} diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index c6a15730cfaa..16cda899e3c6 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -4,7 +4,8 @@ import ( "context" "fmt" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/math" @@ -58,7 +59,7 @@ type BaseKeeper struct { ak types.AccountKeeper cdc codec.BinaryCodec - storeService store.KVStoreService + environment appmodule.Environment mintCoinsRestrictionFn types.MintingRestrictionFn logger log.Logger } @@ -82,8 +83,8 @@ func (k BaseKeeper) GetPaginatedTotalSupply(ctx context.Context, pagination *que // to receive funds through direct and explicit actions, for example, by using a MsgSend or // by using a SendCoinsFromModuleToAccount execution. func NewBaseKeeper( + env appmodule.Environment, cdc codec.BinaryCodec, - storeService store.KVStoreService, ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, @@ -97,10 +98,10 @@ func NewBaseKeeper( logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) return BaseKeeper{ - BaseSendKeeper: NewBaseSendKeeper(cdc, storeService, ak, blockedAddrs, authority, logger), + BaseSendKeeper: NewBaseSendKeeper(env, cdc, ak, blockedAddrs, authority, logger), ak: ak, cdc: cdc, - storeService: storeService, + environment: env, mintCoinsRestrictionFn: types.NoOpMintingRestrictionFn, logger: logger, } @@ -156,10 +157,13 @@ func (k BaseKeeper) DelegateCoins(ctx context.Context, delegatorAddr, moduleAccA if err != nil { return err } - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - types.NewCoinSpentEvent(delAddrStr, amt), - ) + if err := k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeCoinSpent, + event.NewAttribute(types.AttributeKeySpender, delAddrStr), + event.NewAttribute(sdk.AttributeKeyAmount, amt.String()), + ); err != nil { + return err + } err = k.addCoins(ctx, moduleAccAddr, amt) if err != nil { @@ -345,8 +349,6 @@ func (k BaseKeeper) UndelegateCoinsFromModuleToAccount( // MintCoins creates new coins from thin air and adds it to the module account. // An error is returned if the module account does not exist or is unauthorized. func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) - err := k.mintCoinsRestrictionFn(ctx, amounts) if err != nil { k.logger.Error(fmt.Sprintf("Module %q attempted to mint coins %s it doesn't have permission for, error %v", moduleName, amounts, err)) @@ -378,12 +380,13 @@ func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sd if err != nil { return err } + // emit mint event - sdkCtx.EventManager().EmitEvent( - types.NewCoinMintEvent(addrStr, amounts), + return k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeCoinMint, + event.NewAttribute(types.AttributeKeyMinter, addrStr), + event.NewAttribute(sdk.AttributeKeyAmount, amounts.String()), ) - - return nil } // BurnCoins burns coins deletes coins from the balance of an account. @@ -418,12 +421,11 @@ func (k BaseKeeper) BurnCoins(ctx context.Context, address []byte, amounts sdk.C return err } // emit burn event - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - types.NewCoinBurnEvent(addrStr, amounts), + return k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeCoinBurn, + event.NewAttribute(types.AttributeKeyBurner, addrStr), + event.NewAttribute(sdk.AttributeKeyAmount, amounts.String()), ) - - return nil } // setSupply sets the supply for the given coin @@ -446,8 +448,7 @@ func (k BaseKeeper) trackDelegation(ctx context.Context, addr sdk.AccAddress, ba vacc, ok := acc.(types.VestingAccount) if ok { // TODO: return error on account.TrackDelegation - sdkCtx := sdk.UnwrapSDKContext(ctx) - vacc.TrackDelegation(sdkCtx.HeaderInfo().Time, balance, amt) + vacc.TrackDelegation(k.environment.HeaderService.GetHeaderInfo(ctx).Time, balance, amt) k.ak.SetAccount(ctx, acc) } diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 591e6618ec83..6f4edfe217fd 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -131,7 +131,7 @@ func (suite *KeeperTestSuite) SetupTest() { ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig() - storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) // gomock initializations ctrl := gomock.NewController(suite.T()) @@ -140,8 +140,8 @@ func (suite *KeeperTestSuite) SetupTest() { suite.ctx = ctx suite.authKeeper = authKeeper suite.bankKeeper = keeper.NewBaseKeeper( + env, encCfg.Codec, - storeService, suite.authKeeper, map[string]bool{accAddrs[4].String(): true}, authtypes.NewModuleAddress(banktypes.GovModuleName).String(), @@ -300,11 +300,11 @@ func (suite *KeeperTestSuite) TestPrependSendRestriction() { } func (suite *KeeperTestSuite) TestGetAuthority() { - storeService := runtime.NewKVStoreService(storetypes.NewKVStoreKey(banktypes.StoreKey)) + env := runtime.NewEnvironment(runtime.NewKVStoreService(storetypes.NewKVStoreKey(banktypes.StoreKey)), log.NewNopLogger()) NewKeeperWithAuthority := func(authority string) keeper.BaseKeeper { return keeper.NewBaseKeeper( + env, moduletestutil.MakeTestEncodingConfig().Codec, - storeService, suite.authKeeper, nil, authority, diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index 0c5036d77217..b8bf305f57b9 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -5,7 +5,8 @@ import ( "fmt" "cosmossdk.io/collections" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/math" @@ -55,10 +56,10 @@ var _ SendKeeper = (*BaseSendKeeper)(nil) type BaseSendKeeper struct { BaseViewKeeper - cdc codec.BinaryCodec - ak types.AccountKeeper - storeService store.KVStoreService - logger log.Logger + cdc codec.BinaryCodec + ak types.AccountKeeper + environment appmodule.Environment + logger log.Logger // list of addresses that are restricted from receiving transactions blockedAddrs map[string]bool @@ -71,8 +72,8 @@ type BaseSendKeeper struct { } func NewBaseSendKeeper( + env appmodule.Environment, cdc codec.BinaryCodec, - storeService store.KVStoreService, ak types.AccountKeeper, blockedAddrs map[string]bool, authority string, @@ -83,10 +84,10 @@ func NewBaseSendKeeper( } return BaseSendKeeper{ - BaseViewKeeper: NewBaseViewKeeper(cdc, storeService, ak, logger), + BaseViewKeeper: NewBaseViewKeeper(env, cdc, ak, logger), cdc: cdc, ak: ak, - storeService: storeService, + environment: env, blockedAddrs: blockedAddrs, authority: authority, logger: logger, @@ -156,8 +157,6 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, return err } - sdkCtx := sdk.UnwrapSDKContext(ctx) - var outAddress sdk.AccAddress for _, out := range outputs { outAddress, err = k.ak.AddressCodec().StringToBytes(out.Address) @@ -174,14 +173,13 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, return err } - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeTransfer, - sdk.NewAttribute(types.AttributeKeyRecipient, out.Address), - sdk.NewAttribute(sdk.AttributeKeyAmount, out.Coins.String()), - ), - ) - + if err := k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeTransfer, + event.NewAttribute(types.AttributeKeyRecipient, out.Address), + event.NewAttribute(sdk.AttributeKeyAmount, out.Coins.String()), + ); err != nil { + return err + } } return nil @@ -215,17 +213,12 @@ func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccA return err } - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeTransfer, - sdk.NewAttribute(types.AttributeKeyRecipient, toAddrString), - sdk.NewAttribute(types.AttributeKeySender, fromAddrString), - sdk.NewAttribute(sdk.AttributeKeyAmount, amt.String()), - ), + return k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeTransfer, + event.NewAttribute(types.AttributeKeyRecipient, toAddrString), + event.NewAttribute(types.AttributeKeySender, fromAddrString), + event.NewAttribute(sdk.AttributeKeyAmount, amt.String()), ) - - return nil } // subUnlockedCoins removes the unlocked amt coins of the given account. An error is @@ -270,12 +263,12 @@ func (k BaseSendKeeper) subUnlockedCoins(ctx context.Context, addr sdk.AccAddres if err != nil { return err } - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - types.NewCoinSpentEvent(addrStr, amt), - ) - return nil + return k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeCoinSpent, + event.NewAttribute(types.AttributeKeySpender, addrStr), + event.NewAttribute(sdk.AttributeKeyAmount, amt.String()), + ) } // addCoins increase the addr balance by the given amt. Fails if the provided @@ -300,13 +293,11 @@ func (k BaseSendKeeper) addCoins(ctx context.Context, addr sdk.AccAddress, amt s return err } - // emit coin received event - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - types.NewCoinReceivedEvent(addrStr, amt), + return k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeCoinReceived, + event.NewAttribute(types.AttributeKeyReceiver, addrStr), + event.NewAttribute(sdk.AttributeKeyAmount, amt.String()), ) - - return nil } // setBalance sets the coin balance for an account by address. diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 89670938002d..ab9cfc1703fd 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -6,7 +6,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/collections/indexes" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/math" @@ -56,10 +56,10 @@ func (b BalancesIndexes) IndexesList() []collections.Index[collections.Pair[sdk. // BaseViewKeeper implements a read only keeper implementation of ViewKeeper. type BaseViewKeeper struct { - cdc codec.BinaryCodec - storeService store.KVStoreService - ak types.AccountKeeper - logger log.Logger + cdc codec.BinaryCodec + environment appmodule.Environment + ak types.AccountKeeper + logger log.Logger Schema collections.Schema Supply collections.Map[string, math.Int] @@ -70,11 +70,11 @@ type BaseViewKeeper struct { } // NewBaseViewKeeper returns a new BaseViewKeeper. -func NewBaseViewKeeper(cdc codec.BinaryCodec, storeService store.KVStoreService, ak types.AccountKeeper, logger log.Logger) BaseViewKeeper { - sb := collections.NewSchemaBuilder(storeService) +func NewBaseViewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak types.AccountKeeper, logger log.Logger) BaseViewKeeper { + sb := collections.NewSchemaBuilder(env.KVStoreService) k := BaseViewKeeper{ cdc: cdc, - storeService: storeService, + environment: env, ak: ak, logger: logger, Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey, sdk.IntValue), @@ -186,8 +186,7 @@ func (k BaseViewKeeper) LockedCoins(ctx context.Context, addr sdk.AccAddress) sd if acc != nil { vacc, ok := acc.(types.VestingAccount) if ok { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return vacc.LockedCoins(sdkCtx.HeaderInfo().Time) + return vacc.LockedCoins(k.environment.HeaderService.GetHeaderInfo(ctx).Time) } } diff --git a/x/bank/types/events.go b/x/bank/types/events.go index d26c4d8f342c..ef63dac90a31 100644 --- a/x/bank/types/events.go +++ b/x/bank/types/events.go @@ -22,39 +22,3 @@ const ( AttributeKeyMinter = "minter" AttributeKeyBurner = "burner" ) - -// NewCoinSpentEvent constructs a new coin spent sdk.Event -func NewCoinSpentEvent(spender string, amount sdk.Coins) sdk.Event { - return sdk.NewEvent( - EventTypeCoinSpent, - sdk.NewAttribute(AttributeKeySpender, spender), - sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), - ) -} - -// NewCoinReceivedEvent constructs a new coin received sdk.Event -func NewCoinReceivedEvent(receiver string, amount sdk.Coins) sdk.Event { - return sdk.NewEvent( - EventTypeCoinReceived, - sdk.NewAttribute(AttributeKeyReceiver, receiver), - sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), - ) -} - -// NewCoinMintEvent construct a new coin minted sdk.Event -func NewCoinMintEvent(minter string, amount sdk.Coins) sdk.Event { - return sdk.NewEvent( - EventTypeCoinMint, - sdk.NewAttribute(AttributeKeyMinter, minter), - sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), - ) -} - -// NewCoinBurnEvent constructs a new coin burned sdk.Event -func NewCoinBurnEvent(burner string, amount sdk.Coins) sdk.Event { - return sdk.NewEvent( - EventTypeCoinBurn, - sdk.NewAttribute(AttributeKeyBurner, burner), - sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), - ) -} diff --git a/x/circuit/go.mod b/x/circuit/go.mod index a670fa14aba0..7ca1cac82e1f 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -47,7 +47,7 @@ require ( github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.0.0 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/consensus/depinject.go b/x/consensus/depinject.go index 9f613acf3649..695c609e172d 100644 --- a/x/consensus/depinject.go +++ b/x/consensus/depinject.go @@ -3,8 +3,6 @@ package consensus import ( modulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/event" - storetypes "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" authtypes "cosmossdk.io/x/auth/types" @@ -30,10 +28,9 @@ func init() { type ModuleInputs struct { depinject.In - Config *modulev1.Module - Cdc codec.Codec - StoreService storetypes.KVStoreService - EventManager event.Service + Config *modulev1.Module + Cdc codec.Codec + Environment appmodule.Environment } type ModuleOutputs struct { @@ -51,7 +48,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } - k := keeper.NewKeeper(in.Cdc, in.StoreService, authority.String(), in.EventManager) + k := keeper.NewKeeper(in.Cdc, in.Environment, authority.String()) m := NewAppModule(in.Cdc, k) baseappOpt := func(app *baseapp.BaseApp) { app.SetParamStore(k.ParamsStore) diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index a0ccf562dea2..48112da959b7 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -10,8 +10,8 @@ import ( "google.golang.org/grpc/status" "cosmossdk.io/collections" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" - storetypes "cosmossdk.io/core/store" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/consensus/exported" @@ -21,8 +21,7 @@ import ( var StoreKey = "Consensus" type Keeper struct { - storeService storetypes.KVStoreService - event event.Service + environment appmodule.Environment authority string ParamsStore collections.Item[cmtproto.ConsensusParams] @@ -30,13 +29,12 @@ type Keeper struct { var _ exported.ConsensusParamSetter = Keeper{}.ParamsStore -func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, authority string, em event.Service) Keeper { - sb := collections.NewSchemaBuilder(storeService) +func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, authority string) Keeper { + sb := collections.NewSchemaBuilder(env.KVStoreService) return Keeper{ - storeService: storeService, - authority: authority, - event: em, - ParamsStore: collections.NewItem(sb, collections.NewPrefix("Consensus"), "params", codec.CollValue[cmtproto.ConsensusParams](cdc)), + environment: env, + authority: authority, + ParamsStore: collections.NewItem(sb, collections.NewPrefix("Consensus"), "params", codec.CollValue[cmtproto.ConsensusParams](cdc)), } } @@ -79,7 +77,7 @@ func (k Keeper) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (* return nil, err } - if err := k.event.EventManager(ctx).EmitKV( + if err := k.environment.EventService.EventManager(ctx).EmitKV( "update_consensus_params", event.NewAttribute("authority", msg.Authority), event.NewAttribute("parameters", consensusParams.String())); err != nil { diff --git a/x/consensus/keeper/keeper_test.go b/x/consensus/keeper/keeper_test.go index 3c3f9d97e483..b49c634f75d2 100644 --- a/x/consensus/keeper/keeper_test.go +++ b/x/consensus/keeper/keeper_test.go @@ -7,6 +7,7 @@ import ( cmttypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/suite" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -32,9 +33,9 @@ func (s *KeeperTestSuite) SetupTest() { testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) ctx := testCtx.Ctx encCfg := moduletestutil.MakeTestEncodingConfig() - storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) - keeper := consensusparamkeeper.NewKeeper(encCfg.Codec, storeService, authtypes.NewModuleAddress("gov").String(), runtime.EventService{}) + keeper := consensusparamkeeper.NewKeeper(encCfg.Codec, env, authtypes.NewModuleAddress("gov").String()) s.ctx = ctx s.consensusParamsKeeper = &keeper diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 6e6c10bbcd7c..3c3ad843b4bf 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -15,7 +15,7 @@ require ( cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/cockroachdb/errors v1.11.1 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/distribution/go.sum b/x/distribution/go.sum index b2ad48d5fed9..5d4870aa8602 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -132,8 +132,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/distribution/migrations/v4/migrate_funds_test.go b/x/distribution/migrations/v4/migrate_funds_test.go index b353e111c1e2..238e6b2e10b4 100644 --- a/x/distribution/migrations/v4/migrate_funds_test.go +++ b/x/distribution/migrations/v4/migrate_funds_test.go @@ -46,8 +46,8 @@ func TestFundsMigration(t *testing.T) { // create account keeper accountKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encCfg.Codec, - runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), @@ -57,8 +57,8 @@ func TestFundsMigration(t *testing.T) { // create bank keeper bankKeeper := bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), encCfg.Codec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), accountKeeper, map[string]bool{}, authority.String(), diff --git a/x/evidence/CHANGELOG.md b/x/evidence/CHANGELOG.md index 0dd7a026fc42..f00a7953f1ec 100644 --- a/x/evidence/CHANGELOG.md +++ b/x/evidence/CHANGELOG.md @@ -25,11 +25,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Api Breaking Changes + +* [#19482](https://github.com/cosmos/cosmos-sdk/pull/19482) `appmodule.Environment` is passed to `NewKeeper` instead of individual services + ## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/x/evidence/v0.1.0) - 2023-11-07 ### Features -* (x/evidence) [14724](https://github.com/cosmos/cosmos-sdk/pull/14724) The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module. +* [14724](https://github.com/cosmos/cosmos-sdk/pull/14724) The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module. * (keeper) [#15420](https://github.com/cosmos/cosmos-sdk/pull/15420) Move `BeginBlocker` to the keeper folder & make HandleEquivocation private ### API Breaking Changes diff --git a/x/evidence/depinject.go b/x/evidence/depinject.go index 2fba5fa7a13f..880b23fb3107 100644 --- a/x/evidence/depinject.go +++ b/x/evidence/depinject.go @@ -4,7 +4,6 @@ import ( modulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/evidence/keeper" @@ -27,8 +26,8 @@ func init() { type ModuleInputs struct { depinject.In - StoreService store.KVStoreService - Cdc codec.Codec + Environment appmodule.Environment + Cdc codec.Codec StakingKeeper types.StakingKeeper SlashingKeeper types.SlashingKeeper @@ -43,7 +42,7 @@ type ModuleOutputs struct { } func ProvideModule(in ModuleInputs) ModuleOutputs { - k := keeper.NewKeeper(in.Cdc, in.StoreService, in.StakingKeeper, in.SlashingKeeper, in.AddressCodec) + k := keeper.NewKeeper(in.Cdc, in.Environment, in.StakingKeeper, in.SlashingKeeper, in.AddressCodec) m := NewAppModule(*k) return ModuleOutputs{EvidenceKeeper: *k, Module: m} diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 435532cbe15b..2d9135331ede 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/evidence/keeper/abci.go b/x/evidence/keeper/abci.go index ec7f57618520..0ad33d81a73d 100644 --- a/x/evidence/keeper/abci.go +++ b/x/evidence/keeper/abci.go @@ -20,7 +20,6 @@ func (k Keeper) BeginBlocker(ctx context.Context) error { bi := sdk.UnwrapSDKContext(ctx).CometInfo() evidences := bi.Evidence - sdkCtx := sdk.UnwrapSDKContext(ctx) for _, evidence := range evidences { switch evidence.Type { // It's still ongoing discussion how should we treat and slash attacks with @@ -32,7 +31,7 @@ func (k Keeper) BeginBlocker(ctx context.Context) error { return err } default: - k.Logger(sdkCtx).Error(fmt.Sprintf("ignored unknown evidence type: %x", evidence.Type)) + k.Logger().Error(fmt.Sprintf("ignored unknown evidence type: %x", evidence.Type)) } } return nil diff --git a/x/evidence/keeper/infraction.go b/x/evidence/keeper/infraction.go index 2cffa540f7d9..d0adc0e9f9c8 100644 --- a/x/evidence/keeper/infraction.go +++ b/x/evidence/keeper/infraction.go @@ -25,8 +25,7 @@ import ( // TODO: Some of the invalid constraints listed above may need to be reconsidered // in the case of a lunatic attack. func (k Keeper) handleEquivocationEvidence(ctx context.Context, evidence *types.Equivocation) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) - logger := k.Logger(ctx) + logger := k.Logger() consAddr := evidence.GetConsensusAddress(k.stakingKeeper.ConsensusAddressCodec()) validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, consAddr) @@ -64,16 +63,18 @@ func (k Keeper) handleEquivocationEvidence(ctx context.Context, evidence *types. } } + headerInfo := k.environment.HeaderService.GetHeaderInfo(ctx) // calculate the age of the evidence infractionHeight := evidence.GetHeight() infractionTime := evidence.GetTime() - ageDuration := sdkCtx.HeaderInfo().Time.Sub(infractionTime) - ageBlocks := sdkCtx.BlockHeader().Height - infractionHeight + ageDuration := headerInfo.Time.Sub(infractionTime) + ageBlocks := headerInfo.Height - infractionHeight // Reject evidence if the double-sign is too old. Evidence is considered stale // if the difference in time and number of blocks is greater than the allowed // parameters defined. - cp := sdkCtx.ConsensusParams() + sdkCtx := sdk.UnwrapSDKContext(ctx) + cp := sdkCtx.ConsensusParams() // TODO: remove in favor of querying consensus module if cp.Evidence != nil { if ageDuration > cp.Evidence.MaxAgeDuration && ageBlocks > cp.Evidence.MaxAgeNumBlocks { logger.Info( diff --git a/x/evidence/keeper/keeper.go b/x/evidence/keeper/keeper.go index 6a4c99b95de1..e5c54104aab4 100644 --- a/x/evidence/keeper/keeper.go +++ b/x/evidence/keeper/keeper.go @@ -8,14 +8,14 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/event" "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/x/evidence/exported" "cosmossdk.io/x/evidence/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" ) // Keeper defines the evidence module's keeper. The keeper is responsible for @@ -23,7 +23,7 @@ import ( // module. type Keeper struct { cdc codec.BinaryCodec - storeService store.KVStoreService + environment appmodule.Environment router types.Router stakingKeeper types.StakingKeeper slashingKeeper types.SlashingKeeper @@ -36,13 +36,13 @@ type Keeper struct { // NewKeeper creates a new Keeper object. func NewKeeper( - cdc codec.BinaryCodec, storeService store.KVStoreService, stakingKeeper types.StakingKeeper, + cdc codec.BinaryCodec, env appmodule.Environment, stakingKeeper types.StakingKeeper, slashingKeeper types.SlashingKeeper, ac address.Codec, ) *Keeper { - sb := collections.NewSchemaBuilder(storeService) + sb := collections.NewSchemaBuilder(env.KVStoreService) k := &Keeper{ cdc: cdc, - storeService: storeService, + environment: env, stakingKeeper: stakingKeeper, slashingKeeper: slashingKeeper, addressCodec: ac, @@ -57,9 +57,8 @@ func NewKeeper( } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx context.Context) log.Logger { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return sdkCtx.Logger().With("module", "x/"+types.ModuleName) +func (k Keeper) Logger() log.Logger { + return k.environment.Logger.With("module", "x/"+types.ModuleName) } // SetRouter sets the Evidence Handler router for the x/evidence module. Note, @@ -107,13 +106,12 @@ func (k Keeper) SubmitEvidence(ctx context.Context, evidence exported.Evidence) return errors.Wrap(types.ErrInvalidEvidence, err.Error()) } - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeSubmitEvidence, - sdk.NewAttribute(types.AttributeKeyEvidenceHash, strings.ToUpper(hex.EncodeToString(evidence.Hash()))), - ), - ) + if err := k.environment.EventService.EventManager(ctx).EmitKV( + types.EventTypeSubmitEvidence, + event.NewAttribute(types.AttributeKeyEvidenceHash, strings.ToUpper(hex.EncodeToString(evidence.Hash()))), + ); err != nil { + return err + } return k.Evidences.Set(ctx, evidence.Hash(), evidence) } diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index 714472e6eeca..1fd7b3996399 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/header" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/evidence" "cosmossdk.io/x/evidence/exported" @@ -85,7 +86,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig(evidence.AppModuleBasic{}) key := storetypes.NewKVStoreKey(types.StoreKey) - storeService := runtime.NewKVStoreService(key) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) tkey := storetypes.NewTransientStoreKey("evidence_transient_store") testCtx := testutil.DefaultContextWithDB(suite.T(), key, tkey) suite.ctx = testCtx.Ctx @@ -99,7 +100,7 @@ func (suite *KeeperTestSuite) SetupTest() { evidenceKeeper := keeper.NewKeeper( encCfg.Codec, - storeService, + env, stakingKeeper, slashingKeeper, address.NewBech32Codec("cosmos"), @@ -124,7 +125,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.evidenceKeeper = *evidenceKeeper suite.Require().Equal(testCtx.Ctx.Logger().With("module", "x/"+types.ModuleName), - suite.evidenceKeeper.Logger(testCtx.Ctx)) + suite.evidenceKeeper.Logger()) suite.msgServer = keeper.NewMsgServerImpl(suite.evidenceKeeper) } diff --git a/x/feegrant/CHANGELOG.md b/x/feegrant/CHANGELOG.md index a8c1af65341f..35afbf4be95b 100644 --- a/x/feegrant/CHANGELOG.md +++ b/x/feegrant/CHANGELOG.md @@ -25,6 +25,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### API Breaking Changes + +* [#19450](https://github.com/cosmos/cosmos-sdk/pull/19450) Migrate module to use `appmodule.Environment` instead of passing individual services. + ### Consens Breaking Changes * [#19188](https://github.com/cosmos/cosmos-sdk/pull/19188) Remove creation of `BaseAccount` when sending a message to an account that does not exist diff --git a/x/feegrant/basic_fee.go b/x/feegrant/basic_fee.go index e9241ba1ae52..ae9a375ce4f3 100644 --- a/x/feegrant/basic_fee.go +++ b/x/feegrant/basic_fee.go @@ -23,7 +23,8 @@ var _ FeeAllowanceI = (*BasicAllowance)(nil) // If remove is true (regardless of the error), the FeeAllowance will be deleted from storage // (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees) func (a *BasicAllowance) Accept(ctx context.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { - if a.Expiration != nil && a.Expiration.Before(sdk.UnwrapSDKContext(ctx).HeaderInfo().Time) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if a.Expiration != nil && a.Expiration.Before(sdkCtx.HeaderInfo().Time) { return true, errorsmod.Wrap(ErrFeeLimitExpired, "basic allowance") } diff --git a/x/feegrant/filtered_fee.go b/x/feegrant/filtered_fee.go index 75cb208e8bd7..8b10b98237ef 100644 --- a/x/feegrant/filtered_fee.go +++ b/x/feegrant/filtered_fee.go @@ -70,7 +70,7 @@ func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error { // Accept method checks for the filtered messages has valid expiry func (a *AllowedMsgAllowance) Accept(ctx context.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error) { - if !a.allMsgTypesAllowed(sdk.UnwrapSDKContext(ctx), msgs) { + if !a.allMsgTypesAllowed(ctx, msgs) { return false, errorsmod.Wrap(ErrMessageNotAllowed, "message does not exist in allowed messages") } @@ -88,21 +88,22 @@ func (a *AllowedMsgAllowance) Accept(ctx context.Context, fee sdk.Coins, msgs [] return remove, err } -func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx sdk.Context) map[string]bool { +func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx context.Context) map[string]bool { msgsMap := make(map[string]bool, len(a.AllowedMessages)) + sdkCtx := sdk.UnwrapSDKContext(ctx) for _, msg := range a.AllowedMessages { - ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") msgsMap[msg] = true } return msgsMap } -func (a *AllowedMsgAllowance) allMsgTypesAllowed(ctx sdk.Context, msgs []sdk.Msg) bool { +func (a *AllowedMsgAllowance) allMsgTypesAllowed(ctx context.Context, msgs []sdk.Msg) bool { msgsMap := a.allowedMsgsToMap(ctx) - + sdkCtx := sdk.UnwrapSDKContext(ctx) for _, msg := range msgs { - ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") if !msgsMap[sdk.MsgTypeURL(msg)] { return false } diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 346aa31517e2..f0260581bca8 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -14,7 +14,7 @@ require ( cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 5178668a586b..e3d3d1970f81 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -138,8 +138,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/feegrant/keeper/genesis_test.go b/x/feegrant/keeper/genesis_test.go index 578a7812a3b5..f3790ffb8fa5 100644 --- a/x/feegrant/keeper/genesis_test.go +++ b/x/feegrant/keeper/genesis_test.go @@ -7,6 +7,7 @@ import ( "github.com/golang/mock/gomock" "gotest.tools/v3/assert" + "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -50,7 +51,7 @@ func initFixture(t *testing.T) *genesisFixture { return &genesisFixture{ ctx: testCtx.Ctx, - feegrantKeeper: keeper.NewKeeper(encCfg.Codec, runtime.NewKVStoreService(key), accountKeeper), + feegrantKeeper: keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), encCfg.Codec, accountKeeper), accountKeeper: accountKeeper, } } diff --git a/x/feegrant/keeper/keeper.go b/x/feegrant/keeper/keeper.go index 74ddb833b6e6..02492e9d3d4c 100644 --- a/x/feegrant/keeper/keeper.go +++ b/x/feegrant/keeper/keeper.go @@ -6,7 +6,8 @@ import ( "time" "cosmossdk.io/collections" - "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/x/auth/ante" @@ -20,10 +21,10 @@ import ( // Keeper manages state of all fee grants, as well as calculating approval. // It must have a codec with all available allowances registered. type Keeper struct { - cdc codec.BinaryCodec - storeService store.KVStoreService - authKeeper feegrant.AccountKeeper - Schema collections.Schema + cdc codec.BinaryCodec + environment appmodule.Environment + authKeeper feegrant.AccountKeeper + Schema collections.Schema // FeeAllowance key: grantee+granter | value: Grant FeeAllowance collections.Map[collections.Pair[sdk.AccAddress, sdk.AccAddress], feegrant.Grant] // FeeAllowanceQueue key: expiration time+grantee+granter | value: bool @@ -33,13 +34,13 @@ type Keeper struct { var _ ante.FeegrantKeeper = &Keeper{} // NewKeeper creates a feegrant Keeper -func NewKeeper(cdc codec.BinaryCodec, storeService store.KVStoreService, ak feegrant.AccountKeeper) Keeper { - sb := collections.NewSchemaBuilder(storeService) +func NewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak feegrant.AccountKeeper) Keeper { + sb := collections.NewSchemaBuilder(env.KVStoreService) return Keeper{ - cdc: cdc, - storeService: storeService, - authKeeper: ak, + cdc: cdc, + environment: env, + authKeeper: ak, FeeAllowance: collections.NewMap( sb, feegrant.FeeAllowanceKeyPrefix, @@ -75,8 +76,8 @@ func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddr } // expiration shouldn't be in the past. - sdkCtx := sdk.UnwrapSDKContext(ctx) - now := sdkCtx.HeaderInfo().Time + + now := k.environment.HeaderService.GetHeaderInfo(ctx).Time if exp != nil && exp.Before(now) { return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "expiration is before current block time") } @@ -116,15 +117,11 @@ func (k Keeper) GrantAllowance(ctx context.Context, granter, grantee sdk.AccAddr return err } - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - feegrant.EventTypeSetFeeGrant, - sdk.NewAttribute(feegrant.AttributeKeyGranter, grant.Granter), - sdk.NewAttribute(feegrant.AttributeKeyGrantee, grant.Grantee), - ), + return k.environment.EventService.EventManager(ctx).EmitKV( + feegrant.EventTypeSetFeeGrant, + event.NewAttribute(feegrant.AttributeKeyGranter, grant.Granter), + event.NewAttribute(feegrant.AttributeKeyGrantee, grant.Grantee), ) - - return nil } // UpdateAllowance updates the existing grant. @@ -152,15 +149,11 @@ func (k Keeper) UpdateAllowance(ctx context.Context, granter, grantee sdk.AccAdd return err } - sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent( - sdk.NewEvent( - feegrant.EventTypeUpdateFeeGrant, - sdk.NewAttribute(feegrant.AttributeKeyGranter, grant.Granter), - sdk.NewAttribute(feegrant.AttributeKeyGrantee, grant.Grantee), - ), + return k.environment.EventService.EventManager(ctx).EmitKV( + feegrant.EventTypeUpdateFeeGrant, + event.NewAttribute(feegrant.AttributeKeyGranter, grant.Granter), + event.NewAttribute(feegrant.AttributeKeyGrantee, grant.Grantee), ) - - return nil } // revokeAllowance removes an existing grant @@ -194,14 +187,11 @@ func (k Keeper) revokeAllowance(ctx context.Context, granter, grantee sdk.AccAdd return err } - sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent( - sdk.NewEvent( - feegrant.EventTypeRevokeFeeGrant, - sdk.NewAttribute(feegrant.AttributeKeyGranter, granterStr), - sdk.NewAttribute(feegrant.AttributeKeyGrantee, granteeStr), - ), + return k.environment.EventService.EventManager(ctx).EmitKV( + feegrant.EventTypeRevokeFeeGrant, + event.NewAttribute(feegrant.AttributeKeyGranter, granterStr), + event.NewAttribute(feegrant.AttributeKeyGrantee, granteeStr), ) - return nil } // GetAllowance returns the allowance between the granter and grantee. @@ -245,26 +235,25 @@ func (k Keeper) UseGrantedFees(ctx context.Context, granter, grantee sdk.AccAddr if remove && err == nil { // Ignoring the `revokeFeeAllowance` error, because the user has enough grants to perform this transaction. _ = k.revokeAllowance(ctx, granter, grantee) - emitUseGrantEvent(ctx, granterStr, granteeStr) - return nil + return k.emitUseGrantEvent(ctx, granterStr, granteeStr) } if err != nil { return err } - emitUseGrantEvent(ctx, granterStr, granteeStr) + if err := k.emitUseGrantEvent(ctx, granterStr, granteeStr); err != nil { + return err + } // if fee allowance is accepted, store the updated state of the allowance return k.UpdateAllowance(ctx, granter, grantee, grant) } -func emitUseGrantEvent(ctx context.Context, granter, grantee string) { - sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent( - sdk.NewEvent( - feegrant.EventTypeUseFeeGrant, - sdk.NewAttribute(feegrant.AttributeKeyGranter, granter), - sdk.NewAttribute(feegrant.AttributeKeyGrantee, grantee), - ), +func (k *Keeper) emitUseGrantEvent(ctx context.Context, granter, grantee string) error { + return k.environment.EventService.EventManager(ctx).EmitKV( + feegrant.EventTypeUseFeeGrant, + event.NewAttribute(feegrant.AttributeKeyGranter, granter), + event.NewAttribute(feegrant.AttributeKeyGrantee, grantee), ) } @@ -309,7 +298,7 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*feegrant.GenesisState, erro // RemoveExpiredAllowances iterates grantsByExpiryQueue and deletes the expired grants. func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int) error { - exp := sdk.UnwrapSDKContext(ctx).HeaderInfo().Time + exp := k.environment.HeaderService.GetHeaderInfo(ctx).Time rng := collections.NewPrefixUntilTripleRange[time.Time, sdk.AccAddress, sdk.AccAddress](exp) count := 0 diff --git a/x/feegrant/keeper/keeper_test.go b/x/feegrant/keeper/keeper_test.go index 911bd007a71a..eaa92c60f528 100644 --- a/x/feegrant/keeper/keeper_test.go +++ b/x/feegrant/keeper/keeper_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/core/header" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -60,7 +61,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.encodedAddrs = append(suite.encodedAddrs, str) } - suite.feegrantKeeper = keeper.NewKeeper(encCfg.Codec, runtime.NewKVStoreService(key), suite.accountKeeper) + suite.feegrantKeeper = keeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), encCfg.Codec, suite.accountKeeper) suite.ctx = testCtx.Ctx suite.msgSrvr = keeper.NewMsgServerImpl(suite.feegrantKeeper) suite.atom = sdk.NewCoins(sdk.NewCoin("atom", sdkmath.NewInt(555))) diff --git a/x/feegrant/keeper/migrations.go b/x/feegrant/keeper/migrations.go index 0d2b9a05509e..8e94535fd93a 100644 --- a/x/feegrant/keeper/migrations.go +++ b/x/feegrant/keeper/migrations.go @@ -18,5 +18,5 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx context.Context) error { - return v2.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc) + return v2.MigrateStore(ctx, m.keeper.environment, m.keeper.cdc) } diff --git a/x/feegrant/keeper/msg_server.go b/x/feegrant/keeper/msg_server.go index f3c5319123ac..b4ce56b01783 100644 --- a/x/feegrant/keeper/msg_server.go +++ b/x/feegrant/keeper/msg_server.go @@ -4,10 +4,10 @@ import ( "context" "strings" + "cosmossdk.io/core/event" errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/feegrant" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -94,13 +94,12 @@ func (k msgServer) PruneAllowances(ctx context.Context, req *feegrant.MsgPruneAl return nil, err } - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - feegrant.EventTypePruneFeeGrant, - sdk.NewAttribute(feegrant.AttributeKeyPruner, req.Pruner), - ), - ) + if err := k.environment.EventService.EventManager(ctx).EmitKV( + feegrant.EventTypePruneFeeGrant, + event.NewAttribute(feegrant.AttributeKeyPruner, req.Pruner), + ); err != nil { + return nil, err + } return &feegrant.MsgPruneAllowancesResponse{}, nil } diff --git a/x/feegrant/migrations/v2/store.go b/x/feegrant/migrations/v2/store.go index a90f83531abf..cc8ea48d2b53 100644 --- a/x/feegrant/migrations/v2/store.go +++ b/x/feegrant/migrations/v2/store.go @@ -3,16 +3,16 @@ package v2 import ( "context" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/store" "cosmossdk.io/store/prefix" "cosmossdk.io/x/feegrant" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/types" ) -func addAllowancesByExpTimeQueue(ctx context.Context, store store.KVStore, cdc codec.BinaryCodec) error { +func addAllowancesByExpTimeQueue(ctx context.Context, env appmodule.Environment, store store.KVStore, cdc codec.BinaryCodec) error { prefixStore := prefix.NewStore(runtime.KVStoreAdapter(store), FeeAllowanceKeyPrefix) iterator := prefixStore.Iterator(nil, nil) defer iterator.Close() @@ -37,7 +37,7 @@ func addAllowancesByExpTimeQueue(ctx context.Context, store store.KVStore, cdc c if exp != nil { // store key is not changed in 0.46 key := iterator.Key() - if exp.Before(types.UnwrapSDKContext(ctx).HeaderInfo().Time) { + if exp.Before(env.HeaderService.GetHeaderInfo(ctx).Time) { prefixStore.Delete(key) } else { grantByExpTimeQueueKey := FeeAllowancePrefixQueue(exp, key) @@ -52,7 +52,7 @@ func addAllowancesByExpTimeQueue(ctx context.Context, store store.KVStore, cdc c return nil } -func MigrateStore(ctx context.Context, storeService store.KVStoreService, cdc codec.BinaryCodec) error { - store := storeService.OpenKVStore(ctx) - return addAllowancesByExpTimeQueue(ctx, store, cdc) +func MigrateStore(ctx context.Context, env appmodule.Environment, cdc codec.BinaryCodec) error { + store := env.KVStoreService.OpenKVStore(ctx) + return addAllowancesByExpTimeQueue(ctx, env, store, cdc) } diff --git a/x/feegrant/migrations/v2/store_test.go b/x/feegrant/migrations/v2/store_test.go index ab8ad26fe010..be908e48252f 100644 --- a/x/feegrant/migrations/v2/store_test.go +++ b/x/feegrant/migrations/v2/store_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/header" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/feegrant" @@ -87,7 +88,7 @@ func TestMigration(t *testing.T) { } ctx = ctx.WithHeaderInfo(header.Info{Time: now.Add(30 * time.Hour)}) - require.NoError(t, v2.MigrateStore(ctx, runtime.NewKVStoreService(feegrantKey), cdc)) + require.NoError(t, v2.MigrateStore(ctx, runtime.NewEnvironment(runtime.NewKVStoreService(feegrantKey), log.NewNopLogger()), cdc)) store = ctx.KVStore(feegrantKey) require.NotNil(t, store.Get(v2.FeeAllowanceKey(granter1, grantee1))) diff --git a/x/feegrant/module/abci_test.go b/x/feegrant/module/abci_test.go index e2a4d5cc7965..0664726921ea 100644 --- a/x/feegrant/module/abci_test.go +++ b/x/feegrant/module/abci_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/header" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" authtypes "cosmossdk.io/x/auth/types" @@ -47,7 +48,9 @@ func TestFeegrantPruning(t *testing.T) { ac := address.NewBech32Codec("cosmos") accountKeeper.EXPECT().AddressCodec().Return(ac).AnyTimes() - feegrantKeeper := keeper.NewKeeper(encCfg.Codec, runtime.NewKVStoreService(key), accountKeeper) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) + + feegrantKeeper := keeper.NewKeeper(env, encCfg.Codec, accountKeeper) err := feegrantKeeper.GrantAllowance( testCtx.Ctx, diff --git a/x/feegrant/module/depinject.go b/x/feegrant/module/depinject.go index af86f6d7e491..3fb6afa68984 100644 --- a/x/feegrant/module/depinject.go +++ b/x/feegrant/module/depinject.go @@ -3,7 +3,6 @@ package module import ( modulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/feegrant" @@ -30,7 +29,7 @@ func init() { type FeegrantInputs struct { depinject.In - StoreService store.KVStoreService + Environment appmodule.Environment Cdc codec.Codec AccountKeeper feegrant.AccountKeeper BankKeeper feegrant.BankKeeper @@ -38,7 +37,7 @@ type FeegrantInputs struct { } func ProvideModule(in FeegrantInputs) (keeper.Keeper, appmodule.AppModule) { - k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper) + k := keeper.NewKeeper(in.Environment, in.Cdc, in.AccountKeeper) m := NewAppModule(in.Cdc, in.AccountKeeper, in.BankKeeper, k, in.Registry) return k, m } diff --git a/x/feegrant/periodic_fee.go b/x/feegrant/periodic_fee.go index 2b623a5d680e..02b569e00379 100644 --- a/x/feegrant/periodic_fee.go +++ b/x/feegrant/periodic_fee.go @@ -23,7 +23,8 @@ var _ FeeAllowanceI = (*PeriodicAllowance)(nil) // If remove is true (regardless of the error), the FeeAllowance will be deleted from storage // (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees) func (a *PeriodicAllowance) Accept(ctx context.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error) { - blockTime := sdk.UnwrapSDKContext(ctx).HeaderInfo().Time + sdkCtx := sdk.UnwrapSDKContext(ctx) + blockTime := sdkCtx.HeaderInfo().Time if a.Basic.Expiration != nil && blockTime.After(*a.Basic.Expiration) { return true, errorsmod.Wrap(ErrFeeLimitExpired, "absolute limit") diff --git a/x/gov/go.mod b/x/gov/go.mod index b2e2392a5941..023f88699b70 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -16,7 +16,7 @@ require ( cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/chzyer/readline v1.5.1 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/gov/go.sum b/x/gov/go.sum index 857cab29e665..d02f9ca42bef 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -140,8 +140,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/group/CHANGELOG.md b/x/group/CHANGELOG.md index dc2f41fe69bc..c21c3df8009b 100644 --- a/x/group/CHANGELOG.md +++ b/x/group/CHANGELOG.md @@ -34,4 +34,5 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* [#19489](https://github.com/cosmos/cosmos-sdk/pull/19489) `appmodule.Environment` is received on the Keeper to get access to different application services. * [#19410](https://github.com/cosmos/cosmos-sdk/pull/19410) Migrate to Store Service. diff --git a/x/group/go.mod b/x/group/go.mod index b8da0126c9db..ee4e4c01fbbf 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -19,7 +19,7 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/group/go.sum b/x/group/go.sum index 52d4eff5e98c..5bc751595fcc 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -140,8 +140,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/group/keeper/abci.go b/x/group/keeper/abci.go new file mode 100644 index 000000000000..64a965a06e11 --- /dev/null +++ b/x/group/keeper/abci.go @@ -0,0 +1,15 @@ +package keeper + +import ( + "context" +) + +// EndBlocker called at every block, updates proposal's `FinalTallyResult` and +// prunes expired proposals. +func (k Keeper) EndBlocker(ctx context.Context) error { + if err := k.TallyProposalsAtVPEnd(ctx, k.environment); err != nil { + return err + } + + return k.PruneProposals(ctx, k.environment) +} diff --git a/x/group/module/abci_test.go b/x/group/keeper/abci_test.go similarity index 88% rename from x/group/module/abci_test.go rename to x/group/keeper/abci_test.go index 98f3307bd26f..8206cbd0b108 100644 --- a/x/group/module/abci_test.go +++ b/x/group/keeper/abci_test.go @@ -1,4 +1,4 @@ -package module_test +package keeper_test import ( "context" @@ -17,7 +17,6 @@ import ( banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/group" "cosmossdk.io/x/group/keeper" - "cosmossdk.io/x/group/module" grouptestutil "cosmossdk.io/x/group/testutil" stakingkeeper "cosmossdk.io/x/staking/keeper" @@ -164,7 +163,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { "proposal pruned after executor result success": { setupProposal: func(ctx sdk.Context) uint64 { msgs := []sdk.Msg{msgSend1} - pID, err := submitProposalAndVote(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) _, err = s.groupKeeper.Exec(ctx, &group.MsgExec{Executor: addr3.String(), ProposalId: pID}) s.Require().NoError(err) @@ -179,7 +178,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { "proposal with multiple messages pruned when executed with result success": { setupProposal: func(ctx sdk.Context) uint64 { msgs := []sdk.Msg{msgSend1, msgSend1} - pID, err := submitProposalAndVote(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) _, err = s.groupKeeper.Exec(ctx, &group.MsgExec{Executor: addr3.String(), ProposalId: pID}) s.Require().NoError(err) @@ -194,7 +193,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { "proposal not pruned when not executed and rejected": { setupProposal: func(ctx sdk.Context) uint64 { msgs := []sdk.Msg{msgSend1} - pID, err := submitProposalAndVote(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_NO) + pID, err := submitProposalAndVoteHelper(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_NO) s.Require().NoError(err) _, err = s.groupKeeper.Exec(ctx, &group.MsgExec{Executor: addr3.String(), ProposalId: pID}) s.Require().NoError(err) @@ -209,7 +208,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "open proposal is not pruned which must not fail ": { setupProposal: func(ctx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, ctx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, s.app, ctx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) s.Require().NoError(err) _, err = s.groupKeeper.Exec(ctx, &group.MsgExec{Executor: addr3.String(), ProposalId: pID}) s.Require().NoError(err) @@ -223,7 +222,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "proposal not pruned with group policy modified before tally": { setupProposal: func(ctx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, ctx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, s.app, ctx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) s.Require().NoError(err) _, err = s.groupKeeper.UpdateGroupPolicyMetadata(ctx, &group.MsgUpdateGroupPolicyMetadata{ Admin: addr1.String(), @@ -243,7 +242,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { "pruned when proposal is executable when failed before": { setupProposal: func(ctx sdk.Context) uint64 { msgs := []sdk.Msg{msgSend1} - pID, err := submitProposalAndVote(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, s.app, ctx, msgs, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) _, err = s.groupKeeper.Exec(ctx, &group.MsgExec{Executor: s.addrs[2].String(), ProposalId: pID}) s.Require().NoError(err) @@ -255,7 +254,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "proposal with status withdrawn is pruned after voting period end": { setupProposal: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, sdkCtx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, s.app, sdkCtx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) s.Require().NoError(err) _, err = s.groupKeeper.WithdrawProposal(ctx, &group.MsgWithdrawProposal{ ProposalId: pID, @@ -270,7 +269,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "proposal with status withdrawn is not pruned (before voting period)": { setupProposal: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, sdkCtx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, s.app, sdkCtx, []sdk.Msg{msgSend1}, proposers, groupPolicyAddr) s.Require().NoError(err) _, err = s.groupKeeper.WithdrawProposal(ctx, &group.MsgWithdrawProposal{ ProposalId: pID, @@ -286,7 +285,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "proposal with status aborted is pruned after voting period end (due to updated group policy decision policy)": { setupProposal: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, sdkCtx, []sdk.Msg{msgSend2}, proposers, groupPolicyAddr2) + pID, err := submitProposalHelper(s, s.app, sdkCtx, []sdk.Msg{msgSend2}, proposers, groupPolicyAddr2) s.Require().NoError(err) policy := group.NewThresholdDecisionPolicy("3", time.Second, 0) @@ -308,7 +307,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { }, "proposal with status aborted is not pruned before voting period end (due to updated group policy)": { setupProposal: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, s.app, sdkCtx, []sdk.Msg{msgSend2}, proposers, groupPolicyAddr2) + pID, err := submitProposalHelper(s, s.app, sdkCtx, []sdk.Msg{msgSend2}, proposers, groupPolicyAddr2) s.Require().NoError(err) policy := group.NewThresholdDecisionPolicy("3", time.Second, 0) @@ -334,7 +333,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() { s.Run(msg, func() { proposalID := spec.setupProposal(ctx) - err := module.EndBlocker(spec.newCtx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(spec.newCtx) s.Require().NoError(err) if spec.expErrMsg != "" && spec.expExecutorResult != group.PROPOSAL_EXECUTOR_RESULT_SUCCESS { @@ -426,7 +425,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }{ "tally updated after voting period end": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) s.Require().NoError(err) return pID }, @@ -437,7 +436,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }, "tally within voting period": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) s.Require().NoError(err) return pID @@ -449,7 +448,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }, "tally within voting period(with votes)": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposalAndVote(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) return pID @@ -462,7 +461,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { "tally after voting period (not passing)": { preRun: func(sdkCtx sdk.Context) uint64 { // `addrs[1]` has weight 1 - pID, err := submitProposalAndVote(s, app, ctx, []sdk.Msg{msgSend}, []string{addrs[1].String()}, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, app, ctx, []sdk.Msg{msgSend}, []string{addrs[1].String()}, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) return pID @@ -479,7 +478,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }, "tally after voting period(with votes)": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposalAndVote(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) return pID @@ -496,7 +495,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }, "tally of withdrawn proposal": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposal(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) + pID, err := submitProposalHelper(s, app, sdkCtx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr) s.Require().NoError(err) _, err = s.groupKeeper.WithdrawProposal(ctx, &group.MsgWithdrawProposal{ @@ -514,7 +513,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { }, "tally of withdrawn proposal (with votes)": { preRun: func(sdkCtx sdk.Context) uint64 { - pID, err := submitProposalAndVote(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) + pID, err := submitProposalAndVoteHelper(s, app, ctx, []sdk.Msg{msgSend}, proposers, groupPolicyAddr, group.VOTE_OPTION_YES) s.Require().NoError(err) _, err = s.groupKeeper.WithdrawProposal(ctx, &group.MsgWithdrawProposal{ @@ -537,7 +536,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { spec := spec pID := spec.preRun(ctx) - err := module.EndBlocker(spec.newCtx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(spec.newCtx) s.Require().NoError(err) resp, err := s.groupKeeper.Proposal(spec.newCtx, &group.QueryProposalRequest{ ProposalId: pID, @@ -556,7 +555,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { } } -func submitProposal(s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress) (uint64, error) { +func submitProposalHelper(s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress) (uint64, error) { proposalReq := &group.MsgSubmitProposal{ GroupPolicyAddress: groupPolicyAddr.String(), Proposers: proposers, @@ -574,11 +573,11 @@ func submitProposal(s *IntegrationTestSuite, app *runtime.App, ctx context.Conte return proposalRes.ProposalId, nil } -func submitProposalAndVote( +func submitProposalAndVoteHelper( s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress, voteOption group.VoteOption, ) (uint64, error) { - myProposalID, err := submitProposal(s, app, ctx, msgs, proposers, groupPolicyAddr) + myProposalID, err := submitProposalHelper(s, app, ctx, msgs, proposers, groupPolicyAddr) if err != nil { return 0, err } diff --git a/x/group/keeper/genesis.go b/x/group/keeper/genesis.go index 700bacd2f86c..f378f3775799 100644 --- a/x/group/keeper/genesis.go +++ b/x/group/keeper/genesis.go @@ -17,7 +17,7 @@ func (k Keeper) InitGenesis(ctx context.Context, cdc codec.JSONCodec, data json. var genesisState group.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) - store := k.storeService.OpenKVStore(ctx) + store := k.environment.KVStoreService.OpenKVStore(ctx) if err := k.groupTable.Import(store, genesisState.Groups, genesisState.GroupSeq); err != nil { panic(errors.Wrap(err, "groups")) @@ -52,7 +52,7 @@ func (k Keeper) ExportGenesis(ctx context.Context, _ codec.JSONCodec) *group.Gen var groups []*group.GroupInfo - store := k.storeService.OpenKVStore(ctx) + store := k.environment.KVStoreService.OpenKVStore(ctx) groupSeq, err := k.groupTable.Export(store, &groups) if err != nil { diff --git a/x/group/keeper/genesis_test.go b/x/group/keeper/genesis_test.go index c9e3c44640b1..88488eccd3dc 100644 --- a/x/group/keeper/genesis_test.go +++ b/x/group/keeper/genesis_test.go @@ -53,6 +53,7 @@ func (s *GenesisTestSuite) SetupTest() { storeService := runtime.NewKVStoreService(key) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) encCfg := moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}) + env := runtime.NewEnvironment(storeService, log.NewNopLogger()) ctrl := gomock.NewController(s.T()) accountKeeper := grouptestutil.NewMockAccountKeeper(ctrl) @@ -73,7 +74,7 @@ func (s *GenesisTestSuite) SetupTest() { s.cdc = codec.NewProtoCodec(encCfg.InterfaceRegistry) s.ctx = s.sdkCtx - s.keeper = keeper.NewKeeper(storeService, s.cdc, bApp.MsgServiceRouter(), accountKeeper, group.DefaultConfig()) + s.keeper = keeper.NewKeeper(env, s.cdc, bApp.MsgServiceRouter(), accountKeeper, group.DefaultConfig()) } func (s *GenesisTestSuite) TestInitExportGenesis() { diff --git a/x/group/keeper/grpc_query.go b/x/group/keeper/grpc_query.go index e15b2fcf5ecc..5f3bc4cbc37d 100644 --- a/x/group/keeper/grpc_query.go +++ b/x/group/keeper/grpc_query.go @@ -19,8 +19,7 @@ import ( var _ group.QueryServer = Keeper{} // GroupInfo queries info about a group. -func (k Keeper) GroupInfo(goCtx context.Context, request *group.QueryGroupInfoRequest) (*group.QueryGroupInfoResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) GroupInfo(ctx context.Context, request *group.QueryGroupInfoRequest) (*group.QueryGroupInfoResponse, error) { groupID := request.GroupId groupInfo, err := k.getGroupInfo(ctx, groupID) if err != nil { @@ -31,20 +30,19 @@ func (k Keeper) GroupInfo(goCtx context.Context, request *group.QueryGroupInfoRe } // getGroupInfo gets the group info of the given group id. -func (k Keeper) getGroupInfo(ctx sdk.Context, id uint64) (group.GroupInfo, error) { +func (k Keeper) getGroupInfo(ctx context.Context, id uint64) (group.GroupInfo, error) { var obj group.GroupInfo - _, err := k.groupTable.GetOne(k.storeService.OpenKVStore(ctx), id, &obj) + _, err := k.groupTable.GetOne(k.environment.KVStoreService.OpenKVStore(ctx), id, &obj) return obj, err } // GroupPolicyInfo queries info about a group policy. -func (k Keeper) GroupPolicyInfo(goCtx context.Context, request *group.QueryGroupPolicyInfoRequest) (*group.QueryGroupPolicyInfoResponse, error) { +func (k Keeper) GroupPolicyInfo(ctx context.Context, request *group.QueryGroupPolicyInfoRequest) (*group.QueryGroupPolicyInfoResponse, error) { _, err := k.accKeeper.AddressCodec().StringToBytes(request.Address) if err != nil { return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) groupPolicyInfo, err := k.getGroupPolicyInfo(ctx, request.Address) if err != nil { return nil, errorsmod.Wrap(err, "group policy") @@ -54,14 +52,13 @@ func (k Keeper) GroupPolicyInfo(goCtx context.Context, request *group.QueryGroup } // getGroupPolicyInfo gets the group policy info of the given account address. -func (k Keeper) getGroupPolicyInfo(ctx sdk.Context, accountAddress string) (group.GroupPolicyInfo, error) { +func (k Keeper) getGroupPolicyInfo(ctx context.Context, accountAddress string) (group.GroupPolicyInfo, error) { var obj group.GroupPolicyInfo - return obj, k.groupPolicyTable.GetOne(k.storeService.OpenKVStore(ctx), orm.PrimaryKey(&group.GroupPolicyInfo{Address: accountAddress}), &obj) + return obj, k.groupPolicyTable.GetOne(k.environment.KVStoreService.OpenKVStore(ctx), orm.PrimaryKey(&group.GroupPolicyInfo{Address: accountAddress}), &obj) } // GroupMembers queries all members of a group. -func (k Keeper) GroupMembers(goCtx context.Context, request *group.QueryGroupMembersRequest) (*group.QueryGroupMembersResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) GroupMembers(ctx context.Context, request *group.QueryGroupMembersRequest) (*group.QueryGroupMembersResponse, error) { groupID := request.GroupId it, err := k.getGroupMembers(ctx, groupID, request.Pagination) if err != nil { @@ -81,13 +78,12 @@ func (k Keeper) GroupMembers(goCtx context.Context, request *group.QueryGroupMem } // getGroupMembers returns an iterator for the given group id and page request. -func (k Keeper) getGroupMembers(ctx sdk.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.groupMemberByGroupIndex.GetPaginated(k.storeService.OpenKVStore(ctx), id, pageRequest) +func (k Keeper) getGroupMembers(ctx context.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.groupMemberByGroupIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), id, pageRequest) } // GroupsByAdmin queries all groups where a given address is admin. -func (k Keeper) GroupsByAdmin(goCtx context.Context, request *group.QueryGroupsByAdminRequest) (*group.QueryGroupsByAdminResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) GroupsByAdmin(ctx context.Context, request *group.QueryGroupsByAdminRequest) (*group.QueryGroupsByAdminResponse, error) { addr, err := k.accKeeper.AddressCodec().StringToBytes(request.Admin) if err != nil { return nil, err @@ -110,13 +106,12 @@ func (k Keeper) GroupsByAdmin(goCtx context.Context, request *group.QueryGroupsB } // getGroupsByAdmin returns an iterator for the given admin account address and page request. -func (k Keeper) getGroupsByAdmin(ctx sdk.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.groupByAdminIndex.GetPaginated(k.storeService.OpenKVStore(ctx), admin.Bytes(), pageRequest) +func (k Keeper) getGroupsByAdmin(ctx context.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.groupByAdminIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), admin.Bytes(), pageRequest) } // GroupPoliciesByGroup queries all groups policies of a given group. -func (k Keeper) GroupPoliciesByGroup(goCtx context.Context, request *group.QueryGroupPoliciesByGroupRequest) (*group.QueryGroupPoliciesByGroupResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) GroupPoliciesByGroup(ctx context.Context, request *group.QueryGroupPoliciesByGroupRequest) (*group.QueryGroupPoliciesByGroupResponse, error) { groupID := request.GroupId it, err := k.getGroupPoliciesByGroup(ctx, groupID, request.Pagination) if err != nil { @@ -136,14 +131,13 @@ func (k Keeper) GroupPoliciesByGroup(goCtx context.Context, request *group.Query } // getGroupPoliciesByGroup returns an iterator for the given group id and page request. -func (k Keeper) getGroupPoliciesByGroup(ctx sdk.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.groupPolicyByGroupIndex.GetPaginated(k.storeService.OpenKVStore(ctx), id, pageRequest) +func (k Keeper) getGroupPoliciesByGroup(ctx context.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.groupPolicyByGroupIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), id, pageRequest) } // GroupPoliciesByAdmin queries all groups policies where a given address is // admin. -func (k Keeper) GroupPoliciesByAdmin(goCtx context.Context, request *group.QueryGroupPoliciesByAdminRequest) (*group.QueryGroupPoliciesByAdminResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) GroupPoliciesByAdmin(ctx context.Context, request *group.QueryGroupPoliciesByAdminRequest) (*group.QueryGroupPoliciesByAdminResponse, error) { addr, err := k.accKeeper.AddressCodec().StringToBytes(request.Admin) if err != nil { return nil, err @@ -166,13 +160,12 @@ func (k Keeper) GroupPoliciesByAdmin(goCtx context.Context, request *group.Query } // getGroupPoliciesByAdmin returns an iterator for the given admin account address and page request. -func (k Keeper) getGroupPoliciesByAdmin(ctx sdk.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.groupPolicyByAdminIndex.GetPaginated(k.storeService.OpenKVStore(ctx), admin.Bytes(), pageRequest) +func (k Keeper) getGroupPoliciesByAdmin(ctx context.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.groupPolicyByAdminIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), admin.Bytes(), pageRequest) } // Proposal queries a proposal. -func (k Keeper) Proposal(goCtx context.Context, request *group.QueryProposalRequest) (*group.QueryProposalResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) Proposal(ctx context.Context, request *group.QueryProposalRequest) (*group.QueryProposalResponse, error) { proposalID := request.ProposalId proposal, err := k.getProposal(ctx, proposalID) if err != nil { @@ -183,8 +176,7 @@ func (k Keeper) Proposal(goCtx context.Context, request *group.QueryProposalRequ } // ProposalsByGroupPolicy queries all proposals of a group policy. -func (k Keeper) ProposalsByGroupPolicy(goCtx context.Context, request *group.QueryProposalsByGroupPolicyRequest) (*group.QueryProposalsByGroupPolicyResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) ProposalsByGroupPolicy(ctx context.Context, request *group.QueryProposalsByGroupPolicyRequest) (*group.QueryProposalsByGroupPolicyResponse, error) { addr, err := k.accKeeper.AddressCodec().StringToBytes(request.Address) if err != nil { return nil, err @@ -207,22 +199,21 @@ func (k Keeper) ProposalsByGroupPolicy(goCtx context.Context, request *group.Que } // getProposalsByGroupPolicy returns an iterator for the given account address and page request. -func (k Keeper) getProposalsByGroupPolicy(ctx sdk.Context, account sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.proposalByGroupPolicyIndex.GetPaginated(k.storeService.OpenKVStore(ctx), account.Bytes(), pageRequest) +func (k Keeper) getProposalsByGroupPolicy(ctx context.Context, account sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.proposalByGroupPolicyIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), account.Bytes(), pageRequest) } // getProposal gets the proposal info of the given proposal id. -func (k Keeper) getProposal(ctx sdk.Context, proposalID uint64) (group.Proposal, error) { +func (k Keeper) getProposal(ctx context.Context, proposalID uint64) (group.Proposal, error) { var p group.Proposal - if _, err := k.proposalTable.GetOne(k.storeService.OpenKVStore(ctx), proposalID, &p); err != nil { + if _, err := k.proposalTable.GetOne(k.environment.KVStoreService.OpenKVStore(ctx), proposalID, &p); err != nil { return group.Proposal{}, errorsmod.Wrap(err, "load proposal") } return p, nil } // VoteByProposalVoter queries a vote given a voter and a proposal ID. -func (k Keeper) VoteByProposalVoter(goCtx context.Context, request *group.QueryVoteByProposalVoterRequest) (*group.QueryVoteByProposalVoterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) VoteByProposalVoter(ctx context.Context, request *group.QueryVoteByProposalVoterRequest) (*group.QueryVoteByProposalVoterResponse, error) { addr, err := k.accKeeper.AddressCodec().StringToBytes(request.Voter) if err != nil { return nil, err @@ -238,8 +229,7 @@ func (k Keeper) VoteByProposalVoter(goCtx context.Context, request *group.QueryV } // VotesByProposal queries all votes on a proposal. -func (k Keeper) VotesByProposal(goCtx context.Context, request *group.QueryVotesByProposalRequest) (*group.QueryVotesByProposalResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) VotesByProposal(ctx context.Context, request *group.QueryVotesByProposalRequest) (*group.QueryVotesByProposalResponse, error) { proposalID := request.ProposalId it, err := k.getVotesByProposal(ctx, proposalID, request.Pagination) if err != nil { @@ -259,8 +249,7 @@ func (k Keeper) VotesByProposal(goCtx context.Context, request *group.QueryVotes } // VotesByVoter queries all votes of a voter. -func (k Keeper) VotesByVoter(goCtx context.Context, request *group.QueryVotesByVoterRequest) (*group.QueryVotesByVoterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) VotesByVoter(ctx context.Context, request *group.QueryVotesByVoterRequest) (*group.QueryVotesByVoterResponse, error) { addr, err := k.accKeeper.AddressCodec().StringToBytes(request.Voter) if err != nil { return nil, err @@ -283,18 +272,17 @@ func (k Keeper) VotesByVoter(goCtx context.Context, request *group.QueryVotesByV } // GroupsByMember queries all groups where the given address is a member of. -func (k Keeper) GroupsByMember(goCtx context.Context, request *group.QueryGroupsByMemberRequest) (*group.QueryGroupsByMemberResponse, error) { +func (k Keeper) GroupsByMember(ctx context.Context, request *group.QueryGroupsByMemberRequest) (*group.QueryGroupsByMemberResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(goCtx) member, err := k.accKeeper.AddressCodec().StringToBytes(request.Address) if err != nil { return nil, err } - iter, err := k.groupMemberByMemberIndex.GetPaginated(k.storeService.OpenKVStore(ctx), member, request.Pagination) + iter, err := k.groupMemberByMemberIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), member, request.Pagination) if err != nil { return nil, err } @@ -321,24 +309,23 @@ func (k Keeper) GroupsByMember(goCtx context.Context, request *group.QueryGroups } // getVote gets the vote info for the given proposal id and voter address. -func (k Keeper) getVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (group.Vote, error) { +func (k Keeper) getVote(ctx context.Context, proposalID uint64, voter sdk.AccAddress) (group.Vote, error) { var v group.Vote - return v, k.voteTable.GetOne(k.storeService.OpenKVStore(ctx), orm.PrimaryKey(&group.Vote{ProposalId: proposalID, Voter: voter.String()}), &v) + return v, k.voteTable.GetOne(k.environment.KVStoreService.OpenKVStore(ctx), orm.PrimaryKey(&group.Vote{ProposalId: proposalID, Voter: voter.String()}), &v) } // getVotesByProposal returns an iterator for the given proposal id and page request. -func (k Keeper) getVotesByProposal(ctx sdk.Context, proposalID uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.voteByProposalIndex.GetPaginated(k.storeService.OpenKVStore(ctx), proposalID, pageRequest) +func (k Keeper) getVotesByProposal(ctx context.Context, proposalID uint64, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.voteByProposalIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), proposalID, pageRequest) } // getVotesByVoter returns an iterator for the given voter address and page request. -func (k Keeper) getVotesByVoter(ctx sdk.Context, voter sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { - return k.voteByVoterIndex.GetPaginated(k.storeService.OpenKVStore(ctx), voter.Bytes(), pageRequest) +func (k Keeper) getVotesByVoter(ctx context.Context, voter sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) { + return k.voteByVoterIndex.GetPaginated(k.environment.KVStoreService.OpenKVStore(ctx), voter.Bytes(), pageRequest) } // TallyResult computes the live tally result of a proposal. -func (k Keeper) TallyResult(goCtx context.Context, request *group.QueryTallyResultRequest) (*group.QueryTallyResultResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) TallyResult(ctx context.Context, request *group.QueryTallyResultRequest) (*group.QueryTallyResultResponse, error) { proposalID := request.ProposalId proposal, err := k.getProposal(ctx, proposalID) @@ -366,10 +353,8 @@ func (k Keeper) TallyResult(goCtx context.Context, request *group.QueryTallyResu } // Groups returns all the groups present in the state. -func (k Keeper) Groups(goCtx context.Context, request *group.QueryGroupsRequest) (*group.QueryGroupsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - it, err := k.groupTable.PrefixScan(k.storeService.OpenKVStore(ctx), 1, math.MaxUint64) +func (k Keeper) Groups(ctx context.Context, request *group.QueryGroupsRequest) (*group.QueryGroupsResponse, error) { + it, err := k.groupTable.PrefixScan(k.environment.KVStoreService.OpenKVStore(ctx), 1, math.MaxUint64) if err != nil { return nil, err } diff --git a/x/group/keeper/grpc_query_test.go b/x/group/keeper/grpc_query_test.go index dafc811a9f5e..545301177dba 100644 --- a/x/group/keeper/grpc_query_test.go +++ b/x/group/keeper/grpc_query_test.go @@ -69,7 +69,9 @@ func initKeeper(t *testing.T) *fixture { accountKeeper.EXPECT().NewAccount(gomock.Any(), gomock.Any()).Return(nil).AnyTimes() accountKeeper.EXPECT().SetAccount(gomock.Any(), gomock.Any()).AnyTimes() - groupKeeper = groupkeeper.NewKeeper(storeService, encCfg.Codec, bApp.MsgServiceRouter(), accountKeeper, group.DefaultConfig()) + env := runtime.NewEnvironment(storeService, log.NewNopLogger()) + + groupKeeper = groupkeeper.NewKeeper(env, encCfg.Codec, bApp.MsgServiceRouter(), accountKeeper, group.DefaultConfig()) queryHelper := baseapp.NewQueryServerTestHelper(ctx, interfaceRegistry) group.RegisterQueryServer(queryHelper, groupKeeper) queryClient := group.NewQueryClient(queryHelper) diff --git a/x/group/keeper/invariants.go b/x/group/keeper/invariants.go index 060f9fef899a..98d9c0e796e2 100644 --- a/x/group/keeper/invariants.go +++ b/x/group/keeper/invariants.go @@ -26,7 +26,7 @@ func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper) { // GroupTotalWeightInvariant checks that group's TotalWeight must be equal to the sum of its members. func GroupTotalWeightInvariant(keeper Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - msg, broken := GroupTotalWeightInvariantHelper(ctx, keeper.storeService, keeper.groupTable, keeper.groupMemberByGroupIndex) + msg, broken := GroupTotalWeightInvariantHelper(ctx, keeper.environment.KVStoreService, keeper.groupTable, keeper.groupMemberByGroupIndex) return sdk.FormatInvariant(group.ModuleName, weightInvariant, msg), broken } } diff --git a/x/group/keeper/keeper.go b/x/group/keeper/keeper.go index 88ac69a7772a..ede804f85283 100644 --- a/x/group/keeper/keeper.go +++ b/x/group/keeper/keeper.go @@ -1,10 +1,11 @@ package keeper import ( + "context" "fmt" "time" - corestoretypes "cosmossdk.io/core/store" + "cosmossdk.io/core/appmodule" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/x/group" @@ -46,9 +47,8 @@ const ( ) type Keeper struct { - storeService corestoretypes.KVStoreService - - accKeeper group.AccountKeeper + environment appmodule.Environment + accKeeper group.AccountKeeper // Group Table groupTable orm.AutoUInt64Table @@ -83,12 +83,12 @@ type Keeper struct { } // NewKeeper creates a new group keeper. -func NewKeeper(storeService corestoretypes.KVStoreService, cdc codec.Codec, router baseapp.MessageRouter, accKeeper group.AccountKeeper, config group.Config) Keeper { +func NewKeeper(env appmodule.Environment, cdc codec.Codec, router baseapp.MessageRouter, accKeeper group.AccountKeeper, config group.Config) Keeper { k := Keeper{ - storeService: storeService, - router: router, - accKeeper: accKeeper, - cdc: cdc, + environment: env, + router: router, + accKeeper: accKeeper, + cdc: cdc, } /* @@ -236,24 +236,24 @@ func NewKeeper(storeService corestoretypes.KVStoreService, cdc codec.Codec, rout } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", group.ModuleName)) +func (k Keeper) Logger() log.Logger { + return k.environment.Logger.With("module", fmt.Sprintf("x/%s", group.ModuleName)) } // GetGroupSequence returns the current value of the group table sequence func (k Keeper) GetGroupSequence(ctx sdk.Context) uint64 { - return k.groupTable.Sequence().CurVal(k.storeService.OpenKVStore(ctx)) + return k.groupTable.Sequence().CurVal(k.environment.KVStoreService.OpenKVStore(ctx)) } // GetGroupPolicySeq returns the current value of the group policy table sequence func (k Keeper) GetGroupPolicySeq(ctx sdk.Context) uint64 { - return k.groupPolicySeq.CurVal(k.storeService.OpenKVStore(ctx)) + return k.groupPolicySeq.CurVal(k.environment.KVStoreService.OpenKVStore(ctx)) } // proposalsByVPEnd returns all proposals whose voting_period_end is after the `endTime` time argument. -func (k Keeper) proposalsByVPEnd(ctx sdk.Context, endTime time.Time) (proposals []group.Proposal, err error) { +func (k Keeper) proposalsByVPEnd(ctx context.Context, endTime time.Time) (proposals []group.Proposal, err error) { timeBytes := sdk.FormatTimeBytes(endTime) - it, err := k.proposalsByVotingPeriodEnd.PrefixScan(k.storeService.OpenKVStore(ctx), nil, timeBytes) + it, err := k.proposalsByVotingPeriodEnd.PrefixScan(k.environment.KVStoreService.OpenKVStore(ctx), nil, timeBytes) if err != nil { return proposals, err } @@ -284,19 +284,19 @@ func (k Keeper) proposalsByVPEnd(ctx sdk.Context, endTime time.Time) (proposals } // pruneProposal deletes a proposal from state. -func (k Keeper) pruneProposal(ctx sdk.Context, proposalID uint64) error { - err := k.proposalTable.Delete(k.storeService.OpenKVStore(ctx), proposalID) +func (k Keeper) pruneProposal(ctx context.Context, proposalID uint64) error { + err := k.proposalTable.Delete(k.environment.KVStoreService.OpenKVStore(ctx), proposalID) if err != nil { return err } - k.Logger(ctx).Debug(fmt.Sprintf("Pruned proposal %d", proposalID)) + k.Logger().Debug(fmt.Sprintf("Pruned proposal %d", proposalID)) return nil } // abortProposals iterates through all proposals by group policy index // and marks submitted proposals as aborted. -func (k Keeper) abortProposals(ctx sdk.Context, groupPolicyAddr sdk.AccAddress) error { +func (k Keeper) abortProposals(ctx context.Context, groupPolicyAddr sdk.AccAddress) error { proposals, err := k.proposalsByGroupPolicy(ctx, groupPolicyAddr) if err != nil { return err @@ -308,7 +308,7 @@ func (k Keeper) abortProposals(ctx sdk.Context, groupPolicyAddr sdk.AccAddress) if proposalInfo.Status == group.PROPOSAL_STATUS_SUBMITTED { proposalInfo.Status = group.PROPOSAL_STATUS_ABORTED - if err := k.proposalTable.Update(k.storeService.OpenKVStore(ctx), proposalInfo.Id, &proposalInfo); err != nil { + if err := k.proposalTable.Update(k.environment.KVStoreService.OpenKVStore(ctx), proposalInfo.Id, &proposalInfo); err != nil { return err } } @@ -317,8 +317,8 @@ func (k Keeper) abortProposals(ctx sdk.Context, groupPolicyAddr sdk.AccAddress) } // proposalsByGroupPolicy returns all proposals for a given group policy. -func (k Keeper) proposalsByGroupPolicy(ctx sdk.Context, groupPolicyAddr sdk.AccAddress) ([]group.Proposal, error) { - proposalIt, err := k.proposalByGroupPolicyIndex.Get(k.storeService.OpenKVStore(ctx), groupPolicyAddr.Bytes()) +func (k Keeper) proposalsByGroupPolicy(ctx context.Context, groupPolicyAddr sdk.AccAddress) ([]group.Proposal, error) { + proposalIt, err := k.proposalByGroupPolicyIndex.Get(k.environment.KVStoreService.OpenKVStore(ctx), groupPolicyAddr.Bytes()) if err != nil { return nil, err } @@ -341,7 +341,7 @@ func (k Keeper) proposalsByGroupPolicy(ctx sdk.Context, groupPolicyAddr sdk.AccA } // pruneVotes prunes all votes for a proposal from state. -func (k Keeper) pruneVotes(ctx sdk.Context, proposalID uint64) error { +func (k Keeper) pruneVotes(ctx context.Context, proposalID uint64) error { votes, err := k.votesByProposal(ctx, proposalID) if err != nil { return err @@ -349,7 +349,7 @@ func (k Keeper) pruneVotes(ctx sdk.Context, proposalID uint64) error { //nolint:gosec // "implicit memory aliasing in the for loop (because of the pointer on &v)" for _, v := range votes { - err = k.voteTable.Delete(k.storeService.OpenKVStore(ctx), &v) + err = k.voteTable.Delete(k.environment.KVStoreService.OpenKVStore(ctx), &v) if err != nil { return err } @@ -359,8 +359,8 @@ func (k Keeper) pruneVotes(ctx sdk.Context, proposalID uint64) error { } // votesByProposal returns all votes for a given proposal. -func (k Keeper) votesByProposal(ctx sdk.Context, proposalID uint64) ([]group.Vote, error) { - it, err := k.voteByProposalIndex.Get(k.storeService.OpenKVStore(ctx), proposalID) +func (k Keeper) votesByProposal(ctx context.Context, proposalID uint64) ([]group.Vote, error) { + it, err := k.voteByProposalIndex.Get(k.environment.KVStoreService.OpenKVStore(ctx), proposalID) if err != nil { return nil, err } @@ -384,8 +384,9 @@ func (k Keeper) votesByProposal(ctx sdk.Context, proposalID uint64) ([]group.Vot // PruneProposals prunes all proposals that are expired, i.e. whose // `voting_period + max_execution_period` is greater than the current block // time. -func (k Keeper) PruneProposals(ctx sdk.Context) error { - proposals, err := k.proposalsByVPEnd(ctx, ctx.HeaderInfo().Time.Add(-k.config.MaxExecutionPeriod)) +func (k Keeper) PruneProposals(ctx context.Context, env appmodule.Environment) error { + endTime := env.HeaderService.GetHeaderInfo(ctx).Time.Add(-k.config.MaxExecutionPeriod) + proposals, err := k.proposalsByVPEnd(ctx, endTime) if err != nil { return nil } @@ -397,12 +398,13 @@ func (k Keeper) PruneProposals(ctx sdk.Context) error { return err } // Emit event for proposal finalized with its result - if err := ctx.EventManager().EmitTypedEvent( + if err := k.environment.EventService.EventManager(ctx).Emit( &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, TallyResult: &proposal.FinalTallyResult, - }); err != nil { + }, + ); err != nil { return err } } @@ -413,8 +415,8 @@ func (k Keeper) PruneProposals(ctx sdk.Context) error { // TallyProposalsAtVPEnd iterates over all proposals whose voting period // has ended, tallies their votes, prunes them, and updates the proposal's // `FinalTallyResult` field. -func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error { - proposals, err := k.proposalsByVPEnd(ctx, ctx.HeaderInfo().Time) +func (k Keeper) TallyProposalsAtVPEnd(ctx context.Context, env appmodule.Environment) error { + proposals, err := k.proposalsByVPEnd(ctx, env.HeaderService.GetHeaderInfo(ctx).Time) if err != nil { return nil } @@ -439,11 +441,12 @@ func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error { return err } // Emit event for proposal finalized with its result - if err := ctx.EventManager().EmitTypedEvent( + if err := k.environment.EventService.EventManager(ctx).Emit( &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, - }); err != nil { + }, + ); err != nil { return err } } else if proposal.Status == group.PROPOSAL_STATUS_SUBMITTED { @@ -451,7 +454,7 @@ func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error { return errorsmod.Wrap(err, "doTallyAndUpdate") } - if err := k.proposalTable.Update(k.storeService.OpenKVStore(ctx), proposal.Id, &proposal); err != nil { + if err := k.proposalTable.Update(k.environment.KVStoreService.OpenKVStore(ctx), proposal.Id, &proposal); err != nil { return errorsmod.Wrap(err, "proposal update") } } diff --git a/x/group/keeper/keeper_test.go b/x/group/keeper/keeper_test.go index e5d82073399c..860c80738662 100644 --- a/x/group/keeper/keeper_test.go +++ b/x/group/keeper/keeper_test.go @@ -9,6 +9,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/header" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -45,6 +46,7 @@ type TestSuite struct { blockTime time.Time bankKeeper *grouptestutil.MockBankKeeper accountKeeper *grouptestutil.MockAccountKeeper + environment appmodule.Environment } func (s *TestSuite) SetupTest() { @@ -56,6 +58,8 @@ func (s *TestSuite) SetupTest() { encCfg := moduletestutil.MakeTestEncodingConfig(module.AppModuleBasic{}, bank.AppModuleBasic{}) s.addrs = simtestutil.CreateIncrementalAccounts(6) + env := runtime.NewEnvironment(storeService, log.NewNopLogger()) + // setup gomock and initialize some globally expected executions ctrl := gomock.NewController(s.T()) s.accountKeeper = grouptestutil.NewMockAccountKeeper(ctrl) @@ -76,10 +80,12 @@ func (s *TestSuite) SetupTest() { banktypes.RegisterMsgServer(bApp.MsgServiceRouter(), s.bankKeeper) config := group.DefaultConfig() - s.groupKeeper = keeper.NewKeeper(storeService, encCfg.Codec, bApp.MsgServiceRouter(), s.accountKeeper, config) + s.groupKeeper = keeper.NewKeeper(env, encCfg.Codec, bApp.MsgServiceRouter(), s.accountKeeper, config) s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{Time: s.blockTime}) s.sdkCtx = sdk.UnwrapSDKContext(s.ctx) + s.environment = env + // Initial group, group policy and balance setup members := []group.MemberRequest{ {Address: s.addrs[4].String(), Weight: "1"}, {Address: s.addrs[1].String(), Weight: "2"}, @@ -271,7 +277,7 @@ func (s *TestSuite) TestProposalsByVPEnd() { s.Run(msg, func() { pID := spec.preRun(s.sdkCtx) - err := module.EndBlocker(spec.newCtx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(spec.newCtx) s.Require().NoError(err) resp, err := s.groupKeeper.Proposal(spec.newCtx, &group.QueryProposalRequest{ ProposalId: pID, @@ -333,7 +339,7 @@ func (s *TestSuite) TestPruneProposals() { s.sdkCtx = s.sdkCtx.WithHeaderInfo(header.Info{Time: s.sdkCtx.HeaderInfo().Time.Add(expirationTime)}) // Prune Expired Proposals - err = s.groupKeeper.PruneProposals(s.sdkCtx) + err = s.groupKeeper.PruneProposals(s.sdkCtx, s.environment) s.Require().NoError(err) postPrune, err := s.groupKeeper.Proposal(s.ctx, &queryProposal) s.Require().Nil(postPrune) @@ -456,9 +462,9 @@ func (s *TestSuite) TestTallyProposalsAtVPEnd() { s.Require().Equal("1", result.Tally.YesCount) s.Require().NoError(err) - s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx)) + s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx, s.environment)) s.NotPanics(func() { - err := module.EndBlocker(ctx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(ctx) if err != nil { panic(err) } @@ -523,9 +529,9 @@ func (s *TestSuite) TestTallyProposalsAtVPEnd_GroupMemberLeaving() { ctx := s.sdkCtx.WithHeaderInfo(header.Info{Time: s.sdkCtx.HeaderInfo().Time.Add(votingPeriod + 1)}) // Tally the result. This saves the tally result to state. - s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx)) + s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx, s.environment)) s.NotPanics(func() { - err := module.EndBlocker(ctx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(ctx) if err != nil { panic(err) } @@ -538,9 +544,9 @@ func (s *TestSuite) TestTallyProposalsAtVPEnd_GroupMemberLeaving() { }) s.Require().NoError(err) - s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx)) + s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctx, s.environment)) s.NotPanics(func() { - err := module.EndBlocker(ctx, s.groupKeeper) + err := s.groupKeeper.EndBlocker(ctx) if err != nil { panic(err) } diff --git a/x/group/keeper/migrations.go b/x/group/keeper/migrations.go index 33f92acfa158..953888284e98 100644 --- a/x/group/keeper/migrations.go +++ b/x/group/keeper/migrations.go @@ -20,7 +20,7 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate1to2(ctx context.Context) error { return v2.Migrate( ctx, - m.keeper.storeService, + m.keeper.environment.KVStoreService, m.keeper.accKeeper, m.keeper.groupPolicySeq, m.keeper.groupPolicyTable, diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index 06cf6c79368e..b51b794e8019 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -26,7 +26,7 @@ var _ group.MsgServer = Keeper{} // Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 const gasCostPerIteration = uint64(20) -func (k Keeper) CreateGroup(goCtx context.Context, msg *group.MsgCreateGroup) (*group.MsgCreateGroupResponse, error) { +func (k Keeper) CreateGroup(ctx context.Context, msg *group.MsgCreateGroup) (*group.MsgCreateGroupResponse, error) { if _, err := k.accKeeper.AddressCodec().StringToBytes(msg.Admin); err != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid admin address: %s", msg.Admin) } @@ -61,15 +61,14 @@ func (k Keeper) CreateGroup(goCtx context.Context, msg *group.MsgCreateGroup) (* } // Create a new group in the groupTable. - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) groupInfo := &group.GroupInfo{ Id: k.groupTable.Sequence().PeekNextVal(kvStore), Admin: msg.Admin, Metadata: msg.Metadata, Version: 1, TotalWeight: totalWeight.String(), - CreatedAt: ctx.HeaderInfo().Time, + CreatedAt: k.environment.HeaderService.GetHeaderInfo(ctx).Time, } groupID, err := k.groupTable.Create(kvStore, groupInfo) if err != nil { @@ -84,7 +83,7 @@ func (k Keeper) CreateGroup(goCtx context.Context, msg *group.MsgCreateGroup) (* Address: m.Address, Weight: m.Weight, Metadata: m.Metadata, - AddedAt: ctx.HeaderInfo().Time, + AddedAt: k.environment.HeaderService.GetHeaderInfo(ctx).Time, }, }) if err != nil { @@ -92,14 +91,14 @@ func (k Keeper) CreateGroup(goCtx context.Context, msg *group.MsgCreateGroup) (* } } - if err := ctx.EventManager().EmitTypedEvent(&group.EventCreateGroup{GroupId: groupID}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventCreateGroup{GroupId: groupID}); err != nil { return nil, err } return &group.MsgCreateGroupResponse{GroupId: groupID}, nil } -func (k Keeper) UpdateGroupMembers(goCtx context.Context, msg *group.MsgUpdateGroupMembers) (*group.MsgUpdateGroupMembersResponse, error) { +func (k Keeper) UpdateGroupMembers(ctx context.Context, msg *group.MsgUpdateGroupMembers) (*group.MsgUpdateGroupMembersResponse, error) { if msg.GroupId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "group id") } @@ -112,8 +111,7 @@ func (k Keeper) UpdateGroupMembers(goCtx context.Context, msg *group.MsgUpdateGr return nil, errorsmod.Wrap(err, "members") } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(g *group.GroupInfo) error { totalWeight, err := math.NewNonNegativeDecFromString(g.TotalWeight) if err != nil { @@ -191,7 +189,7 @@ func (k Keeper) UpdateGroupMembers(goCtx context.Context, msg *group.MsgUpdateGr return errorsmod.Wrap(err, "add member") } } else { // else handle create. - groupMember.Member.AddedAt = ctx.HeaderInfo().Time + groupMember.Member.AddedAt = k.environment.HeaderService.GetHeaderInfo(ctx).Time if err := k.groupMemberTable.Create(kvStore, &groupMember); err != nil { return errorsmod.Wrap(err, "add member") } @@ -220,7 +218,7 @@ func (k Keeper) UpdateGroupMembers(goCtx context.Context, msg *group.MsgUpdateGr return &group.MsgUpdateGroupMembersResponse{}, nil } -func (k Keeper) UpdateGroupAdmin(goCtx context.Context, msg *group.MsgUpdateGroupAdmin) (*group.MsgUpdateGroupAdminResponse, error) { +func (k Keeper) UpdateGroupAdmin(ctx context.Context, msg *group.MsgUpdateGroupAdmin) (*group.MsgUpdateGroupAdminResponse, error) { if msg.GroupId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "group id") } @@ -237,8 +235,7 @@ func (k Keeper) UpdateGroupAdmin(goCtx context.Context, msg *group.MsgUpdateGrou return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "new admin address") } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(g *group.GroupInfo) error { g.Admin = msg.NewAdmin g.Version++ @@ -253,7 +250,7 @@ func (k Keeper) UpdateGroupAdmin(goCtx context.Context, msg *group.MsgUpdateGrou return &group.MsgUpdateGroupAdminResponse{}, nil } -func (k Keeper) UpdateGroupMetadata(goCtx context.Context, msg *group.MsgUpdateGroupMetadata) (*group.MsgUpdateGroupMetadataResponse, error) { +func (k Keeper) UpdateGroupMetadata(ctx context.Context, msg *group.MsgUpdateGroupMetadata) (*group.MsgUpdateGroupMetadataResponse, error) { if msg.GroupId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "group id") } @@ -266,8 +263,7 @@ func (k Keeper) UpdateGroupMetadata(goCtx context.Context, msg *group.MsgUpdateG return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "admin address") } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(g *group.GroupInfo) error { g.Metadata = msg.Metadata g.Version++ @@ -329,7 +325,7 @@ func (k Keeper) CreateGroupWithPolicy(ctx context.Context, msg *group.MsgCreateG return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupID, GroupPolicyAddress: groupPolicyRes.Address}, nil } -func (k Keeper) CreateGroupPolicy(goCtx context.Context, msg *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) { +func (k Keeper) CreateGroupPolicy(ctx context.Context, msg *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) { if msg.GroupId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "group id") } @@ -352,7 +348,6 @@ func (k Keeper) CreateGroupPolicy(goCtx context.Context, msg *group.MsgCreateGro return nil, errorsmod.Wrap(err, "request admin") } - ctx := sdk.UnwrapSDKContext(goCtx) groupInfo, err := k.getGroupInfo(ctx, msg.GetGroupID()) if err != nil { return nil, err @@ -372,7 +367,7 @@ func (k Keeper) CreateGroupPolicy(goCtx context.Context, msg *group.MsgCreateGro return nil, err } - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) // Generate account address of group policy. var accountAddr sdk.AccAddress @@ -413,7 +408,7 @@ func (k Keeper) CreateGroupPolicy(goCtx context.Context, msg *group.MsgCreateGro msg.GetMetadata(), 1, policy, - ctx.HeaderInfo().Time, + k.environment.HeaderService.GetHeaderInfo(ctx).Time, ) if err != nil { return nil, err @@ -423,14 +418,14 @@ func (k Keeper) CreateGroupPolicy(goCtx context.Context, msg *group.MsgCreateGro return nil, errorsmod.Wrap(err, "could not create group policy") } - if err := ctx.EventManager().EmitTypedEvent(&group.EventCreateGroupPolicy{Address: accountAddr.String()}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventCreateGroupPolicy{Address: accountAddr.String()}); err != nil { return nil, err } return &group.MsgCreateGroupPolicyResponse{Address: accountAddr.String()}, nil } -func (k Keeper) UpdateGroupPolicyAdmin(goCtx context.Context, msg *group.MsgUpdateGroupPolicyAdmin) (*group.MsgUpdateGroupPolicyAdminResponse, error) { +func (k Keeper) UpdateGroupPolicyAdmin(ctx context.Context, msg *group.MsgUpdateGroupPolicyAdmin) (*group.MsgUpdateGroupPolicyAdminResponse, error) { if strings.EqualFold(msg.Admin, msg.NewAdmin) { return nil, errorsmod.Wrap(errors.ErrInvalid, "new and old admin are same") } @@ -439,8 +434,7 @@ func (k Keeper) UpdateGroupPolicyAdmin(goCtx context.Context, msg *group.MsgUpda return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "new admin address") } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(groupPolicy *group.GroupPolicyInfo) error { groupPolicy.Admin = msg.NewAdmin groupPolicy.Version++ @@ -454,7 +448,7 @@ func (k Keeper) UpdateGroupPolicyAdmin(goCtx context.Context, msg *group.MsgUpda return &group.MsgUpdateGroupPolicyAdminResponse{}, nil } -func (k Keeper) UpdateGroupPolicyDecisionPolicy(goCtx context.Context, msg *group.MsgUpdateGroupPolicyDecisionPolicy) (*group.MsgUpdateGroupPolicyDecisionPolicyResponse, error) { +func (k Keeper) UpdateGroupPolicyDecisionPolicy(ctx context.Context, msg *group.MsgUpdateGroupPolicyDecisionPolicy) (*group.MsgUpdateGroupPolicyDecisionPolicyResponse, error) { policy, err := msg.GetDecisionPolicy() if err != nil { return nil, errorsmod.Wrap(err, "decision policy") @@ -464,8 +458,7 @@ func (k Keeper) UpdateGroupPolicyDecisionPolicy(goCtx context.Context, msg *grou return nil, errorsmod.Wrap(err, "decision policy") } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(groupPolicy *group.GroupPolicyInfo) error { groupInfo, err := k.getGroupInfo(ctx, groupPolicy.GroupId) if err != nil { @@ -493,10 +486,9 @@ func (k Keeper) UpdateGroupPolicyDecisionPolicy(goCtx context.Context, msg *grou return &group.MsgUpdateGroupPolicyDecisionPolicyResponse{}, nil } -func (k Keeper) UpdateGroupPolicyMetadata(goCtx context.Context, msg *group.MsgUpdateGroupPolicyMetadata) (*group.MsgUpdateGroupPolicyMetadataResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k Keeper) UpdateGroupPolicyMetadata(ctx context.Context, msg *group.MsgUpdateGroupPolicyMetadata) (*group.MsgUpdateGroupPolicyMetadataResponse, error) { metadata := msg.GetMetadata() - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) action := func(groupPolicy *group.GroupPolicyInfo) error { groupPolicy.Metadata = metadata @@ -516,7 +508,7 @@ func (k Keeper) UpdateGroupPolicyMetadata(goCtx context.Context, msg *group.MsgU return &group.MsgUpdateGroupPolicyMetadataResponse{}, nil } -func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitProposal) (*group.MsgSubmitProposalResponse, error) { +func (k Keeper) SubmitProposal(ctx context.Context, msg *group.MsgSubmitProposal) (*group.MsgSubmitProposalResponse, error) { if len(msg.Proposers) == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "proposers") } @@ -568,8 +560,7 @@ func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitPropos return nil, err } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) policyAcc, err := k.getGroupPolicyInfo(ctx, msg.GroupPolicyAddress) if err != nil { return nil, errorsmod.Wrapf(err, "load group policy: %s", msg.GroupPolicyAddress) @@ -607,12 +598,12 @@ func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitPropos GroupPolicyAddress: msg.GroupPolicyAddress, Metadata: msg.Metadata, Proposers: msg.Proposers, - SubmitTime: ctx.HeaderInfo().Time, + SubmitTime: k.environment.HeaderService.GetHeaderInfo(ctx).Time, GroupVersion: groupInfo.Version, GroupPolicyVersion: policyAcc.Version, Status: group.PROPOSAL_STATUS_SUBMITTED, ExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN, - VotingPeriodEnd: ctx.HeaderInfo().Time.Add(policy.GetVotingPeriod()), // The voting window begins as soon as the proposal is submitted. + VotingPeriodEnd: k.environment.HeaderService.GetHeaderInfo(ctx).Time.Add(policy.GetVotingPeriod()), // The voting window begins as soon as the proposal is submitted. FinalTallyResult: group.DefaultTallyResult(), Title: msg.Title, Summary: msg.Summary, @@ -627,7 +618,7 @@ func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitPropos return nil, errorsmod.Wrap(err, "create proposal") } - if err := ctx.EventManager().EmitTypedEvent(&group.EventSubmitProposal{ProposalId: id}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventSubmitProposal{ProposalId: id}); err != nil { return nil, err } @@ -635,7 +626,7 @@ func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitPropos if msg.Exec == group.Exec_EXEC_TRY { // Consider proposers as Yes votes for _, proposer := range msg.Proposers { - ctx.GasMeter().ConsumeGas(gasCostPerIteration, "vote on proposal") + k.environment.GasService.GetGasMeter(ctx).Consume(gasCostPerIteration, "vote on proposal") _, err = k.Vote(ctx, &group.MsgVote{ ProposalId: id, Voter: proposer, @@ -661,7 +652,7 @@ func (k Keeper) SubmitProposal(goCtx context.Context, msg *group.MsgSubmitPropos return &group.MsgSubmitProposalResponse{ProposalId: id}, nil } -func (k Keeper) WithdrawProposal(goCtx context.Context, msg *group.MsgWithdrawProposal) (*group.MsgWithdrawProposalResponse, error) { +func (k Keeper) WithdrawProposal(ctx context.Context, msg *group.MsgWithdrawProposal) (*group.MsgWithdrawProposalResponse, error) { if msg.ProposalId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "proposal id") } @@ -670,8 +661,7 @@ func (k Keeper) WithdrawProposal(goCtx context.Context, msg *group.MsgWithdrawPr return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid group policy admin / proposer address: %s", msg.Address) } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) proposal, err := k.getProposal(ctx, msg.ProposalId) if err != nil { return nil, err @@ -697,14 +687,14 @@ func (k Keeper) WithdrawProposal(goCtx context.Context, msg *group.MsgWithdrawPr return nil, err } - if err := ctx.EventManager().EmitTypedEvent(&group.EventWithdrawProposal{ProposalId: msg.ProposalId}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventWithdrawProposal{ProposalId: msg.ProposalId}); err != nil { return nil, err } return &group.MsgWithdrawProposalResponse{}, nil } -func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteResponse, error) { +func (k Keeper) Vote(ctx context.Context, msg *group.MsgVote) (*group.MsgVoteResponse, error) { if msg.ProposalId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "proposal id") } @@ -726,8 +716,7 @@ func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteR return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid voter address: %s", msg.Voter) } - ctx := sdk.UnwrapSDKContext(goCtx) - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) proposal, err := k.getProposal(ctx, msg.ProposalId) if err != nil { return nil, err @@ -738,7 +727,7 @@ func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteR return nil, errorsmod.Wrap(errors.ErrInvalid, "proposal not open for voting") } - if ctx.HeaderInfo().Time.After(proposal.VotingPeriodEnd) { + if k.environment.HeaderService.GetHeaderInfo(ctx).Time.After(proposal.VotingPeriodEnd) { return nil, errorsmod.Wrap(errors.ErrExpired, "voting period has ended already") } @@ -762,7 +751,7 @@ func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteR Voter: msg.Voter, Option: msg.Option, Metadata: msg.Metadata, - SubmitTime: ctx.HeaderInfo().Time, + SubmitTime: k.environment.HeaderService.GetHeaderInfo(ctx).Time, } // The ORM will return an error if the vote already exists, @@ -771,7 +760,7 @@ func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteR return nil, errorsmod.Wrap(err, "store vote") } - if err := ctx.EventManager().EmitTypedEvent(&group.EventVote{ProposalId: msg.ProposalId}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventVote{ProposalId: msg.ProposalId}); err != nil { return nil, err } @@ -789,7 +778,7 @@ func (k Keeper) Vote(goCtx context.Context, msg *group.MsgVote) (*group.MsgVoteR // doTallyAndUpdate performs a tally, and, if the tally result is final, then: // - updates the proposal's `Status` and `FinalTallyResult` fields, // - prune all the votes. -func (k Keeper) doTallyAndUpdate(ctx sdk.Context, p *group.Proposal, groupInfo group.GroupInfo, policyInfo group.GroupPolicyInfo) error { +func (k Keeper) doTallyAndUpdate(ctx context.Context, p *group.Proposal, groupInfo group.GroupInfo, policyInfo group.GroupPolicyInfo) error { policy, err := policyInfo.GetDecisionPolicy() if err != nil { return err @@ -807,7 +796,7 @@ func (k Keeper) doTallyAndUpdate(ctx sdk.Context, p *group.Proposal, groupInfo g // If the result was final (i.e. enough votes to pass) or if the voting // period ended, then we consider the proposal as final. - if isFinal := result.Final || ctx.HeaderInfo().Time.After(p.VotingPeriodEnd); isFinal { + if isFinal := result.Final || k.environment.HeaderService.GetHeaderInfo(ctx).Time.After(p.VotingPeriodEnd); isFinal { if err := k.pruneVotes(ctx, p.Id); err != nil { return err } @@ -873,7 +862,7 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR if results, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr, decisionPolicy); err != nil { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_FAILURE logs = fmt.Sprintf("proposal execution failed on proposal %d, because of error %s", proposal.Id, err.Error()) - k.Logger(ctx).Info("proposal execution failed", "cause", err, "proposalID", proposal.Id) + k.Logger().Info("proposal execution failed", "cause", err, "proposalID", proposal.Id) } else { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_SUCCESS flush() @@ -893,7 +882,7 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR } // Emit event for proposal finalized with its result - if err := ctx.EventManager().EmitTypedEvent( + if err := k.environment.EventService.EventManager(ctx).Emit( &group.EventProposalPruned{ ProposalId: proposal.Id, Status: proposal.Status, @@ -902,13 +891,13 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR return nil, err } } else { - store := k.storeService.OpenKVStore(goCtx) + store := k.environment.KVStoreService.OpenKVStore(ctx) if err := k.proposalTable.Update(store, proposal.Id, &proposal); err != nil { return nil, err } } - if err := ctx.EventManager().EmitTypedEvent(&group.EventExec{ + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventExec{ ProposalId: proposal.Id, Logs: logs, Result: proposal.ExecutorResult, @@ -922,7 +911,7 @@ func (k Keeper) Exec(goCtx context.Context, msg *group.MsgExec) (*group.MsgExecR } // LeaveGroup implements the MsgServer/LeaveGroup method. -func (k Keeper) LeaveGroup(goCtx context.Context, msg *group.MsgLeaveGroup) (*group.MsgLeaveGroupResponse, error) { +func (k Keeper) LeaveGroup(ctx context.Context, msg *group.MsgLeaveGroup) (*group.MsgLeaveGroupResponse, error) { if msg.GroupId == 0 { return nil, errorsmod.Wrap(errors.ErrEmpty, "group-id") } @@ -932,7 +921,6 @@ func (k Keeper) LeaveGroup(goCtx context.Context, msg *group.MsgLeaveGroup) (*gr return nil, errorsmod.Wrap(err, "group member") } - ctx := sdk.UnwrapSDKContext(goCtx) groupInfo, err := k.getGroupInfo(ctx, msg.GroupId) if err != nil { return nil, errorsmod.Wrap(err, "group") @@ -961,7 +949,7 @@ func (k Keeper) LeaveGroup(goCtx context.Context, msg *group.MsgLeaveGroup) (*gr return nil, err } - kvStore := k.storeService.OpenKVStore(goCtx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) // delete group member in the groupMemberTable. if err := k.groupMemberTable.Delete(kvStore, gm); err != nil { @@ -980,7 +968,7 @@ func (k Keeper) LeaveGroup(goCtx context.Context, msg *group.MsgLeaveGroup) (*gr return nil, err } - if err := ctx.EventManager().EmitTypedEvent(&group.EventLeaveGroup{ + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventLeaveGroup{ GroupId: msg.GroupId, Address: msg.Address, }); err != nil { @@ -990,8 +978,8 @@ func (k Keeper) LeaveGroup(goCtx context.Context, msg *group.MsgLeaveGroup) (*gr return &group.MsgLeaveGroupResponse{}, nil } -func (k Keeper) getGroupMember(ctx sdk.Context, member *group.GroupMember) (*group.GroupMember, error) { - kvStore := k.storeService.OpenKVStore(ctx) +func (k Keeper) getGroupMember(ctx context.Context, member *group.GroupMember) (*group.GroupMember, error) { + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) var groupMember group.GroupMember switch err := k.groupMemberTable.GetOne(kvStore, orm.PrimaryKey(member), &groupMember); { @@ -1013,7 +1001,7 @@ type ( // doUpdateGroupPolicy first makes sure that the group policy admin initiated the group policy update, // before performing the group policy update and emitting an event. -func (k Keeper) doUpdateGroupPolicy(ctx sdk.Context, reqGroupPolicy, reqAdmin string, action groupPolicyActionFn, note string) error { +func (k Keeper) doUpdateGroupPolicy(ctx context.Context, reqGroupPolicy, reqAdmin string, action groupPolicyActionFn, note string) error { groupPolicyAddr, err := k.accKeeper.AddressCodec().StringToBytes(reqGroupPolicy) if err != nil { return errorsmod.Wrap(err, "group policy address") @@ -1042,7 +1030,7 @@ func (k Keeper) doUpdateGroupPolicy(ctx sdk.Context, reqGroupPolicy, reqAdmin st return err } - if err = ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroupPolicy{Address: groupPolicyInfo.Address}); err != nil { + if err = k.environment.EventService.EventManager(ctx).Emit(&group.EventUpdateGroupPolicy{Address: groupPolicyInfo.Address}); err != nil { return err } @@ -1051,7 +1039,7 @@ func (k Keeper) doUpdateGroupPolicy(ctx sdk.Context, reqGroupPolicy, reqAdmin st // doUpdateGroup first makes sure that the group admin initiated the group update, // before performing the group update and emitting an event. -func (k Keeper) doUpdateGroup(ctx sdk.Context, groupID uint64, reqGroupAdmin string, action actionFn, errNote string) error { +func (k Keeper) doUpdateGroup(ctx context.Context, groupID uint64, reqGroupAdmin string, action actionFn, errNote string) error { groupInfo, err := k.getGroupInfo(ctx, groupID) if err != nil { return err @@ -1065,7 +1053,7 @@ func (k Keeper) doUpdateGroup(ctx sdk.Context, groupID uint64, reqGroupAdmin str return errorsmod.Wrap(err, errNote) } - if err := ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroup{GroupId: groupID}); err != nil { + if err := k.environment.EventService.EventManager(ctx).Emit(&group.EventUpdateGroup{GroupId: groupID}); err != nil { return err } @@ -1074,8 +1062,8 @@ func (k Keeper) doUpdateGroup(ctx sdk.Context, groupID uint64, reqGroupAdmin str // validateDecisionPolicies loops through all decision policies from the group, // and calls each of their Validate() method. -func (k Keeper) validateDecisionPolicies(ctx sdk.Context, g group.GroupInfo) error { - kvStore := k.storeService.OpenKVStore(ctx) +func (k Keeper) validateDecisionPolicies(ctx context.Context, g group.GroupInfo) error { + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) it, err := k.groupPolicyByGroupIndex.Get(kvStore, g.Id) if err != nil { return err diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index b880b2145ae3..b3024521d289 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -12,6 +12,8 @@ import ( "github.com/golang/mock/gomock" "cosmossdk.io/core/header" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/group" "cosmossdk.io/x/group/internal/math" @@ -19,6 +21,7 @@ import ( minttypes "cosmossdk.io/x/mint/types" "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -2024,10 +2027,12 @@ func (s *TestSuite) TestWithdrawProposal() { postRun: func(sdkCtx sdk.Context) { resp, err := s.groupKeeper.Proposal(s.ctx, &group.QueryProposalRequest{ProposalId: proposalID}) s.Require().NoError(err) + key := storetypes.NewKVStoreKey(group.StoreKey) + env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()) vpe := resp.Proposal.VotingPeriodEnd timeDiff := vpe.Sub(s.sdkCtx.HeaderInfo().Time) ctxVPE := sdkCtx.WithHeaderInfo(header.Info{Time: s.sdkCtx.HeaderInfo().Time.Add(timeDiff).Add(time.Second * 1)}) - s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE)) + s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE, env)) events := ctxVPE.EventManager().ABCIEvents() s.Require().True(eventTypeFound(events, EventProposalPruned)) diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index 361340de7eba..88ca0491637b 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -16,6 +16,7 @@ import ( // doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or // by the account of group policy only. Otherwise this gives access to other peoples accounts as the sdk middlewares are bypassed +// TODO: use context.Context and env bundler service once baseapp's MsgServiceHandler is migrated to use context.Context func (s Keeper) doExecuteMsgs(ctx sdk.Context, router baseapp.MessageRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress, decisionPolicy group.DecisionPolicy) ([]sdk.Result, error) { // Ensure it's not too early to execute the messages. minExecutionDate := proposal.SubmitTime.Add(decisionPolicy.GetMinExecutionPeriod()) diff --git a/x/group/keeper/tally.go b/x/group/keeper/tally.go index 4f567f72ef37..68a29acc5b6e 100644 --- a/x/group/keeper/tally.go +++ b/x/group/keeper/tally.go @@ -1,18 +1,19 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/group" "cosmossdk.io/x/group/errors" "cosmossdk.io/x/group/internal/orm" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Tally is a function that tallies a proposal by iterating through its votes, // and returns the tally result without modifying the proposal or any state. -func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupID uint64) (group.TallyResult, error) { +func (k Keeper) Tally(ctx context.Context, p group.Proposal, groupID uint64) (group.TallyResult, error) { // If proposal has already been tallied and updated, then its status is // accepted/rejected, in which case we just return the previously stored result. // @@ -22,7 +23,7 @@ func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupID uint64) (group. return p.FinalTallyResult, nil } - kvStore := k.storeService.OpenKVStore(ctx) + kvStore := k.environment.KVStoreService.OpenKVStore(ctx) it, err := k.voteByProposalIndex.Get(kvStore, p.Id) if err != nil { diff --git a/x/group/migrations/v2/migrate_test.go b/x/group/migrations/v2/migrate_test.go index ed60eab541b0..b83c014cd9ee 100644 --- a/x/group/migrations/v2/migrate_test.go +++ b/x/group/migrations/v2/migrate_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" corestore "cosmossdk.io/core/store" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/auth" authkeeper "cosmossdk.io/x/auth/keeper" @@ -82,7 +83,7 @@ func createGroupPolicies(ctx sdk.Context, storeService corestore.KVStoreService, // createOldPolicyAccount re-creates the group policy account using a module account func createOldPolicyAccount(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Codec, policies []sdk.AccAddress) ([]*authtypes.ModuleAccount, group.AccountKeeper) { - accountKeeper := authkeeper.NewAccountKeeper(cdc, runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey)), authtypes.ProtoBaseAccount, nil, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authorityAddr.String()) + accountKeeper := authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey)), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, nil, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authorityAddr.String()) oldPolicyAccounts := make([]*authtypes.ModuleAccount, len(policies)) for i, policyAddr := range policies { diff --git a/x/group/module/abci.go b/x/group/module/abci.go deleted file mode 100644 index 6cf2258af554..000000000000 --- a/x/group/module/abci.go +++ /dev/null @@ -1,17 +0,0 @@ -package module - -import ( - "cosmossdk.io/x/group/keeper" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// EndBlocker called at every block, updates proposal's `FinalTallyResult` and -// prunes expired proposals. -func EndBlocker(ctx sdk.Context, k keeper.Keeper) error { - if err := k.TallyProposalsAtVPEnd(ctx); err != nil { - return err - } - - return k.PruneProposals(ctx) -} diff --git a/x/group/module/depinject.go b/x/group/module/depinject.go index 21ff996905fd..3810847332f4 100644 --- a/x/group/module/depinject.go +++ b/x/group/module/depinject.go @@ -3,7 +3,6 @@ package module import ( modulev1 "cosmossdk.io/api/cosmos/group/module/v1" "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/group" @@ -30,7 +29,7 @@ type GroupInputs struct { depinject.In Config *modulev1.Module - StoreService store.KVStoreService + Environment appmodule.Environment Cdc codec.Codec AccountKeeper group.AccountKeeper BankKeeper group.BankKeeper @@ -46,7 +45,7 @@ type GroupOutputs struct { } func ProvideModule(in GroupInputs) GroupOutputs { - k := keeper.NewKeeper(in.StoreService, + k := keeper.NewKeeper(in.Environment, in.Cdc, in.MsgServiceRouter, in.AccountKeeper, diff --git a/x/group/module/module.go b/x/group/module/module.go index c2fbdcb09cdb..c756aa3b0938 100644 --- a/x/group/module/module.go +++ b/x/group/module/module.go @@ -148,8 +148,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // EndBlock implements the group module's EndBlock. func (am AppModule) EndBlock(ctx context.Context) error { - c := sdk.UnwrapSDKContext(ctx) - return EndBlocker(c, am.keeper) + return am.keeper.EndBlocker(ctx) } // GenerateGenesisState creates a randomized GenState of the group module. diff --git a/x/mint/go.mod b/x/mint/go.mod index bae813b69d45..6d98b67d1ffa 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -11,7 +11,7 @@ require ( cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/mint/go.sum b/x/mint/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/nft/go.mod b/x/nft/go.mod index 43d3d2c12127..b9773105076a 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -10,7 +10,7 @@ require ( cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/nft/go.sum b/x/nft/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/params/go.mod b/x/params/go.mod index 0c1d90dcb547..3a16261013c7 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -13,7 +13,7 @@ require ( cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/params/go.sum b/x/params/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index c7471d043d4f..01a9a8101cca 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/slashing/CHANGELOG.md b/x/slashing/CHANGELOG.md index 8c822a02c8ea..c5e3852773ef 100644 --- a/x/slashing/CHANGELOG.md +++ b/x/slashing/CHANGELOG.md @@ -29,6 +29,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* [#19458](https://github.com/cosmos/cosmos-sdk/pull/19458) Avoid writing SignInfo's for validator's who did not miss a block. (Every BeginBlock) * [#18959](https://github.com/cosmos/cosmos-sdk/pull/18959) Avoid deserialization of parameters with every validator lookup * [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `JailUntil` and `Tombstone` methods no longer panics if the signing info does not exist for the validator but instead returns error. @@ -41,5 +42,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * remove from `types`: `AddrPubkeyRelationKey` * remove from `Keeper`: `AddPubkey` * [#19440](https://github.com/cosmos/cosmos-sdk/pull/19440) Slashing Module creation takes `appmodule.Environment` instead of individual services +* [#19458](https://github.com/cosmos/cosmos-sdk/pull/19458) ValidatorSigningInfo.IndexOffset is deprecated, and no longer used. The index is now derived using just the StartHeight. ### Bug Fixes diff --git a/x/slashing/README.md b/x/slashing/README.md index 60848fb4c1d6..1a620c8c7d57 100644 --- a/x/slashing/README.md +++ b/x/slashing/README.md @@ -212,10 +212,11 @@ provisions and rewards. At the beginning of each block, we update the `ValidatorSigningInfo` for each validator and check if they've crossed below the liveness threshold over a sliding window. This sliding window is defined by `SignedBlocksWindow` and the -index in this window is determined by `IndexOffset` found in the validator's -`ValidatorSigningInfo`. For each block processed, the `IndexOffset` is incremented -regardless if the validator signed or not. Once the index is determined, the -`MissedBlocksBitArray` and `MissedBlocksCounter` are updated accordingly. +index in this window is determined by (`height - SignInfo.StartHeight`). +Notice that the position in the sliding window is incremented every block, +independent of whether the validator signed or not. +Once the index is determined, the `MissedBlocksBitArray` and +`MissedBlocksCounter` are updated accordingly. Finally, in order to determine if a validator crosses below the liveness threshold, we fetch the maximum number of blocks missed, `maxMissed`, which is @@ -235,10 +236,8 @@ for vote in block.LastCommitInfo.Votes { signInfo := GetValidatorSigningInfo(vote.Validator.Address) // This is a relative index, so we counts blocks the validator SHOULD have - // signed. We use the 0-value default signing info if not present, except for - // start height. - index := signInfo.IndexOffset % SignedBlocksWindow() - signInfo.IndexOffset++ + // signed. We use the 0-value default signing info if not present. + index := (height - signInfo.StartHeight) % SignedBlocksWindow() // Update MissedBlocksBitArray and MissedBlocksCounter. The MissedBlocksCounter // just tracks the sum of MissedBlocksBitArray. That way we avoid needing to diff --git a/x/slashing/go.mod b/x/slashing/go.mod index a740e03b5b5a..19c073fa950d 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -16,7 +16,7 @@ require ( github.com/bits-and-blooms/bitset v1.10.0 github.com/cockroachdb/errors v1.11.1 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index e79152cab9a4..19173486bd87 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -132,8 +132,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/slashing/keeper/genesis_test.go b/x/slashing/keeper/genesis_test.go index a46f3574f928..eee5bfe98d57 100644 --- a/x/slashing/keeper/genesis_test.go +++ b/x/slashing/keeper/genesis_test.go @@ -23,9 +23,9 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() { consStr2, err := s.stakingKeeper.ConsensusAddressCodec().BytesToString(consAddr2) require.NoError(err) - info1 := types.NewValidatorSigningInfo(consStr1, int64(4), int64(3), + info1 := types.NewValidatorSigningInfo(consStr1, int64(4), time.Now().UTC().Add(100000000000), false, int64(10)) - info2 := types.NewValidatorSigningInfo(consStr2, int64(5), int64(4), + info2 := types.NewValidatorSigningInfo(consStr2, int64(5), time.Now().UTC().Add(10000000000), false, int64(10)) s.Require().NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr1, info1)) diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index 9c4697745bc5..89afc2ae7f70 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -36,7 +36,6 @@ func (s *KeeperTestSuite) TestGRPCSigningInfo() { signingInfo := slashingtypes.NewValidatorSigningInfo( consStr, 0, - int64(0), time.Unix(2, 0), false, int64(0), @@ -66,7 +65,6 @@ func (s *KeeperTestSuite) TestGRPCSigningInfos() { signingInfo := slashingtypes.NewValidatorSigningInfo( consStr1, 0, - int64(0), time.Unix(2, 0), false, int64(0), diff --git a/x/slashing/keeper/hooks.go b/x/slashing/keeper/hooks.go index d0b389eebd78..9d92dd0a8853 100644 --- a/x/slashing/keeper/hooks.go +++ b/x/slashing/keeper/hooks.go @@ -39,7 +39,6 @@ func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddres signingInfo = types.NewValidatorSigningInfo( consStr, blockHeight, - 0, time.Unix(0, 0), false, 0, diff --git a/x/slashing/keeper/infractions.go b/x/slashing/keeper/infractions.go index 37fd458c976d..2b6b90cec626 100644 --- a/x/slashing/keeper/infractions.go +++ b/x/slashing/keeper/infractions.go @@ -58,12 +58,21 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t signedBlocksWindow := params.SignedBlocksWindow // Compute the relative index, so we count the blocks the validator *should* - // have signed. We will use the 0-value default signing info if not present, - // except for start height. The index is in the range [0, SignedBlocksWindow) + // have signed. We will also use the 0-value default signing info if not present. + // The index is in the range [0, SignedBlocksWindow) // and is used to see if a validator signed a block at the given height, which // is represented by a bit in the bitmap. - index := signInfo.IndexOffset % signedBlocksWindow - signInfo.IndexOffset++ + // The validator start height should get mapped to index 0, so we computed index as: + // (height - startHeight) % signedBlocksWindow + // + // NOTE: There is subtle different behavior between genesis validators and non-genesis validators. + // A genesis validator will start at index 0, whereas a non-genesis validator's startHeight will be the block + // they bonded on, but the first block they vote on will be one later. (And thus their first vote is at index 1) + index := (height - signInfo.StartHeight) % signedBlocksWindow + if signInfo.StartHeight > height { + return fmt.Errorf("invalid state, the validator %v has start height %d , which is greater than the current height %d (as parsed from the header)", + signInfo.Address, signInfo.StartHeight, height) + } // determine if the validator signed the previous block previous, err := k.GetMissedBlockBitmapValue(ctx, consAddr, index) @@ -71,6 +80,7 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t return errors.Wrap(err, "failed to get the validator's bitmap value") } + modifiedSignInfo := false missed := signed == comet.BlockIDFlagAbsent switch { case !previous && missed: @@ -81,6 +91,7 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t } signInfo.MissedBlocksCounter++ + modifiedSignInfo = true case previous && !missed: // Bitmap value has changed from missed to not missed, so we flip the bit @@ -90,6 +101,7 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t } signInfo.MissedBlocksCounter-- + modifiedSignInfo = true default: // bitmap value at this index has not changed, no need to update counter @@ -126,6 +138,7 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t // if we are past the minimum height and the validator has missed too many blocks, punish them if height > minHeight && signInfo.MissedBlocksCounter > maxMissed { + modifiedSignInfo = true validator, err := k.sk.ValidatorByConsAddr(ctx, consAddr) if err != nil { return err @@ -172,8 +185,9 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t // We need to reset the counter & bitmap so that the validator won't be // immediately slashed for downtime upon re-bonding. + // We don't set the start height as this will get correctly set + // once they bond again in the AfterValidatorBonded hook! signInfo.MissedBlocksCounter = 0 - signInfo.IndexOffset = 0 err = k.DeleteMissedBlockBitmap(ctx, consAddr) if err != nil { return err @@ -198,5 +212,8 @@ func (k Keeper) HandleValidatorSignatureWithParams(ctx context.Context, params t } // Set the updated signing info - return k.ValidatorSigningInfo.Set(ctx, consAddr, signInfo) + if modifiedSignInfo { + return k.ValidatorSigningInfo.Set(ctx, consAddr, signInfo) + } + return nil } diff --git a/x/slashing/keeper/msg_server_test.go b/x/slashing/keeper/msg_server_test.go index fc62a7f20fa9..39b04636328d 100644 --- a/x/slashing/keeper/msg_server_test.go +++ b/x/slashing/keeper/msg_server_test.go @@ -221,7 +221,7 @@ func (s *KeeperTestSuite) TestUnjail() { s.Require().NoError(err) - info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), int64(3), + info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), time.Unix(2, 0), false, int64(10)) s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info)) @@ -256,7 +256,7 @@ func (s *KeeperTestSuite) TestUnjail() { s.Require().NoError(err) - info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), int64(3), + info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), time.Unix(2, 0), true, int64(10)) s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info)) @@ -291,7 +291,7 @@ func (s *KeeperTestSuite) TestUnjail() { s.Require().NoError(err) - info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), int64(3), + info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), s.ctx.HeaderInfo().Time.AddDate(0, 0, 1), false, int64(10)) s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info)) @@ -326,7 +326,7 @@ func (s *KeeperTestSuite) TestUnjail() { val.Jailed = true s.Require().NoError(err) - info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), int64(3), + info := slashingtypes.NewValidatorSigningInfo(consStr, int64(4), time.Unix(2, 0), false, int64(10)) s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info)) diff --git a/x/slashing/keeper/signing_info_test.go b/x/slashing/keeper/signing_info_test.go index 824e3537281a..ff0c65bb17ef 100644 --- a/x/slashing/keeper/signing_info_test.go +++ b/x/slashing/keeper/signing_info_test.go @@ -22,7 +22,6 @@ func (s *KeeperTestSuite) TestValidatorSigningInfo() { signingInfo := slashingtypes.NewValidatorSigningInfo( consStr, ctx.BlockHeight(), - int64(3), time.Unix(2, 0), false, int64(10), @@ -34,7 +33,6 @@ func (s *KeeperTestSuite) TestValidatorSigningInfo() { info, err := keeper.ValidatorSigningInfo.Get(ctx, consAddr) require.NoError(err) require.Equal(info.StartHeight, ctx.BlockHeight()) - require.Equal(info.IndexOffset, int64(3)) require.Equal(info.JailedUntil, time.Unix(2, 0).UTC()) require.Equal(info.MissedBlocksCounter, int64(10)) @@ -126,7 +124,6 @@ func (s *KeeperTestSuite) TestPerformConsensusPubKeyUpdate() { newInfo := slashingtypes.NewValidatorSigningInfo( newConsAddr.String(), int64(4), - int64(3), time.Unix(2, 0).UTC(), false, int64(10), diff --git a/x/slashing/proto/cosmos/slashing/v1beta1/slashing.proto b/x/slashing/proto/cosmos/slashing/v1beta1/slashing.proto index 5398ec0d059d..0d6c4d2872b4 100644 --- a/x/slashing/proto/cosmos/slashing/v1beta1/slashing.proto +++ b/x/slashing/proto/cosmos/slashing/v1beta1/slashing.proto @@ -18,10 +18,10 @@ message ValidatorSigningInfo { string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; // Height at which validator was first a candidate OR was un-jailed int64 start_height = 2; - // Index which is incremented every time a validator is bonded in a block and + // DEPRECATED: Index which is incremented every time a validator is bonded in a block and // _may_ have signed a pre-commit or not. This in conjunction with the // signed_blocks_window param determines the index in the missed block bitmap. - int64 index_offset = 3; + int64 index_offset = 3 [deprecated = true]; // Timestamp until which the validator is jailed due to liveness downtime. google.protobuf.Timestamp jailed_until = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; diff --git a/x/slashing/simulation/decoder_test.go b/x/slashing/simulation/decoder_test.go index 6f28d250a649..8d62e18fa36b 100644 --- a/x/slashing/simulation/decoder_test.go +++ b/x/slashing/simulation/decoder_test.go @@ -31,7 +31,7 @@ func TestDecodeStore(t *testing.T) { consAddrStr1, err := addresscodec.NewBech32Codec("cosmosvalcons").BytesToString(consAddr1) require.NoError(t, err) - info := types.NewValidatorSigningInfo(consAddrStr1, 0, 1, time.Now().UTC(), false, 0) + info := types.NewValidatorSigningInfo(consAddrStr1, 0, time.Now().UTC(), false, 0) kvPairs := kv.Pairs{ Pairs: []kv.Pair{ diff --git a/x/slashing/types/signing_info.go b/x/slashing/types/signing_info.go index 8fa00aa96bf1..e55796010fa3 100644 --- a/x/slashing/types/signing_info.go +++ b/x/slashing/types/signing_info.go @@ -6,13 +6,12 @@ import ( // NewValidatorSigningInfo creates a new ValidatorSigningInfo instance func NewValidatorSigningInfo( - consAddr string, startHeight, indexOffset int64, + consAddr string, startHeight int64, jailedUntil time.Time, tombstoned bool, missedBlocksCounter int64, ) ValidatorSigningInfo { return ValidatorSigningInfo{ Address: consAddr, StartHeight: startHeight, - IndexOffset: indexOffset, JailedUntil: jailedUntil, Tombstoned: tombstoned, MissedBlocksCounter: missedBlocksCounter, diff --git a/x/slashing/types/slashing.pb.go b/x/slashing/types/slashing.pb.go index 92ffd3501eb6..68390e2fd3c3 100644 --- a/x/slashing/types/slashing.pb.go +++ b/x/slashing/types/slashing.pb.go @@ -37,10 +37,10 @@ type ValidatorSigningInfo struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Height at which validator was first a candidate OR was un-jailed StartHeight int64 `protobuf:"varint,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` - // Index which is incremented every time a validator is bonded in a block and + // DEPRECATED: Index which is incremented every time a validator is bonded in a block and // _may_ have signed a pre-commit or not. This in conjunction with the // signed_blocks_window param determines the index in the missed block bitmap. - IndexOffset int64 `protobuf:"varint,3,opt,name=index_offset,json=indexOffset,proto3" json:"index_offset,omitempty"` + IndexOffset int64 `protobuf:"varint,3,opt,name=index_offset,json=indexOffset,proto3" json:"index_offset,omitempty"` // Deprecated: Do not use. // Timestamp until which the validator is jailed due to liveness downtime. JailedUntil time.Time `protobuf:"bytes,4,opt,name=jailed_until,json=jailedUntil,proto3,stdtime" json:"jailed_until"` // Whether or not a validator has been tombstoned (killed out of validator @@ -99,6 +99,7 @@ func (m *ValidatorSigningInfo) GetStartHeight() int64 { return 0 } +// Deprecated: Do not use. func (m *ValidatorSigningInfo) GetIndexOffset() int64 { if m != nil { return m.IndexOffset @@ -193,47 +194,47 @@ func init() { } var fileDescriptor_1078e5d96a74cc52 = []byte{ - // 625 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x4f, 0xd4, 0x40, - 0x18, 0xdd, 0x01, 0x44, 0x9d, 0xc5, 0x83, 0xe3, 0x22, 0x65, 0x95, 0xee, 0xc2, 0xc1, 0x6c, 0x48, - 0x68, 0x05, 0x13, 0x0f, 0x70, 0x72, 0xd9, 0x18, 0x35, 0x24, 0x92, 0xc5, 0x1f, 0x89, 0x07, 0x9b, - 0x69, 0x67, 0xb6, 0x3b, 0xd2, 0xce, 0x6c, 0x3a, 0x53, 0x17, 0xfe, 0x05, 0x13, 0x13, 0x8e, 0x1e, - 0x3d, 0x72, 0xe4, 0xc0, 0x3f, 0xe0, 0x8d, 0x23, 0xe1, 0x64, 0x3c, 0xa0, 0xd9, 0x3d, 0xe0, 0x9f, - 0x61, 0x3a, 0xd3, 0x2e, 0x08, 0x37, 0x2e, 0x4d, 0xfb, 0xde, 0xfb, 0xde, 0x37, 0xdf, 0x9b, 0x2f, - 0x85, 0x8f, 0x02, 0x21, 0x63, 0x21, 0x5d, 0x19, 0x61, 0xd9, 0x65, 0x3c, 0x74, 0x3f, 0x2f, 0xfb, - 0x54, 0xe1, 0xe5, 0x11, 0xe0, 0xf4, 0x12, 0xa1, 0x04, 0x9a, 0x31, 0x3a, 0x67, 0x04, 0xe7, 0xba, - 0x6a, 0x25, 0x14, 0xa1, 0xd0, 0x1a, 0x37, 0x7b, 0x33, 0xf2, 0xaa, 0x1d, 0x0a, 0x11, 0x46, 0xd4, - 0xd5, 0x5f, 0x7e, 0xda, 0x71, 0x49, 0x9a, 0x60, 0xc5, 0x04, 0xcf, 0xf9, 0xda, 0x65, 0x5e, 0xb1, - 0x98, 0x4a, 0x85, 0xe3, 0x5e, 0x2e, 0x98, 0x35, 0xfd, 0x3c, 0xe3, 0x9c, 0x37, 0x37, 0xd4, 0x5d, - 0x1c, 0x33, 0x2e, 0x5c, 0xfd, 0x34, 0xd0, 0xc2, 0x8f, 0x31, 0x58, 0x79, 0x87, 0x23, 0x46, 0xb0, - 0x12, 0xc9, 0x16, 0x0b, 0x39, 0xe3, 0xe1, 0x4b, 0xde, 0x11, 0x68, 0x0d, 0xde, 0xc4, 0x84, 0x24, - 0x54, 0x4a, 0x0b, 0xd4, 0x41, 0xe3, 0x76, 0x73, 0xfe, 0xe4, 0x70, 0x69, 0x2e, 0xb7, 0x5b, 0x17, - 0x5c, 0x52, 0x2e, 0x53, 0xf9, 0xcc, 0x48, 0xb6, 0x54, 0xc2, 0x78, 0xd8, 0x2e, 0x2a, 0xd0, 0x3c, - 0x9c, 0x92, 0x0a, 0x27, 0xca, 0xeb, 0x52, 0x16, 0x76, 0x95, 0x35, 0x56, 0x07, 0x8d, 0xf1, 0x76, - 0x59, 0x63, 0x2f, 0x34, 0x94, 0x49, 0x18, 0x27, 0x74, 0xc7, 0x13, 0x9d, 0x8e, 0xa4, 0xca, 0x1a, - 0x37, 0x12, 0x8d, 0xbd, 0xd6, 0x10, 0xda, 0x80, 0x53, 0x9f, 0x30, 0x8b, 0x28, 0xf1, 0x52, 0xae, - 0x58, 0x64, 0x4d, 0xd4, 0x41, 0xa3, 0xbc, 0x52, 0x75, 0x4c, 0x02, 0x4e, 0x91, 0x80, 0xf3, 0xa6, - 0x48, 0xa0, 0x79, 0xe7, 0xe8, 0xb4, 0x56, 0xda, 0xfb, 0x5d, 0x03, 0xfb, 0x67, 0x07, 0x8b, 0xa0, - 0x5d, 0x36, 0xe5, 0x6f, 0xb3, 0x6a, 0x64, 0x43, 0xa8, 0x44, 0xec, 0x4b, 0x25, 0x38, 0x25, 0xd6, - 0x8d, 0x3a, 0x68, 0xdc, 0x6a, 0x5f, 0x40, 0xd0, 0x0a, 0x9c, 0x8e, 0x99, 0x94, 0x94, 0x78, 0x7e, - 0x24, 0x82, 0x6d, 0xe9, 0x05, 0x22, 0xe5, 0x8a, 0x26, 0xd6, 0xa4, 0x3e, 0xd9, 0x3d, 0x43, 0x36, - 0x35, 0xb7, 0x6e, 0xa8, 0xd5, 0x89, 0xbf, 0xdf, 0x6b, 0x60, 0xe1, 0xeb, 0x04, 0x9c, 0xdc, 0xc4, - 0x09, 0x8e, 0x25, 0x7a, 0x0c, 0x2b, 0x92, 0x85, 0xfc, 0xdc, 0xa4, 0xcf, 0x38, 0x11, 0x7d, 0x1d, - 0xe1, 0x78, 0x1b, 0x19, 0xce, 0x78, 0xbc, 0xd7, 0x0c, 0x62, 0x59, 0x5b, 0xee, 0xe5, 0x55, 0x3d, - 0x9a, 0x14, 0x25, 0x59, 0x66, 0x53, 0xcd, 0xa7, 0xd9, 0x44, 0xbf, 0x4e, 0x6b, 0x0f, 0x4c, 0xf2, - 0x92, 0x6c, 0x3b, 0x4c, 0xb8, 0x31, 0x56, 0x5d, 0x67, 0x83, 0x86, 0x38, 0xd8, 0x6d, 0xd1, 0xe0, - 0xe4, 0x70, 0x09, 0xe6, 0x17, 0xd3, 0xa2, 0x81, 0x19, 0x1d, 0xc5, 0x8c, 0x6f, 0x69, 0xcf, 0x4d, - 0x9a, 0xe4, 0xad, 0x3e, 0xc2, 0xfb, 0x44, 0xf4, 0x79, 0xb6, 0x30, 0x5e, 0x96, 0x8c, 0x57, 0xac, - 0x96, 0x0e, 0xbf, 0xbc, 0x32, 0x7b, 0x25, 0xd9, 0x56, 0x2e, 0x30, 0xc1, 0x7e, 0x1b, 0x05, 0x5b, - 0x29, 0x7c, 0x5e, 0x61, 0x16, 0x15, 0x22, 0x24, 0x61, 0x55, 0x2f, 0xb9, 0xd7, 0x49, 0x70, 0x90, - 0x21, 0x1e, 0x11, 0xa9, 0x1f, 0x51, 0x3d, 0x9c, 0xbe, 0xbd, 0xeb, 0xcf, 0x33, 0xa3, 0x9d, 0x9f, - 0xe7, 0xc6, 0x2d, 0xed, 0x9b, 0xcd, 0x87, 0x38, 0x9c, 0xb9, 0xd2, 0xd4, 0x9c, 0x4d, 0xdf, 0xf1, - 0xf5, 0x3b, 0x4e, 0x5f, 0xea, 0x68, 0x4c, 0x57, 0xe7, 0xbf, 0x9c, 0x1d, 0x2c, 0x3e, 0x34, 0xe2, - 0x25, 0x49, 0xb6, 0xdd, 0x9d, 0xf3, 0x3f, 0x80, 0x59, 0x82, 0xe6, 0xda, 0xfe, 0xc0, 0x06, 0x47, - 0x03, 0x1b, 0x1c, 0x0f, 0x6c, 0xf0, 0x67, 0x60, 0x83, 0xbd, 0xa1, 0x5d, 0x3a, 0x1e, 0xda, 0xa5, - 0x9f, 0x43, 0xbb, 0xf4, 0x61, 0xee, 0xbf, 0x73, 0x5c, 0xa8, 0x56, 0xbb, 0x3d, 0x2a, 0xfd, 0x49, - 0x1d, 0xfe, 0x93, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x18, 0xd0, 0xfc, 0x71, 0x5f, 0x04, 0x00, - 0x00, + // 633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0x00, 0x3f, 0x7e, 0x3a, 0xad, 0x07, 0xc7, 0x22, 0x4b, 0x95, 0x6d, 0x21, 0xd1, 0x34, + 0x24, 0xec, 0x0a, 0x26, 0x1e, 0xe0, 0x64, 0x69, 0x8c, 0x1a, 0x12, 0xc9, 0xe2, 0x9f, 0xc4, 0x83, + 0x9b, 0xd9, 0x9d, 0xe9, 0x76, 0x64, 0x77, 0xa6, 0xd9, 0x99, 0x15, 0xf8, 0x0a, 0x26, 0x26, 0x1c, + 0x3d, 0x7a, 0xe4, 0xc8, 0x81, 0xaf, 0x60, 0xc2, 0x91, 0x70, 0x32, 0x1e, 0xd0, 0x94, 0x03, 0x7e, + 0x0c, 0xb3, 0x33, 0xbb, 0x80, 0x70, 0xe3, 0xd2, 0xb4, 0xcf, 0xf3, 0xbc, 0xcf, 0x3b, 0xef, 0xf3, + 0xbe, 0x29, 0x7c, 0x18, 0x0a, 0x99, 0x08, 0xe9, 0xca, 0x18, 0xcb, 0x3e, 0xe3, 0x91, 0xfb, 0x69, + 0x21, 0xa0, 0x0a, 0x2f, 0x9c, 0x01, 0xce, 0x20, 0x15, 0x4a, 0xa0, 0x49, 0xa3, 0x73, 0xce, 0xe0, + 0x42, 0xd7, 0xa8, 0x47, 0x22, 0x12, 0x5a, 0xe3, 0xe6, 0xdf, 0x8c, 0xbc, 0x61, 0x47, 0x42, 0x44, + 0x31, 0x75, 0xf5, 0xaf, 0x20, 0xeb, 0xb9, 0x24, 0x4b, 0xb1, 0x62, 0x82, 0x17, 0x7c, 0xf3, 0x32, + 0xaf, 0x58, 0x42, 0xa5, 0xc2, 0xc9, 0xa0, 0x10, 0x4c, 0x99, 0x7e, 0xbe, 0x71, 0x2e, 0x9a, 0x1b, + 0xea, 0x36, 0x4e, 0x18, 0x17, 0xae, 0xfe, 0x34, 0xd0, 0xec, 0xf7, 0x11, 0x58, 0x7f, 0x8b, 0x63, + 0x46, 0xb0, 0x12, 0xe9, 0x3a, 0x8b, 0x38, 0xe3, 0xd1, 0x0b, 0xde, 0x13, 0x68, 0x19, 0xfe, 0x8f, + 0x09, 0x49, 0xa9, 0x94, 0x16, 0x68, 0x81, 0xf6, 0xcd, 0xce, 0xcc, 0xd1, 0xfe, 0xfc, 0x74, 0x61, + 0xb7, 0x22, 0xb8, 0xa4, 0x5c, 0x66, 0xf2, 0xa9, 0x91, 0xac, 0xab, 0x94, 0xf1, 0xc8, 0x2b, 0x2b, + 0xd0, 0x0c, 0xac, 0x49, 0x85, 0x53, 0xe5, 0xf7, 0x29, 0x8b, 0xfa, 0xca, 0x1a, 0x69, 0x81, 0xf6, + 0xa8, 0x57, 0xd5, 0xd8, 0x73, 0x0d, 0xa1, 0x07, 0xb0, 0xc6, 0x38, 0xa1, 0x5b, 0xbe, 0xe8, 0xf5, + 0x24, 0x55, 0xd6, 0x68, 0x2e, 0xe9, 0x8c, 0x58, 0xc0, 0xab, 0x6a, 0xfc, 0x95, 0x86, 0xd1, 0x2a, + 0xac, 0x7d, 0xc4, 0x2c, 0xa6, 0xc4, 0xcf, 0xb8, 0x62, 0xb1, 0x35, 0xd6, 0x02, 0xed, 0xea, 0x62, + 0xc3, 0x31, 0x29, 0x38, 0x65, 0x0a, 0xce, 0xeb, 0x32, 0x85, 0xce, 0xad, 0x83, 0xe3, 0x66, 0x65, + 0xe7, 0x57, 0x13, 0xec, 0x9e, 0xee, 0xcd, 0x01, 0xaf, 0x6a, 0xca, 0xdf, 0xe4, 0xd5, 0xc8, 0x86, + 0x50, 0x89, 0x24, 0x90, 0x4a, 0x70, 0x4a, 0xac, 0xff, 0x5a, 0xa0, 0x7d, 0xc3, 0xbb, 0x80, 0xa0, + 0x45, 0x38, 0x91, 0x30, 0x29, 0x29, 0xf1, 0x83, 0x58, 0x84, 0x1b, 0xd2, 0x0f, 0x45, 0xc6, 0x15, + 0x4d, 0xad, 0x71, 0x3d, 0xc0, 0x1d, 0x43, 0x76, 0x34, 0xb7, 0x62, 0xa8, 0xa5, 0xb1, 0x3f, 0xdf, + 0x9a, 0x60, 0xf6, 0xcb, 0x18, 0x1c, 0x5f, 0xc3, 0x29, 0x4e, 0x24, 0x7a, 0x04, 0xeb, 0x92, 0x45, + 0xfc, 0xdc, 0x64, 0x93, 0x71, 0x22, 0x36, 0x75, 0x8c, 0xa3, 0x1e, 0x32, 0x9c, 0xf1, 0x78, 0xa7, + 0x19, 0xc4, 0xf2, 0xb6, 0xdc, 0x2f, 0xaa, 0x06, 0x34, 0x2d, 0x4b, 0xf2, 0xdc, 0x6a, 0x9d, 0x27, + 0xf9, 0x44, 0x3f, 0x8f, 0x9b, 0xf7, 0x4c, 0xfa, 0x92, 0x6c, 0x38, 0x4c, 0xb8, 0x09, 0x56, 0x7d, + 0x67, 0x95, 0x46, 0x38, 0xdc, 0xee, 0xd2, 0xf0, 0x68, 0x7f, 0x1e, 0x16, 0xcb, 0xe9, 0xd2, 0xd0, + 0x8c, 0x8e, 0x12, 0xc6, 0xd7, 0xb5, 0xe7, 0x1a, 0x4d, 0x8b, 0x56, 0x1f, 0xe0, 0x5d, 0x22, 0x36, + 0x79, 0x7e, 0x34, 0x7e, 0x9e, 0x8c, 0x5f, 0x9e, 0x97, 0x5e, 0x40, 0x75, 0x71, 0xea, 0x4a, 0xb2, + 0xdd, 0x42, 0x60, 0x82, 0xfd, 0x7a, 0x16, 0x6c, 0xbd, 0xf4, 0x79, 0x89, 0x59, 0x5c, 0x8a, 0x90, + 0x84, 0x0d, 0x7d, 0xe8, 0x7e, 0x2f, 0xc5, 0x61, 0x8e, 0xf8, 0x44, 0x64, 0x41, 0x4c, 0xf5, 0x70, + 0x7a, 0x7b, 0xd7, 0x9f, 0x67, 0x52, 0x3b, 0x3f, 0x2b, 0x8c, 0xbb, 0xda, 0x37, 0x9f, 0x0f, 0x71, + 0x38, 0x79, 0xa5, 0xa9, 0x79, 0x9b, 0xde, 0xf1, 0xf5, 0x3b, 0x4e, 0x5c, 0xea, 0x68, 0x4c, 0x97, + 0x66, 0x3e, 0x9f, 0xee, 0xcd, 0xdd, 0x37, 0xe2, 0x79, 0x49, 0x36, 0xdc, 0xad, 0xf3, 0x7f, 0x01, + 0x73, 0x04, 0x9d, 0xe5, 0xdd, 0xa1, 0x0d, 0x0e, 0x86, 0x36, 0x38, 0x1c, 0xda, 0xe0, 0xf7, 0xd0, + 0x06, 0x3b, 0x27, 0x76, 0xe5, 0xf0, 0xc4, 0xae, 0xfc, 0x38, 0xb1, 0x2b, 0xef, 0xa7, 0xff, 0x79, + 0xc7, 0x85, 0x6a, 0xb5, 0x3d, 0xa0, 0x32, 0x18, 0xd7, 0xe1, 0x3f, 0xfe, 0x1b, 0x00, 0x00, 0xff, + 0xff, 0x57, 0xe6, 0xe5, 0x80, 0x63, 0x04, 0x00, 0x00, } func (this *ValidatorSigningInfo) Equal(that interface{}) bool { diff --git a/x/staking/go.mod b/x/staking/go.mod index 611b44ea4d55..72802567e028 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -12,7 +12,7 @@ require ( cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.2 github.com/cometbft/cometbft v0.38.5 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 diff --git a/x/staking/go.sum b/x/staking/go.sum index fe813734d17d..dd7ad289fa86 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -130,8 +130,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 4dbe93dd81c6..6b70d5121a78 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -1195,11 +1195,15 @@ func (k Keeper) ValidateUnbondAmount( return shares, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "invalid shares amount") } - // Cap the shares at the delegation's shares. Shares being greater could occur - // due to rounding, however we don't want to truncate the shares or take the - // minimum because we want to allow for the full withdraw of shares from a - // delegation. - if shares.GT(delShares) { + // Depending on the share, amount can be smaller than unit amount(1stake). + // If the remain amount after unbonding is smaller than the minimum share, + // it's completely unbonded to avoid leaving dust shares. + tolerance, err := validator.SharesFromTokens(math.OneInt()) + if err != nil { + return shares, err + } + + if delShares.Sub(shares).LT(tolerance) { shares = delShares } diff --git a/x/staking/keeper/delegation_test.go b/x/staking/keeper/delegation_test.go index c2200e04867e..883073748965 100644 --- a/x/staking/keeper/delegation_test.go +++ b/x/staking/keeper/delegation_test.go @@ -1176,3 +1176,51 @@ func (s *KeeperTestSuite) TestSetUnbondingDelegationEntry() { // unbondingID comes from a global counter -> gaps in unbondingIDs are OK as long as every unbondingID is unique require.Equal(uint64(2), resUnbonding.Entries[1].UnbondingId) } + +func (s *KeeperTestSuite) TestUndelegateWithDustShare() { + ctx, keeper := s.ctx, s.stakingKeeper + require := s.Require() + + addrDels, valAddrs := createValAddrs(2) + + s.accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() + + // construct the validators[0] & slash 1stake + amt := math.NewInt(100) + validator := testutil.NewValidator(s.T(), valAddrs[0], PKs[0]) + validator, _ = validator.AddTokensFromDel(amt) + validator = validator.RemoveTokens(math.NewInt(1)) + validator = stakingkeeper.TestingUpdateValidator(keeper, ctx, validator, true) + + // first add a validators[0] to delegate too + bond1to1 := stakingtypes.NewDelegation(addrDels[0].String(), valAddrs[0].String(), math.LegacyNewDec(100)) + require.NoError(keeper.SetDelegation(ctx, bond1to1)) + resBond, err := keeper.Delegations.Get(ctx, collections.Join(addrDels[0], valAddrs[0])) + require.NoError(err) + require.Equal(bond1to1, resBond) + + // second delegators[1] add a validators[0] to delegate + bond2to1 := stakingtypes.NewDelegation(addrDels[1].String(), valAddrs[0].String(), math.LegacyNewDec(1)) + validator, delegatorShare := validator.AddTokensFromDel(math.NewInt(1)) + bond2to1.Shares = delegatorShare + _ = stakingkeeper.TestingUpdateValidator(keeper, ctx, validator, true) + require.NoError(keeper.SetDelegation(ctx, bond2to1)) + resBond, err = keeper.Delegations.Get(ctx, collections.Join(addrDels[1], valAddrs[0])) + require.NoError(err) + require.Equal(bond2to1, resBond) + + // check delegation state + delegations, err := keeper.GetValidatorDelegations(ctx, valAddrs[0]) + require.NoError(err) + require.Equal(2, len(delegations)) + + // undelegate all delegator[0]'s delegate + _, err = s.msgServer.Undelegate(ctx, stakingtypes.NewMsgUndelegate(addrDels[0].String(), valAddrs[0].String(), sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(99)))) + require.NoError(err) + + // remain only delegator[1]'s delegate + delegations, err = keeper.GetValidatorDelegations(ctx, valAddrs[0]) + require.NoError(err) + require.Equal(1, len(delegations)) + require.Equal(delegations[0].DelegatorAddress, addrDels[1].String()) +} diff --git a/x/tx/go.mod b/x/tx/go.mod index 76d72d11749c..cc9c8510d2b4 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/core v0.11.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.2.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/gogoproto v1.4.11 github.com/google/go-cmp v0.6.0 github.com/google/gofuzz v1.2.0 diff --git a/x/tx/go.sum b/x/tx/go.sum index 66edb5ad6862..fe45c7cb2cbf 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -6,8 +6,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 37783356c74a..96c5fd07d55a 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -13,7 +13,7 @@ require ( cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 github.com/cometbft/cometbft v0.38.5 github.com/cosmos/cosmos-db v1.0.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.4 github.com/cosmos/cosmos-sdk v0.51.0 github.com/cosmos/gogoproto v1.4.11 github.com/golang/protobuf v1.5.3 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index e0f79611f6a7..4158ade1b774 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -332,8 +332,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= -github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= -github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= +github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=