feat(staking)!: add consensus and validator address codec in staking (#16959)

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
This commit is contained in:
Julien Robert
2023-07-13 09:08:27 +00:00
committed by GitHub
co-authored by Facundo Medica
parent b1ac5768f7
commit e0be2b80fc
38 changed files with 185 additions and 145 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests
go 1.20
require (
cosmossdk.io/api v0.5.0
cosmossdk.io/api v0.6.0
cosmossdk.io/collections v0.3.0
cosmossdk.io/core v0.9.0
cosmossdk.io/depinject v1.0.0-alpha.3
+2 -2
View File
@@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
cosmossdk.io/api v0.5.0 h1:C0gzb5N3qYE0VEUlXleuilv7Z/7/MHhdOKkgn2Ugfnc=
cosmossdk.io/api v0.5.0/go.mod h1:5Jc00Q4tSTcrZXvvE3J/ybvZK6DopLcp3ThK3X703QE=
cosmossdk.io/api v0.6.0 h1:AEpx/sRZaQEusARZqAxbg20zRXnS6e1F+uoal39trOM=
cosmossdk.io/api v0.6.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M=
cosmossdk.io/collections v0.3.0 h1:v0eEqLBxebAV+t+Ahwf9tSJOu95HVLINwROXx2TTZ08=
cosmossdk.io/collections v0.3.0/go.mod h1:CHE1+niUElL9ikCpevRZcp0yqQ4TU0TrEEGirN0mvIg=
cosmossdk.io/core v0.9.0 h1:30ScAOHDIUOCg1DKAwqkho9wuQJnu7GUrMcg0XLioic=
@@ -84,7 +84,6 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -84,7 +84,6 @@ func initFixture(tb testing.TB) *fixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -101,7 +100,7 @@ func initFixture(tb testing.TB) *fixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
distrKeeper := distrkeeper.NewKeeper(
cdc, runtime.NewKVStoreService(keys[distrtypes.StoreKey]), accountKeeper, bankKeeper, stakingKeeper, distrtypes.ModuleName, authority.String(),
@@ -105,7 +105,6 @@ func initFixture(tb testing.TB) *fixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -122,7 +121,7 @@ func initFixture(tb testing.TB) *fixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
slashingKeeper := slashingkeeper.NewKeeper(cdc, codec.NewLegacyAmino(), runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), stakingKeeper, authority.String())
+1 -2
View File
@@ -76,7 +76,6 @@ func initFixture(tb testing.TB) *fixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -93,7 +92,7 @@ func initFixture(tb testing.TB) *fixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
// set default staking params
err := stakingKeeper.SetParams(newCtx, stakingtypes.DefaultParams())
@@ -76,7 +76,6 @@ func initFixture(tb testing.TB) *fixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -93,7 +92,7 @@ func initFixture(tb testing.TB) *fixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
slashingKeeper := slashingkeeper.NewKeeper(cdc, &codec.LegacyAmino{}, runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), stakingKeeper, authority.String())
@@ -120,7 +120,6 @@ func initFixture(tb testing.TB) *fixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -137,7 +136,7 @@ func initFixture(tb testing.TB) *fixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[types.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[types.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil)
bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper, nil)
@@ -91,7 +91,6 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture {
authtypes.ProtoBaseAccount,
maccPerms,
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
sdk.Bech32MainPrefix,
authority.String(),
)
@@ -108,7 +107,7 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture {
log.NewNopLogger(),
)
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String())
stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr))
authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts, nil)
bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper, nil)