refactor(x/auth): auth module can recognize x/accounts account (#20002)

This commit is contained in:
son trinh
2024-04-11 09:56:37 +00:00
committed by GitHub
parent 1d2a795eaf
commit a0d727eebc
56 changed files with 295 additions and 21 deletions
+2
View File
@@ -1,6 +1,7 @@
package slashing
import (
_ "cosmossdk.io/x/accounts" // import as blank for app wiring
_ "cosmossdk.io/x/auth" // import as blank for app wiring
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring
_ "cosmossdk.io/x/bank" // import as blank for app wiring
@@ -16,6 +17,7 @@ import (
)
var AppConfig = configurator.NewAppConfig(
configurator.AccountsModule(),
configurator.AuthModule(),
configurator.BankModule(),
configurator.StakingModule(),
@@ -4,6 +4,7 @@ import (
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -14,6 +15,7 @@ import (
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/auth"
authkeeper "cosmossdk.io/x/auth/keeper"
authtestutil "cosmossdk.io/x/auth/testutil"
authtypes "cosmossdk.io/x/auth/types"
"cosmossdk.io/x/bank"
bankkeeper "cosmossdk.io/x/bank/keeper"
@@ -73,6 +75,10 @@ func initFixture(tb testing.TB) *fixture {
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
}
// gomock initializations
ctrl := gomock.NewController(&testing.T{})
acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl)
accountKeeper := authkeeper.NewAccountKeeper(
runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()),
cdc,
@@ -81,6 +87,7 @@ func initFixture(tb testing.TB) *fixture {
addresscodec.NewBech32Codec(sdk.Bech32MainPrefix),
sdk.Bech32MainPrefix,
authority.String(),
acctsModKeeper,
)
blockedAddresses := map[string]bool{
@@ -62,6 +62,7 @@ func TestSlashingMsgs(t *testing.T) {
app, err := sims.SetupWithConfiguration(
depinject.Configs(
configurator.NewAppConfig(
configurator.AccountsModule(),
configurator.AuthModule(),
configurator.StakingModule(),
configurator.SlashingModule(),