Skip to content

Commit

Permalink
[CORE-538] Fix bogus account numbers being generated in tests and re-…
Browse files Browse the repository at this point in the history
…enable tests. (#976)
  • Loading branch information
lcwik authored Jan 18, 2024
1 parent a1352a5 commit 6e48e42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
7 changes: 6 additions & 1 deletion protocol/testutil/auth/auth_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ func CreateTestModuleAccount(
moduleName string,
permissions []string,
) {
modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(moduleName), nil, 0, 0)
modBaseAcc := authtypes.NewBaseAccount(
authtypes.NewModuleAddress(moduleName),
nil,
accountKeeper.NextAccountNumber(ctx),
0,
)
modAcc := authtypes.NewModuleAccount(modBaseAcc, moduleName, permissions...)
accountKeeper.SetModuleAccount(ctx, modAcc)
}
16 changes: 2 additions & 14 deletions protocol/x/subaccounts/keeper/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import (
)

func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccount_Success(t *testing.T) {
t.Skip("TODO(CORE-538): The issue is that the dependent modules are not initialized " +
"appropriately and we error out with 'collections: conflict: index uniqueness constrain " +
"violation: 0'. Swap to use testapp to initialize.")
tests := map[string]struct {
testTransferFundToAccount bool
asset asstypes.Asset
Expand Down Expand Up @@ -148,7 +145,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun
testAccAddress, err := sdk.AccAddressFromBech32(addressStr)
require.NoError(t, err)

testAcc := authtypes.NewBaseAccount(testAccAddress, nil, 999, 0)
testAcc := authtypes.NewBaseAccount(testAccAddress, nil, accountKeeper.NextAccountNumber(ctx), 0)
accountKeeper.SetAccount(ctx, testAcc)

if tc.accAddressBalance.Sign() > 0 {
Expand Down Expand Up @@ -248,9 +245,6 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun
}

func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccount_Failure(t *testing.T) {
t.Skip("TODO(CORE-538): The issue is that the dependent modules are not initialized " +
"appropriately and we error out with 'collections: conflict: index uniqueness constrain " +
"violation: 0'. Swap to use testapp to initialize.")
tests := map[string]struct {
skipSetUpUsdc bool
testTransferFundToAccount bool
Expand Down Expand Up @@ -378,7 +372,7 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun
testAccAddress, err := sdk.AccAddressFromBech32(addressStr)
require.NoError(t, err)

testAcc := authtypes.NewBaseAccount(testAccAddress, nil, 0, 0)
testAcc := authtypes.NewBaseAccount(testAccAddress, nil, accountKeeper.NextAccountNumber(ctx), 0)
accountKeeper.SetAccount(ctx, testAcc)

if tc.accAddressBalance.Sign() > 0 {
Expand Down Expand Up @@ -484,9 +478,6 @@ func TestWithdrawFundsFromSubaccountToAccount_DepositFundsFromAccountToSubaccoun
}

func TestTransferFeesToFeeCollectorModule(t *testing.T) {
t.Skip("TODO(CORE-538): The issue is that the dependent modules are not initialized " +
"appropriately and we error out with 'collections: conflict: index uniqueness constrain " +
"violation: 0'. Swap to use testapp to initialize.")
tests := map[string]struct {
skipSetUpUsdc bool

Expand Down Expand Up @@ -664,9 +655,6 @@ func TestTransferFeesToFeeCollectorModule(t *testing.T) {
}

func TestTransferInsuranceFundPayments(t *testing.T) {
t.Skip("TODO(CORE-538): The issue is that the dependent modules are not initialized " +
"appropriately and we error out with 'collections: conflict: index uniqueness constrain " +
"violation: 0'. Swap to use testapp to initialize.")
tests := map[string]struct {
skipSetUpUsdc bool

Expand Down

0 comments on commit 6e48e42

Please sign in to comment.