refactor(x/distribution)!: remove PreviousProposer and return early if there are no fees to distribute (#20735)

This commit is contained in:
Facundo Medica
2024-07-04 12:50:15 +00:00
committed by GitHub
parent b63d8404e4
commit 01312dfd5d
15 changed files with 149 additions and 343 deletions
+1
View File
@@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### State Machine Breaking
* [#20735](https://github.com/cosmos/cosmos-sdk/pull/20735) Remove PreviousProposer from the state machine.
* [#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.
+1 -4
View File
@@ -6,7 +6,6 @@ import (
"cosmossdk.io/x/distribution/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// BeginBlocker sets the proposer for determining distribution during endblock
@@ -38,7 +37,5 @@ func (k Keeper) BeginBlocker(ctx context.Context) error {
}
}
// record the proposer for when we payout on the next block
consAddr := sdk.ConsAddress(ci.ProposerAddress)
return k.PreviousProposer.Set(ctx, consAddr)
return nil
}
+4
View File
@@ -21,6 +21,10 @@ func (k Keeper) AllocateTokens(ctx context.Context, totalPreviousPower int64, bo
// (and distributed to the previous proposer)
feeCollector := k.authKeeper.GetModuleAccount(ctx, k.feeCollectorName)
feesCollectedInt := k.bankKeeper.GetAllBalances(ctx, feeCollector.GetAddress())
// return early if no fees to distribute
if feesCollectedInt.Empty() {
return nil
}
feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...)
// transfer collected fees to the distribution module account
+1 -23
View File
@@ -37,19 +37,6 @@ func (k Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error
}
}
var previousProposer sdk.ConsAddress
if data.PreviousProposer != "" {
var err error
previousProposer, err = k.stakingKeeper.ConsensusAddressCodec().StringToBytes(data.PreviousProposer)
if err != nil {
return err
}
}
if err := k.PreviousProposer.Set(ctx, previousProposer); err != nil {
return err
}
for _, rew := range data.OutstandingRewards {
valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(rew.ValidatorAddress)
if err != nil {
@@ -177,11 +164,6 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error)
return nil, err
}
pp, err := k.PreviousProposer.Get(ctx)
if err != nil {
return nil, err
}
outstanding := make([]types.ValidatorOutstandingRewardsRecord, 0)
err = k.ValidatorOutstandingRewards.Walk(ctx, nil, func(addr sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool, err error) {
@@ -303,9 +285,5 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error)
return nil, err
}
ppAddr, err := k.stakingKeeper.ConsensusAddressCodec().BytesToString(pp)
if err != nil {
return nil, err
}
return types.NewGenesisState(params, feePool, dwi, ppAddr, outstanding, acc, his, cur, dels, slashes), nil
return types.NewGenesisState(params, feePool, dwi, outstanding, acc, his, cur, dels, slashes), nil
}
-2
View File
@@ -51,7 +51,6 @@ type Keeper struct {
ValidatorOutstandingRewards collections.Map[sdk.ValAddress, types.ValidatorOutstandingRewards]
// ValidatorHistoricalRewards key: valAddr+period | value: ValidatorHistoricalRewards
ValidatorHistoricalRewards collections.Map[collections.Pair[sdk.ValAddress, uint64], types.ValidatorHistoricalRewards]
PreviousProposer collections.Item[sdk.ConsAddress]
// ValidatorSlashEvents key: valAddr+height+period | value: ValidatorSlashEvent
ValidatorSlashEvents collections.Map[collections.Triple[sdk.ValAddress, uint64, uint64], types.ValidatorSlashEvent]
@@ -130,7 +129,6 @@ func NewKeeper(
collections.PairKeyCodec(sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), sdk.LEUint64Key), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility
codec.CollValue[types.ValidatorHistoricalRewards](cdc),
),
PreviousProposer: collections.NewItem(sb, types.ProposerKey, "previous_proposer", collcodec.KeyToValueCodec(sdk.ConsAddressKey)),
ValidatorSlashEvents: collections.NewMap(
sb,
types.ValidatorSlashEventPrefix,
+3 -30
View File
@@ -6,8 +6,6 @@ import (
gogotypes "github.com/cosmos/gogoproto/types"
"cosmossdk.io/collections"
collcodec "cosmossdk.io/collections/codec"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
@@ -15,37 +13,12 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
var (
OldProposerKey = []byte{0x01}
NewProposerKey = collections.NewPrefix(1)
)
var OldProposerKey = []byte{0x01}
// MigrateStore removes the last proposer from store.
func MigrateStore(ctx context.Context, env appmodule.Environment, cdc codec.BinaryCodec) error {
store := env.KVStoreService.OpenKVStore(ctx)
bz, err := store.Get(OldProposerKey)
if err != nil {
return err
}
if bz == nil {
// previous proposer not set, nothing to do
return nil
}
addrValue := gogotypes.BytesValue{}
err = cdc.Unmarshal(bz, &addrValue)
if err != nil {
return err
}
sb := collections.NewSchemaBuilder(env.KVStoreService)
prevProposer := collections.NewItem(sb, NewProposerKey, "previous_proposer", collcodec.KeyToValueCodec(sdk.ConsAddressKey))
_, err = sb.Build()
if err != nil {
return err
}
return prevProposer.Set(ctx, addrValue.GetValue())
return store.Delete(OldProposerKey)
}
// GetPreviousProposerConsAddr returns the proposer consensus address for the
+4 -11
View File
@@ -5,8 +5,6 @@ import (
"github.com/stretchr/testify/require"
"cosmossdk.io/collections"
collcodec "cosmossdk.io/collections/codec"
"cosmossdk.io/core/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/distribution"
@@ -32,6 +30,7 @@ func TestMigration(t *testing.T) {
addr1 := secp256k1.GenPrivKey().PubKey().Address()
consAddr1 := sdk.ConsAddress(addr1)
// Set and check the previous proposer
err := v4.SetPreviousProposerConsAddr(ctx, storeService, cdc, consAddr1)
require.NoError(t, err)
@@ -42,13 +41,7 @@ func TestMigration(t *testing.T) {
err = v4.MigrateStore(ctx, env, cdc)
require.NoError(t, err)
sb := collections.NewSchemaBuilder(storeService)
prevProposer := collections.NewItem(sb, v4.NewProposerKey, "previous_proposer", collcodec.KeyToValueCodec(sdk.ConsAddressKey))
_, err = sb.Build()
require.NoError(t, err)
newAddr, err := prevProposer.Get(ctx)
require.NoError(t, err)
require.Equal(t, consAddr1, newAddr)
// Check that the previous proposer has been removed
_, err = v4.GetPreviousProposerConsAddr(ctx, storeService, cdc)
require.ErrorContains(t, err, "previous proposer not set")
}
@@ -126,9 +126,6 @@ message GenesisState {
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// fee_pool defines the previous proposer at genesis.
string previous_proposer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// fee_pool defines the outstanding rewards of all validators at genesis.
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
@@ -152,4 +149,6 @@ message GenesisState {
// fee_pool defines the validator slash events at genesis.
repeated ValidatorSlashEventRecord validator_slash_events = 10
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
reserved 4; // previous_proposer
}
-3
View File
@@ -22,9 +22,6 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string {
cdc.MustUnmarshal(kvB.Value, &feePoolB)
return fmt.Sprintf("%v\n%v", feePoolA, feePoolB)
case bytes.Equal(kvA.Key[:1], types.ProposerKey):
return fmt.Sprintf("%v\n%v", sdk.ConsAddress(kvA.Value), sdk.ConsAddress(kvB.Value))
case bytes.Equal(kvA.Key[:1], types.ValidatorOutstandingRewardsPrefix):
var rewardsA, rewardsB types.ValidatorOutstandingRewards
cdc.MustUnmarshal(kvA.Value, &rewardsA)
+2 -5
View File
@@ -19,9 +19,8 @@ import (
)
var (
delPk1 = ed25519.GenPrivKey().PubKey()
valAddr1 = sdk.ValAddress(delPk1.Address())
consAddr1 = sdk.ConsAddress(delPk1.Address().Bytes())
delPk1 = ed25519.GenPrivKey().PubKey()
valAddr1 = sdk.ValAddress(delPk1.Address())
)
func TestDecodeDistributionStore(t *testing.T) {
@@ -38,7 +37,6 @@ func TestDecodeDistributionStore(t *testing.T) {
kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{Key: types.FeePoolKey, Value: cdc.MustMarshal(&feePool)},
{Key: types.ProposerKey, Value: consAddr1.Bytes()},
{Key: types.GetValidatorSlashEventKeyPrefix(valAddr1, 13), Value: cdc.MustMarshal(&slashEvent)},
{Key: []byte{0x99}, Value: []byte{0x99}},
},
@@ -49,7 +47,6 @@ func TestDecodeDistributionStore(t *testing.T) {
expectedLog string
}{
{"FeePool", fmt.Sprintf("%v\n%v", feePool, feePool)},
{"Proposer", fmt.Sprintf("%v\n%v", consAddr1, consAddr1)},
{"ValidatorSlashEvent", fmt.Sprintf("%v\n%v", slashEvent, slashEvent)},
{"other", ""},
}
+1 -3
View File
@@ -1,7 +1,7 @@
package types
func NewGenesisState(
params Params, fp FeePool, dwis []DelegatorWithdrawInfo, pp string, r []ValidatorOutstandingRewardsRecord,
params Params, fp FeePool, dwis []DelegatorWithdrawInfo, r []ValidatorOutstandingRewardsRecord,
acc []ValidatorAccumulatedCommissionRecord, historical []ValidatorHistoricalRewardsRecord,
cur []ValidatorCurrentRewardsRecord, dels []DelegatorStartingInfoRecord, slashes []ValidatorSlashEventRecord,
) *GenesisState {
@@ -9,7 +9,6 @@ func NewGenesisState(
Params: params,
FeePool: fp,
DelegatorWithdrawInfos: dwis,
PreviousProposer: pp,
OutstandingRewards: r,
ValidatorAccumulatedCommissions: acc,
ValidatorHistoricalRewards: historical,
@@ -25,7 +24,6 @@ func DefaultGenesisState() *GenesisState {
FeePool: InitialFeePool(),
Params: DefaultParams(),
DelegatorWithdrawInfos: []DelegatorWithdrawInfo{},
PreviousProposer: "",
OutstandingRewards: []ValidatorOutstandingRewardsRecord{},
ValidatorAccumulatedCommissions: []ValidatorAccumulatedCommissionRecord{},
ValidatorHistoricalRewards: []ValidatorHistoricalRewardsRecord{},
+59 -105
View File
@@ -334,8 +334,6 @@ type GenesisState struct {
FeePool FeePool `protobuf:"bytes,2,opt,name=fee_pool,json=feePool,proto3" json:"fee_pool"`
// fee_pool defines the delegator withdraw infos at genesis.
DelegatorWithdrawInfos []DelegatorWithdrawInfo `protobuf:"bytes,3,rep,name=delegator_withdraw_infos,json=delegatorWithdrawInfos,proto3" json:"delegator_withdraw_infos"`
// fee_pool defines the previous proposer at genesis.
PreviousProposer string `protobuf:"bytes,4,opt,name=previous_proposer,json=previousProposer,proto3" json:"previous_proposer,omitempty"`
// fee_pool defines the outstanding rewards of all validators at genesis.
OutstandingRewards []ValidatorOutstandingRewardsRecord `protobuf:"bytes,5,rep,name=outstanding_rewards,json=outstandingRewards,proto3" json:"outstanding_rewards"`
// fee_pool defines the accumulated commissions of all validators at genesis.
@@ -399,66 +397,65 @@ func init() {
}
var fileDescriptor_76eed0f9489db580 = []byte{
// 943 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0x1b, 0x45,
0x14, 0xf6, 0x3a, 0x25, 0x4d, 0x26, 0x45, 0x34, 0xd3, 0x34, 0x6c, 0xd2, 0x76, 0x9d, 0x94, 0x1e,
0x0a, 0x28, 0x6b, 0x1a, 0x10, 0x54, 0x45, 0x80, 0x1a, 0xb7, 0xe5, 0xc7, 0x01, 0x22, 0x5b, 0x02,
0x81, 0x90, 0xac, 0xf1, 0xee, 0x78, 0x3d, 0xaa, 0xbd, 0x63, 0xcd, 0x8c, 0xd7, 0x80, 0xc4, 0x81,
0x53, 0x11, 0xe2, 0xc0, 0x09, 0x71, 0xac, 0x38, 0x55, 0x48, 0x48, 0x1c, 0xfa, 0x47, 0xf4, 0x58,
0x55, 0x1c, 0x38, 0x01, 0x72, 0x0e, 0x20, 0x8e, 0xfc,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x94, 0xf1, 0x9d, 0xa7, 0xf1,
0x6c, 0x54, 0x6c, 0x09, 0xbf, 0x34, 0xfb, 0x7c, 0x6a, 0x3a, 0x72, 0x7b, 0x59, 0x32, 0xb8, 0xfc,
0xf8, 0xe3, 0x31, 0x8f, 0x9f, 0x75, 0xbb, 0x69, 0xc7, 0xe1, 0x18, 0xac, 0x17, 0x8e, 0x21, 0x6e,
0x03, 0x09, 0xfe, 0xea, 0xe3, 0xce, 0xa1, 0x3c, 0xf4, 0x5a, 0xc1, 0x34, 0x32, 0x96, 0xd9, 0xde,
0x5b, 0x77, 0x26, 0x8e, 0x75, 0x6f, 0xe2, 0x58, 0xf7, 0x27, 0x8e, 0xf5, 0xe7, 0xc4, 0xb1, 0xbe,
0x3b, 0x70, 0x2a, 0xf7, 0x0f, 0x9c, 0xca, 0x6f, 0x07, 0x4e, 0xe5, 0x93, 0x6d, 0x85, 0xcf, 0xfd,
0x9b, 0x2e, 0xa1, 0xf5, 0xcf, 0xa6, 0xbf, 0xe1, 0xe5, 0x27, 0x5f, 0x67, 0x51, 0x7e, 0x87, 0xbf,
0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, 0x53, 0xd9, 0xb1, 0x65, 0x0c, 0x00, 0x00,
// 925 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x8f, 0xdb, 0x44,
0x14, 0x8e, 0x93, 0x34, 0xcd, 0x4e, 0x8a, 0xd8, 0x9d, 0x6e, 0x17, 0xef, 0xb6, 0x75, 0x36, 0xa5,
0x87, 0x02, 0x5a, 0x87, 0x06, 0x04, 0x55, 0x11, 0xa0, 0x26, 0x6d, 0x81, 0x1e, 0xa0, 0x4a, 0x24,
0x10, 0x08, 0x29, 0x9a, 0xd8, 0x13, 0x67, 0xd4, 0xc4, 0x13, 0x79, 0x26, 0x0e, 0x20, 0x71, 0xe0,
0x54, 0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0xc7, 0x99, 0xbb, 0x69, 0x1a, 0xcf, 0xf9, 0xd9, 0x96, 0xf0, 0x4b, 0xb5, 0x41,
0xe7, 0xc6, 0x1a, 0xd3, 0xd7, 0x42, 0x06, 0x57, 0x8e, 0x3e, 0xd7, 0xd2, 0xf8, 0x49, 0x9b, 0xaa,
0x76, 0x0c, 0x4e, 0xc1, 0x56, 0xe6, 0xfc, 0x60, 0x3a, 0x08, 0xc1, 0x5f, 0x3b, 0xea, 0x00, 0x49,
0x43, 0x6f, 0x66, 0x8c, 0x11, 0x65, 0x0b, 0xdd, 0x2a, 0x96, 0x8b, 0xeb, 0x27, 0x9a, 0x6f, 0xdf,
0x9f, 0x19, 0xda, 0xc3, 0x99, 0xa1, 0x3d, 0x9a, 0x19, 0xda, 0x9f, 0x33, 0x43, 0xfb, 0x76, 0xdf,
0xc8, 0x3d, 0xda, 0x37, 0x72, 0xbf, 0xed, 0x1b, 0xb9, 0x4f, 0x6a, 0x82, 0x05, 0xb3, 0xef, 0x98,
0x84, 0xd6, 0x3f, 0x9b, 0xff, 0x04, 0x0f, 0xbf, 0xd8, 0x7a, 0xa5, 0xf0, 0x33, 0xfa, 0x95, 0xff,
0x02, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x9c, 0xf4, 0xd9, 0x24, 0x0c, 0x00, 0x00,
}
func (m *DelegatorWithdrawInfo) Marshal() (dAtA []byte, err error) {
@@ -868,13 +865,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x2a
}
}
if len(m.PreviousProposer) > 0 {
i -= len(m.PreviousProposer)
copy(dAtA[i:], m.PreviousProposer)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.PreviousProposer)))
i--
dAtA[i] = 0x22
}
if len(m.DelegatorWithdrawInfos) > 0 {
for iNdEx := len(m.DelegatorWithdrawInfos) - 1; iNdEx >= 0; iNdEx-- {
{
@@ -1063,10 +1053,6 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
l = len(m.PreviousProposer)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
if len(m.OutstandingRewards) > 0 {
for _, e := range m.OutstandingRewards {
l = e.Size()
@@ -2135,38 +2121,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PreviousProposer", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PreviousProposer = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OutstandingRewards", wireType)
+5 -3
View File
@@ -33,8 +33,6 @@ const (
//
// - 0x00<proposalID_Bytes>: FeePol
//
// - 0x01: sdk.ConsAddress
//
// - 0x02<valAddrLen (1 Byte)><valAddr_Bytes>: ValidatorOutstandingRewards
//
// - 0x03<accAddrLen (1 Byte)><accAddr_Bytes>: sdk.AccAddress
@@ -52,7 +50,6 @@ const (
// - 0x09: Params
var (
FeePoolKey = collections.NewPrefix(0) // key for global distribution state
ProposerKey = collections.NewPrefix(1) // key for the proposer operator address
ValidatorOutstandingRewardsPrefix = collections.NewPrefix(2) // key for outstanding rewards
DelegatorWithdrawAddrPrefix = collections.NewPrefix(3) // key for delegator withdraw address
DelegatorStartingInfoPrefix = collections.NewPrefix(4) // key for delegator starting info
@@ -63,6 +60,11 @@ var (
ParamsKey = collections.NewPrefix(9) // key for distribution module params
)
// Reserved prefixes
var (
DeprecatedProposerKey = collections.NewPrefix(1) // key for the proposer operator address
)
// GetValidatorSlashEventAddressHeight creates the height from a validator's slash event key.
func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, height uint64) {
// key is in the format: