Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Apr 9, 2024
1 parent 6bdddfd commit 7331fea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion e2e/helpers/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ func ValidatorVote(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain,
propID, err := strconv.ParseUint(proposalID, 10, 64)
require.NoError(t, err, "failed to parse proposalID")

resp, _ := cosmos.PollForProposalStatusV1(ctx, chain, height, height+searchHeightDelta, propID, govv1.ProposalStatus_PROPOSAL_STATUS_PASSED)
resp, _ := cosmos.PollForProposalStatusV1(ctx, chain, height, (height-1)+searchHeightDelta, propID, govv1.ProposalStatus_PROPOSAL_STATUS_PASSED)
t.Log("PollForProposalStatusV8 resp", resp)
require.NotNil(t, resp, "proposal not found", propID)

require.EqualValues(t, govv1.ProposalStatus_PROPOSAL_STATUS_PASSED, resp.Status, "proposal status did not change to passed in expected number of blocks")
}

Expand Down
6 changes: 2 additions & 4 deletions e2e/helpers/poa.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ func POACreatePendingValidator(
return ExecuteTransaction(ctx, chain, cmd)
}

func SubmitGovernanceProposalForValidatorChanges(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, validator string, power uint64, unsafe bool) string {
govAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn"

func SubmitGovernanceProposalForValidatorChanges(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, validator string, power uint64, unsafe bool, authority string) string {
powerMsg := []cosmos.ProtoMessage{
&poa.MsgSetPower{
Sender: govAddr,
Sender: authority,
ValidatorAddress: validator,
Power: power,
Unsafe: unsafe,
Expand Down
7 changes: 5 additions & 2 deletions e2e/poa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func TestPOABase(t *testing.T) {

// === Test Cases ===
testStakingDisabled(t, ctx, chain, validators, acc0, acc1)
testGovernance(t, ctx, chain, acc0, validators)
testPowerErrors(t, ctx, chain, validators, incorrectUser, acc0)
testPending(t, ctx, chain, acc0)
testGovernance(t, ctx, chain, acc0, validators)
testUpdatePOAParams(t, ctx, chain, acc0, incorrectUser)
}

Expand Down Expand Up @@ -192,8 +192,11 @@ func testPending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, a

func testGovernance(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, acc0 ibc.Wallet, validators []string) {
t.Log("\n===== TEST GOVERNANCE =====")

authorityAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" // gov

// ibc.ChainConfig key: app_state.poa.params.admins must contain the governance address.
propID := helpers.SubmitGovernanceProposalForValidatorChanges(t, ctx, chain, acc0, validators[0], 1_234_567, true)
propID := helpers.SubmitGovernanceProposalForValidatorChanges(t, ctx, chain, acc0, validators[0], 1_234_567, true, authorityAddr)
helpers.ValidatorVote(t, ctx, chain, propID, cosmos.ProposalVoteYes, 25)

// validate the validator[0] was set to 1_234_567
Expand Down

0 comments on commit 7331fea

Please sign in to comment.