Repository: osmosis-labs/osmosis
Pull request #2081 (2022-07-15 04:33:26)

Move random genesis to an extension interface
\## What is the purpose of the change

Remove random genesis state from module API, and demo this change for other people doing something on the SDK

## Brief Changelog

- Rename and move GenerateGenesisState to a new extension interface, under better name RandomGenesisState.

(We still need to come back and unscrew up all the genesis handling, but this is a nice step in the direction)

## Testing and Verifying

FullAppSimulation still making lockup module messages succesfully. Checked via local execution.

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes?  yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? code comment


Patch:
diff --git a/osmomath/math.go b/osmomath/math.go
index def0f5014..d8f341bb6 100644
--- a/osmomath/math.go
+++ b/osmomath/math.go
@@ -84,6 +84,10 @@ func Pow(base sdk.Dec, exp sdk.Dec) sdk.Dec {
 // Contract: 0 < base <= 2
 // 0 <= exp < 1.
 func PowApprox(base sdk.Dec, exp sdk.Dec, precision sdk.Dec) sdk.Dec {
+	if !base.IsPositive() {
+		panic(fmt.Errorf("base must be greater than 0"))
+	}
+
 	if exp.IsZero() {
 		return sdk.OneDec()
 	}
diff --git a/simulation/types/manager.go b/simulation/types/manager.go
index 063f693b6..f4eea1d69 100644
--- a/simulation/types/manager.go
+++ b/simulation/types/manager.go
@@ -19,15 +19,16 @@ import (
 type AppModuleSimulationV2 interface {
 	module.AppModule
 
-	// randomized genesis states
-	// TODO: Come back and improve SimulationState interface
-	// TODO: Move this to an extension interface
-	// default: simState.GenState[types.ModuleName] = app.DefaultGenesis(simState.Cdc)
-	GenerateGenesisState(*module.SimulationState, *SimCtx)
 	Actions() []Action
 	// PropertyTests()
 }
 
+type AppModuleSimulationV2WithRandGenesis interface {
+	AppModuleSimulationV2
+	// TODO: Come back and improve SimulationState interface
+	RandomGenesisState(*module.SimulationState, *SimCtx)
+}
+
 // SimulationManager defines a simulation manager that provides the high level utility
 // for managing and executing simulation functionalities for a group of modules
 type Manager struct {
@@ -137,7 +138,12 @@ func (m Manager) Actions(seed int64, cdc codec.JSONCodec) []Action {
 func (m Manager) GenerateGenesisStates(simState *module.SimulationState, sim *SimCtx) {
 	for _, moduleName := range m.moduleManager.OrderInitGenesis {
 		if simModule, ok := m.Modules[moduleName]; ok {
-			simModule.GenerateGenesisState(simState, sim)
+			// if we define a random genesis function use it, otherwise use default genesis
+			if mod, ok := simModule.(AppModuleSimulationV2WithRandGenesis); ok {
+				mod.RandomGenesisState(simState, sim)
+			} else {
+				simState.GenState[simModule.Name()] = simModule.DefaultGenesis(simState.Cdc)
+			}
 		}
 		if simModule, ok := m.legacyModules[moduleName]; ok {
 			simModule.GenerateGenesisState(simState)
diff --git a/x/gamm/module.go b/x/gamm/module.go
index df389ae70..ce1f7ae38 100644
--- a/x/gamm/module.go
+++ b/x/gamm/module.go
@@ -158,9 +158,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
 func (AppModule) ConsensusVersion() uint64 { return 1 }
 
 // **** simulation implementation ****
-func (am AppModule) GenerateGenesisState(m *module.SimulationState, s *simulation.SimCtx) {
-	m.GenState[types.ModuleName] = am.DefaultGenesis(m.Cdc)
-}
 
 func (am AppModule) Actions() []simulation.Action {
 	return []simulation.Action{
diff --git a/x/lockup/module.go b/x/lockup/module.go
index 05de92c6c..f5665e275 100644
--- a/x/lockup/module.go
+++ b/x/lockup/module.go
@@ -185,11 +185,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
 
 // AppModuleSimulationV2 functions
 
-// GenerateGenesisState creates a randomized GenState of the pool-incentives module.
-func (am AppModule) GenerateGenesisState(simState *module.SimulationState, s *simulation.SimCtx) {
-	simState.GenState[types.ModuleName] = am.DefaultGenesis(simState.Cdc)
-}
-
 // WeightedOperations returns the all the lockup module operations with their respective weights.
 func (am AppModule) Actions() []simulation.Action {
 	return []simulation.Action{


Test patch:
diff --git a/osmomath/math_test.go b/osmomath/math_test.go
index c01caf80e..b369db336 100644
--- a/osmomath/math_test.go
+++ b/osmomath/math_test.go
@@ -1,10 +1,13 @@
 package osmomath
 
 import (
+	"fmt"
 	"testing"
 
 	sdk "github.com/cosmos/cosmos-sdk/types"
 
+	"github.com/osmosis-labs/osmosis/v7/osmoutils"
+
 	"github.com/stretchr/testify/require"
 )
 
@@ -23,50 +26,143 @@ func TestAbsDifferenceWithSign(t *testing.T) {
 }
 
 func TestPowApprox(t *testing.T) {
-	base, err := sdk.NewDecFromStr("0.8")
-	require.NoError(t, err)
-	exp, err := sdk.NewDecFromStr("0.32")
-	require.NoError(t, err)
-
-	s := PowApprox(base, exp, powPrecision)
-	expectedDec, err := sdk.NewDecFromStr("0.93108385")
-	require.NoError(t, err)
-
-	require.True(
-		t,
-		expectedDec.Sub(s).Abs().LTE(powPrecision),
-		"expected value & actual value's difference should less than precision",
-	)
+	testCases := []struct {
+		base           sdk.Dec
+		exp            sdk.Dec
+		powPrecision   sdk.Dec
+		expectedResult sdk.Dec
+	}{
+		{
+			// medium base, small exp
+			base:           sdk.MustNewDecFromStr("0.8"),
+			exp:            sdk.MustNewDecFromStr("0.32"),
+			powPrecision:   sdk.MustNewDecFromStr("0.00000001"),
+			expectedResult: sdk.MustNewDecFromStr("0.93108385"),
+		},
+		{
+			// zero exp
+			base:           sdk.MustNewDecFromStr("0.8"),
+			exp:            sdk.ZeroDec(),
+			powPrecision:   sdk.MustNewDecFromStr("0.00001"),
+			expectedResult: sdk.OneDec(),
+		},
+		{
+			// zero base, this should panic
+			base:           sdk.ZeroDec(),
+			exp:            sdk.OneDec(),
+			powPrecision:   sdk.MustNewDecFromStr("0.00001"),
+			expectedResult: sdk.ZeroDec(),
+		},
+		{
+			// large base, small exp
+			base:           sdk.MustNewDecFromStr("1.9999"),
+			exp:            sdk.MustNewDecFromStr("0.23"),
+			powPrecision:   sdk.MustNewDecFromStr("0.000000001"),
+			expectedResult: sdk.MustNewDecFromStr("1.172821461"),
+		},
+		{
+			// large base, large integer exp
+			base:           sdk.MustNewDecFromStr("1.777"),
+			exp:            sdk.MustNewDecFromStr("20"),
+			powPrecision:   sdk.MustNewDecFromStr("0.000000000001"),
+			expectedResult: sdk.MustNewDecFromStr("98570.862372081602"),
+		},
+		{
+			// medium base, large exp, high precision
+			base:           sdk.MustNewDecFromStr("1.556"),
+			exp:            sdk.MustNewDecFromStr("20.9123"),
+			powPrecision:   sdk.MustNewDecFromStr("0.0000000000000001"),
+			expectedResult: sdk.MustNewDecFromStr("10360.058421529811344618"),
+		},
+		{
+			// high base, large exp, high precision
+			base:           sdk.MustNewDecFromStr("1.886"),
+			exp:            sdk.MustNewDecFromStr("31.9123"),
+			powPrecision:   sdk.MustNewDecFromStr("0.00000000000001"),
+			expectedResult: sdk.MustNewDecFromStr("621110716.84727942280335811"),
+		},
+		{
+			// base equal one
+			base:           sdk.MustNewDecFromStr("1"),
+			exp:            sdk.MustNewDecFromStr("123"),
+			powPrecision:   sdk.MustNewDecFromStr("0.00000001"),
+			expectedResult: sdk.OneDec(),
+		},
+	}
 
-	base, err = sdk.NewDecFromStr("0.8")
-	require.NoError(t, err)
-	exp = sdk.ZeroDec()
-	require.NoError(t, err)
-
-	s = PowApprox(base, exp, powPrecision)
-	expectedDec = sdk.OneDec()
-	require.NoError(t, err)
-
-	require.True(
-		t,
-		expectedDec.Sub(s).Abs().LTE(powPrecision),
-		"expected value & actual value's difference should less than precision",
-	)
+	for i, tc := range testCases {
+		var actualResult sdk.Dec
+		osmoutils.ConditionalPanic(t, tc.base.Equal(sdk.ZeroDec()), func() {
+			fmt.Println(tc.base)
+			actualResult = PowApprox(tc.base, tc.exp, tc.powPrecision)
+			require.True(
+				t,
+				tc.expectedResult.Sub(actualResult).Abs().LTE(tc.powPrecision),
+				fmt.Sprintf("test %d failed: expected value & actual value's difference should be less than precision", i),
+			)
+		})
+	}
 }
 
 func TestPow(t *testing.T) {
-	base, err := sdk.NewDecFromStr("1.68")
-	require.NoError(t, err)
-	exp, err := sdk.NewDecFromStr("0.32")
-	require.NoError(t, err)
-
-	s := Pow(base, exp)
-	expectedDec, err := sdk.NewDecFromStr("1.18058965")
-	require.NoError(t, err)
+	testCases := []struct {
+		base           sdk.Dec
+		exp            sdk.Dec
+		expectedResult sdk.Dec
+	}{
+		{
+			// medium base, small exp
+			base:           sdk.MustNewDecFromStr("0.8"),
+			exp:            sdk.MustNewDecFromStr("0.32"),
+			expectedResult: sdk.MustNewDecFromStr("0.93108385"),
+		},
+		{
+			// zero exp
+			base:           sdk.MustNewDecFromStr("0.8"),
+			exp:            sdk.ZeroDec(),
+			expectedResult: sdk.OneDec(),
+		},
+		{
+			// zero base, this should panic
+			base:           sdk.ZeroDec(),
+			exp:            sdk.OneDec(),
+			expectedResult: sdk.ZeroDec(),
+		},
+		{
+			// large base, small exp
+			base:           sdk.MustNewDecFromStr("1.9999"),
+			exp:            sdk.MustNewDecFromStr("0.23"),
+			expectedResult: sdk.MustNewDecFromStr("1.172821461"),
+		},
+		{
+			// small base, large exp
+			base:           sdk.MustNewDecFromStr("0.0000123"),
+			exp:            sdk.MustNewDecFromStr("123"),
+			expectedResult: sdk.ZeroDec(),
+		},
+		{
+			// large base, large exp
+			base:           sdk.MustNewDecFromStr("1.777"),
+			exp:            sdk.MustNewDecFromStr("20"),
+			expectedResult: sdk.MustNewDecFromStr("98570.862372081602"),
+		},
+		{
+			// base equal one
+			base:           sdk.MustNewDecFromStr("1"),
+			exp:            sdk.MustNewDecFromStr("123"),
+			expectedResult: sdk.OneDec(),
+		},
+	}
 
-	require.True(
-		t,
-		expectedDec.Sub(s).Abs().LTE(powPrecision),
-		"expected value & actual value's difference should less than precision",
-	)
+	for i, tc := range testCases {
+		var actualResult sdk.Dec
+		osmoutils.ConditionalPanic(t, tc.base.Equal(sdk.ZeroDec()), func() {
+			actualResult = Pow(tc.base, tc.exp)
+			require.True(
+				t,
+				tc.expectedResult.Sub(actualResult).Abs().LTE(powPrecision),
+				fmt.Sprintf("test %d failed: expected value & actual value's difference should be less than precision", i),
+			)
+		})
+	}
 }
diff --git a/tests/e2e/configurer/chain/queries.go b/tests/e2e/configurer/chain/queries.go
index 3e44415e6..672ecebdb 100644
--- a/tests/e2e/configurer/chain/queries.go
+++ b/tests/e2e/configurer/chain/queries.go
@@ -26,24 +26,15 @@ func (n *NodeConfig) QueryGRPCGateway(path string) ([]byte, error) {
 	fullQueryPath := fmt.Sprintf("%s/%s", endpoint, path)
 
 	var resp *http.Response
-	retriesLeft := 5
-	for {
+	require.Eventually(n.t, func() bool {
 		resp, err = http.Get(fullQueryPath)
-
-		if resp.StatusCode == http.StatusServiceUnavailable {
-			retriesLeft--
-			if retriesLeft == 0 {
-				return nil, err
-			}
-			time.Sleep(10 * time.Second)
-		} else {
-			break
+		if err != nil {
+			n.t.Logf("error while executing HTTP request: %s", err.Error())
+			return false
 		}
-	}
 
-	if err != nil {
-		return nil, fmt.Errorf("failed to execute HTTP request: %w", err)
-	}
+		return resp.StatusCode != http.StatusServiceUnavailable
+	}, time.Minute, time.Second*10, "failed to execute HTTP request")
 
 	defer resp.Body.Close()
 
diff --git a/x/superfluid/keeper/distribution_test.go b/x/superfluid/keeper/distribution_test.go
index dad228dc5..1e77f51c8 100644
--- a/x/superfluid/keeper/distribution_test.go
+++ b/x/superfluid/keeper/distribution_test.go
@@ -63,16 +63,13 @@ func (suite *KeeperTestSuite) TestMoveSuperfluidDelegationRewardToGauges() {
 		suite.Run(tc.name, func() {
 			suite.SetupTest()
 
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
 
 			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 			// setup superfluid delegations
-			intermediaryAccs, _ := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, intermediaryAccs, _ := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 			unbondingDuration := suite.App.StakingKeeper.GetParams(suite.Ctx).UnbondingTime
 
 			// allocate rewards to first validator
diff --git a/x/superfluid/keeper/edge_case_test.go b/x/superfluid/keeper/edge_case_test.go
index c4ba9287a..a03a17883 100644
--- a/x/superfluid/keeper/edge_case_test.go
+++ b/x/superfluid/keeper/edge_case_test.go
@@ -6,6 +6,7 @@ import (
 	sdk "github.com/cosmos/cosmos-sdk/types"
 	evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
 	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+
 	lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types"
 )
 
@@ -49,7 +50,7 @@ func (suite *KeeperTestSuite) TestSuperfluidDelegatedValidatorJailed() {
 			for _, del := range tc.superDelegations {
 				valAddr := valAddrs[del.valIndex]
 				delAddr := delAddrs[del.delIndex]
-				lock := suite.SetupSuperfluidDelegate(delAddr, valAddr, denoms[del.lpIndex], del.lpAmount)
+				lock := suite.setupSuperfluidDelegate(delAddr, valAddr, denoms[del.lpIndex], del.lpAmount)
 
 				// save accounts and locks for future use
 				locks = append(locks, lock)
@@ -125,8 +126,6 @@ func (suite *KeeperTestSuite) TestTryUnbondingSuperfluidLockupDirectly() {
 		tc := tc
 		suite.Run(tc.name, func() {
 			suite.SetupTest()
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
 
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
@@ -134,8 +133,7 @@ func (suite *KeeperTestSuite) TestTryUnbondingSuperfluidLockupDirectly() {
 			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 			// setup superfluid delegations
-			_, _, _ = delAddrs, valAddrs, denoms
-			_, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, _, locks := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 
 			for _, lock := range locks {
 				err := suite.App.LockupKeeper.BeginUnlock(suite.Ctx, lock.ID, sdk.Coins{})
diff --git a/x/superfluid/keeper/grpc_query_test.go b/x/superfluid/keeper/grpc_query_test.go
index 8b027179e..cd9f6aabe 100644
--- a/x/superfluid/keeper/grpc_query_test.go
+++ b/x/superfluid/keeper/grpc_query_test.go
@@ -43,9 +43,6 @@ func (suite *KeeperTestSuite) TestGRPCSuperfluidAsset() {
 func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegations() {
 	suite.SetupTest()
 
-	// Generate delegator addresses
-	delAddrs := CreateRandomAccounts(2)
-
 	// setup 2 validators
 	valAddrs := suite.SetupValidators([]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded})
 
@@ -60,13 +57,13 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegations() {
 	}
 
 	// setup superfluid delegations
-	_, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, superfluidDelegations, denoms)
+	delegatorAddresses, _, locks := suite.setupSuperfluidDelegations(valAddrs, superfluidDelegations, denoms)
 
 	// for each superfluid delegation, query the amount and make sure it is 1000000
 	for _, delegation := range superfluidDelegations {
 		lpDenom := denoms[delegation.lpIndex]
 		res, err := suite.queryClient.SuperfluidDelegationAmount(sdk.WrapSDKContext(suite.Ctx), &types.SuperfluidDelegationAmountRequest{
-			DelegatorAddress: delAddrs[delegation.delIndex].String(),
+			DelegatorAddress: delegatorAddresses[delegation.delIndex].String(),
 			ValidatorAddress: valAddrs[delegation.valIndex].String(),
 			Denom:            lpDenom,
 		})
@@ -75,7 +72,7 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegations() {
 	}
 
 	// for each delegator, query all their superfluid delegations and make sure they have 2 delegations
-	for _, delegator := range delAddrs {
+	for _, delegator := range delegatorAddresses {
 		res, err := suite.queryClient.SuperfluidDelegationsByDelegator(sdk.WrapSDKContext(suite.Ctx), &types.SuperfluidDelegationsByDelegatorRequest{
 			DelegatorAddress: delegator.String(),
 		})
@@ -139,12 +136,8 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegations() {
 func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegationsDontIncludeUnbonding() {
 	suite.SetupTest()
 
-	// Generate delegator addresses
-	delAddrs := CreateRandomAccounts(2)
-
 	// setup 2 validators
 	valAddrs := suite.SetupValidators([]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded})
-
 	denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 	// create a delegation of 1000000 for every combination of 2 delegations, 2 validators, and 2 superfluid denoms
@@ -156,7 +149,7 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegationsDontIncludeUnbon
 	}
 
 	// setup superfluid delegations
-	_, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, superfluidDelegations, denoms)
+	delegatorAddresses, _, locks := suite.setupSuperfluidDelegations(valAddrs, superfluidDelegations, denoms)
 
 	// start unbonding the superfluid delegations of denom0 from delegator0 to validator0
 	err := suite.querier.SuperfluidUndelegate(suite.Ctx, locks[0].Owner, locks[0].ID)
@@ -164,7 +157,7 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegationsDontIncludeUnbon
 
 	// query to make sure that the amount delegated for the now unbonding delegation is 0
 	res, err := suite.queryClient.SuperfluidDelegationAmount(sdk.WrapSDKContext(suite.Ctx), &types.SuperfluidDelegationAmountRequest{
-		DelegatorAddress: delAddrs[0].String(),
+		DelegatorAddress: delegatorAddresses[0].String(),
 		ValidatorAddress: valAddrs[0].String(),
 		Denom:            denoms[0],
 	})
@@ -173,7 +166,7 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegationsDontIncludeUnbon
 
 	// query to make sure that the unbonding delegation is not included in delegator query
 	res2, err := suite.queryClient.SuperfluidDelegationsByDelegator(sdk.WrapSDKContext(suite.Ctx), &types.SuperfluidDelegationsByDelegatorRequest{
-		DelegatorAddress: delAddrs[0].String(),
+		DelegatorAddress: delegatorAddresses[0].String(),
 	})
 	suite.Require().NoError(err)
 	suite.Require().Len(res2.SuperfluidDelegationRecords, 1)
@@ -206,9 +199,6 @@ func (suite *KeeperTestSuite) TestGRPCQuerySuperfluidDelegationsDontIncludeUnbon
 func (suite *KeeperTestSuite) TestGRPCQueryTotalDelegationByDelegator() {
 	suite.SetupTest()
 
-	// Generate delegator addresses
-	delAddrs := CreateRandomAccounts(2)
-
 	// setup 2 validators
 	valAddrs := suite.SetupValidators([]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded})
 
@@ -223,13 +213,13 @@ func (suite *KeeperTestSuite) TestGRPCQueryTotalDelegationByDelegator() {
 	}
 
 	// setup superfluid delegations
-	suite.SetupSuperfluidDelegations(delAddrs, valAddrs, superfluidDelegations, denoms)
+	delegatorAddresses, _, _ := suite.setupSuperfluidDelegations(valAddrs, superfluidDelegations, denoms)
 
 	// setup normal delegations
-	bond0to0 := stakingtypes.NewDelegation(delAddrs[0], valAddrs[0], sdk.NewDec(9000000))
-	bond0to1 := stakingtypes.NewDelegation(delAddrs[0], valAddrs[1], sdk.NewDec(9000000))
-	bond1to0 := stakingtypes.NewDelegation(delAddrs[1], valAddrs[0], sdk.NewDec(9000000))
-	bond1to1 := stakingtypes.NewDelegation(delAddrs[1], valAddrs[1], sdk.NewDec(9000000))
+	bond0to0 := stakingtypes.NewDelegation(delegatorAddresses[0], valAddrs[0], sdk.NewDec(9000000))
+	bond0to1 := stakingtypes.NewDelegation(delegatorAddresses[0], valAddrs[1], sdk.NewDec(9000000))
+	bond1to0 := stakingtypes.NewDelegation(delegatorAddresses[1], valAddrs[0], sdk.NewDec(9000000))
+	bond1to1 := stakingtypes.NewDelegation(delegatorAddresses[1], valAddrs[1], sdk.NewDec(9000000))
 
 	suite.App.StakingKeeper.SetDelegation(suite.Ctx, bond0to0)
 	suite.App.StakingKeeper.SetDelegation(suite.Ctx, bond0to1)
@@ -245,7 +235,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTotalDelegationByDelegator() {
 
 	// for each delegator, query all their superfluid delegations and normal delegations. Making sure they have 4 delegations
 	// Making sure TotalEquivalentStakedAmount is equal to converted amount + normal delegations
-	for _, delegator := range delAddrs {
+	for _, delegator := range delegatorAddresses {
 		res, err := suite.queryClient.TotalDelegationByDelegator(sdk.WrapSDKContext(suite.Ctx), &types.QueryTotalDelegationByDelegatorRequest{
 			DelegatorAddress: delegator.String(),
 		})
diff --git a/x/superfluid/keeper/hooks_test.go b/x/superfluid/keeper/hooks_test.go
index ecfc0ff37..901746735 100644
--- a/x/superfluid/keeper/hooks_test.go
+++ b/x/superfluid/keeper/hooks_test.go
@@ -49,8 +49,7 @@ func (suite *KeeperTestSuite) TestSuperfluidAfterEpochEnd() {
 			denoms, poolIds := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20)})
 
 			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-			intermediaryAccs, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			delAddrs, intermediaryAccs, locks := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
 
 			// run swap and set spot price
@@ -257,16 +256,13 @@ func (suite *KeeperTestSuite) TestBeforeSlashingUnbondingDelegationHook() {
 
 			slashFactor := sdk.NewDecWithPrec(5, 2)
 
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
 
 			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 			// setup superfluid delegations
-			intermediaryAccs, _ := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, intermediaryAccs, _ := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
 
 			for _, lockId := range tc.superUnbondingLockIds {
diff --git a/x/superfluid/keeper/intermediary_account_test.go b/x/superfluid/keeper/intermediary_account_test.go
index ee86ab52e..29cbe67a3 100644
--- a/x/superfluid/keeper/intermediary_account_test.go
+++ b/x/superfluid/keeper/intermediary_account_test.go
@@ -52,7 +52,7 @@ func (suite *KeeperTestSuite) TestIntermediaryAccountCreation() {
 				suite.Require().Equal(uint64(0), interAcc.GaugeId)
 				suite.Require().Equal("", interAcc.ValAddr)
 
-				lock := suite.SetupSuperfluidDelegate(delAddr, valAddr, denom, superDelegation.lpAmount)
+				lock := suite.setupSuperfluidDelegate(delAddr, valAddr, denom, superDelegation.lpAmount)
 
 				// check that intermediary Account connection is established
 				interAccConnection := suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, lock.ID)
diff --git a/x/superfluid/keeper/keeper_test.go b/x/superfluid/keeper/keeper_test.go
index a6bd2272c..fa5a73d1f 100644
--- a/x/superfluid/keeper/keeper_test.go
+++ b/x/superfluid/keeper/keeper_test.go
@@ -14,6 +14,7 @@ import (
 	epochtypes "github.com/osmosis-labs/osmosis/v7/x/epochs/types"
 	"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer"
 	gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types"
+	lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types"
 	minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types"
 	"github.com/osmosis-labs/osmosis/v7/x/superfluid/keeper"
 	"github.com/osmosis-labs/osmosis/v7/x/superfluid/types"
@@ -152,6 +153,98 @@ func (suite *KeeperTestSuite) SetupGammPoolsAndSuperfluidAssets(multipliers []sd
 	return denoms, poolIds
 }
 
+func (suite *KeeperTestSuite) setupSuperfluidDelegations(valAddrs []sdk.ValAddress, superDelegations []superfluidDelegation, denoms []string) ([]sdk.AccAddress, []types.SuperfluidIntermediaryAccount, []lockuptypes.PeriodLock) {
+	flagIntermediaryAcc := make(map[string]bool)
+	intermediaryAccs := []types.SuperfluidIntermediaryAccount{}
+	locks := []lockuptypes.PeriodLock{}
+	delAddrs := []sdk.AccAddress{}
+
+	// we do sanity check on the test cases.
+	// if superfluid staking is happening with single val and multiple superfluid delegations,
+	// we should be running `AddTokensToLockByID`, instead of creating new locks
+	delegatorAddressMap := make(map[int64]sdk.AccAddress)
+	for _, superDelegation := range superDelegations {
+		// either create or use existing delegator address
+		var delAddr sdk.AccAddress
+		if cachedAddr, ok := delegatorAddressMap[superDelegation.delIndex]; ok {
+			delAddr = cachedAddr
+		} else {
+			pk := ed25519.GenPrivKey().PubKey()
+			delAddr = sdk.AccAddress(pk.Address())
+			delegatorAddressMap[superDelegation.delIndex] = delAddr
+			delAddrs = append(delAddrs, delAddr)
+		}
+
+		valAddr := valAddrs[superDelegation.valIndex]
+		lock := suite.setupSuperfluidDelegate(delAddr, valAddr, denoms[superDelegation.lpIndex], superDelegation.lpAmount)
+		address := suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, lock.ID)
+		gotAcc := suite.App.SuperfluidKeeper.GetIntermediaryAccount(suite.Ctx, address)
+
+		// save accounts for future use
+		if flagIntermediaryAcc[gotAcc.String()] == false {
+			flagIntermediaryAcc[gotAcc.String()] = true
+			intermediaryAccs = append(intermediaryAccs, gotAcc)
+		}
+		// save locks for future use
+		locks = append(locks, lock)
+	}
+	return delAddrs, intermediaryAccs, locks
+}
+
+func (suite *KeeperTestSuite) checkIntermediaryAccountDelegations(intermediaryAccs []types.SuperfluidIntermediaryAccount) {
+	for _, acc := range intermediaryAccs {
+		valAddr, err := sdk.ValAddressFromBech32(acc.ValAddr)
+		suite.Require().NoError(err)
+
+		// check delegation from intermediary account to validator
+		delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, acc.GetAccAddress(), valAddr)
+		suite.Require().True(found)
+		suite.Require().True(delegation.Shares.GTE(sdk.NewDec(10000000)))
+
+		// check delegated tokens
+		validator, found := suite.App.StakingKeeper.GetValidator(suite.Ctx, valAddr)
+		suite.Require().True(found)
+		delegatedTokens := validator.TokensFromShares(delegation.Shares).TruncateInt()
+		suite.Require().True(delegatedTokens.GTE(sdk.NewInt(10000000)))
+	}
+}
+
+func (suite *KeeperTestSuite) setupSuperfluidDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, denom string, amount int64) lockuptypes.PeriodLock {
+	unbondingDuration := suite.App.StakingKeeper.GetParams(suite.Ctx).UnbondingTime
+
+	// create lockup of LP token
+	coins := sdk.Coins{sdk.NewInt64Coin(denom, amount)}
+	lastLockID := suite.App.LockupKeeper.GetLastLockID(suite.Ctx)
+
+	lockID := suite.LockTokens(delAddr, coins, unbondingDuration)
+	lock, err := suite.App.LockupKeeper.GetLockByID(suite.Ctx, lockID)
+	suite.Require().NoError(err)
+
+	// here we check if check `LockTokens` added to existing locks or created a new lock.
+	// if `LockTokens` created a new lock, we continue SuperfluidDelegate
+	// if lock has been existing before, we wouldn't have to call SuperfluidDelegate separately, as hooks on LockTokens would have automatically called IncreaseSuperfluidDelegation
+	if lastLockID != lockID {
+		err = suite.App.SuperfluidKeeper.SuperfluidDelegate(suite.Ctx, lock.Owner, lock.ID, valAddr.String())
+		suite.Require().NoError(err)
+	} else {
+		// here we handle two cases.
+		// 1. the lock has existed before but has not been superflud staking
+		// 2. the lock has existed before and has been superfluid staking
+
+		// we check if synth lock that has existed before, if it did, it means that the lock has been superfluid staked
+		// we do not care about unbonding synthlocks, as superfluid delegation has no effect
+
+		_, err := suite.App.LockupKeeper.GetSyntheticLockup(suite.Ctx, lockID, keeper.StakingSyntheticDenom(lock.Coins[0].Denom, valAddr.String()))
+		// if lock has existed before but has not been superfluid staked, we do initial superfluid staking
+		if err != nil {
+			err = suite.App.SuperfluidKeeper.SuperfluidDelegate(suite.Ctx, lock.Owner, lock.ID, valAddr.String())
+			suite.Require().NoError(err)
+		}
+	}
+
+	return *lock
+}
+
 func TestKeeperTestSuite(t *testing.T) {
 	suite.Run(t, new(KeeperTestSuite))
 }
diff --git a/x/superfluid/keeper/slash_test.go b/x/superfluid/keeper/slash_test.go
index 8f09c51bc..bbe302047 100644
--- a/x/superfluid/keeper/slash_test.go
+++ b/x/superfluid/keeper/slash_test.go
@@ -72,7 +72,7 @@ func (suite *KeeperTestSuite) TestBeforeValidatorSlashed() {
 			for _, del := range tc.superDelegations {
 				valAddr := valAddrs[del.valIndex]
 				delAddr := delAddrs[del.delIndex]
-				lock := suite.SetupSuperfluidDelegate(delAddr, valAddr, denoms[del.lpIndex], del.lpAmount)
+				lock := suite.setupSuperfluidDelegate(delAddr, valAddr, denoms[del.lpIndex], del.lpAmount)
 
 				// save accounts and locks for future use
 				locks = append(locks, lock)
@@ -145,16 +145,13 @@ func (suite *KeeperTestSuite) TestSlashLockupsForUnbondingDelegationSlash() {
 		suite.Run(tc.name, func() {
 			suite.SetupTest()
 
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
 
 			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 			// setup superfluid delegations
-			intermediaryAccs, _ := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, intermediaryAccs, _ := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
 
 			for _, lockId := range tc.superUnbondingLockIds {
diff --git a/x/superfluid/keeper/stake_test.go b/x/superfluid/keeper/stake_test.go
index 9a4b487ce..f72ce7162 100644
--- a/x/superfluid/keeper/stake_test.go
+++ b/x/superfluid/keeper/stake_test.go
@@ -1,13 +1,11 @@
 package keeper_test
 
 import (
-	"fmt"
 	"time"
 
 	abci "github.com/tendermint/tendermint/abci/types"
 
 	lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types"
-	minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types"
 	"github.com/osmosis-labs/osmosis/v7/x/superfluid/keeper"
 	"github.com/osmosis-labs/osmosis/v7/x/superfluid/types"
 
@@ -15,146 +13,35 @@ import (
 	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
 )
 
-type normalDelegation struct {
-	delIndex   int64
-	valIndex   int64
-	coinAmount int64
-}
-
 type superfluidDelegation struct {
 	delIndex int64
 	valIndex int64
 	lpIndex  int64
 	lpAmount int64
 }
-type superfluidRedelegation struct {
-	lockId      uint64
-	oldValIndex int64
-	newValIndex int64
-}
-
-type osmoEquivalentMultiplier struct {
-	lpIndex int64
-	price   sdk.Dec
-}
-
-func (suite *KeeperTestSuite) SetupNormalDelegation(delAddrs []sdk.AccAddress, valAddrs []sdk.ValAddress, del normalDelegation) error {
-	val, found := suite.App.StakingKeeper.GetValidator(suite.Ctx, valAddrs[del.valIndex])
-	if !found {
-		return fmt.Errorf("validator not found")
-	}
-	_, err := suite.App.StakingKeeper.Delegate(suite.Ctx, delAddrs[del.delIndex], sdk.NewIntFromUint64(uint64(del.coinAmount)), stakingtypes.Bonded, val, false)
-	return err
-}
-
-func (suite *KeeperTestSuite) SetupSuperfluidDelegations(delAddrs []sdk.AccAddress, valAddrs []sdk.ValAddress, superDelegations []superfluidDelegation, denoms []string) ([]types.SuperfluidIntermediaryAccount, []lockuptypes.PeriodLock) {
-	flagIntermediaryAcc := make(map[string]bool)
-	intermediaryAccs := []types.SuperfluidIntermediaryAccount{}
-	locks := []lockuptypes.PeriodLock{}
-
-	// setup superfluid delegations
-
-	// we do sanity check on the test cases.
-	// if superfluid staking is happening with single val and multiple superfluid delegations,
-	// we should be running `AddTokensToLockByID`, instead of creating new locks
-	for _, del := range superDelegations {
-		delAddr := delAddrs[del.delIndex]
-		valAddr := valAddrs[del.valIndex]
-		lock := suite.SetupSuperfluidDelegate(delAddr, valAddr, denoms[del.lpIndex], del.lpAmount)
-		address := suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, lock.ID)
-		gotAcc := suite.App.SuperfluidKeeper.GetIntermediaryAccount(suite.Ctx, address)
-
-		// save accounts for future use
-		if flagIntermediaryAcc[gotAcc.String()] == false {
-			flagIntermediaryAcc[gotAcc.String()] = true
-			intermediaryAccs = append(intermediaryAccs, gotAcc)
-		}
-		// save locks for future use
-		locks = append(locks, lock)
-	}
-	return intermediaryAccs, locks
-}
-
-func (suite *KeeperTestSuite) checkIntermediaryAccountDelegations(intermediaryAccs []types.SuperfluidIntermediaryAccount) {
-	for _, acc := range intermediaryAccs {
-		valAddr, err := sdk.ValAddressFromBech32(acc.ValAddr)
-		suite.Require().NoError(err)
-
-		// check delegation from intermediary account to validator
-		delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, acc.GetAccAddress(), valAddr)
-		suite.Require().True(found)
-		suite.Require().True(delegation.Shares.GTE(sdk.NewDec(10000000)))
-
-		// check delegated tokens
-		validator, found := suite.App.StakingKeeper.GetValidator(suite.Ctx, valAddr)
-		suite.Require().True(found)
-		delegatedTokens := validator.TokensFromShares(delegation.Shares).TruncateInt()
-		suite.Require().True(delegatedTokens.GTE(sdk.NewInt(10000000)))
-	}
-}
-
-func (suite *KeeperTestSuite) SetupSuperfluidDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, denom string, amount int64) lockuptypes.PeriodLock {
-	unbondingDuration := suite.App.StakingKeeper.GetParams(suite.Ctx).UnbondingTime
-
-	// create lockup of LP token
-	coins := sdk.Coins{sdk.NewInt64Coin(denom, amount)}
-	lastLockID := suite.App.LockupKeeper.GetLastLockID(suite.Ctx)
-
-	lockID := suite.LockTokens(delAddr, coins, unbondingDuration)
-	lock, err := suite.App.LockupKeeper.GetLockByID(suite.Ctx, lockID)
-	suite.Require().NoError(err)
-
-	// here we check if check `LockTokens` added to existing locks or created a new lock.
-	// if `LockTokens` created a new lock, we continue SuperfluidDelegate
-	// if lock has been existing before, we wouldn't have to call SuperfluidDelegate separately, as hooks on LockTokens would have automatically called IncreaseSuperfluidDelegation
-	if lastLockID != lockID {
-		err = suite.App.SuperfluidKeeper.SuperfluidDelegate(suite.Ctx, lock.Owner, lock.ID, valAddr.String())
-		suite.Require().NoError(err)
-	} else {
-		// here we handle two cases.
-		// 1. the lock has existed before but has not been superflud staking
-		// 2. the lock has existed before and has been superfluid staking
-
-		// we check if synth lock that has existed before, if it did, it means that the lock has been superfluid staked
-		// we do not care about unbonding synthlocks, as superfluid delegation has no effect
-
-		_, err := suite.App.LockupKeeper.GetSyntheticLockup(suite.Ctx, lockID, keeper.StakingSyntheticDenom(lock.Coins[0].Denom, valAddr.String()))
-		// if lock has existed before but has not been superfluid staked, we do initial superfluid staking
-		if err != nil {
-			err = suite.App.SuperfluidKeeper.SuperfluidDelegate(suite.Ctx, lock.Owner, lock.ID, valAddr.String())
-			suite.Require().NoError(err)
-		}
-	}
-
-	return *lock
-}
 
 func (suite *KeeperTestSuite) TestSuperfluidDelegate() {
 	testCases := []struct {
 		name               string
 		validatorStats     []stakingtypes.BondStatus
-		delegatorNumber    int
 		superDelegations   []superfluidDelegation
 		expInterDelegation []sdk.Dec
 	}{
 		{
 			"with single validator and single superfluid delegation",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}},
 			[]sdk.Dec{sdk.NewDec(10000000)}, // 50% x 20 x 1000000
 		},
 		{
 			"with single validator and additional superfluid delegations",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 0, 1000000}},
 			[]sdk.Dec{sdk.NewDec(20000000)}, // 50% x 20 x 1000000 x 2
 		},
 		{
 			"with multiple validators and multiple superfluid delegations",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			2,
 			[]superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}},
 			[]sdk.Dec{sdk.NewDec(10000000), sdk.NewDec(10000000)}, // 50% x 20 x 1000000
 		},
@@ -166,9 +53,6 @@ func (suite *KeeperTestSuite) TestSuperfluidDelegate() {
 			suite.SetupTest()
 			bondDenom := suite.App.StakingKeeper.BondDenom(suite.Ctx)
 
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
 
@@ -179,8 +63,7 @@ func (suite *KeeperTestSuite) TestSuperfluidDelegate() {
 			presupplyWithOffset := suite.App.BankKeeper.GetSupplyWithOffset(suite.Ctx, bondDenom)
 
 			// setup superfluid delegations
-			_, _, _ = delAddrs, valAddrs, denoms
-			intermediaryAccs, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, intermediaryAccs, locks := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 
 			// ensure post-superfluid delegations osmo supplywithoffset is the same while supply is not
 			postsupply := suite.App.BankKeeper.GetSupply(suite.Ctx, bondDenom)
@@ -257,9 +140,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 	testCases := []struct {
 		name                  string
 		validatorStats        []stakingtypes.BondStatus
-		delegatorNumber       int
 		superDelegations      []superfluidDelegation
-		addMoreTokensLockIds  []uint64
 		superUnbondingLockIds []uint64
 		expSuperUnbondingErr  []bool
 		// expected amount of delegation to intermediary account
@@ -268,9 +149,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 		{
 			"with single validator and single superfluid delegation and single undelegation",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]uint64{},
 			[]uint64{1},
 			[]bool{false},
 			[]sdk.Dec{sdk.ZeroDec()},
@@ -287,9 +166,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 		{
 			"with single validator and additional superfluid delegations and single undelegation",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 0, 1000000}},
-			[]uint64{},
 			[]uint64{1},
 			[]bool{false},
 			[]sdk.Dec{sdk.ZeroDec()},
@@ -297,9 +174,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 		{
 			"with multiple validators and multiple superfluid delegations and multiple undelegations",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			2,
 			[]superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}},
-			[]uint64{},
 			[]uint64{1, 2},
 			[]bool{false, false},
 			[]sdk.Dec{sdk.ZeroDec()},
@@ -307,9 +182,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 		{
 			"undelegating not available lock id",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]uint64{},
 			[]uint64{2},
 			[]bool{true},
 			[]sdk.Dec{},
@@ -317,9 +190,7 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 		{
 			"try undelegating twice for same lock id",
 			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
 			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]uint64{},
 			[]uint64{1, 1},
 			[]bool{false, true},
 			[]sdk.Dec{sdk.ZeroDec()},
@@ -333,30 +204,15 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 
 			bondDenom := suite.App.StakingKeeper.GetParams(suite.Ctx).BondDenom
 
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
 			// setup validators
 			valAddrs := suite.SetupValidators(tc.validatorStats)
 
 			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 			// setup superfluid delegations
-			intermediaryAccs, _ := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
+			_, intermediaryAccs, _ := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
 			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
 
-			for _, lockId := range tc.addMoreTokensLockIds {
-				lock, err := suite.App.LockupKeeper.GetLockByID(suite.Ctx, lockId)
-				suite.Require().NoError(err)
-				lockOwner, err := sdk.AccAddressFromBech32(lock.Owner)
-				suite.Require().NoError(err)
-				coin := sdk.NewInt64Coin("gamm/pool/1", 1000000)
-				suite.App.BankKeeper.MintCoins(suite.Ctx, minttypes.ModuleName, sdk.NewCoins(coin))
-				suite.App.BankKeeper.SendCoinsFromModuleToAccount(suite.Ctx, minttypes.ModuleName, lockOwner, sdk.NewCoins(coin))
-				_, err = suite.App.LockupKeeper.AddTokensToLockByID(suite.Ctx, lockId, lockOwner, coin)
-				suite.Require().NoError(err)
-			}
-
 			for index, lockId := range tc.superUnbondingLockIds {
 				// get intermediary account
 				accAddr := suite.App.SuperfluidKeeper.GetLockIdIntermediaryAccountConnection(suite.Ctx, lockId)
@@ -445,16 +301,13 @@ func (suite *KeeperTestSuite) TestSuperfluidUndelegate() {
 func (suite *KeeperTestSuite) TestSuperfluidUnbondLock() {
 	suite.SetupTest()
 
-	// Generate delegator addresses
-	delAddrs := CreateRandomAccounts(1)
-
 	// setup validators
 	valAddrs := suite.SetupValidators([]stakingtypes.BondStatus{stakingtypes.Bonded})
 
 	denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
 
 	// setup superfluid delegations
-	intermediaryAccs, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, []superfluidDelegation{{0, 0, 0, 1000000}}, denoms)
+	_, intermediaryAccs, locks := suite.setupSuperfluidDelegations(valAddrs, []superfluidDelegation{{0, 0, 0, 1000000}}, denoms)
 	suite.checkIntermediaryAccountDelegations(intermediaryAccs)
 
 	for _, lock := range locks {
@@ -527,6 +380,151 @@ func (suite *KeeperTestSuite) TestSuperfluidUnbondLock() {
 	}
 }
 
+func (suite *KeeperTestSuite) TestRefreshIntermediaryDelegationAmounts() {
+	testCases := []struct {
+		name             string
+		validatorStats   []stakingtypes.BondStatus
+		superDelegations []superfluidDelegation
+		// denom of the superfluid asset is the key, multiplier is the value
+		multipliersByDenom map[string]sdk.Dec
+	}{
+		{
+			"with single validator and single delegation",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(10)},
+		},
+		{
+			"with single validator and additional delegations",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 0, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(10)},
+		},
+		{
+			"with multiple validator and multiple superfluid delegations",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(10)},
+		},
+		{
+			"with single validator and multiple denom superfluid delegations",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 1, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(10), "gamm/pool/2": sdk.NewDec(10)},
+		},
+		{
+			"with multiple validators and multiple denom superfluid delegations",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 1, 1, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(10), "gamm/pool/2": sdk.NewDec(10)},
+		},
+		{
+			"zero price multiplier check",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDec(0)},
+		},
+		{
+			"dust price multiplier check",
+			[]stakingtypes.BondStatus{stakingtypes.Bonded},
+			[]superfluidDelegation{{0, 0, 0, 1000000}},
+			map[string]sdk.Dec{"gamm/pool/1": sdk.NewDecWithPrec(1, 10)}, // 10^-10
+		},
+	}
+
+	for _, tc := range testCases {
+		tc := tc
+		suite.Run(tc.name, func() {
+			suite.SetupTest()
+
+			// setup validators
+			valAddrs := suite.SetupValidators(tc.validatorStats)
+
+			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
+
+			// setup superfluid delegations
+			_, intermediaryAccs, locks := suite.setupSuperfluidDelegations(valAddrs, tc.superDelegations, denoms)
+			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
+
+			// we make a map of intermediary account to delegation shares to store delegation share
+			// before refreshing intermediary account delegations on epoch
+			interAccIndexToDenomShare := make(map[int]sdk.Dec)
+			for accIndex, intermediaryAcc := range intermediaryAccs {
+				valAddr, err := sdk.ValAddressFromBech32(intermediaryAcc.ValAddr)
+				suite.Require().NoError(err)
+				delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, intermediaryAcc.GetAccAddress(), valAddr)
+				suite.Require().True(found)
+
+				interAccIndexToDenomShare[accIndex] = delegation.Shares
+			}
+
+			for denom, multiplier := range tc.multipliersByDenom {
+				suite.App.SuperfluidKeeper.SetOsmoEquivalentMultiplier(suite.Ctx, 2, denom, multiplier)
+			}
+
+			suite.App.SuperfluidKeeper.RefreshIntermediaryDelegationAmounts(suite.Ctx)
+
+			originalMultiplier := sdk.NewDec(20)
+			for interAccIndex, intermediaryAcc := range intermediaryAccs {
+				multiplier := tc.multipliersByDenom[intermediaryAcc.Denom]
+				oldDelegation := interAccIndexToDenomShare[interAccIndex]
+				expDelegation := oldDelegation.Mul(multiplier).Quo(originalMultiplier)
+				lpTokenAmount := sdk.NewInt(1000000)
+				decAmt := multiplier.Mul(lpTokenAmount.ToDec())
+				asset := suite.App.SuperfluidKeeper.GetSuperfluidAsset(suite.Ctx, intermediaryAcc.Denom)
+				expAmount := suite.App.SuperfluidKeeper.GetRiskAdjustedOsmoValue(suite.Ctx, asset, decAmt.RoundInt())
+
+				// check delegation changes
+				valAddr, err := sdk.ValAddressFromBech32(intermediaryAcc.ValAddr)
+				suite.Require().NoError(err)
+				delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, intermediaryAcc.GetAccAddress(), valAddr)
+				if expAmount.IsPositive() {
+					suite.Require().True(found)
+					suite.Require().Equal(delegation.Shares, expDelegation)
+				} else {
+					suite.Require().False(found)
+				}
+			}
+
+			// unbond all lockups
+			for _, lock := range locks {
+				// superfluid undelegate
+				// handling the case same lockup is used for further delegation
+				cacheCtx, write := suite.Ctx.CacheContext()
+				err := suite.App.SuperfluidKeeper.SuperfluidUndelegate(cacheCtx, lock.Owner, lock.ID)
+				if err == nil {
+					write()
+				}
+			}
+			unbondingDuration := suite.App.StakingKeeper.GetParams(suite.Ctx).UnbondingTime
+
+			for _, intermediaryAcc := range intermediaryAccs {
+				suite.Ctx = suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(unbondingDuration + time.Second))
+				suite.App.EndBlocker(suite.Ctx, abci.RequestEndBlock{Height: suite.Ctx.BlockHeight()})
+
+				unbonded := suite.App.BankKeeper.GetBalance(suite.Ctx, intermediaryAcc.GetAccAddress(), sdk.DefaultBondDenom)
+				suite.Require().True(unbonded.IsZero())
+			}
+
+			// refresh intermediary account delegations
+			suite.App.SuperfluidKeeper.RefreshIntermediaryDelegationAmounts(suite.Ctx)
+
+			for _, intermediaryAcc := range intermediaryAccs {
+				// check unbonded amount is removed after refresh operation
+				refreshed := suite.App.BankKeeper.GetBalance(suite.Ctx, intermediaryAcc.GetAccAddress(), sdk.DefaultBondDenom)
+				suite.Require().True(refreshed.IsZero())
+			}
+
+		})
+	}
+}
+
+// type superfluidRedelegation struct {
+// 	lockId      uint64
+// 	oldValIndex int64
+// 	newValIndex int64
+// }
+
 // func (suite *KeeperTestSuite) TestSuperfluidRedelegate() {
 // 	testCases := []struct {
 // 		name                    string
@@ -676,367 +674,3 @@ func (suite *KeeperTestSuite) TestSuperfluidUnbondLock() {
 // 		})
 // 	}
 // }
-
-func (suite *KeeperTestSuite) TestRefreshIntermediaryDelegationAmounts() {
-	testCases := []struct {
-		name                string
-		validatorStats      []stakingtypes.BondStatus
-		delegatorNumber     int
-		superDelegations    []superfluidDelegation
-		roundOneMultipliers []osmoEquivalentMultiplier
-		roundTwoMultipliers []osmoEquivalentMultiplier
-		checkAccIndexes     []int64
-	}{
-		{
-			"with single validator and single delegation",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
-			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0},
-		},
-		{
-			"with single validator and additional delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			1,
-			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0},
-		},
-		{
-			"with multiple validator and multiple superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}, {1, 1, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0, 1},
-		},
-		{
-			"with single validator and multiple denom superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 0, 1, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}, {1, sdk.NewDec(10)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0, 1},
-		},
-		{
-			"with multiple validators and multiple denom superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}, {0, 1, 1, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}, {1, sdk.NewDec(10)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0, 1},
-		},
-		{
-			"zero price multiplier check",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(0)}},
-			[]osmoEquivalentMultiplier{},
-			[]int64{0},
-		},
-		{
-			"refresh case from zero to non-zero",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(0)}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}},
-			[]int64{0},
-		},
-		{
-			"dust price multiplier check",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDecWithPrec(1, 10)}}, // 10^-10
-			[]osmoEquivalentMultiplier{},
-			[]int64{0},
-		},
-		{
-			"refresh case from dust to non-dust",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			2,
-			[]superfluidDelegation{{0, 0, 0, 1000000}},
-			[]osmoEquivalentMultiplier{{0, sdk.NewDecWithPrec(1, 10)}}, // 10^-10
-			[]osmoEquivalentMultiplier{{0, sdk.NewDec(10)}},
-			[]int64{0},
-		},
-	}
-
-	for _, tc := range testCases {
-		tc := tc
-		suite.Run(tc.name, func() {
-			suite.SetupTest()
-
-			bondDenom := suite.App.StakingKeeper.BondDenom(suite.Ctx)
-
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(tc.delegatorNumber)
-
-			// setup validators
-			valAddrs := suite.SetupValidators(tc.validatorStats)
-
-			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
-
-			// setup superfluid delegations
-			intermediaryAccs, locks := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, tc.superDelegations, denoms)
-			suite.checkIntermediaryAccountDelegations(intermediaryAccs)
-			intermediaryDels := []sdk.Dec{}
-
-			for _, intAccIndex := range tc.checkAccIndexes {
-				expAcc := intermediaryAccs[intAccIndex]
-				valAddr, err := sdk.ValAddressFromBech32(expAcc.ValAddr)
-				suite.Require().NoError(err)
-
-				// check delegation from intermediary account to validator
-				delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, expAcc.GetAccAddress(), valAddr)
-				suite.Require().True(found)
-				intermediaryDels = append(intermediaryDels, delegation.Shares)
-			}
-
-			// multiplier change before refresh
-			multiplierByDenom := make(map[string]sdk.Dec)
-			for _, multiplier := range tc.roundOneMultipliers {
-				denom := denoms[multiplier.lpIndex]
-				multiplierByDenom[denom] = multiplier.price
-				suite.App.SuperfluidKeeper.SetOsmoEquivalentMultiplier(suite.Ctx, 2, denom, multiplier.price)
-			}
-
-			// get pre-superfluid delgations osmo supply and supplyWithOffset
-			presupply := suite.App.BankKeeper.GetSupply(suite.Ctx, bondDenom)
-			presupplyWithOffset := suite.App.BankKeeper.GetSupplyWithOffset(suite.Ctx, bondDenom)
-
-			// refresh intermediary account delegations
-			suite.App.SuperfluidKeeper.RefreshIntermediaryDelegationAmounts(suite.Ctx)
-
-			// ensure post-superfluid delegations osmo supplywithoffset is the same while supply is not
-			postsupply := suite.App.BankKeeper.GetSupply(suite.Ctx, bondDenom)
-			postsupplyWithOffset := suite.App.BankKeeper.GetSupplyWithOffset(suite.Ctx, bondDenom)
-			suite.Require().False(postsupply.IsEqual(presupply), "presupply: %s   postsupply: %s", presupply, postsupply)
-			suite.Require().True(postsupplyWithOffset.IsEqual(presupplyWithOffset))
-
-			originMultiplier := sdk.NewDec(20)
-			for index, intAccIndex := range tc.checkAccIndexes {
-				expAcc := intermediaryAccs[intAccIndex]
-				multiplier, ok := multiplierByDenom[expAcc.Denom]
-				if !ok {
-					multiplier = originMultiplier
-				}
-
-				// calculating the estimated delegation amount for multiplier change
-				expDelegation := intermediaryDels[index].Mul(multiplier).Quo(originMultiplier)
-				lpTokenAmount := sdk.NewInt(1000000)
-				decAmt := multiplier.Mul(lpTokenAmount.ToDec())
-				asset := suite.App.SuperfluidKeeper.GetSuperfluidAsset(suite.Ctx, expAcc.Denom)
-				expAmount := suite.App.SuperfluidKeeper.GetRiskAdjustedOsmoValue(suite.Ctx, asset, decAmt.RoundInt())
-
-				valAddr, err := sdk.ValAddressFromBech32(expAcc.ValAddr)
-				suite.Require().NoError(err)
-
-				// check delegation changes
-				delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, expAcc.GetAccAddress(), valAddr)
-				if expAmount.IsPositive() {
-					suite.Require().True(found)
-					suite.Require().Equal(delegation.Shares, expDelegation)
-				} else {
-					suite.Require().False(found)
-				}
-			}
-
-			// if second round multipliers exists, execute round two multipliers mock and finish tests
-			if len(tc.roundTwoMultipliers) > 0 {
-				multiplier2ByDenom := make(map[string]sdk.Dec)
-				for _, multiplier := range tc.roundTwoMultipliers {
-					denom := denoms[multiplier.lpIndex]
-					multiplier2ByDenom[denom] = multiplier.price
-					suite.App.SuperfluidKeeper.SetOsmoEquivalentMultiplier(suite.Ctx, 3, denom, multiplier.price)
-				}
-				// refresh intermediary account delegations
-				suite.App.SuperfluidKeeper.RefreshIntermediaryDelegationAmounts(suite.Ctx)
-
-				for index, intAccIndex := range tc.checkAccIndexes {
-					expAcc := intermediaryAccs[intAccIndex]
-					valAddr, err := sdk.ValAddressFromBech32(expAcc.ValAddr)
-					suite.Require().NoError(err)
-
-					expDelegation := intermediaryDels[index].Mul(multiplier2ByDenom[expAcc.Denom]).Quo(originMultiplier)
-
-					// check delegation changes
-					delegation, found := suite.App.StakingKeeper.GetDelegation(suite.Ctx, expAcc.GetAccAddress(), valAddr)
-
-					suite.Require().True(found)
-					suite.Require().Equal(delegation.Shares, expDelegation)
-				}
-				return
-			}
-
-			// unbond all lockups
-			for _, lock := range locks {
-				// superfluid undelegate
-				// handling the case same lockup is used for further delegation
-				cacheCtx, write := suite.Ctx.CacheContext()
-				err := suite.App.SuperfluidKeeper.SuperfluidUndelegate(cacheCtx, lock.Owner, lock.ID)
-				if err == nil {
-					write()
-				}
-			}
-			unbondingDuration := suite.App.StakingKeeper.GetParams(suite.Ctx).UnbondingTime
-
-			// check intermediary account changes after unbonding operations
-			for _, intAccIndex := range tc.checkAccIndexes {
-				expAcc := intermediaryAccs[intAccIndex]
-				suite.Ctx = suite.Ctx.WithBlockTime(suite.Ctx.BlockTime().Add(unbondingDuration + time.Second))
-				suite.App.EndBlocker(suite.Ctx, abci.RequestEndBlock{Height: suite.Ctx.BlockHeight()})
-
-				unbonded := suite.App.BankKeeper.GetBalance(suite.Ctx, expAcc.GetAccAddress(), sdk.DefaultBondDenom)
-				suite.Require().True(unbonded.IsZero())
-			}
-
-			// refresh intermediary account delegations
-			suite.App.SuperfluidKeeper.RefreshIntermediaryDelegationAmounts(suite.Ctx)
-
-			// check if intermediary accounts does not have free balance after refresh operation
-			for _, intAccIndex := range tc.checkAccIndexes {
-				expAcc := intermediaryAccs[intAccIndex]
-				// check unbonded amount is removed after refresh operation
-				refreshed := suite.App.BankKeeper.GetBalance(suite.Ctx, expAcc.GetAccAddress(), sdk.DefaultBondDenom)
-				suite.Require().True(refreshed.IsZero())
-			}
-		})
-	}
-}
-
-func (suite *KeeperTestSuite) TestSuperfluidDelegationGovernanceVoting() {
-	testCases := []struct {
-		name              string
-		validatorStats    []stakingtypes.BondStatus
-		superDelegations  [][]superfluidDelegation
-		normalDelegations []normalDelegation
-	}{
-		{
-			"with single validator and single delegation",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			[][]superfluidDelegation{{{0, 0, 0, 1000000}}},
-			nil,
-		},
-		{
-			"with single validator and additional delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			[][]superfluidDelegation{{{0, 0, 0, 1000000}, {0, 0, 0, 1000000}}},
-			nil,
-		},
-		{
-			"with multiple validator and multiple superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			[][]superfluidDelegation{{{0, 0, 0, 1000000}}, {{1, 1, 0, 1000000}}},
-			nil,
-		},
-		{
-			"with single validator and multiple denom superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			[][]superfluidDelegation{{{0, 0, 0, 1000000}, {0, 0, 1, 1000000}}},
-			nil,
-		},
-		{
-			"with multiple validators and multiple denom superfluid delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			[][]superfluidDelegation{{{0, 0, 0, 1000000}, {0, 1, 1, 1000000}}},
-			nil,
-		},
-		{
-			"many delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded, stakingtypes.Bonded},
-			[][]superfluidDelegation{
-				{{0, 0, 0, 1000000}, {0, 1, 1, 1000000}},
-				{{1, 0, 0, 1000000}, {1, 0, 1, 1000000}},
-				{{2, 1, 1, 1000000}, {2, 1, 0, 1000000}},
-				{{3, 0, 0, 1000000}, {3, 1, 1, 1000000}},
-			},
-			nil,
-		},
-		{
-			"with normal delegations",
-			[]stakingtypes.BondStatus{stakingtypes.Bonded},
-			[][]superfluidDelegation{
-				{{0, 0, 0, 1000000}, {0, 0, 1, 1000000}},
-			},
-			[]normalDelegation{
-				{0, 0, 1000000},
-			},
-		},
-	}
-
-	for _, tc := range testCases {
-		tc := tc
-
-		suite.Run(tc.name, func() {
-			suite.SetupTest()
-
-			denoms, _ := suite.SetupGammPoolsAndSuperfluidAssets([]sdk.Dec{sdk.NewDec(20), sdk.NewDec(20)})
-
-			// Generate delegator addresses
-			delAddrs := CreateRandomAccounts(len(tc.superDelegations))
-
-			// setup validators
-			valAddrs := suite.SetupValidators(tc.validatorStats)
-
-			// setup superfluid delegations
-			for _, sfdel := range tc.superDelegations {
-				intermediaryAccs, _ := suite.SetupSuperfluidDelegations(delAddrs, valAddrs, sfdel, denoms)
-				suite.checkIntermediaryAccountDelegations(intermediaryAccs)
-			}
-
-			// setup normal delegations
-			for _, del := range tc.normalDelegations {
-				err := suite.SetupNormalDelegation(delAddrs, valAddrs, del)
-				suite.NoError(err)
-			}
-
-			// all expected delegated amounts to a validator from a delegator
-			delegatedAmount := func(delidx, validx int) sdk.Int {
-				res := sdk.ZeroInt()
-				for _, del := range tc.superDelegations[delidx] {
-					if del.valIndex == int64(validx) {
-						res = res.AddRaw(del.lpAmount)
-					}
-				}
-				if len(tc.normalDelegations) != 0 {
-					del := tc.normalDelegations[delidx]
-					res = res.AddRaw(del.coinAmount / 10) // LP price is 10 osmo in this test
-				}
-				return res
-			}
-			for delidx := range tc.superDelegations {
-				// store all actual delegations to a validator
-				sharePerValidatorMap := make(map[string]sdk.Dec)
-				for validx := range tc.validatorStats {
-					sharePerValidatorMap[valAddrs[validx].String()] = sdk.ZeroDec()
-				}
-				addToSharePerValidatorMap := func(val sdk.ValAddress, share sdk.Dec) {
-					if existing, ok := sharePerValidatorMap[val.String()]; ok {
-						share.AddMut(existing)
-					}
-					sharePerValidatorMap[val.String()] = share
-				}
-
-				// iterate delegations and add eligible shares to the sharePerValidatorMap
-				suite.App.SuperfluidKeeper.IterateDelegations(suite.Ctx, delAddrs[delidx], func(_ int64, del stakingtypes.DelegationI) bool {
-					addToSharePerValidatorMap(del.GetValidatorAddr(), del.GetShares())
-					return false
-				})
-
-				// check if the expected delegated amount equals to actual
-				for validx := range tc.validatorStats {
-					suite.Equal(delegatedAmount(delidx, validx).Int64()*10, sharePerValidatorMap[valAddrs[validx].String()].RoundInt().Int64())
-				}
-			}
-		})
-	}
-}