From e5aa3e6adcb744f8a36b5565b169233c890773a9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 11:08:06 +0100 Subject: [PATCH 01/15] fix(x/distribution): fee pool is still used and still accrues --- .../v1beta1/distribution.pulsar.go | 158 +++++++++--------- api/cosmos/nft/v1beta1/query.pulsar.go | 20 +++ api/cosmos/nft/v1beta1/query_grpc.pb.go | 20 +++ .../distribution/v1beta1/distribution.proto | 2 + testutil/testdata/query.pb.go | 7 +- testutil/testdata/testdata.pb.go | 7 +- testutil/testdata/testpb/query.pulsar.go | 7 +- testutil/testdata/testpb/query_grpc.pb.go | 1 - testutil/testdata/testpb/testdata.pulsar.go | 7 +- testutil/testdata/testpb/tx.pulsar.go | 9 +- testutil/testdata/testpb/tx_grpc.pb.go | 1 - .../testdata/testpb/unknonwnproto.pulsar.go | 13 +- testutil/testdata/tx.pb.go | 7 +- testutil/testdata/unknonwnproto.pb.go | 7 +- x/distribution/README.md | 132 +-------------- x/distribution/keeper/allocation.go | 25 +-- x/distribution/keeper/genesis.go | 5 +- x/distribution/keeper/keeper.go | 7 +- x/distribution/keeper/migrations.go | 16 +- .../{funds/migrate.go => v4/migrate_funds.go} | 5 +- .../migrate_funds_test.go} | 6 +- x/distribution/module.go | 6 +- x/distribution/types/distribution.pb.go | 132 ++++++++------- x/distribution/types/fee_pool.go | 1 + x/nft/query.pb.go | 40 +++++ 25 files changed, 296 insertions(+), 345 deletions(-) rename x/distribution/migrations/{funds/migrate.go => v4/migrate_funds.go} (88%) rename x/distribution/migrations/{funds/migrate_test.go => v4/migrate_funds_test.go} (96%) diff --git a/api/cosmos/distribution/v1beta1/distribution.pulsar.go b/api/cosmos/distribution/v1beta1/distribution.pulsar.go index 73f5ec266876..5ae99f03ed86 100644 --- a/api/cosmos/distribution/v1beta1/distribution.pulsar.go +++ b/api/cosmos/distribution/v1beta1/distribution.pulsar.go @@ -6925,6 +6925,8 @@ func (x *ValidatorSlashEvents) GetValidatorSlashEvents() []*ValidatorSlashEvent } // FeePool is the global fee pool for distribution. +// +// Deprecated: Do not use. type FeePool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7304,7 +7306,7 @@ var file_cosmos_distribution_v1beta1_distribution_proto_rawDesc = []byte{ 0x74, 0x61, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x07, 0x46, 0x65, 0x65, + 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x07, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x7d, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, @@ -7313,83 +7315,83 @@ var file_cosmos_distribution_v1beta1_distribution_proto_rawDesc = []byte{ 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, - 0x6f, 0x6f, 0x6c, 0x22, 0x97, 0x02, 0x0a, 0x1a, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, - 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x3a, 0x28, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0xca, - 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xd4, 0x01, - 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, - 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, - 0x12, 0x4c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 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, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, 0x44, - 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2c, - 0xea, 0xde, 0x1f, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0xa2, 0xe7, 0xb0, 0x2a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x68, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x22, 0xe1, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, - 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, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, - 0x42, 0x38, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, - 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xd5, 0x01, 0x0a, 0x25, 0x43, 0x6f, 0x6d, - 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x50, - 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x44, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, - 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x3a, 0x24, 0x18, 0x01, 0x88, 0xa0, - 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x42, 0x88, 0x02, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x44, - 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, - 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x27, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6f, 0x6f, 0x6c, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x97, 0x02, 0x0a, 0x1a, 0x43, 0x6f, 0x6d, 0x6d, + 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x79, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x28, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xe8, + 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x22, 0xd4, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x27, 0x0a, 0x0f, 0x70, + 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x65, + 0x72, 0x69, 0x6f, 0x64, 0x12, 0x4c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 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, 0x05, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x2c, 0xea, 0xde, 0x1f, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa2, 0xe7, 0xb0, 0x2a, 0x0f, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0xe1, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x6f, 0x72, 0x5f, 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, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xd5, 0x01, 0x0a, + 0x25, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, + 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x44, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x3a, 0x24, + 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x42, 0x88, 0x02, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x64, 0x69, 0x73, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, + 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 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/cosmos/nft/v1beta1/query.pulsar.go b/api/cosmos/nft/v1beta1/query.pulsar.go index 5f0101a7084d..764855b26a88 100644 --- a/api/cosmos/nft/v1beta1/query.pulsar.go +++ b/api/cosmos/nft/v1beta1/query.pulsar.go @@ -10998,6 +10998,8 @@ func (x *QueryBalanceRequest) GetOwner() string { } // QueryBalanceByQueryStringRequest is the request type for the Query/Balance RPC method +// +// Since: nft v0.1.1 type QueryBalanceByQueryStringRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11081,6 +11083,8 @@ func (x *QueryBalanceResponse) GetAmount() uint64 { } // QueryBalanceByQueryStringResponse is the response type for the Query/Balance RPC method +// +// Since: nft v0.1.1 type QueryBalanceByQueryStringResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11164,6 +11168,8 @@ func (x *QueryOwnerRequest) GetId() string { } // QueryOwnerByQueryStringRequest is the request type for the Query/Owner RPC method +// +// Since: nft v0.1.1 type QueryOwnerByQueryStringRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11247,6 +11253,8 @@ func (x *QueryOwnerResponse) GetOwner() string { } // QueryOwnerByQueryStringResponse is the response type for the Query/Owner RPC method +// +// Since: nft v0.1.1 type QueryOwnerByQueryStringResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11321,6 +11329,8 @@ func (x *QuerySupplyRequest) GetClassId() string { } // QuerySupplyByQueryStringRequest is the request type for the Query/Supply RPC method +// +// Since: nft v0.1.1 type QuerySupplyByQueryStringRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11395,6 +11405,8 @@ func (x *QuerySupplyResponse) GetAmount() uint64 { } // QuerySupplyByQueryStringResponse is the response type for the Query/Supply RPC method +// +// Since: nft v0.1.1 type QuerySupplyByQueryStringResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11579,6 +11591,8 @@ func (x *QueryNFTRequest) GetId() string { } // QueryNFTByQueryStringRequest is the request type for the Query/NFT RPC method +// +// Since: nft v0.1.1 type QueryNFTByQueryStringRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11662,6 +11676,8 @@ func (x *QueryNFTResponse) GetNft() *NFT { } // QueryNFTByQueryStringResponse is the response type for the Query/NFT RPC method +// +// Since: nft v0.1.1 type QueryNFTByQueryStringResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11736,6 +11752,8 @@ func (x *QueryClassRequest) GetClassId() string { } // QueryClassByQueryStringRequest is the request type for the Query/Class RPC method +// +// Since: nft v0.1.1 type QueryClassByQueryStringRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11810,6 +11828,8 @@ func (x *QueryClassResponse) GetClass() *Class { } // QueryClassByQueryStringResponse is the response type for the Query/Class RPC method +// +// Since: nft v0.1.1 type QueryClassByQueryStringResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/cosmos/nft/v1beta1/query_grpc.pb.go b/api/cosmos/nft/v1beta1/query_grpc.pb.go index d25acc384af2..df71c4359a94 100644 --- a/api/cosmos/nft/v1beta1/query_grpc.pb.go +++ b/api/cosmos/nft/v1beta1/query_grpc.pb.go @@ -40,14 +40,20 @@ type QueryClient interface { // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) // BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + // + // Since: nft v0.1.1 BalanceByQueryString(ctx context.Context, in *QueryBalanceByQueryStringRequest, opts ...grpc.CallOption) (*QueryBalanceByQueryStringResponse, error) // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) // OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + // + // Since: nft v0.1.1 OwnerByQueryString(ctx context.Context, in *QueryOwnerByQueryStringRequest, opts ...grpc.CallOption) (*QueryOwnerByQueryStringResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) // SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721. + // + // Since: nft v0.1.1 SupplyByQueryString(ctx context.Context, in *QuerySupplyByQueryStringRequest, opts ...grpc.CallOption) (*QuerySupplyByQueryStringResponse, error) // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in // ERC721Enumerable @@ -55,10 +61,14 @@ type QueryClient interface { // NFT queries an NFT based on its class and id. NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) // NFTByQueryString queries an NFT based on its class and id. + // + // Since: nft v0.1.1 NFTByQueryString(ctx context.Context, in *QueryNFTByQueryStringRequest, opts ...grpc.CallOption) (*QueryNFTByQueryStringResponse, error) // Class queries an NFT class based on its id Class(ctx context.Context, in *QueryClassRequest, opts ...grpc.CallOption) (*QueryClassResponse, error) // Class queries an NFT class based on its id + // + // Since: nft v0.1.1 ClassByQueryString(ctx context.Context, in *QueryClassByQueryStringRequest, opts ...grpc.CallOption) (*QueryClassByQueryStringResponse, error) // Classes queries all NFT classes Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) @@ -187,14 +197,20 @@ type QueryServer interface { // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) // BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + // + // Since: nft v0.1.1 BalanceByQueryString(context.Context, *QueryBalanceByQueryStringRequest) (*QueryBalanceByQueryStringResponse, error) // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) // OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + // + // Since: nft v0.1.1 OwnerByQueryString(context.Context, *QueryOwnerByQueryStringRequest) (*QueryOwnerByQueryStringResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) // SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721. + // + // Since: nft v0.1.1 SupplyByQueryString(context.Context, *QuerySupplyByQueryStringRequest) (*QuerySupplyByQueryStringResponse, error) // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in // ERC721Enumerable @@ -202,10 +218,14 @@ type QueryServer interface { // NFT queries an NFT based on its class and id. NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) // NFTByQueryString queries an NFT based on its class and id. + // + // Since: nft v0.1.1 NFTByQueryString(context.Context, *QueryNFTByQueryStringRequest) (*QueryNFTByQueryStringResponse, error) // Class queries an NFT class based on its id Class(context.Context, *QueryClassRequest) (*QueryClassResponse, error) // Class queries an NFT class based on its id + // + // Since: nft v0.1.1 ClassByQueryString(context.Context, *QueryClassByQueryStringRequest) (*QueryClassByQueryStringResponse, error) // Classes queries all NFT classes Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) diff --git a/proto/cosmos/distribution/v1beta1/distribution.proto b/proto/cosmos/distribution/v1beta1/distribution.proto index 120afb15fc57..010f588b5fdb 100644 --- a/proto/cosmos/distribution/v1beta1/distribution.proto +++ b/proto/cosmos/distribution/v1beta1/distribution.proto @@ -116,6 +116,8 @@ message ValidatorSlashEvents { // FeePool is the global fee pool for distribution. message FeePool { + option deprecated = true; + repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, diff --git a/testutil/testdata/query.pb.go b/testutil/testdata/query.pb.go index 0bb946d1a9a6..d104840c5dce 100644 --- a/testutil/testdata/query.pb.go +++ b/testutil/testdata/query.pb.go @@ -6,16 +6,15 @@ package testdata import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - types "github.com/cosmos/cosmos-sdk/codec/types" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/testutil/testdata/testdata.pb.go b/testutil/testdata/testdata.pb.go index 93017231c60c..3db89888b056 100644 --- a/testutil/testdata/testdata.pb.go +++ b/testutil/testdata/testdata.pb.go @@ -5,13 +5,12 @@ package testdata import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/testutil/testdata/testpb/query.pulsar.go b/testutil/testdata/testpb/query.pulsar.go index f4e9bad12663..9b2a04bab5cc 100644 --- a/testutil/testdata/testpb/query.pulsar.go +++ b/testutil/testdata/testpb/query.pulsar.go @@ -3,15 +3,14 @@ package testpb import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/testutil/testdata/testpb/query_grpc.pb.go b/testutil/testdata/testpb/query_grpc.pb.go index e01aae23a5c3..565a93499d4b 100644 --- a/testutil/testdata/testpb/query_grpc.pb.go +++ b/testutil/testdata/testpb/query_grpc.pb.go @@ -8,7 +8,6 @@ package testpb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/testutil/testdata/testpb/testdata.pulsar.go b/testutil/testdata/testpb/testdata.pulsar.go index 00473c4fd0e8..8802ea9cd312 100644 --- a/testutil/testdata/testpb/testdata.pulsar.go +++ b/testutil/testdata/testpb/testdata.pulsar.go @@ -3,16 +3,15 @@ package testpb import ( fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/testutil/testdata/testpb/tx.pulsar.go b/testutil/testdata/testpb/tx.pulsar.go index d1a26a980dc6..5e4213c4802a 100644 --- a/testutil/testdata/testpb/tx.pulsar.go +++ b/testutil/testdata/testpb/tx.pulsar.go @@ -2,18 +2,17 @@ package testpb import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( diff --git a/testutil/testdata/testpb/tx_grpc.pb.go b/testutil/testdata/testpb/tx_grpc.pb.go index 103111c993a2..3971c84d770a 100644 --- a/testutil/testdata/testpb/tx_grpc.pb.go +++ b/testutil/testdata/testpb/tx_grpc.pb.go @@ -8,7 +8,6 @@ package testpb import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/testutil/testdata/testpb/unknonwnproto.pulsar.go b/testutil/testdata/testpb/unknonwnproto.pulsar.go index 5e5c214b36f5..84dbe6fbdb53 100644 --- a/testutil/testdata/testpb/unknonwnproto.pulsar.go +++ b/testutil/testdata/testpb/unknonwnproto.pulsar.go @@ -2,21 +2,20 @@ package testpb import ( + v1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" binary "encoding/binary" fmt "fmt" - io "io" - math "math" - reflect "reflect" - sort "sort" - sync "sync" - - v1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" + io "io" + math "math" + reflect "reflect" + sort "sort" + sync "sync" ) var ( diff --git a/testutil/testdata/tx.pb.go b/testutil/testdata/tx.pb.go index 70ed5f9952b7..e2d416faa41e 100644 --- a/testutil/testdata/tx.pb.go +++ b/testutil/testdata/tx.pb.go @@ -6,10 +6,6 @@ package testdata import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,6 +14,9 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/testutil/testdata/unknonwnproto.pb.go b/testutil/testdata/unknonwnproto.pb.go index 69d4059c44ef..3522a7253598 100644 --- a/testutil/testdata/unknonwnproto.pb.go +++ b/testutil/testdata/unknonwnproto.pb.go @@ -6,14 +6,13 @@ package testdata import ( encoding_binary "encoding/binary" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - types "github.com/cosmos/cosmos-sdk/codec/types" tx "github.com/cosmos/cosmos-sdk/types/tx" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/distribution/README.md b/x/distribution/README.md index 32858fd696db..c76902d89328 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -43,7 +43,7 @@ and delegators to independently and lazily withdraw their rewards. As a part of the lazy computations, each delegator holds an accumulation term specific to each validator which is used to estimate what their approximate -fair portion of tokens held in the global fee pool is owed to them. +fair portion of tokens held in the fee pool is owed to them. ```text entitlement = delegator-accumulation / all-delegators-accumulation @@ -81,7 +81,6 @@ to set up a script to periodically withdraw and rebond rewards. * [Concepts](#concepts) * [State](#state) - * [FeePool](#feepool) * [Validator Distribution](#validator-distribution) * [Delegation Distribution](#delegation-distribution) * [Params](#params) @@ -127,33 +126,6 @@ count is decremented. If the reference count hits zero, the historical record is ## State -### FeePool - -All globally tracked parameters for distribution are stored within -`FeePool`. Rewards are collected and added to the reward pool and -distributed to validators/delegators from here. - -Note that the reward pool holds decimal coins (`DecCoins`) to allow -for fractions of coins to be received from operations like inflation. -When coins are distributed from the pool they are truncated back to -`sdk.Coins` which are non-decimal. - -* FeePool: `0x00 -> ProtocolBuffer(FeePool)` - -```go -// coins with decimal -type DecCoins []DecCoin - -type DecCoin struct { - Amount math.LegacyDec - Denom string -} -``` - -```protobuf reference -https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/v1beta1/distribution.proto#L116-L123 -``` - ### Validator Distribution Validator distribution information for the relevant validator is updated each time: @@ -206,7 +178,6 @@ the distribution `ModuleAccount` account. When a delegator or validator withdraws their rewards, they are taken out of the `ModuleAccount`. During begin block, the different claims on the fees collected are updated as follows: -* The reserve community tax is charged. * The remainder is distributed proportionally by voting power to all bonded validators ### The Distribution Scheme @@ -218,12 +189,12 @@ inflationary rewards to the stake. All fees are collected in a specific module account during the block. During `BeginBlock`, they are sent to the `"distribution"` `ModuleAccount`. No other sending of tokens occurs. Instead, the rewards each account is entitled to are stored, and withdrawals can be triggered -through the messages `FundCommunityPool`, `WithdrawValidatorCommission` and +through the messages `WithdrawValidatorCommission` and `WithdrawDelegatorReward`. #### Reward to the Community Pool -The community pool gets `community_tax * fees`, plus any remaining dust after +The community pool (x/protocolpool) gets `community_tax * fees`, plus any remaining dust after validators get their rewards that are always rounded down to the nearest integer value. @@ -344,33 +315,6 @@ The commission is calculated in every block during `BeginBlock`, so no iteration The amount withdrawn is deducted from the `ValidatorOutstandingRewards` variable for the validator. Only integer amounts can be sent. If the accumulated awards have decimals, the amount is truncated before the withdrawal is sent, and the remainder is left to be withdrawn later. -### FundCommunityPool - -This message sends coins directly from the sender to the community pool. - -The transaction fails if the amount cannot be transferred from the sender to the distribution module account. - -```go -func (k Keeper) FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error { - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount); err != nil { - return err - } - - feePool, err := k.FeePool.Get(ctx) - if err != nil { - return err - } - - feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...) - - if err := k.FeePool.Set(ctx, feePool); err != nil { - return err - } - - return nil -} -``` - ### Common distribution operations These operations take place during many different messages. @@ -452,7 +396,7 @@ By default, all values are set to a `0`, except period, which is set to `1`. * triggered-by: `staking.RemoveValidator` Outstanding commission is sent to the validator's self-delegation withdrawal address. -Remaining delegator rewards get sent to the community fee pool. +Remaining delegator rewards get sent to the community pool. Note: The validator gets removed only when it has no remaining delegations. At that time, all outstanding delegator rewards will have been withdrawn. @@ -525,13 +469,12 @@ The distribution module contains the following parameters: * `baseproposerreward` and `bonusproposerreward` were parameters that are deprecated in v0.47 and are not used. :::note -The reserve pool is the pool of collected funds for use by governance taken via the `CommunityTax`. -Currently with the Cosmos SDK, tokens collected by the CommunityTax are accounted for but unspendable. +The community tax is collected and sent to the community pool (x/protocolpool). ::: ## Client -## CLI +### CLI A user can query and interact with the `distribution` module using the CLI. @@ -565,28 +508,6 @@ commission: denom: stake ``` -##### community-pool - -The `community-pool` command allows users to query all coin balances within the community pool. - -```shell -simd query distribution community-pool [flags] -``` - -Example: - -```shell -simd query distribution community-pool -``` - -Example Output: - -```yml -pool: -- amount: "1000000.000000000000000000" - denom: stake -``` - ##### params The `params` command allows users to query the parameters of the `distribution` module. @@ -688,7 +609,7 @@ rewards: The `validator-distribution-info` command allows users to query validator commission and self-delegation rewards for validator. -````shell +```shell simd query distribution validator-distribution-info cosmosvaloper1... ``` @@ -712,20 +633,6 @@ The `tx` commands allow users to interact with the `distribution` module. simd tx distribution --help ``` -##### fund-community-pool - -The `fund-community-pool` command allows users to send funds to the community pool. - -```shell -simd tx distribution fund-community-pool [amount] [flags] -``` - -Example: - -```shell -simd tx distribution fund-community-pool 100stake --from cosmos1... -``` - ##### set-withdraw-addr The `set-withdraw-addr` command allows users to set the withdraw address for rewards associated with a delegator address. @@ -1022,28 +929,3 @@ Example Output: "withdrawAddress": "cosmos1..." } ``` - -#### CommunityPool - -The `CommunityPool` endpoint allows users to query the community pool coins. - -Example: - -```shell -grpcurl -plaintext \ - localhost:9090 \ - cosmos.distribution.v1beta1.Query/CommunityPool -``` - -Example Output: - -```json -{ - "pool": [ - { - "denom": "stake", - "amount": "1000000000000000000" - } - ] -} -``` diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index a3eb1cdd3b30..b895bc52fd0a 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" "cosmossdk.io/x/distribution/types" + protocolpooltypes "cosmossdk.io/x/protocolpool/types" stakingtypes "cosmossdk.io/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -24,23 +25,10 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...) // transfer collected fees to the distribution module account - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, k.feeCollectorName, types.ModuleName, feesCollectedInt) - if err != nil { - return err - } - - // temporary workaround to keep CanWithdrawInvariant happy - // general discussions here: https://github.com/cosmos/cosmos-sdk/issues/2906#issuecomment-441867634 - feePool, err := k.FeePool.Get(ctx) - if err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, k.feeCollectorName, types.ModuleName, feesCollectedInt); err != nil { return err } - if totalPreviousPower == 0 { - feePool.CommunityPool = feePool.CommunityPool.Add(feesCollected...) - return k.FeePool.Set(ctx, feePool) - } - // calculate fraction allocated to validators remaining := feesCollected communityTax, err := k.GetCommunityTax(ctx) @@ -77,9 +65,12 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo remaining = remaining.Sub(reward) } - // allocate community funding - feePool.CommunityPool = feePool.CommunityPool.Add(remaining...) - return k.FeePool.Set(ctx, feePool) + // send to community pool + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, sdk.NormalizeCoins(remaining)); err != nil { + return err + } + + return nil } // AllocateTokensToValidator allocate tokens to a particular validator, diff --git a/x/distribution/keeper/genesis.go b/x/distribution/keeper/genesis.go index 10a733c51d9d..0f3ecaccb9ff 100644 --- a/x/distribution/keeper/genesis.go +++ b/x/distribution/keeper/genesis.go @@ -14,8 +14,7 @@ import ( func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { var moduleHoldings sdk.DecCoins - err := k.FeePool.Set(ctx, data.FeePool) - if err != nil { + if err := k.FeePool.Set(ctx, data.FeePool); err != nil { panic(err) } @@ -47,7 +46,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { } } - if err = k.PreviousProposer.Set(ctx, previousProposer); err != nil { + if err := k.PreviousProposer.Set(ctx, previousProposer); err != nil { panic(err) } diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 7be7e2b4b9c4..e97b6a090c35 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -25,14 +25,15 @@ type Keeper struct { authKeeper types.AccountKeeper bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper - poolKeeper types.PoolKeeper // TODO: Needs to be removed in v0.53 + poolKeeper types.PoolKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string - Schema collections.Schema - Params collections.Item[types.Params] + Schema collections.Schema + Params collections.Item[types.Params] + // Deprecated: this is staying for the migration from distribution community pool to protocolpool. FeePool collections.Item[types.FeePool] // DelegatorsWithdrawAddress key: delAddr | value: withdrawAddr DelegatorsWithdrawAddress collections.Map[sdk.AccAddress, sdk.AccAddress] diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index 6c7719711bb7..cea2daa05920 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -1,7 +1,6 @@ package keeper import ( - "cosmossdk.io/x/distribution/migrations/funds" v4 "cosmossdk.io/x/distribution/migrations/v4" "cosmossdk.io/x/distribution/types" pooltypes "cosmossdk.io/x/protocolpool/types" @@ -32,11 +31,17 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error { return nil } +// Migrate3to4 migrates the x/distribution module state to use collections +// Additionally it migrates distribution fee pool to use protocol pool module account func (m Migrator) Migrate3to4(ctx sdk.Context) error { - return v4.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc) + if err := v4.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc); err != nil { + return err + } + + return m.migrateFunds(ctx) } -func (m Migrator) MigrateFundsToPool(ctx sdk.Context) error { +func (m Migrator) migrateFunds(ctx sdk.Context) error { macc := m.keeper.GetDistributionAccount(ctx) poolMacc := m.keeper.authKeeper.GetModuleAccount(ctx, pooltypes.ModuleName) @@ -44,10 +49,11 @@ func (m Migrator) MigrateFundsToPool(ctx sdk.Context) error { if err != nil { return err } - err = funds.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc) - if err != nil { + + if err = v4.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc); err != nil { return err } + // return FeePool as empty (since FeePool funds are migrated to pool module account) return m.keeper.FeePool.Set(ctx, types.FeePool{}) } diff --git a/x/distribution/migrations/funds/migrate.go b/x/distribution/migrations/v4/migrate_funds.go similarity index 88% rename from x/distribution/migrations/funds/migrate.go rename to x/distribution/migrations/v4/migrate_funds.go index 73688e6ffb44..adca2a6681ea 100644 --- a/x/distribution/migrations/funds/migrate.go +++ b/x/distribution/migrations/v4/migrate_funds.go @@ -1,4 +1,4 @@ -package funds +package v4 import ( "fmt" @@ -17,8 +17,7 @@ func MigrateFunds(ctx sdk.Context, bankKeeper types.BankKeeper, feePool types.Fe } // transfer feepool funds from the distribution module account to pool module account - err := bankKeeper.SendCoinsFromModuleToModule(ctx, macc.GetName(), poolMacc.GetName(), poolBal) - if err != nil { + if err := bankKeeper.SendCoinsFromModuleToModule(ctx, macc.GetName(), poolMacc.GetName(), poolBal); err != nil { return err } diff --git a/x/distribution/migrations/funds/migrate_test.go b/x/distribution/migrations/v4/migrate_funds_test.go similarity index 96% rename from x/distribution/migrations/funds/migrate_test.go rename to x/distribution/migrations/v4/migrate_funds_test.go index 1ba5d0ea0085..d51558abb0cd 100644 --- a/x/distribution/migrations/funds/migrate_test.go +++ b/x/distribution/migrations/v4/migrate_funds_test.go @@ -1,4 +1,4 @@ -package funds_test +package v4_test import ( "testing" @@ -16,7 +16,7 @@ import ( banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/distribution" "cosmossdk.io/x/distribution/keeper" - "cosmossdk.io/x/distribution/migrations/funds" + v4 "cosmossdk.io/x/distribution/migrations/v4" distrtestutil "cosmossdk.io/x/distribution/testutil" disttypes "cosmossdk.io/x/distribution/types" pooltypes "cosmossdk.io/x/protocolpool/types" @@ -101,7 +101,7 @@ func TestFundsMigration(t *testing.T) { poolAcc := authtypes.NewEmptyModuleAccount(pooltypes.ModuleName) // migrate feepool funds from distribution module account to pool module accout - err = funds.MigrateFunds(ctx, bankKeeper, feepool, distrAcc, poolAcc) + err = v4.MigrateFunds(ctx, bankKeeper, feepool, distrAcc, poolAcc) require.NoError(t, err) // set distrbution feepool as empty (since migration) diff --git a/x/distribution/module.go b/x/distribution/module.go index 97a501b9084a..5419b34f93cb 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -28,7 +28,7 @@ import ( ) // ConsensusVersion defines the current x/distribution module consensus version. -const ConsensusVersion = 5 +const ConsensusVersion = 4 var ( _ module.AppModuleBasic = AppModule{} @@ -143,10 +143,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil { panic(fmt.Sprintf("failed to migrate x/%s from version 3 to 4: %v", types.ModuleName, err)) } - - if err := cfg.RegisterMigration(types.ModuleName, 4, m.MigrateFundsToPool); err != nil { - panic(fmt.Sprintf("failed to migrate funds from x/%s to x/protocolpool module", types.ModuleName)) - } } // InitGenesis performs genesis initialization for the distribution module. It returns diff --git a/x/distribution/types/distribution.pb.go b/x/distribution/types/distribution.pb.go index 8fcd62b9baad..af87f73c0eb0 100644 --- a/x/distribution/types/distribution.pb.go +++ b/x/distribution/types/distribution.pb.go @@ -387,6 +387,8 @@ func (m *ValidatorSlashEvents) GetValidatorSlashEvents() []ValidatorSlashEvent { } // FeePool is the global fee pool for distribution. +// +// Deprecated: Do not use. type FeePool struct { CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool"` } @@ -647,71 +649,71 @@ func init() { } var fileDescriptor_cd78a31ea281a992 = []byte{ - // 1015 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xc1, 0x6f, 0x1b, 0xc5, - 0x17, 0xf6, 0x34, 0x89, 0xd3, 0x4c, 0xdb, 0xe4, 0xd7, 0x89, 0x93, 0x3a, 0x6e, 0x7f, 0xb6, 0xbb, - 0xa2, 0xc2, 0x04, 0x62, 0x93, 0x22, 0x21, 0x94, 0x0b, 0x6a, 0xec, 0x56, 0x20, 0x15, 0x88, 0x36, - 0x08, 0x24, 0x38, 0xac, 0xc6, 0xbb, 0x13, 0x7b, 0xc8, 0xee, 0xcc, 0x32, 0x33, 0x76, 0x92, 0x03, - 0xf7, 0xc0, 0x01, 0xb8, 0x81, 0x7a, 0xaa, 0xe0, 0x52, 0x71, 0xca, 0x21, 0x7f, 0x44, 0xc5, 0xa9, - 0xaa, 0x00, 0x21, 0x0e, 0x01, 0x92, 0x43, 0x10, 0x7f, 0x05, 0x9a, 0x9d, 0xf1, 0xae, 0x13, 0x02, - 0x2a, 0x45, 0x16, 0x97, 0x28, 0xf3, 0xde, 0xec, 0xfb, 0xbe, 0xef, 0xcd, 0x37, 0x6f, 0x0c, 0xeb, - 0x3e, 0x97, 0x11, 0x97, 0x8d, 0x80, 0x4a, 0x25, 0x68, 0xbb, 0xa7, 0x28, 0x67, 0x8d, 0xfe, 0x72, - 0x9b, 0x28, 0xbc, 0x7c, 0x22, 0x58, 0x8f, 0x05, 0x57, 0x1c, 0x5d, 0x35, 0xfb, 0xeb, 0x27, 0x52, - 0x76, 0x7f, 0xa9, 0xd0, 0xe1, 0x1d, 0x9e, 0xec, 0x6b, 0xe8, 0xff, 0xcc, 0x27, 0xa5, 0xb2, 0x85, - 0x68, 0x63, 0x49, 0xd2, 0xd2, 0x3e, 0xa7, 0xb6, 0x64, 0x69, 0xc1, 0xe4, 0x3d, 0xf3, 0xa1, 0xad, - 0x6f, 0x52, 0x97, 0x71, 0x44, 0x19, 0x6f, 0x24, 0x7f, 0x4d, 0xc8, 0xb9, 0x37, 0x06, 0xf3, 0x6b, - 0x58, 0xe0, 0x48, 0xa2, 0xf7, 0xe1, 0x25, 0x9f, 0x47, 0x51, 0x8f, 0x51, 0xb5, 0xe3, 0x29, 0xbc, - 0x5d, 0x04, 0x55, 0x50, 0x9b, 0x5a, 0x7d, 0xf9, 0xe1, 0x41, 0x25, 0xf7, 0xd3, 0x41, 0xc5, 0x52, - 0x95, 0xc1, 0x66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x1f, 0x1c, - 0x96, 0xc1, 0xc3, 0xc3, 0x32, 0x78, 0x74, 0x58, 0x06, 0xbf, 0x1c, 0x96, 0xc1, 0xe7, 0x47, 0xe5, - 0xdc, 0xa3, 0xa3, 0x72, 0xee, 0xc7, 0xa3, 0x72, 0xee, 0xbd, 0xeb, 0x27, 0x6c, 0x75, 0xea, 0x37, - 0x44, 0xd2, 0xb4, 0x76, 0x3e, 0xf9, 0x99, 0xf7, 0xd2, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x10, - 0x1e, 0x8d, 0x91, 0x99, 0x0a, 0x00, 0x00, + // 1018 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x34, 0x89, 0xd3, 0x4c, 0xdb, 0x84, 0x4e, 0x7e, 0xd4, 0x71, 0x8b, 0xed, 0xae, 0xa8, + 0x30, 0x81, 0xd8, 0xa4, 0x48, 0x08, 0xf9, 0x82, 0x1a, 0xbb, 0x15, 0x48, 0x05, 0xa2, 0x0d, 0x02, + 0x09, 0x0e, 0xab, 0xf1, 0xee, 0xc4, 0x1e, 0xb2, 0x3b, 0xb3, 0xcc, 0x8c, 0x9d, 0xe4, 0xc0, 0xbd, + 0x20, 0x04, 0xdc, 0x40, 0x3d, 0x55, 0x70, 0xa9, 0x38, 0xe5, 0x90, 0x3f, 0xa2, 0xe2, 0x54, 0x55, + 0x80, 0x10, 0x87, 0x00, 0xc9, 0x21, 0x88, 0xbf, 0x02, 0xcd, 0xce, 0x78, 0xd7, 0x09, 0x01, 0x95, + 0x22, 0x8b, 0x4b, 0x94, 0x79, 0x6f, 0xf6, 0x7d, 0xdf, 0xf7, 0xe6, 0x9b, 0x37, 0x86, 0x35, 0x9f, + 0xcb, 0x88, 0xcb, 0x7a, 0x40, 0xa5, 0x12, 0xb4, 0xdd, 0x53, 0x94,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 0x18, 0x4e, 0x1a, 0x25, 0x72, 0xc4, 0x22, 0x06, + 0x30, 0x68, 0x01, 0xe6, 0x63, 0x22, 0x28, 0x37, 0x6e, 0x1c, 0x77, 0xed, 0xca, 0xf9, 0x0a, 0xc0, + 0x52, 0xca, 0xf2, 0x86, 0x6f, 0x35, 0x93, 0xa0, 0xc9, 0xa3, 0x88, 0x4a, 0x49, 0x39, 0x43, 0x7d, + 0x08, 0xfd, 0x74, 0x35, 0x62, 0xbe, 0x43, 0x48, 0xce, 0xe7, 0x00, 0x5e, 0x4e, 0xa9, 0xbd, 0xd5, + 0x53, 0x52, 0x61, 0x16, 0x50, 0xd6, 0xf9, 0xdf, 0x9a, 0xa8, 0x19, 0xcd, 0xa6, 0x8c, 0xd6, 0x43, + 0x2c, 0xbb, 0x37, 0xfb, 0x84, 0x29, 0xf4, 0x1c, 0x7c, 0xaa, 0x3f, 0x08, 0x7b, 0xb6, 0xcd, 0x20, + 0x69, 0xf3, 0x4c, 0x1a, 0x5f, 0x4b, 0xc2, 0xe8, 0x0d, 0x78, 0x76, 0x43, 0x60, 0x5f, 0xdf, 0x00, + 0x3b, 0x17, 0x56, 0xfe, 0xf5, 0x55, 0x75, 0xd3, 0x12, 0xce, 0xc7, 0x00, 0xce, 0x9d, 0xc2, 0x48, + 0xa2, 0x0f, 0xe1, 0x42, 0x46, 0x49, 0xea, 0x84, 0x47, 0x92, 0x8c, 0xed, 0xd5, 0x8b, 0xb5, 0x7f, + 0x98, 0xca, 0xb5, 0x53, 0x4a, 0xae, 0x4e, 0x69, 0x9e, 0xa6, 0x21, 0x73, 0xfd, 0x53, 0x20, 0x9d, + 0x4f, 0x01, 0x9c, 0xbc, 0x45, 0xc8, 0x1a, 0xe7, 0x21, 0xfa, 0x08, 0x4e, 0x67, 0x73, 0x36, 0xe6, + 0x3c, 0x1c, 0xf1, 0x11, 0x65, 0x53, 0x5d, 0xc3, 0x37, 0xce, 0x14, 0x80, 0xf3, 0xe5, 0x19, 0x58, +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x3a, 0x19, 0xb3, 0x0d, 0x30, 0x0b, 0xe7, 0x37, 0x00, 0x17, + 0xad, 0x2c, 0xca, 0x59, 0x2a, 0xd0, 0x3e, 0x61, 0x6f, 0xc2, 0x8b, 0xd9, 0x85, 0xd0, 0x6f, 0x18, + 0x91, 0xd2, 0xbe, 0xfe, 0x57, 0x1f, 0xed, 0x2d, 0x3f, 0x6d, 0xa9, 0x65, 0xb3, 0xd0, 0x6c, 0x59, + 0x57, 0x42, 0x8f, 0x9c, 0xec, 0x7e, 0xdb, 0x38, 0x62, 0x30, 0x9f, 0x3e, 0xef, 0xa3, 0x74, 0xb6, + 0x45, 0x69, 0x8c, 0xeb, 0xe3, 0x75, 0x7e, 0x00, 0xf0, 0xda, 0xdf, 0x9b, 0xfa, 0x5d, 0xaa, 0xba, + 0x2d, 0x12, 0x73, 0x49, 0xd5, 0x88, 0xfc, 0xbd, 0x30, 0xe4, 0x6f, 0x9d, 0xb2, 0x2b, 0x54, 0x80, + 0x93, 0x81, 0x01, 0x2e, 0x4c, 0x24, 0x89, 0xc1, 0xb2, 0xf1, 0xcc, 0x9d, 0xc7, 0xb0, 0xe4, 0xea, + 0xab, 0xf7, 0x0f, 0x4a, 0xe0, 0xc1, 0x41, 0x09, 0x3c, 0x3c, 0x28, 0x81, 0x5f, 0x0f, 0x4a, 0xe0, + 0x8b, 0xc3, 0x52, 0xee, 0xe1, 0x61, 0x29, 0xf7, 0xd3, 0x61, 0x29, 0xf7, 0xde, 0xd5, 0x63, 0xb6, + 0x3a, 0xf1, 0x3b, 0x22, 0x69, 0x5a, 0x3b, 0x9f, 0xfc, 0xd4, 0x7b, 0xe9, 0xcf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x1f, 0x10, 0x85, 0x0f, 0x9d, 0x0a, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/distribution/types/fee_pool.go b/x/distribution/types/fee_pool.go index 645afd401a33..81c7614c450d 100644 --- a/x/distribution/types/fee_pool.go +++ b/x/distribution/types/fee_pool.go @@ -7,6 +7,7 @@ import ( ) // zero fee pool +// Deperecated: FeePool is deprecated func InitialFeePool() FeePool { return FeePool{ CommunityPool: sdk.DecCoins{}, diff --git a/x/nft/query.pb.go b/x/nft/query.pb.go index e6ef5e297c83..523f9409f732 100644 --- a/x/nft/query.pb.go +++ b/x/nft/query.pb.go @@ -85,6 +85,8 @@ func (m *QueryBalanceRequest) GetOwner() string { } // QueryBalanceByQueryStringRequest is the request type for the Query/Balance RPC method +// +// Since: nft v0.1.1 type QueryBalanceByQueryStringRequest struct { // class_id associated with the nft ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -186,6 +188,8 @@ func (m *QueryBalanceResponse) GetAmount() uint64 { } // QueryBalanceByQueryStringResponse is the response type for the Query/Balance RPC method +// +// Since: nft v0.1.1 type QueryBalanceByQueryStringResponse struct { // amount is the number of all NFTs of a given class owned by the owner Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` @@ -287,6 +291,8 @@ func (m *QueryOwnerRequest) GetId() string { } // QueryOwnerByQueryStringRequest is the request type for the Query/Owner RPC method +// +// Since: nft v0.1.1 type QueryOwnerByQueryStringRequest struct { // class_id associated with the nft ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -388,6 +394,8 @@ func (m *QueryOwnerResponse) GetOwner() string { } // QueryOwnerByQueryStringResponse is the response type for the Query/Owner RPC method +// +// Since: nft v0.1.1 type QueryOwnerByQueryStringResponse struct { // owner is the owner address of the nft Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` @@ -480,6 +488,8 @@ func (m *QuerySupplyRequest) GetClassId() string { } // QuerySupplyByQueryStringRequest is the request type for the Query/Supply RPC method +// +// Since: nft v0.1.1 type QuerySupplyByQueryStringRequest struct { // class_id associated with the nft ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -572,6 +582,8 @@ func (m *QuerySupplyResponse) GetAmount() uint64 { } // QuerySupplyByQueryStringResponse is the response type for the Query/Supply RPC method +// +// Since: nft v0.1.1 type QuerySupplyByQueryStringResponse struct { // amount is the number of all NFTs from the given class Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` @@ -792,6 +804,8 @@ func (m *QueryNFTRequest) GetId() string { } // QueryNFTByQueryStringRequest is the request type for the Query/NFT RPC method +// +// Since: nft v0.1.1 type QueryNFTByQueryStringRequest struct { // class_id associated with the nft ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -893,6 +907,8 @@ func (m *QueryNFTResponse) GetNft() *NFT { } // QueryNFTByQueryStringResponse is the response type for the Query/NFT RPC method +// +// Since: nft v0.1.1 type QueryNFTByQueryStringResponse struct { // owner is the owner address of the nft Nft *NFT `protobuf:"bytes,1,opt,name=nft,proto3" json:"nft,omitempty"` @@ -985,6 +1001,8 @@ func (m *QueryClassRequest) GetClassId() string { } // QueryClassByQueryStringRequest is the request type for the Query/Class RPC method +// +// Since: nft v0.1.1 type QueryClassByQueryStringRequest struct { // class_id associated with the nft ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` @@ -1077,6 +1095,8 @@ func (m *QueryClassResponse) GetClass() *Class { } // QueryClassByQueryStringResponse is the response type for the Query/Class RPC method +// +// Since: nft v0.1.1 type QueryClassByQueryStringResponse struct { // class defines the class of the nft type. Class *Class `protobuf:"bytes,1,opt,name=class,proto3" json:"class,omitempty"` @@ -1330,14 +1350,20 @@ type QueryClient interface { // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) // BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + // + // Since: nft v0.1.1 BalanceByQueryString(ctx context.Context, in *QueryBalanceByQueryStringRequest, opts ...grpc.CallOption) (*QueryBalanceByQueryStringResponse, error) // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) // OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + // + // Since: nft v0.1.1 OwnerByQueryString(ctx context.Context, in *QueryOwnerByQueryStringRequest, opts ...grpc.CallOption) (*QueryOwnerByQueryStringResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) // SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721. + // + // Since: nft v0.1.1 SupplyByQueryString(ctx context.Context, in *QuerySupplyByQueryStringRequest, opts ...grpc.CallOption) (*QuerySupplyByQueryStringResponse, error) // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in // ERC721Enumerable @@ -1345,10 +1371,14 @@ type QueryClient interface { // NFT queries an NFT based on its class and id. NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) // NFTByQueryString queries an NFT based on its class and id. + // + // Since: nft v0.1.1 NFTByQueryString(ctx context.Context, in *QueryNFTByQueryStringRequest, opts ...grpc.CallOption) (*QueryNFTByQueryStringResponse, error) // Class queries an NFT class based on its id Class(ctx context.Context, in *QueryClassRequest, opts ...grpc.CallOption) (*QueryClassResponse, error) // Class queries an NFT class based on its id + // + // Since: nft v0.1.1 ClassByQueryString(ctx context.Context, in *QueryClassByQueryStringRequest, opts ...grpc.CallOption) (*QueryClassByQueryStringResponse, error) // Classes queries all NFT classes Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) @@ -1475,14 +1505,20 @@ type QueryServer interface { // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) // BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 + // + // Since: nft v0.1.1 BalanceByQueryString(context.Context, *QueryBalanceByQueryStringRequest) (*QueryBalanceByQueryStringResponse, error) // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) // OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 + // + // Since: nft v0.1.1 OwnerByQueryString(context.Context, *QueryOwnerByQueryStringRequest) (*QueryOwnerByQueryStringResponse, error) // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) // SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721. + // + // Since: nft v0.1.1 SupplyByQueryString(context.Context, *QuerySupplyByQueryStringRequest) (*QuerySupplyByQueryStringResponse, error) // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in // ERC721Enumerable @@ -1490,10 +1526,14 @@ type QueryServer interface { // NFT queries an NFT based on its class and id. NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) // NFTByQueryString queries an NFT based on its class and id. + // + // Since: nft v0.1.1 NFTByQueryString(context.Context, *QueryNFTByQueryStringRequest) (*QueryNFTByQueryStringResponse, error) // Class queries an NFT class based on its id Class(context.Context, *QueryClassRequest) (*QueryClassResponse, error) // Class queries an NFT class based on its id + // + // Since: nft v0.1.1 ClassByQueryString(context.Context, *QueryClassByQueryStringRequest) (*QueryClassByQueryStringResponse, error) // Classes queries all NFT classes Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) From 4b639f4887e0b3c0893c990ae553a8d62570bb2f Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 11:12:02 +0100 Subject: [PATCH 02/15] updates --- x/distribution/keeper/msg_server.go | 2 +- x/distribution/keeper/msg_server_test.go | 2 +- x/distribution/testutil/expected_keepers_mocks.go | 12 ++++++------ x/distribution/types/expected_keepers.go | 2 +- x/protocolpool/keeper/keeper.go | 8 ++++---- x/protocolpool/keeper/msg_server.go | 5 ++--- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/x/distribution/keeper/msg_server.go b/x/distribution/keeper/msg_server.go index d92b619a09e8..48282e0f9ed8 100644 --- a/x/distribution/keeper/msg_server.go +++ b/x/distribution/keeper/msg_server.go @@ -158,7 +158,7 @@ func (k msgServer) CommunityPoolSpend(ctx context.Context, msg *types.MsgCommuni return nil, fmt.Errorf("invalid recipient address: %w", err) } - if err := k.poolKeeper.DistributeFromFeePool(ctx, msg.Amount, recipient); err != nil { + if err := k.poolKeeper.DistributeFromCommunityPool(ctx, msg.Amount, recipient); err != nil { return nil, err } diff --git a/x/distribution/keeper/msg_server_test.go b/x/distribution/keeper/msg_server_test.go index 19441a97f04c..a4aa0f97d0c8 100644 --- a/x/distribution/keeper/msg_server_test.go +++ b/x/distribution/keeper/msg_server_test.go @@ -259,7 +259,7 @@ func TestMsgUpdateParams(t *testing.T) { func TestMsgCommunityPoolSpend(t *testing.T) { ctx, addrs, distrKeeper, dep := initFixture(t) - dep.poolKeeper.EXPECT().DistributeFromFeePool(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() + dep.poolKeeper.EXPECT().DistributeFromCommunityPool(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() msgServer := keeper.NewMsgServerImpl(distrKeeper) cases := []struct { diff --git a/x/distribution/testutil/expected_keepers_mocks.go b/x/distribution/testutil/expected_keepers_mocks.go index f57b9aca571b..8cc11554bb7b 100644 --- a/x/distribution/testutil/expected_keepers_mocks.go +++ b/x/distribution/testutil/expected_keepers_mocks.go @@ -249,18 +249,18 @@ func (m *MockPoolKeeper) EXPECT() *MockPoolKeeperMockRecorder { return m.recorder } -// DistributeFromFeePool mocks base method. -func (m *MockPoolKeeper) DistributeFromFeePool(ctx context.Context, amount types0.Coins, receiveAddr types0.AccAddress) error { +// DistributeFromCommunityPool mocks base method. +func (m *MockPoolKeeper) DistributeFromCommunityPool(ctx context.Context, amount types0.Coins, receiveAddr types0.AccAddress) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DistributeFromFeePool", ctx, amount, receiveAddr) + ret := m.ctrl.Call(m, "DistributeFromCommunityPool", ctx, amount, receiveAddr) ret0, _ := ret[0].(error) return ret0 } -// DistributeFromFeePool indicates an expected call of DistributeFromFeePool. -func (mr *MockPoolKeeperMockRecorder) DistributeFromFeePool(ctx, amount, receiveAddr interface{}) *gomock.Call { +// DistributeFromCommunityPool indicates an expected call of DistributeFromCommunityPool. +func (mr *MockPoolKeeperMockRecorder) DistributeFromCommunityPool(ctx, amount, receiveAddr interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DistributeFromFeePool", reflect.TypeOf((*MockPoolKeeper)(nil).DistributeFromFeePool), ctx, amount, receiveAddr) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DistributeFromCommunityPool", reflect.TypeOf((*MockPoolKeeper)(nil).DistributeFromCommunityPool), ctx, amount, receiveAddr) } // FundCommunityPool mocks base method. diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index 6b0c7ffc391a..ce6968a5ecb9 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -36,7 +36,7 @@ type BankKeeper interface { // PoolKeeper defines the expected interface needed to fund & distribute pool balances. type PoolKeeper interface { FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error - DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + DistributeFromCommunityPool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error GetCommunityPool(ctx context.Context) (sdk.Coins, error) } diff --git a/x/protocolpool/keeper/keeper.go b/x/protocolpool/keeper/keeper.go index 5af89f45fb60..3f059cc84786 100644 --- a/x/protocolpool/keeper/keeper.go +++ b/x/protocolpool/keeper/keeper.go @@ -75,9 +75,9 @@ func (k Keeper) FundCommunityPool(ctx context.Context, amount sdk.Coins, sender return k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount) } -// DistributeFromFeePool distributes funds from the protocolpool module account to +// DistributeFromCommunityPool distributes funds from the protocolpool module account to // a receiver address. -func (k Keeper) DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error { +func (k Keeper) DistributeFromCommunityPool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error { return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, receiveAddr, amount) } @@ -97,8 +97,8 @@ func (k Keeper) claimFunds(ctx context.Context, recipient sdk.AccAddress) (amoun return sdk.Coin{}, fmt.Errorf("error getting claimable funds: %w", err) } - // distribute amount from feepool - err = k.DistributeFromFeePool(ctx, sdk.NewCoins(amount), recipient) + // distribute amount from cimmunity pool + err = k.DistributeFromCommunityPool(ctx, sdk.NewCoins(amount), recipient) if err != nil { return sdk.Coin{}, fmt.Errorf("error distributing from fee pool: %w", err) } diff --git a/x/protocolpool/keeper/msg_server.go b/x/protocolpool/keeper/msg_server.go index ad1e4b61c5c7..5cc913777881 100644 --- a/x/protocolpool/keeper/msg_server.go +++ b/x/protocolpool/keeper/msg_server.go @@ -93,12 +93,11 @@ func (k MsgServer) CommunityPoolSpend(ctx context.Context, msg *types.MsgCommuni } // distribute funds from community pool module account - if err := k.Keeper.DistributeFromFeePool(ctx, msg.Amount, recipient); err != nil { + if err := k.Keeper.DistributeFromCommunityPool(ctx, msg.Amount, recipient); err != nil { return nil, err } - logger := k.Logger(ctx) - logger.Info("transferred from the community pool to recipient", "amount", msg.Amount.String(), "recipient", msg.Recipient) + k.Logger(ctx).Info("transferred from the community pool to recipient", "amount", msg.Amount.String(), "recipient", msg.Recipient) return &types.MsgCommunityPoolSpendResponse{}, nil } From 74062d5866c112b8606481e98c4c9cc68b175b11 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 12:06:31 +0100 Subject: [PATCH 03/15] updates --- .../v1beta1/distribution.pulsar.go | 341 +++++++++++++----- .../distribution/v1beta1/distribution.proto | 9 +- x/distribution/README.md | 44 +-- x/distribution/abci.go | 7 + x/distribution/keeper/allocation.go | 29 +- x/distribution/keeper/allocation_test.go | 6 +- x/distribution/keeper/delegation.go | 10 +- x/distribution/keeper/genesis.go | 2 +- x/distribution/keeper/hooks.go | 10 +- x/distribution/keeper/invariants.go | 11 +- x/distribution/keeper/keeper.go | 3 +- x/distribution/keeper/migrations.go | 8 +- x/distribution/keeper/validator.go | 4 +- x/distribution/migrations/v4/migrate_funds.go | 14 +- .../migrations/v4/migrate_funds_test.go | 4 +- x/distribution/simulation/decoder_test.go | 2 +- x/distribution/types/distribution.pb.go | 206 +++++++---- x/distribution/types/fee_pool.go | 13 +- x/distribution/types/fee_pool_test.go | 3 + 19 files changed, 495 insertions(+), 231 deletions(-) diff --git a/api/cosmos/distribution/v1beta1/distribution.pulsar.go b/api/cosmos/distribution/v1beta1/distribution.pulsar.go index 5ae99f03ed86..cdfdc65147ab 100644 --- a/api/cosmos/distribution/v1beta1/distribution.pulsar.go +++ b/api/cosmos/distribution/v1beta1/distribution.pulsar.go @@ -3703,15 +3703,68 @@ func (x *_FeePool_1_list) IsValid() bool { return x.list != nil } +var _ protoreflect.List = (*_FeePool_2_list)(nil) + +type _FeePool_2_list struct { + list *[]*v1beta1.DecCoin +} + +func (x *_FeePool_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_FeePool_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_FeePool_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) + (*x.list)[i] = concreteValue +} + +func (x *_FeePool_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_FeePool_2_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.DecCoin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_FeePool_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_FeePool_2_list) NewElement() protoreflect.Value { + v := new(v1beta1.DecCoin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_FeePool_2_list) IsValid() bool { + return x.list != nil +} + var ( md_FeePool protoreflect.MessageDescriptor fd_FeePool_community_pool protoreflect.FieldDescriptor + fd_FeePool_decimal_pool protoreflect.FieldDescriptor ) func init() { file_cosmos_distribution_v1beta1_distribution_proto_init() md_FeePool = File_cosmos_distribution_v1beta1_distribution_proto.Messages().ByName("FeePool") fd_FeePool_community_pool = md_FeePool.Fields().ByName("community_pool") + fd_FeePool_decimal_pool = md_FeePool.Fields().ByName("decimal_pool") } var _ protoreflect.Message = (*fastReflection_FeePool)(nil) @@ -3785,6 +3838,12 @@ func (x *fastReflection_FeePool) Range(f func(protoreflect.FieldDescriptor, prot return } } + if len(x.DecimalPool) != 0 { + value := protoreflect.ValueOfList(&_FeePool_2_list{list: &x.DecimalPool}) + if !f(fd_FeePool_decimal_pool, value) { + return + } + } } // Has reports whether a field is populated. @@ -3802,6 +3861,8 @@ func (x *fastReflection_FeePool) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.distribution.v1beta1.FeePool.community_pool": return len(x.CommunityPool) != 0 + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + return len(x.DecimalPool) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3820,6 +3881,8 @@ func (x *fastReflection_FeePool) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "cosmos.distribution.v1beta1.FeePool.community_pool": x.CommunityPool = nil + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + x.DecimalPool = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3842,6 +3905,12 @@ func (x *fastReflection_FeePool) Get(descriptor protoreflect.FieldDescriptor) pr } listValue := &_FeePool_1_list{list: &x.CommunityPool} return protoreflect.ValueOfList(listValue) + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + if len(x.DecimalPool) == 0 { + return protoreflect.ValueOfList(&_FeePool_2_list{}) + } + listValue := &_FeePool_2_list{list: &x.DecimalPool} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3866,6 +3935,10 @@ func (x *fastReflection_FeePool) Set(fd protoreflect.FieldDescriptor, value prot lv := value.List() clv := lv.(*_FeePool_1_list) x.CommunityPool = *clv.list + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + lv := value.List() + clv := lv.(*_FeePool_2_list) + x.DecimalPool = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3892,6 +3965,12 @@ func (x *fastReflection_FeePool) Mutable(fd protoreflect.FieldDescriptor) protor } value := &_FeePool_1_list{list: &x.CommunityPool} return protoreflect.ValueOfList(value) + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + if x.DecimalPool == nil { + x.DecimalPool = []*v1beta1.DecCoin{} + } + value := &_FeePool_2_list{list: &x.DecimalPool} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3908,6 +3987,9 @@ func (x *fastReflection_FeePool) NewField(fd protoreflect.FieldDescriptor) proto case "cosmos.distribution.v1beta1.FeePool.community_pool": list := []*v1beta1.DecCoin{} return protoreflect.ValueOfList(&_FeePool_1_list{list: &list}) + case "cosmos.distribution.v1beta1.FeePool.decimal_pool": + list := []*v1beta1.DecCoin{} + return protoreflect.ValueOfList(&_FeePool_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.FeePool")) @@ -3983,6 +4065,12 @@ func (x *fastReflection_FeePool) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } } + if len(x.DecimalPool) > 0 { + for _, e := range x.DecimalPool { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -4012,6 +4100,22 @@ func (x *fastReflection_FeePool) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.DecimalPool) > 0 { + for iNdEx := len(x.DecimalPool) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.DecimalPool[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } if len(x.CommunityPool) > 0 { for iNdEx := len(x.CommunityPool) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.CommunityPool[iNdEx]) @@ -4111,6 +4215,40 @@ func (x *fastReflection_FeePool) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DecimalPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.DecimalPool = append(x.DecimalPool, &v1beta1.DecCoin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.DecimalPool[len(x.DecimalPool)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6925,14 +7063,15 @@ func (x *ValidatorSlashEvents) GetValidatorSlashEvents() []*ValidatorSlashEvent } // FeePool is the global fee pool for distribution. -// -// Deprecated: Do not use. +// It holds decimal coins. Once whole those coins can be burned or distributed to the community pool. type FeePool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Deprecated: Do not use. CommunityPool []*v1beta1.DecCoin `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3" json:"community_pool,omitempty"` + DecimalPool []*v1beta1.DecCoin `protobuf:"bytes,2,rep,name=decimal_pool,json=decimalPool,proto3" json:"decimal_pool,omitempty"` } func (x *FeePool) Reset() { @@ -6955,6 +7094,7 @@ func (*FeePool) Descriptor() ([]byte, []int) { return file_cosmos_distribution_v1beta1_distribution_proto_rawDescGZIP(), []int{7} } +// Deprecated: Do not use. func (x *FeePool) GetCommunityPool() []*v1beta1.DecCoin { if x != nil { return x.CommunityPool @@ -6962,6 +7102,13 @@ func (x *FeePool) GetCommunityPool() []*v1beta1.DecCoin { return nil } +func (x *FeePool) GetDecimalPool() []*v1beta1.DecCoin { + if x != nil { + return x.DecimalPool + } + return nil +} + // CommunityPoolSpendProposal details a proposal for use of community funds, // together with how many coins are proposed to be spent, and to which // recipient account. @@ -7306,92 +7453,99 @@ var file_cosmos_distribution_v1beta1_distribution_proto_rawDesc = []byte{ 0x74, 0x61, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x8c, 0x01, 0x0a, 0x07, 0x46, 0x65, 0x65, - 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x7d, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, + 0x73, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x80, 0x02, 0x0a, 0x07, 0x46, 0x65, 0x65, + 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x7f, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, 0xde, 0x1f, 0x00, - 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, - 0x6f, 0x6f, 0x6c, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x97, 0x02, 0x0a, 0x1a, 0x43, 0x6f, 0x6d, 0x6d, - 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x50, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x79, 0x0a, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, - 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, - 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x28, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xe8, - 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x22, 0xd4, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x27, 0x0a, 0x0f, 0x70, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x65, - 0x72, 0x69, 0x6f, 0x64, 0x12, 0x4c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 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, 0x05, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x2c, 0xea, 0xde, 0x1f, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa2, 0xe7, 0xb0, 0x2a, 0x0f, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0xe1, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x6f, 0x72, 0x5f, 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, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, - 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, - 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xd5, 0x01, 0x0a, - 0x25, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, - 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x44, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x3a, 0x24, - 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x42, 0x88, 0x02, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x64, 0x69, 0x73, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, - 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, - 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, 0xe2, 0x1e, 0x01, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x3a, 0x18, 0x01, 0xc8, 0xde, + 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, + 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, + 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x74, 0x0a, 0x0c, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, + 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x33, 0xc8, 0xde, 0x1f, 0x00, 0xaa, + 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x0b, + 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x97, 0x02, 0x0a, 0x1a, + 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x70, 0x65, + 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, + 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, + 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, + 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x28, 0x18, 0x01, 0x88, + 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xd4, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x69, + 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, + 0x75, 0x73, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x4c, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 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, + 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2c, 0xea, 0xde, 0x1f, 0x0f, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa2, 0xe7, 0xb0, 0x2a, 0x0f, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0xe1, 0x01, 0x0a, + 0x19, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 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, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x72, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, + 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, + 0x22, 0xd5, 0x01, 0x0a, 0x25, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x50, 0x6f, + 0x6f, 0x6c, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x57, + 0x69, 0x74, 0x68, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x3a, 0x24, 0x18, 0x01, 0x88, 0xa0, 0x1f, 0x00, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x42, 0x88, 0x02, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x11, 0x44, 0x69, + 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x40, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, + 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x44, 0x58, 0xaa, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x27, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x44, + 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa8, + 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7430,13 +7584,14 @@ var file_cosmos_distribution_v1beta1_distribution_proto_depIdxs = []int32{ 12, // 3: cosmos.distribution.v1beta1.ValidatorOutstandingRewards.rewards:type_name -> cosmos.base.v1beta1.DecCoin 5, // 4: cosmos.distribution.v1beta1.ValidatorSlashEvents.validator_slash_events:type_name -> cosmos.distribution.v1beta1.ValidatorSlashEvent 12, // 5: cosmos.distribution.v1beta1.FeePool.community_pool:type_name -> cosmos.base.v1beta1.DecCoin - 13, // 6: cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount:type_name -> cosmos.base.v1beta1.Coin - 12, // 7: cosmos.distribution.v1beta1.DelegationDelegatorReward.reward:type_name -> cosmos.base.v1beta1.DecCoin - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 12, // 6: cosmos.distribution.v1beta1.FeePool.decimal_pool:type_name -> cosmos.base.v1beta1.DecCoin + 13, // 7: cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount:type_name -> cosmos.base.v1beta1.Coin + 12, // 8: cosmos.distribution.v1beta1.DelegationDelegatorReward.reward:type_name -> cosmos.base.v1beta1.DecCoin + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_cosmos_distribution_v1beta1_distribution_proto_init() } diff --git a/proto/cosmos/distribution/v1beta1/distribution.proto b/proto/cosmos/distribution/v1beta1/distribution.proto index 010f588b5fdb..4be19167c209 100644 --- a/proto/cosmos/distribution/v1beta1/distribution.proto +++ b/proto/cosmos/distribution/v1beta1/distribution.proto @@ -115,14 +115,17 @@ message ValidatorSlashEvents { } // FeePool is the global fee pool for distribution. +// It holds decimal coins. Once whole those coins can be burned or distributed to the community pool. message FeePool { - option deprecated = true; - repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + deprecated = true ]; + + repeated cosmos.base.v1beta1.DecCoin decimal_pool = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; } // CommunityPoolSpendProposal details a proposal for use of community funds, diff --git a/x/distribution/README.md b/x/distribution/README.md index c76902d89328..72a3bb743b8d 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -2,6 +2,8 @@ sidebar_position: 1 --- +// TODO REVIEW this whole doc + # `x/distribution` ## Overview @@ -81,17 +83,17 @@ to set up a script to periodically withdraw and rebond rewards. * [Concepts](#concepts) * [State](#state) - * [Validator Distribution](#validator-distribution) - * [Delegation Distribution](#delegation-distribution) - * [Params](#params) + * [Validator Distribution](#validator-distribution) + * [Delegation Distribution](#delegation-distribution) + * [Params](#params) * [Begin Block](#begin-block) * [Messages](#messages) * [Hooks](#hooks) * [Events](#events) * [Parameters](#parameters) * [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) + * [CLI](#cli) + * [gRPC](#grpc) ## Concepts @@ -258,15 +260,15 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/distribution/ ```go func (k Keeper) SetWithdrawAddr(ctx context.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error - if k.blockedAddrs[withdrawAddr.String()] { - fail with "`{withdrawAddr}` is not allowed to receive external funds" - } + if k.blockedAddrs[withdrawAddr.String()] { + fail with "`{withdrawAddr}` is not allowed to receive external funds" + } - if !k.GetWithdrawAddrEnabled(ctx) { - fail with `ErrSetWithdrawAddrDisabled` - } + if !k.GetWithdrawAddrEnabled(ctx) { + fail with `ErrSetWithdrawAddrDisabled` + } - k.SetDelegatorWithdrawAddr(ctx, delegatorAddr, withdrawAddr) + k.SetDelegatorWithdrawAddr(ctx, delegatorAddr, withdrawAddr) ``` ### MsgWithdrawDelegatorReward @@ -330,17 +332,17 @@ func (k Keeper) initializeDelegation(ctx context.Context, val sdk.ValAddress, de // period has already been incremented - we want to store the period ended by this delegation action previousPeriod := k.GetValidatorCurrentRewards(ctx, val).Period - 1 - // increment reference count for the period we're going to track - k.incrementReferenceCount(ctx, val, previousPeriod) + // increment reference count for the period we're going to track + k.incrementReferenceCount(ctx, val, previousPeriod) - validator := k.stakingKeeper.Validator(ctx, val) - delegation := k.stakingKeeper.Delegation(ctx, del, val) + validator := k.stakingKeeper.Validator(ctx, val) + delegation := k.stakingKeeper.Delegation(ctx, del, val) - // calculate delegation stake in tokens - // we don't store directly, so multiply delegation shares * (tokens per share) - // note: necessary to truncate so we don't allow withdrawing more rewards than owed - stake := validator.TokensFromSharesTruncated(delegation.GetShares()) - k.SetDelegatorStartingInfo(ctx, val, del, types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight()))) + // calculate delegation stake in tokens + // we don't store directly, so multiply delegation shares * (tokens per share) + // note: necessary to truncate so we don't allow withdrawing more rewards than owed + stake := validator.TokensFromSharesTruncated(delegation.GetShares()) + k.SetDelegatorStartingInfo(ctx, val, del, types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight()))) } ``` diff --git a/x/distribution/abci.go b/x/distribution/abci.go index 85d6bf769d3a..f2f9452ad2c0 100644 --- a/x/distribution/abci.go +++ b/x/distribution/abci.go @@ -27,6 +27,13 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) error { if err := k.AllocateTokens(ctx, previousTotalPower, ctx.CometInfo().LastCommit.Votes); err != nil { return err } + + // every 1000 blocks send whole coins from decimal pool to community pool + if ctx.BlockHeight()%1000 == 0 { + if err := k.SendDecimalPoolToCommunityPool(ctx); err != nil { + return err + } + } } // record the proposer for when we payout on the next block diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index b895bc52fd0a..c3b05acb11b1 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -65,8 +65,13 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo remaining = remaining.Sub(reward) } - // send to community pool - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, sdk.NormalizeCoins(remaining)); err != nil { + // send to community pool and set remainder in fee pool + amt, re := remaining.TruncateDecimal() + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, amt); err != nil { + return err + } + + if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: re}); err != nil { return err } @@ -135,3 +140,23 @@ func (k Keeper) AllocateTokensToValidator(ctx context.Context, val stakingtypes. outstanding.Rewards = outstanding.Rewards.Add(tokens...) return k.ValidatorOutstandingRewards.Set(ctx, valBz, outstanding) } + +// SendDecimalPoolToCommunityPool sends the decimal pool to the community pool +// Any remainer stays in the decimal pool +func (k Keeper) SendDecimalPoolToCommunityPool(ctx context.Context) error { + feePool, err := k.FeePool.Get(ctx) + if err != nil { + return err + } + + if feePool.DecimalPool.IsZero() { + return nil + } + + amt, re := feePool.DecimalPool.TruncateDecimal() + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, amt); err != nil { + return err + } + + return k.FeePool.Set(ctx, types.FeePool{DecimalPool: re}) +} diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 3b3a4dd9d18c..79fbd4bf9840 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -150,7 +150,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { feePool, err := distrKeeper.FeePool.Get(ctx) require.NoError(t, err) - require.True(t, feePool.CommunityPool.IsZero()) + require.True(t, feePool.DecimalPool.IsZero()) _, err = distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valAddr0) require.ErrorIs(t, err, collections.ErrNotFound) @@ -192,7 +192,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { // 2 community pool coins feePool, err = distrKeeper.FeePool.Get(ctx) require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: math.LegacyNewDec(2)}}, feePool.CommunityPool) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: math.LegacyNewDec(2)}}, feePool.DecimalPool) // 50% commission for first proposer, (0.5 * 98%) * 100 / 2 = 23.25 val0Commission, err := distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valAddr0) @@ -291,7 +291,7 @@ func TestAllocateTokensTruncation(t *testing.T) { feePool, err := distrKeeper.FeePool.Get(ctx) require.NoError(t, err) - require.True(t, feePool.CommunityPool.IsZero()) + require.True(t, feePool.DecimalPool.IsZero()) _, err = distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valAddr0) require.ErrorIs(t, err, collections.ErrNotFound) diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index a107f35d7c93..ec40d025ccf7 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -248,7 +248,7 @@ func (k Keeper) withdrawDelegationRewards(ctx context.Context, val stakingtypes. ) } - // truncate reward dec coins, return remainder to community pool + // truncate reward dec coins, return remainder to decimal pool finalRewards, remainder := rewards.TruncateDecimal() // add coins to user account @@ -264,10 +264,8 @@ func (k Keeper) withdrawDelegationRewards(ctx context.Context, val stakingtypes. } } - // update the outstanding rewards and the community pool only if the - // transaction was successful - err = k.ValidatorOutstandingRewards.Set(ctx, sdk.ValAddress(valAddr), types.ValidatorOutstandingRewards{Rewards: outstanding.Sub(rewards)}) - if err != nil { + // update the outstanding rewards and the decimal pool only if the transaction was successful + if err := k.ValidatorOutstandingRewards.Set(ctx, sdk.ValAddress(valAddr), types.ValidatorOutstandingRewards{Rewards: outstanding.Sub(rewards)}); err != nil { return nil, err } @@ -276,7 +274,7 @@ func (k Keeper) withdrawDelegationRewards(ctx context.Context, val stakingtypes. return nil, err } - feePool.CommunityPool = feePool.CommunityPool.Add(remainder...) + feePool.DecimalPool = feePool.DecimalPool.Add(remainder...) err = k.FeePool.Set(ctx, feePool) if err != nil { return nil, err diff --git a/x/distribution/keeper/genesis.go b/x/distribution/keeper/genesis.go index 0f3ecaccb9ff..2abc1645615c 100644 --- a/x/distribution/keeper/genesis.go +++ b/x/distribution/keeper/genesis.go @@ -127,7 +127,7 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) { } } - moduleHoldings = moduleHoldings.Add(data.FeePool.CommunityPool...) + moduleHoldings = moduleHoldings.Add(data.FeePool.DecimalPool...) moduleHoldingsInt, _ := moduleHoldings.TruncateDecimal() // check if the module account exists diff --git a/x/distribution/keeper/hooks.go b/x/distribution/keeper/hooks.go index 6a819fc88500..924744f9035d 100644 --- a/x/distribution/keeper/hooks.go +++ b/x/distribution/keeper/hooks.go @@ -56,13 +56,13 @@ func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, val // split into integral & remainder coins, remainder := commission.TruncateDecimal() - // remainder to community pool + // remainder to decimal pool feePool, err := h.k.FeePool.Get(ctx) if err != nil { return err } - feePool.CommunityPool = feePool.CommunityPool.Add(remainder...) + feePool.DecimalPool = feePool.DecimalPool.Add(remainder...) err = h.k.FeePool.Set(ctx, feePool) if err != nil { return err @@ -82,15 +82,15 @@ func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, val } } - // Add outstanding to community pool + // Add outstanding to decimal pool // The validator is removed only after it has no more delegations. - // This operation sends only the remaining dust to the community pool. + // This operation sends only the remaining dust to the decimal pool. feePool, err := h.k.FeePool.Get(ctx) if err != nil { return err } - feePool.CommunityPool = feePool.CommunityPool.Add(outstanding...) + feePool.DecimalPool = feePool.DecimalPool.Add(outstanding...) err = h.k.FeePool.Set(ctx, feePool) if err != nil { return err diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index fd11bc60a9db..9384d4829733 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -196,16 +196,9 @@ func ModuleAccountInvariant(k Keeper) sdk.Invariant { return sdk.FormatInvariant(types.ModuleName, "module account coins", err.Error()), true } - communityPool, err := k.FeePool.Get(ctx) - if err != nil { - panic(err) - } - - expectedInt, _ := expectedCoins.Add(communityPool.CommunityPool...).TruncateDecimal() - - macc := k.GetDistributionAccount(ctx) - balances := k.bankKeeper.GetAllBalances(ctx, macc.GetAddress()) + expectedInt, _ := expectedCoins.TruncateDecimal() + balances := k.bankKeeper.GetAllBalances(ctx, k.GetDistributionAccount(ctx).GetAddress()) broken := !balances.Equal(expectedInt) return sdk.FormatInvariant( types.ModuleName, "ModuleAccount coins", diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index e97b6a090c35..1b018349b8e9 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -33,7 +33,8 @@ type Keeper struct { Schema collections.Schema Params collections.Item[types.Params] - // Deprecated: this is staying for the migration from distribution community pool to protocolpool. + // FeePool stores decimal tokens that cannot be yet distributed. + // In the past it held the community pool, but it has been replaced by x/protocolpool. FeePool collections.Item[types.FeePool] // DelegatorsWithdrawAddress key: delAddr | value: withdrawAddr DelegatorsWithdrawAddress collections.Map[sdk.AccAddress, sdk.AccAddress] diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index cea2daa05920..03807186c42a 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -2,7 +2,6 @@ package keeper import ( v4 "cosmossdk.io/x/distribution/migrations/v4" - "cosmossdk.io/x/distribution/types" pooltypes "cosmossdk.io/x/protocolpool/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -50,10 +49,11 @@ func (m Migrator) migrateFunds(ctx sdk.Context) error { return err } - if err = v4.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc); err != nil { + feelPool, err := v4.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc) + if err != nil { return err } - // return FeePool as empty (since FeePool funds are migrated to pool module account) - return m.keeper.FeePool.Set(ctx, types.FeePool{}) + // the feelpool has now an empty community pool and the remainder is stored in the DecimalPool + return m.keeper.FeePool.Set(ctx, feelPool) } diff --git a/x/distribution/keeper/validator.go b/x/distribution/keeper/validator.go index f07ff12705bc..995f3e6d69e5 100644 --- a/x/distribution/keeper/validator.go +++ b/x/distribution/keeper/validator.go @@ -61,7 +61,7 @@ func (k Keeper) IncrementValidatorPeriod(ctx context.Context, val stakingtypes.V if val.GetTokens().IsZero() { // can't calculate ratio for zero-token validators - // ergo we instead add to the community pool + // ergo we instead add to the decimal pool feePool, err := k.FeePool.Get(ctx) if err != nil { return 0, err @@ -72,7 +72,7 @@ func (k Keeper) IncrementValidatorPeriod(ctx context.Context, val stakingtypes.V return 0, err } - feePool.CommunityPool = feePool.CommunityPool.Add(rewards.Rewards...) + feePool.DecimalPool = feePool.DecimalPool.Add(rewards.Rewards...) outstanding.Rewards = outstanding.GetRewards().Sub(rewards.Rewards) err = k.FeePool.Set(ctx, feePool) if err != nil { diff --git a/x/distribution/migrations/v4/migrate_funds.go b/x/distribution/migrations/v4/migrate_funds.go index adca2a6681ea..bf2df7c82294 100644 --- a/x/distribution/migrations/v4/migrate_funds.go +++ b/x/distribution/migrations/v4/migrate_funds.go @@ -9,22 +9,24 @@ import ( ) // MigrateFunds migrates the distribution module funds to pool module -func MigrateFunds(ctx sdk.Context, bankKeeper types.BankKeeper, feePool types.FeePool, macc, poolMacc sdk.ModuleAccountI) error { - poolBal := sdk.NormalizeCoins(feePool.CommunityPool) +func MigrateFunds(ctx sdk.Context, bankKeeper types.BankKeeper, feePool types.FeePool, macc, poolMacc sdk.ModuleAccountI) (types.FeePool, error) { + poolBal, remainder := feePool.CommunityPool.TruncateDecimal() + distrbalances := bankKeeper.GetAllBalances(ctx, macc.GetAddress()) if distrbalances.IsZero() || distrbalances.IsAllLT(poolBal) { - return fmt.Errorf("%s module account balance is less than FeePool balance", macc.GetName()) + return types.FeePool{}, fmt.Errorf("%s module account balance is less than FeePool balance", macc.GetName()) } // transfer feepool funds from the distribution module account to pool module account if err := bankKeeper.SendCoinsFromModuleToModule(ctx, macc.GetName(), poolMacc.GetName(), poolBal); err != nil { - return err + return types.FeePool{}, err } // check the migrated balance from pool module account is same as fee pool balance balances := bankKeeper.GetAllBalances(ctx, poolMacc.GetAddress()) if !balances.Equal(poolBal) { - return fmt.Errorf("pool module account balance is not same as FeePool balance after migration") + return types.FeePool{}, fmt.Errorf("pool module account balance is not same as FeePool balance after migration") } - return nil + + return types.FeePool{DecimalPool: remainder}, nil } diff --git a/x/distribution/migrations/v4/migrate_funds_test.go b/x/distribution/migrations/v4/migrate_funds_test.go index d51558abb0cd..74e4647e76fc 100644 --- a/x/distribution/migrations/v4/migrate_funds_test.go +++ b/x/distribution/migrations/v4/migrate_funds_test.go @@ -100,8 +100,8 @@ func TestFundsMigration(t *testing.T) { // Set pool module account poolAcc := authtypes.NewEmptyModuleAccount(pooltypes.ModuleName) - // migrate feepool funds from distribution module account to pool module accout - err = v4.MigrateFunds(ctx, bankKeeper, feepool, distrAcc, poolAcc) + // migrate feepool funds from distribution module account to pool module account + _, err = v4.MigrateFunds(ctx, bankKeeper, feepool, distrAcc, poolAcc) require.NoError(t, err) // set distrbution feepool as empty (since migration) diff --git a/x/distribution/simulation/decoder_test.go b/x/distribution/simulation/decoder_test.go index 10f97a837801..fdd35a28ef56 100644 --- a/x/distribution/simulation/decoder_test.go +++ b/x/distribution/simulation/decoder_test.go @@ -31,7 +31,7 @@ func TestDecodeDistributionStore(t *testing.T) { decCoins := sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, math.LegacyOneDec())} feePool := types.InitialFeePool() - feePool.CommunityPool = decCoins + feePool.DecimalPool = decCoins slashEvent := types.NewValidatorSlashEvent(10, math.LegacyOneDec()) kvPairs := kv.Pairs{ diff --git a/x/distribution/types/distribution.pb.go b/x/distribution/types/distribution.pb.go index af87f73c0eb0..5e072e0ed09d 100644 --- a/x/distribution/types/distribution.pb.go +++ b/x/distribution/types/distribution.pb.go @@ -387,10 +387,10 @@ func (m *ValidatorSlashEvents) GetValidatorSlashEvents() []ValidatorSlashEvent { } // FeePool is the global fee pool for distribution. -// -// Deprecated: Do not use. +// It holds decimal coins. Once whole those coins can be burned or distributed to the community pool. type FeePool struct { - CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool"` + CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool"` // Deprecated: Do not use. + DecimalPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,2,rep,name=decimal_pool,json=decimalPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"decimal_pool"` } func (m *FeePool) Reset() { *m = FeePool{} } @@ -426,6 +426,7 @@ func (m *FeePool) XXX_DiscardUnknown() { var xxx_messageInfo_FeePool proto.InternalMessageInfo +// Deprecated: Do not use. func (m *FeePool) GetCommunityPool() github_com_cosmos_cosmos_sdk_types.DecCoins { if m != nil { return m.CommunityPool @@ -433,6 +434,13 @@ func (m *FeePool) GetCommunityPool() github_com_cosmos_cosmos_sdk_types.DecCoins return nil } +func (m *FeePool) GetDecimalPool() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.DecimalPool + } + return nil +} + // CommunityPoolSpendProposal details a proposal for use of community funds, // together with how many coins are proposed to be spent, and to which // recipient account. @@ -649,71 +657,73 @@ func init() { } var fileDescriptor_cd78a31ea281a992 = []byte{ - // 1018 bytes of a gzipped FileDescriptorProto + // 1044 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x34, 0x89, 0xd3, 0x4c, 0xdb, 0x84, 0x4e, 0x7e, 0xd4, 0x71, 0x8b, 0xed, 0xae, 0xa8, - 0x30, 0x81, 0xd8, 0xa4, 0x48, 0x08, 0xf9, 0x82, 0x1a, 0xbb, 0x15, 0x48, 0x05, 0xa2, 0x0d, 0x02, - 0x09, 0x0e, 0xab, 0xf1, 0xee, 0xc4, 0x1e, 0xb2, 0x3b, 0xb3, 0xcc, 0x8c, 0x9d, 0xe4, 0xc0, 0xbd, - 0x20, 0x04, 0xdc, 0x40, 0x3d, 0x55, 0x70, 0xa9, 0x38, 0xe5, 0x90, 0x3f, 0xa2, 0xe2, 0x54, 0x55, - 0x80, 0x10, 0x87, 0x00, 0xc9, 0x21, 0x88, 0xbf, 0x02, 0xcd, 0xce, 0x78, 0xd7, 0x09, 0x01, 0x95, - 0x22, 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, 0x7c, 0xde, - 0x63, 0x2a, 0x39, 0xdf, 0x0b, 0xee, 0x74, 0x1a, 0x6e, 0xea, 0xa8, 0xf3, 0x0d, 0x80, 0x97, 0x52, - 0x61, 0xcd, 0x9e, 0x10, 0x84, 0xa9, 0x81, 0xaa, 0x18, 0x4e, 0x1a, 0x25, 0x72, 0xc4, 0x22, 0x06, - 0x30, 0x68, 0x01, 0xe6, 0x63, 0x22, 0x28, 0x37, 0x6e, 0x1c, 0x77, 0xed, 0xca, 0xf9, 0x0a, 0xc0, - 0x52, 0xca, 0xf2, 0x86, 0x6f, 0x35, 0x93, 0xa0, 0xc9, 0xa3, 0x88, 0x4a, 0x49, 0x39, 0x43, 0x7d, - 0x08, 0xfd, 0x74, 0x35, 0x62, 0xbe, 0x43, 0x48, 0xce, 0xe7, 0x00, 0x5e, 0x4e, 0xa9, 0xbd, 0xd5, - 0x53, 0x52, 0x61, 0x16, 0x50, 0xd6, 0xf9, 0xdf, 0x9a, 0xa8, 0x19, 0xcd, 0xa6, 0x8c, 0xd6, 0x43, - 0x2c, 0xbb, 0x37, 0xfb, 0x84, 0x29, 0xf4, 0x1c, 0x7c, 0xaa, 0x3f, 0x08, 0x7b, 0xb6, 0xcd, 0x20, - 0x69, 0xf3, 0x4c, 0x1a, 0x5f, 0x4b, 0xc2, 0xe8, 0x0d, 0x78, 0x76, 0x43, 0x60, 0x5f, 0xdf, 0x00, - 0x3b, 0x17, 0x56, 0xfe, 0xf5, 0x55, 0x75, 0xd3, 0x12, 0xce, 0xc7, 0x00, 0xce, 0x9d, 0xc2, 0x48, - 0xa2, 0x0f, 0xe1, 0x42, 0x46, 0x49, 0xea, 0x84, 0x47, 0x92, 0x8c, 0xed, 0xd5, 0x8b, 0xb5, 0x7f, - 0x98, 0xca, 0xb5, 0x53, 0x4a, 0xae, 0x4e, 0x69, 0x9e, 0xa6, 0x21, 0x73, 0xfd, 0x53, 0x20, 0x9d, - 0x4f, 0x01, 0x9c, 0xbc, 0x45, 0xc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0xd0, 0x63, 0x2e, 0x9b, 0x29, + 0xd6, 0x8e, 0x18, 0xcc, 0xa7, 0x4f, 0x8a, 0xf3, 0x1c, 0x78, 0x16, 0xa5, 0x36, 0xa4, 0x8f, 0xd7, + 0xf9, 0x11, 0xc0, 0xeb, 0xff, 0x5c, 0xd4, 0xef, 0x51, 0xd5, 0x6e, 0x90, 0x98, 0x4b, 0xaa, 0xce, + 0xa9, 0xbe, 0x67, 0xfb, 0xea, 0x5b, 0xbb, 0xec, 0x0a, 0x15, 0xe0, 0x48, 0x60, 0x80, 0x0b, 0xc3, + 0x89, 0xa3, 0xb7, 0xac, 0x3d, 0x77, 0xef, 0x14, 0x25, 0xb9, 0xf2, 0xda, 0xc3, 0xfd, 0x12, 0x78, + 0xb4, 0x5f, 0x02, 0x8f, 0xf7, 0x4b, 0xe0, 0xb7, 0xfd, 0x12, 0xf8, 0xf2, 0xa0, 0x94, 0x7b, 0x7c, + 0x50, 0xca, 0xfd, 0x7c, 0x50, 0xca, 0xbd, 0x7f, 0xed, 0x48, 0x59, 0x1d, 0x7b, 0xbb, 0x24, 0x49, + 0x6b, 0xe6, 0x93, 0xe7, 0xe5, 0xcd, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x08, 0x33, 0x8d, + 0x11, 0x0b, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -954,6 +964,14 @@ func (this *FeePool) Equal(that interface{}) bool { return false } } + if len(this.DecimalPool) != len(that1.DecimalPool) { + return false + } + for i := range this.DecimalPool { + if !this.DecimalPool[i].Equal(&that1.DecimalPool[i]) { + return false + } + } return true } func (this *DelegatorStartingInfo) Equal(that interface{}) bool { @@ -1370,6 +1388,20 @@ func (m *FeePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DecimalPool) > 0 { + for iNdEx := len(m.DecimalPool) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DecimalPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDistribution(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } if len(m.CommunityPool) > 0 { for iNdEx := len(m.CommunityPool) - 1; iNdEx >= 0; iNdEx-- { { @@ -1726,6 +1758,12 @@ func (m *FeePool) Size() (n int) { n += 1 + l + sovDistribution(uint64(l)) } } + if len(m.DecimalPool) > 0 { + for _, e := range m.DecimalPool { + l = e.Size() + n += 1 + l + sovDistribution(uint64(l)) + } + } return n } @@ -2623,6 +2661,40 @@ func (m *FeePool) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecimalPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDistribution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDistribution + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDistribution + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DecimalPool = append(m.DecimalPool, types.DecCoin{}) + if err := m.DecimalPool[len(m.DecimalPool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDistribution(dAtA[iNdEx:]) diff --git a/x/distribution/types/fee_pool.go b/x/distribution/types/fee_pool.go index 81c7614c450d..4a0b9b7b5716 100644 --- a/x/distribution/types/fee_pool.go +++ b/x/distribution/types/fee_pool.go @@ -6,19 +6,22 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// zero fee pool -// Deperecated: FeePool is deprecated +// InitialFeePool initalizes a zero fee pool func InitialFeePool() FeePool { return FeePool{ + DecimalPool: sdk.DecCoins{}, CommunityPool: sdk.DecCoins{}, } } // ValidateGenesis validates the fee pool for a genesis state func (f FeePool) ValidateGenesis() error { - if f.CommunityPool.IsAnyNegative() { - return fmt.Errorf("negative CommunityPool in distribution fee pool, is %v", - f.CommunityPool) + if f.DecimalPool.IsAnyNegative() { + return fmt.Errorf("negative DecimalPool in distribution fee pool, is %v", f.DecimalPool) + } + + if f.CommunityPool.IsAnyNegative() { // TODO(@julienrbrt) in v0.53, panic if the community pool is set + return fmt.Errorf("negative CommunityPool in distribution fee pool, is %v", f.CommunityPool) } return nil diff --git a/x/distribution/types/fee_pool_test.go b/x/distribution/types/fee_pool_test.go index 192e94f022b2..86d3c93f6e64 100644 --- a/x/distribution/types/fee_pool_test.go +++ b/x/distribution/types/fee_pool_test.go @@ -17,4 +17,7 @@ func TestValidateGenesis(t *testing.T) { fp2 := types.FeePool{CommunityPool: sdk.DecCoins{{Denom: "stake", Amount: math.LegacyNewDec(-1)}}} require.NotNil(t, fp2.ValidateGenesis()) + + fp3 := types.FeePool{DecimalPool: sdk.DecCoins{{Denom: "stake", Amount: math.LegacyNewDec(-1)}}} + require.NotNil(t, fp3.ValidateGenesis()) } From 5c7cc0d2a96bbdbbb7205d914538c62e3280f7bb Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 12:11:58 +0100 Subject: [PATCH 04/15] updates --- simapp/export.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simapp/export.go b/simapp/export.go index 81e78fd3267b..3d501298198e 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -126,8 +126,8 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] if err != nil { panic(err) } - // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + // donate any unwithdrawn outstanding reward tokens to the community pool + rewards, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) if err != nil { panic(err) } @@ -135,7 +135,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] if err != nil { panic(err) } - feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + feePool.DecimalPool = feePool.DecimalPool.Add(rewards...) // distribution will allocate this to the protocolpool eventually if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { panic(err) } From 4cfc9a74ecbadea2aa8ff1966445ba7acb8cd689 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 12:33:45 +0100 Subject: [PATCH 05/15] fixes --- x/distribution/keeper/allocation.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index c3b05acb11b1..4bb03a20719c 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -29,6 +29,17 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo return err } + if totalPreviousPower == 0 { + feePool, err := k.FeePool.Get(ctx) + if err != nil { + return err + } + + if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: feePool.DecimalPool.Add(feesCollected...)}); err != nil { + return err + } + } + // calculate fraction allocated to validators remaining := feesCollected communityTax, err := k.GetCommunityTax(ctx) @@ -71,7 +82,12 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo return err } - if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: re}); err != nil { + feePool, err := k.FeePool.Get(ctx) + if err != nil { + return err + } + + if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: feePool.DecimalPool.Add(re...)}); err != nil { return err } From 721dec9b608983d5e482f06706c7d23320c8701c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 12:38:46 +0100 Subject: [PATCH 06/15] liiiint --- x/distribution/keeper/allocation.go | 15 +++++---------- x/distribution/types/fee_pool.go | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 4bb03a20719c..00335348e1d0 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -29,12 +29,12 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo return err } - if totalPreviousPower == 0 { - feePool, err := k.FeePool.Get(ctx) - if err != nil { - return err - } + feePool, err := k.FeePool.Get(ctx) + if err != nil { + return err + } + if totalPreviousPower == 0 { if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: feePool.DecimalPool.Add(feesCollected...)}); err != nil { return err } @@ -82,11 +82,6 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo return err } - feePool, err := k.FeePool.Get(ctx) - if err != nil { - return err - } - if err := k.FeePool.Set(ctx, types.FeePool{DecimalPool: feePool.DecimalPool.Add(re...)}); err != nil { return err } diff --git a/x/distribution/types/fee_pool.go b/x/distribution/types/fee_pool.go index 4a0b9b7b5716..894bff19196c 100644 --- a/x/distribution/types/fee_pool.go +++ b/x/distribution/types/fee_pool.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// InitialFeePool initalizes a zero fee pool +// InitialFeePool initializes a zero fee pool func InitialFeePool() FeePool { return FeePool{ DecimalPool: sdk.DecCoins{}, From 8c4c1938073a90b15b451431b5b5c6c913aadeed Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 12:53:33 +0100 Subject: [PATCH 07/15] feedback Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> --- x/protocolpool/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/protocolpool/keeper/keeper.go b/x/protocolpool/keeper/keeper.go index 3f059cc84786..d50c8583d61c 100644 --- a/x/protocolpool/keeper/keeper.go +++ b/x/protocolpool/keeper/keeper.go @@ -97,7 +97,7 @@ func (k Keeper) claimFunds(ctx context.Context, recipient sdk.AccAddress) (amoun return sdk.Coin{}, fmt.Errorf("error getting claimable funds: %w", err) } - // distribute amount from cimmunity pool + // distribute amount from community pool err = k.DistributeFromCommunityPool(ctx, sdk.NewCoins(amount), recipient) if err != nil { return sdk.Coin{}, fmt.Errorf("error distributing from fee pool: %w", err) From 53bdcaf0a7e0f8a897063c177ac5b30b9b26d949 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 15:35:14 +0100 Subject: [PATCH 08/15] updates --- CHANGELOG.md | 22 +------ .../distribution/keeper/msg_server_test.go | 7 -- x/distribution/CHANGELOG.md | 64 +++++++++++++++++++ x/distribution/README.md | 21 +++++- x/distribution/keeper/allocation.go | 51 ++++++++++----- x/distribution/keeper/allocation_test.go | 5 +- 6 files changed, 123 insertions(+), 47 deletions(-) create mode 100644 x/distribution/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b6ba42414dff..f8843ee570e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,8 +80,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (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. * (x/bank/testutil) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) `MsgSendExec` has been removed because of AutoCLI migration. -* (x/distribution) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) The `FundCommunityPool` and `DistributeFromFeePool` keeper methods are now removed from x/distribution. -* (x/distribution) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) The distribution module keeper now takes a new argument `PoolKeeper` in addition. * (app) [#17838](https://github.com/cosmos/cosmos-sdk/pull/17838) Params module was removed from simapp and all imports of the params module removed throughout the repo. * The Cosmos SDK has migrated away from using params, if your app still uses it, then you can leave it plugged into your app * (x/staking) [#17778](https://github.com/cosmos/cosmos-sdk/pull/17778) Use collections for `Params` @@ -129,8 +127,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/staking) [#17248](https://github.com/cosmos/cosmos-sdk/pull/17248) Use collections for `UnbondingType`. * remove from `types`: `GetUnbondingTypeKey`. * (client) [#17259](https://github.com/cosmos/cosmos-sdk/pull/17259) Remove deprecated `clientCtx.PrintObjectLegacy`. Use `clientCtx.PrintProto` or `clientCtx.PrintRaw` instead. -* (x/distribution) [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Use collections for `PreviousProposer` and `ValidatorSlashEvents`: - * remove from `Keeper`: `GetPreviousProposerConsAddr`, `SetPreviousProposerConsAddr`, `GetValidatorHistoricalReferenceCount`, `GetValidatorSlashEvent`, `SetValidatorSlashEvent`. * (x/feegrant) [#16535](https://github.com/cosmos/cosmos-sdk/pull/16535) Use collections for `FeeAllowance`, `FeeAllowanceQueue`. * (x/staking) [#17063](https://github.com/cosmos/cosmos-sdk/pull/17063) Use collections for `HistoricalInfo`: * remove `Keeper`: `GetHistoricalInfo`, `SetHistoricalInfo` @@ -140,19 +136,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * remove `Keeper`: `SetValidatorSigningInfo`, `GetValidatorSigningInfo`, `IterateValidatorSigningInfos` * (x/staking) [#17026](https://github.com/cosmos/cosmos-sdk/pull/17026) Use collections for `LastTotalPower`: * remove `Keeper`: `SetLastTotalPower`, `GetLastTotalPower` -* (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: - * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. -* (x/distribution) [#16459](https://github.com/cosmos/cosmos-sdk/pull/16459) use collections for `ValidatorCurrentRewards` state management: - * remove `Keeper`: `IterateValidatorCurrentRewards`, `GetValidatorCurrentRewards`, `SetValidatorCurrentRewards`, `DeleteValidatorCurrentRewards` * (x/authz) [#16509](https://github.com/cosmos/cosmos-sdk/pull/16509) `AcceptResponse` has been moved to sdk/types/authz and the `Updated` field is now of the type `sdk.Msg` instead of `authz.Authorization`. -* (x/distribution) [#16483](https://github.com/cosmos/cosmos-sdk/pull/16483) use collections for `DelegatorStartingInfo` state management: - * remove `Keeper`: `IterateDelegatorStartingInfo`, `GetDelegatorStartingInfo`, `SetDelegatorStartingInfo`, `DeleteDelegatorStartingInfo`, `HasDelegatorStartingInfo` -* (x/distribution) [#16571](https://github.com/cosmos/cosmos-sdk/pull/16571) use collections for `ValidatorAccumulatedCommission` state management: - * remove `Keeper`: `IterateValidatorAccumulatedCommission`, `GetValidatorAccumulatedCommission`, `SetValidatorAccumulatedCommission`, `DeleteValidatorAccumulatedCommission` -* (x/distribution) [#16590](https://github.com/cosmos/cosmos-sdk/pull/16590) use collections for `ValidatorOutstandingRewards` state management: - * remove `Keeper`: `IterateValidatorOutstandingRewards`, `GetValidatorOutstandingRewards`, `SetValidatorOutstandingRewards`, `DeleteValidatorOutstandingRewards` -* (x/distribution) [#16607](https://github.com/cosmos/cosmos-sdk/pull/16607) use collections for `ValidatorHistoricalRewards` state management: - * remove `Keeper`: `IterateValidatorHistoricalRewards`, `GetValidatorHistoricalRewards`, `SetValidatorHistoricalRewards`, `DeleteValidatorHistoricalRewards`, `DeleteValidatorHistoricalReward`, `DeleteAllValidatorHistoricalRewards` * (x/slashing) [#16441](https://github.com/cosmos/cosmos-sdk/pull/16441) Params state is migrated to collections. `GetParams` has been removed. * (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling. * (client) [#17215](https://github.com/cosmos/cosmos-sdk/pull/17215) `server.StartCmd`,`server.ExportCmd`,`server.NewRollbackCmd`,`pruning.Cmd`,`genutilcli.InitCmd`,`genutilcli.GenTxCmd`,`genutilcli.CollectGenTxsCmd`,`genutilcli.AddGenesisAccountCmd`, do not take a home directory anymore. It is inferred from the root command. @@ -164,7 +148,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types) [#17426](https://github.com/cosmos/cosmos-sdk/pull/17426) `NewContext` does not take a `cmtproto.Header{}` any longer. * `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context * (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name -* (x/distribution) [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) `AllocateTokens` takes `comet.VoteInfos` instead of `[]abci.VoteInfo` * (types) [#17738](https://github.com/cosmos/cosmos-sdk/pull/17738) `WithBlockTime()` was removed & `BlockTime()` were deprecated in favor of `WithHeaderInfo()` & `HeaderInfo()`. `BlockTime` now gets data from `HeaderInfo()` instead of `BlockHeader()`. * (client) [#17746](https://github.com/cosmos/cosmos-sdk/pull/17746) `txEncodeAmino` & `txDecodeAmino` txs via grpc and rest were removed * `RegisterLegacyAmino` was removed from `AppModuleBasic` @@ -188,18 +171,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `appd export` has moved with other genesis commands, use `appd genesis export` instead. * (x/auth/vesting) [#18100](https://github.com/cosmos/cosmos-sdk/pull/18100) `appd tx vesting create-vesting-account` takes an amount of coin as last argument instead of second. Coins are space separated. -* (x/distribution) [#17963](https://github.com/cosmos/cosmos-sdk/pull/17963) `appd tx distribution withdraw-rewards` now only withdraws rewards for the delegator's own delegations. For withdrawing validators commission, use `appd tx distribution withdraw-validator-commission`. ### State Machine Breaking -* (x/distribution) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Migrate community pool funds from x/distribution to x/protocolpool. -* (x/distribution) [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Migrate `PreviousProposer` to collections. * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) Upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. * (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `HistoricalInfo` was replaced with `HistoricalRecord`, it removes the validator set and comet header and only keep what is needed for IBC. ### Client Breaking Changes -* (x/distribution) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Deprecate `CommunityPool` and `FundCommunityPool` rpc methods. Use x/protocolpool module's rpc methods instead. +* \_ ## [v0.50.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.1) - 2023-11-07 diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 4afa781f6b28..8ac6f9e5b322 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -324,13 +324,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) { // check current balance is greater than initial balance curBalance := f.bankKeeper.GetAllBalances(f.sdkCtx, sdk.AccAddress(f.valAddr)) assert.Assert(t, initBalance.IsAllLTE(curBalance)) - - // check rewards - curFeePool, _ := f.distrKeeper.FeePool.Get(f.sdkCtx) - rewards := curFeePool.GetCommunityPool().Sub(initFeePool.CommunityPool) - curOutstandingRewards, err := f.distrKeeper.ValidatorOutstandingRewards.Get(f.sdkCtx, f.valAddr) - assert.NilError(t, err) - assert.DeepEqual(t, rewards, initOutstandingRewards.Sub(curOutstandingRewards.Rewards)) } prevProposerConsAddr, err := f.distrKeeper.PreviousProposer.Get(f.sdkCtx) diff --git a/x/distribution/CHANGELOG.md b/x/distribution/CHANGELOG.md new file mode 100644 index 000000000000..6eaa62a96b4e --- /dev/null +++ b/x/distribution/CHANGELOG.md @@ -0,0 +1,64 @@ + + +# Changelog + +## [Unreleased] + +### Features + +* + +### API Breaking Changes + +* [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Use collections for `PreviousProposer` and `ValidatorSlashEvents`: + * remove from `Keeper`: `GetPreviousProposerConsAddr`, `SetPreviousProposerConsAddr`, `GetValidatorHistoricalReferenceCount`, `GetValidatorSlashEvent`, `SetValidatorSlashEvent`. +* [#16483](https://github.com/cosmos/cosmos-sdk/pull/16483) use collections for `DelegatorStartingInfo` state management: + * remove `Keeper`: `IterateDelegatorStartingInfo`, `GetDelegatorStartingInfo`, `SetDelegatorStartingInfo`, `DeleteDelegatorStartingInfo`, `HasDelegatorStartingInfo` +* [#16571](https://github.com/cosmos/cosmos-sdk/pull/16571) use collections for `ValidatorAccumulatedCommission` state management: + * remove `Keeper`: `IterateValidatorAccumulatedCommission`, `GetValidatorAccumulatedCommission`, `SetValidatorAccumulatedCommission`, `DeleteValidatorAccumulatedCommission` +* [#16590](https://github.com/cosmos/cosmos-sdk/pull/16590) use collections for `ValidatorOutstandingRewards` state management: + * remove `Keeper`: `IterateValidatorOutstandingRewards`, `GetValidatorOutstandingRewards`, `SetValidatorOutstandingRewards`, `DeleteValidatorOutstandingRewards` +* [#16607](https://github.com/cosmos/cosmos-sdk/pull/16607) use collections for `ValidatorHistoricalRewards` state management: + * remove `Keeper`: `IterateValidatorHistoricalRewards`, `GetValidatorHistoricalRewards`, `SetValidatorHistoricalRewards`, `DeleteValidatorHistoricalRewards`, `DeleteValidatorHistoricalReward`, `DeleteAllValidatorHistoricalRewards` +* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) The `FundCommunityPool` and `DistributeFromFeePool` keeper methods are now removed from x/distribution. +* [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: + * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. +* [#16459](https://github.com/cosmos/cosmos-sdk/pull/16459) use collections for `ValidatorCurrentRewards` state management: + * remove `Keeper`: `IterateValidatorCurrentRewards`, `GetValidatorCurrentRewards`, `SetValidatorCurrentRewards`, `DeleteValidatorCurrentRewards` +* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) The distribution module keeper now takes a new argument `PoolKeeper` in addition. +* [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) `AllocateTokens` takes `comet.VoteInfos` instead of `[]abci.VoteInfo` + +### CLI Breaking Changes + +* [#17963](https://github.com/cosmos/cosmos-sdk/pull/17963) `appd tx distribution withdraw-rewards` now only withdraws rewards for the delegator's own delegations. For withdrawing validators commission, use `appd tx distribution withdraw-validator-commission`. + +### State Machine Breaking + +* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Migrate community pool funds from `x/distribution` to `x/protocolpool`. +* [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Migrate `PreviousProposer` to collections. +* [#18539](https://github.com/cosmos/cosmos-sdk/pull/18539) Introduce `FeePool.DecimalPool` to replace `FeePool.CommunityPool`, which temporarily holds fractional rewards until they are distributed to the community pool every 1000 blocks. + +### Client Breaking Changes + +* [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Deprecate `CommunityPool` and `FundCommunityPool` rpc methods. Use `x/protocolpool` module's rpc methods instead. diff --git a/x/distribution/README.md b/x/distribution/README.md index 72a3bb743b8d..7bca8887729f 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -2,8 +2,6 @@ sidebar_position: 1 --- -// TODO REVIEW this whole doc - # `x/distribution` ## Overview @@ -128,6 +126,25 @@ count is decremented. If the reference count hits zero, the historical record is ## State +### FeePool + +The `FeePool` is used to store decimal rewards to allow +for fractions of coins to be received from operations like inflation. + +Once those rewards are big enough, they are sent as `sdk.Coins` to the community pool. + +* FeePool: `0x00 -> ProtocolBuffer(FeePool)` + +```go +// coins with decimal +type DecCoins []DecCoin + +type DecCoin struct { + Amount math.LegacyDec + Denom string +} +``` + ### Validator Distribution Validator distribution information for the relevant validator is updated each time: diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 00335348e1d0..43b40db7d1cf 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -3,6 +3,7 @@ package keeper import ( "context" "errors" + "sync" "cosmossdk.io/collections" "cosmossdk.io/core/comet" @@ -50,29 +51,49 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo voteMultiplier := math.LegacyOneDec().Sub(communityTax) feeMultiplier := feesCollected.MulDecTruncate(voteMultiplier) - // allocate tokens proportionally to voting power - // - // TODO: Consider parallelizing later - // - // Ref: https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376 + var wg sync.WaitGroup + // channel for errors + errc := make(chan error, len(bondedVotes)) + // channel for remaining rewards + remainingc := make(chan sdk.DecCoins, len(bondedVotes)) + for _, vote := range bondedVotes { + wg.Add(1) + go func(vote comet.VoteInfo) { + defer wg.Done() - validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) - if err != nil { - return err - } + validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) + if err != nil { + errc <- err + return + } + + powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) + reward := feeMultiplier.MulDecTruncate(powerFraction) - // TODO: Consider micro-slashing for missing votes. - // - // Ref: https://github.com/cosmos/cosmos-sdk/issues/2525#issuecomment-430838701 - powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) - reward := feeMultiplier.MulDecTruncate(powerFraction) + err = k.AllocateTokensToValidator(ctx, validator, reward) + if err != nil { + errc <- err + return + } - err = k.AllocateTokensToValidator(ctx, validator, reward) + remainingc <- reward + }(vote) + } + wg.Wait() + + // Close the channels + close(errc) + close(remainingc) + + for err := range errc { if err != nil { return err } + } + // calculate the remaining rewards + for reward := range remainingc { remaining = remaining.Sub(reward) } diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 79fbd4bf9840..ffe2cc28de8f 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -168,6 +168,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { fees := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100))) bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees) bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees) + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, "protocolpool", sdk.Coins{{Denom: sdk.DefaultBondDenom, Amount: math.NewInt(2)}}) // 2 community pool coins votes := []comet.VoteInfo{ { @@ -189,10 +190,9 @@ func TestAllocateTokensToManyValidators(t *testing.T) { require.NoError(t, err) require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: math.LegacyNewDecWithPrec(490, 1)}}, val1OutstandingRewards.Rewards) - // 2 community pool coins feePool, err = distrKeeper.FeePool.Get(ctx) require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: math.LegacyNewDec(2)}}, feePool.DecimalPool) + require.True(t, feePool.DecimalPool.IsZero()) // 50% commission for first proposer, (0.5 * 98%) * 100 / 2 = 23.25 val0Commission, err := distrKeeper.ValidatorsAccumulatedCommission.Get(ctx, valAddr0) @@ -309,6 +309,7 @@ func TestAllocateTokensTruncation(t *testing.T) { fees := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(634195840))) bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees) bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees) + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, "protocolpool", gomock.Any()) // something is sent to community pool votes := []comet.VoteInfo{ { From ef55a6543b7fedf3a39617158432fa7dd9d3ef4a Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 15:46:52 +0100 Subject: [PATCH 09/15] updates --- x/distribution/keeper/allocation.go | 3 +-- x/distribution/keeper/migrations.go | 6 +++--- x/protocolpool/keeper/keeper.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 43b40db7d1cf..734d0543ab7b 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -71,8 +71,7 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) reward := feeMultiplier.MulDecTruncate(powerFraction) - err = k.AllocateTokensToValidator(ctx, validator, reward) - if err != nil { + if err = k.AllocateTokensToValidator(ctx, validator, reward); err != nil { errc <- err return } diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index 03807186c42a..d6be0de99f51 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -49,11 +49,11 @@ func (m Migrator) migrateFunds(ctx sdk.Context) error { return err } - feelPool, err := v4.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc) + feePool, err = v4.MigrateFunds(ctx, m.keeper.bankKeeper, feePool, macc, poolMacc) if err != nil { return err } - // the feelpool has now an empty community pool and the remainder is stored in the DecimalPool - return m.keeper.FeePool.Set(ctx, feelPool) + // the feePool has now an empty community pool and the remainder is stored in the DecimalPool + return m.keeper.FeePool.Set(ctx, feePool) } diff --git a/x/protocolpool/keeper/keeper.go b/x/protocolpool/keeper/keeper.go index d50c8583d61c..1ef7be7d16ff 100644 --- a/x/protocolpool/keeper/keeper.go +++ b/x/protocolpool/keeper/keeper.go @@ -100,7 +100,7 @@ func (k Keeper) claimFunds(ctx context.Context, recipient sdk.AccAddress) (amoun // distribute amount from community pool err = k.DistributeFromCommunityPool(ctx, sdk.NewCoins(amount), recipient) if err != nil { - return sdk.Coin{}, fmt.Errorf("error distributing from fee pool: %w", err) + return sdk.Coin{}, fmt.Errorf("error distributing from community pool: %w", err) } return amount, nil From 275ef67d6c521b56a2256fa5ee27b80e5c3ca0e4 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 22 Nov 2023 15:56:49 +0100 Subject: [PATCH 10/15] cleanup --- tests/integration/distribution/keeper/msg_server_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 8ac6f9e5b322..e03280f4bc52 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -178,8 +178,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) { }) require.NoError(t, err) require.NoError(t, f.distrKeeper.Params.Set(f.sdkCtx, distrtypes.DefaultParams())) - initFeePool, err := f.distrKeeper.FeePool.Get(f.sdkCtx) - assert.NilError(t, err) delAddr := sdk.AccAddress(PKS[1].Address()) valConsAddr := sdk.ConsAddress(valConsPk0.Address()) @@ -228,8 +226,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) { require.NoError(t, err) err = f.distrKeeper.ValidatorOutstandingRewards.Set(f.sdkCtx, f.valAddr, distrtypes.ValidatorOutstandingRewards{Rewards: valCommission}) require.NoError(t, err) - initOutstandingRewards, err := f.distrKeeper.GetValidatorOutstandingRewardsCoins(f.sdkCtx, f.valAddr) - assert.NilError(t, err) testCases := []struct { name string From cdb89f448a6bb1af6751af6ea61b57c784ecf9c8 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 23 Nov 2023 19:34:43 +0100 Subject: [PATCH 11/15] feedback --- x/distribution/keeper/allocation.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 734d0543ab7b..f41e9967095e 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -53,9 +53,9 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo var wg sync.WaitGroup // channel for errors - errc := make(chan error, len(bondedVotes)) + errCh := make(chan error, len(bondedVotes)) // channel for remaining rewards - remainingc := make(chan sdk.DecCoins, len(bondedVotes)) + remainingCh := make(chan sdk.DecCoins, len(bondedVotes)) for _, vote := range bondedVotes { wg.Add(1) @@ -64,7 +64,7 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) if err != nil { - errc <- err + errCh <- err return } @@ -72,27 +72,28 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo reward := feeMultiplier.MulDecTruncate(powerFraction) if err = k.AllocateTokensToValidator(ctx, validator, reward); err != nil { - errc <- err + errCh <- err return } - remainingc <- reward + remainingCh <- reward }(vote) } - wg.Wait() - // Close the channels - close(errc) - close(remainingc) + go func() { + wg.Wait() + close(errCh) + close(remainingCh) + }() - for err := range errc { + for err := range errCh { if err != nil { return err } } // calculate the remaining rewards - for reward := range remainingc { + for reward := range remainingCh { remaining = remaining.Sub(reward) } From 766ed29b5f6a5252c52d1ad2d48b8daaf0a2a490 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Nov 2023 10:31:28 +0100 Subject: [PATCH 12/15] use errgroup --- x/distribution/go.mod | 2 +- x/distribution/keeper/allocation.go | 34 ++++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/x/distribution/go.mod b/x/distribution/go.mod index c07108a4c0f8..5a423d0cebdb 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -27,6 +27,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 + golang.org/x/sync v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a google.golang.org/grpc v1.59.0 gotest.tools/v3 v3.5.1 @@ -145,7 +146,6 @@ require ( golang.org/x/crypto v0.15.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/term v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index f41e9967095e..66befa32dfce 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -3,7 +3,6 @@ package keeper import ( "context" "errors" - "sync" "cosmossdk.io/collections" "cosmossdk.io/core/comet" @@ -11,6 +10,7 @@ import ( "cosmossdk.io/x/distribution/types" protocolpooltypes "cosmossdk.io/x/protocolpool/types" stakingtypes "cosmossdk.io/x/staking/types" + "golang.org/x/sync/errgroup" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -51,46 +51,36 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo voteMultiplier := math.LegacyOneDec().Sub(communityTax) feeMultiplier := feesCollected.MulDecTruncate(voteMultiplier) - var wg sync.WaitGroup - // channel for errors - errCh := make(chan error, len(bondedVotes)) + // allocate tokens proportionally to voting power + var g errgroup.Group // channel for remaining rewards remainingCh := make(chan sdk.DecCoins, len(bondedVotes)) for _, vote := range bondedVotes { - wg.Add(1) - go func(vote comet.VoteInfo) { - defer wg.Done() + vote := vote + g.Go(func() error { validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) if err != nil { - errCh <- err - return + return err } powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) reward := feeMultiplier.MulDecTruncate(powerFraction) if err = k.AllocateTokensToValidator(ctx, validator, reward); err != nil { - errCh <- err - return + return err } remainingCh <- reward - }(vote) + return nil + }) } - go func() { - wg.Wait() - close(errCh) - close(remainingCh) - }() - - for err := range errCh { - if err != nil { - return err - } + if err := g.Wait(); err != nil { + return err } + close(remainingCh) // calculate the remaining rewards for reward := range remainingCh { From 274d773459a977bd349d7e18b93991f2bc59f1fe Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Nov 2023 10:38:04 +0100 Subject: [PATCH 13/15] lint --- x/distribution/keeper/allocation.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 66befa32dfce..1f04b34cd347 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -4,13 +4,14 @@ import ( "context" "errors" + "golang.org/x/sync/errgroup" + "cosmossdk.io/collections" "cosmossdk.io/core/comet" "cosmossdk.io/math" "cosmossdk.io/x/distribution/types" protocolpooltypes "cosmossdk.io/x/protocolpool/types" stakingtypes "cosmossdk.io/x/staking/types" - "golang.org/x/sync/errgroup" sdk "github.com/cosmos/cosmos-sdk/types" ) From 773fe531d7aea5327ac7458e3b3d4225293e3370 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 28 Nov 2023 13:10:22 +0100 Subject: [PATCH 14/15] updates --- CHANGELOG.md | 4 ---- x/distribution/README.md | 14 +++++++------- x/distribution/{ => keeper}/abci.go | 7 +++---- x/distribution/keeper/allocation.go | 9 ++++----- x/distribution/keeper/allocation_test.go | 4 ++-- x/distribution/keeper/migrations.go | 4 ++-- x/distribution/module.go | 2 +- x/distribution/types/keys.go | 2 ++ 8 files changed, 21 insertions(+), 25 deletions(-) rename x/distribution/{ => keeper}/abci.go (85%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570131263eb4..d6e2789133a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -178,10 +178,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) Upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. * (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `HistoricalInfo` was replaced with `HistoricalRecord`, it removes the validator set and comet header and only keep what is needed for IBC. -### Client Breaking Changes - -* \_ - ## [v0.50.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.1) - 2023-11-07 > v0.50.0 has been retracted due to a mistake in tagging the release. Please use v0.50.1 instead. diff --git a/x/distribution/README.md b/x/distribution/README.md index 7bca8887729f..03e1e5baff21 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -81,17 +81,17 @@ to set up a script to periodically withdraw and rebond rewards. * [Concepts](#concepts) * [State](#state) - * [Validator Distribution](#validator-distribution) - * [Delegation Distribution](#delegation-distribution) - * [Params](#params) + * [Validator Distribution](#validator-distribution) + * [Delegation Distribution](#delegation-distribution) + * [Params](#params) * [Begin Block](#begin-block) * [Messages](#messages) * [Hooks](#hooks) * [Events](#events) * [Parameters](#parameters) * [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) + * [CLI](#cli) + * [gRPC](#grpc) ## Concepts @@ -128,8 +128,7 @@ count is decremented. If the reference count hits zero, the historical record is ### FeePool -The `FeePool` is used to store decimal rewards to allow -for fractions of coins to be received from operations like inflation. +The `FeePool` is used to store decimal rewards to allow for fractions of coins to be received from operations like inflation. Once those rewards are big enough, they are sent as `sdk.Coins` to the community pool. @@ -197,6 +196,7 @@ the distribution `ModuleAccount` account. When a delegator or validator withdraws their rewards, they are taken out of the `ModuleAccount`. During begin block, the different claims on the fees collected are updated as follows: +* The reserve community tax is charged. * The remainder is distributed proportionally by voting power to all bonded validators ### The Distribution Scheme diff --git a/x/distribution/abci.go b/x/distribution/keeper/abci.go similarity index 85% rename from x/distribution/abci.go rename to x/distribution/keeper/abci.go index f2f9452ad2c0..d4db46c60977 100644 --- a/x/distribution/abci.go +++ b/x/distribution/keeper/abci.go @@ -1,9 +1,8 @@ -package distribution +package keeper import ( "time" - "cosmossdk.io/x/distribution/keeper" "cosmossdk.io/x/distribution/types" "github.com/cosmos/cosmos-sdk/telemetry" @@ -12,7 +11,7 @@ import ( // BeginBlocker sets the proposer for determining distribution during endblock // and distribute rewards for the previous block. -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) error { +func (k Keeper) BeginBlocker(ctx sdk.Context) error { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) // determine the total power signing the block @@ -30,7 +29,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) error { // every 1000 blocks send whole coins from decimal pool to community pool if ctx.BlockHeight()%1000 == 0 { - if err := k.SendDecimalPoolToCommunityPool(ctx); err != nil { + if err := k.sendDecimalPoolToCommunityPool(ctx); err != nil { return err } } diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 1f04b34cd347..29f49ce1a850 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -10,7 +10,6 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" "cosmossdk.io/x/distribution/types" - protocolpooltypes "cosmossdk.io/x/protocolpool/types" stakingtypes "cosmossdk.io/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -90,7 +89,7 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo // send to community pool and set remainder in fee pool amt, re := remaining.TruncateDecimal() - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, amt); err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolModuleName, amt); err != nil { return err } @@ -164,9 +163,9 @@ func (k Keeper) AllocateTokensToValidator(ctx context.Context, val stakingtypes. return k.ValidatorOutstandingRewards.Set(ctx, valBz, outstanding) } -// SendDecimalPoolToCommunityPool sends the decimal pool to the community pool +// sendDecimalPoolToCommunityPool sends the decimal pool to the community pool // Any remainer stays in the decimal pool -func (k Keeper) SendDecimalPoolToCommunityPool(ctx context.Context) error { +func (k Keeper) sendDecimalPoolToCommunityPool(ctx context.Context) error { feePool, err := k.FeePool.Get(ctx) if err != nil { return err @@ -177,7 +176,7 @@ func (k Keeper) SendDecimalPoolToCommunityPool(ctx context.Context) error { } amt, re := feePool.DecimalPool.TruncateDecimal() - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, protocolpooltypes.ModuleName, amt); err != nil { + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolModuleName, amt); err != nil { return err } diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index ffe2cc28de8f..e88f9df2acd0 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -168,7 +168,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { fees := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100))) bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees) bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees) - bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, "protocolpool", sdk.Coins{{Denom: sdk.DefaultBondDenom, Amount: math.NewInt(2)}}) // 2 community pool coins + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, disttypes.ProtocolPoolModuleName, sdk.Coins{{Denom: sdk.DefaultBondDenom, Amount: math.NewInt(2)}}) // 2 community pool coins votes := []comet.VoteInfo{ { @@ -309,7 +309,7 @@ func TestAllocateTokensTruncation(t *testing.T) { fees := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(634195840))) bankKeeper.EXPECT().GetAllBalances(gomock.Any(), feeCollectorAcc.GetAddress()).Return(fees) bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), "fee_collector", disttypes.ModuleName, fees) - bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, "protocolpool", gomock.Any()) // something is sent to community pool + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), disttypes.ModuleName, disttypes.ProtocolPoolModuleName, gomock.Any()) // something is sent to community pool votes := []comet.VoteInfo{ { diff --git a/x/distribution/keeper/migrations.go b/x/distribution/keeper/migrations.go index d6be0de99f51..4152a9a6faea 100644 --- a/x/distribution/keeper/migrations.go +++ b/x/distribution/keeper/migrations.go @@ -2,7 +2,7 @@ package keeper import ( v4 "cosmossdk.io/x/distribution/migrations/v4" - pooltypes "cosmossdk.io/x/protocolpool/types" + "cosmossdk.io/x/distribution/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -42,7 +42,7 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { func (m Migrator) migrateFunds(ctx sdk.Context) error { macc := m.keeper.GetDistributionAccount(ctx) - poolMacc := m.keeper.authKeeper.GetModuleAccount(ctx, pooltypes.ModuleName) + poolMacc := m.keeper.authKeeper.GetModuleAccount(ctx, types.ProtocolPoolModuleName) feePool, err := m.keeper.FeePool.Get(ctx) if err != nil { diff --git a/x/distribution/module.go b/x/distribution/module.go index 5419b34f93cb..caa441ee2cb6 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -166,7 +166,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock returns the begin blocker for the distribution module. func (am AppModule) BeginBlock(ctx context.Context) error { c := sdk.UnwrapSDKContext(ctx) - return BeginBlocker(c, am.keeper) + return am.keeper.BeginBlocker(c) } // AppModuleSimulation functions diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index 70260d5a7515..f79281dcd88e 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -24,6 +24,8 @@ const ( // It should be synced with the gov module's name if it is ever changed. // See: https://github.com/cosmos/cosmos-sdk/blob/b62a28aac041829da5ded4aeacfcd7a42873d1c8/x/gov/types/keys.go#L9 GovModuleName = "gov" + // ProtocolPoolModuleName duplicates the protocolpool module's name to avoid a cyclic dependency with x/protocolpool. + ProtocolPoolModuleName = "protocolpool" ) // Keys for distribution store From 3decfdae5ea0d8738b6aa305cc086a284cbcbacb Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 30 Nov 2023 11:57:29 +0100 Subject: [PATCH 15/15] split pr --- x/distribution/go.mod | 3 +- x/distribution/keeper/allocation.go | 46 ++++++++++------------------- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 4e65a9eacf16..7181c577be37 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -27,12 +27,13 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 - golang.org/x/sync v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a google.golang.org/grpc v1.59.0 gotest.tools/v3 v3.5.1 ) +require golang.org/x/sync v0.5.0 // indirect + require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.12.0 // indirect diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 29f49ce1a850..0d798b593bbe 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -4,8 +4,6 @@ import ( "context" "errors" - "golang.org/x/sync/errgroup" - "cosmossdk.io/collections" "cosmossdk.io/core/comet" "cosmossdk.io/math" @@ -52,41 +50,29 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo feeMultiplier := feesCollected.MulDecTruncate(voteMultiplier) // allocate tokens proportionally to voting power - var g errgroup.Group - // channel for remaining rewards - remainingCh := make(chan sdk.DecCoins, len(bondedVotes)) - + // + // TODO: Consider parallelizing later + // + // Ref: https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376 for _, vote := range bondedVotes { - vote := vote - - g.Go(func() error { - validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) - if err != nil { - return err - } - powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) - reward := feeMultiplier.MulDecTruncate(powerFraction) - - if err = k.AllocateTokensToValidator(ctx, validator, reward); err != nil { - return err - } + validator, err := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) + if err != nil { + return err + } - remainingCh <- reward - return nil - }) - } + // TODO: Consider micro-slashing for missing votes. + // + // Ref: https://github.com/cosmos/cosmos-sdk/issues/2525#issuecomment-430838701 + powerFraction := math.LegacyNewDec(vote.Validator.Power).QuoTruncate(math.LegacyNewDec(totalPreviousPower)) + reward := feeMultiplier.MulDecTruncate(powerFraction) - if err := g.Wait(); err != nil { - return err - } - close(remainingCh) + if err = k.AllocateTokensToValidator(ctx, validator, reward); err != nil { + return err + } - // calculate the remaining rewards - for reward := range remainingCh { remaining = remaining.Sub(reward) } - // send to community pool and set remainder in fee pool amt, re := remaining.TruncateDecimal() if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ProtocolPoolModuleName, amt); err != nil {