feat(x/protocolpool,x/distribution)!: remove dependency + fix continuous fund bug (#20790)
This commit is contained in:
@@ -86,11 +86,12 @@ func initFixture(t *testing.T) *fixture {
|
||||
authority := authtypes.NewModuleAddress("gov")
|
||||
|
||||
maccPerms := map[string][]string{
|
||||
pooltypes.ModuleName: {},
|
||||
pooltypes.StreamAccount: {},
|
||||
distrtypes.ModuleName: {authtypes.Minter},
|
||||
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
pooltypes.ModuleName: {},
|
||||
pooltypes.StreamAccount: {},
|
||||
pooltypes.ProtocolPoolDistrAccount: {},
|
||||
distrtypes.ModuleName: {authtypes.Minter},
|
||||
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
}
|
||||
|
||||
// gomock initializations
|
||||
@@ -137,13 +138,13 @@ func initFixture(t *testing.T) *fixture {
|
||||
poolKeeper := poolkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), log.NewNopLogger()), accountKeeper, bankKeeper, stakingKeeper, authority.String())
|
||||
|
||||
distrKeeper := distrkeeper.NewKeeper(
|
||||
cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, poolKeeper, cometService, distrtypes.ModuleName, authority.String(),
|
||||
cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, cometService, distrtypes.ModuleName, authority.String(),
|
||||
)
|
||||
|
||||
authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts)
|
||||
bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper)
|
||||
stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper)
|
||||
distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper, poolKeeper)
|
||||
distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper)
|
||||
poolModule := protocolpool.NewAppModule(cdc, poolKeeper, accountKeeper, bankKeeper)
|
||||
|
||||
addr := sdk.AccAddress(PKS[0].Address())
|
||||
|
||||
@@ -67,12 +67,13 @@ func initFixture(tb testing.TB) *fixture {
|
||||
authority := authtypes.NewModuleAddress(types.ModuleName)
|
||||
|
||||
maccPerms := map[string][]string{
|
||||
pooltypes.ModuleName: {},
|
||||
pooltypes.StreamAccount: {},
|
||||
minttypes.ModuleName: {authtypes.Minter},
|
||||
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
types.ModuleName: {authtypes.Burner},
|
||||
pooltypes.ModuleName: {},
|
||||
pooltypes.StreamAccount: {},
|
||||
pooltypes.ProtocolPoolDistrAccount: {},
|
||||
minttypes.ModuleName: {authtypes.Minter},
|
||||
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
types.ModuleName: {authtypes.Burner},
|
||||
}
|
||||
|
||||
// gomock initializations
|
||||
|
||||
@@ -87,7 +87,6 @@ func TestWithdrawAnytime(t *testing.T) {
|
||||
// TestExpireInTheMiddle tests if a continuous fund that expires without anyone
|
||||
// calling the withdraw function, the funds are still distributed correctly.
|
||||
func TestExpireInTheMiddle(t *testing.T) {
|
||||
t.Skip("This is a bug @facu found, will fix in another PR")
|
||||
var accountKeeper authkeeper.AccountKeeper
|
||||
var protocolpoolKeeper protocolpoolkeeper.Keeper
|
||||
var bankKeeper bankkeeper.Keeper
|
||||
@@ -131,8 +130,8 @@ func TestExpireInTheMiddle(t *testing.T) {
|
||||
_, err = msgServer.WithdrawContinuousFund(ctx, &protocolpooltypes.MsgWithdrawContinuousFund{
|
||||
RecipientAddress: testAddr0Str,
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
endBalance := bankKeeper.GetBalance(ctx, testAddrs[0], sdk.DefaultBondDenom)
|
||||
require.Equal(t, "158441stake", endBalance.String())
|
||||
require.Equal(t, "237661stake", endBalance.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user