Skip to content

Commit

Permalink
make test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Apr 12, 2023
1 parent f2082c8 commit c0ba54b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 0 additions & 3 deletions x/gov/keeper/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (k Keeper) RegisterCrossChainSyncParamsApp() error {
}

func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) error {
// this validates content and size of changes is not empty
if err := cpc.ValidateBasic(); err != nil {
return err
}
Expand Down Expand Up @@ -67,8 +66,6 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er
return err
}

// Need these in order to register paramsKeeper to be a CrosschainApp so that it can register channel(3)

func (k Keeper) ExecuteSynPackage(ctx sdk.Context, appCtx *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult {
k.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload))
return sdk.ExecuteResult{}
Expand Down
3 changes: 2 additions & 1 deletion x/gov/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) SetupSuite() {
}

func (suite *KeeperTestSuite) reset() {
govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, _, encCfg, ctx := setupGovKeeper(suite.T())
govKeeper, acctKeeper, bankKeeper, stakingKeeper, distKeeper, crossChainKeeper, encCfg, ctx := setupGovKeeper(suite.T())

// Populate the gov account with some coins, as the TestProposal we have
// is a MsgSend from the gov account.
Expand All @@ -64,6 +64,7 @@ func (suite *KeeperTestSuite) reset() {
suite.bankKeeper = bankKeeper
suite.stakingKeeper = stakingKeeper
suite.distKeeper = distKeeper
suite.crossChainKeeper = crossChainKeeper
suite.cdc = encCfg.Codec
suite.queryClient = queryClient
suite.legacyQueryClient = legacyQueryClient
Expand Down
16 changes: 14 additions & 2 deletions x/gov/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,24 @@ func (suite *KeeperTestSuite) TestUpdateCrossChainParams() {
Authority: suite.govKeeper.GetAuthority(),
Params: v1.CrossChainParamsChange{
Key: "upgrade",
Values: []string{"not_an_address", "not_an_address"},
Targets: []string{"not_an_address"},
Values: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9", "0xeAE67217D95E786a9309A363437066428b97c046"},
Targets: []string{"0xeAE67217D95E786a9309A363437066428b97c046"},
},
},
expectErr: true,
},
{
name: "single parameter change should work",
request: &v1.MsgUpdateCrossChainParams{
Authority: suite.govKeeper.GetAuthority(),
Params: v1.CrossChainParamsChange{
Key: "param_1",
Values: []string{"new_param_1"},
Targets: []string{"0x76d244CE05c3De4BbC6fDd7F56379B145709ade9"},
},
},
expectErr: false,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit c0ba54b

Please sign in to comment.