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
-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", ""},
}