Skip to content

Commit

Permalink
expedited_voting_period
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvubk committed Oct 9, 2024
1 parent 8efc28c commit 96cbdc9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions tests/systemtests/genesis_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ func SetGovVotingPeriod(t *testing.T, period time.Duration) GenesisMutator {
}
}

func SetGovExpeditedVotingPeriod(t *testing.T, period time.Duration) GenesisMutator {
t.Helper()
return func(genesis []byte) []byte {
state, err := sjson.SetRawBytes(genesis, "app_state.gov.params.expedited_voting_period", []byte(fmt.Sprintf("%q", period.String())))
require.NoError(t, err)
return state
}
}

// GetGenesisBalance return the balance amount for an address from the given genesis json
func GetGenesisBalance(rawGenesis []byte, addr string) sdk.Coins {
var r []sdk.Coin
Expand Down
9 changes: 7 additions & 2 deletions tests/systemtests/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,13 @@ func TestQueryDeposit(t *testing.T) {

sut.ResetChain(t)
cli := NewCLIWrapper(t, sut, verbose)
// Set short period
sut.ModifyGenesisJSON(t, SetGovVotingPeriod(t, time.Second*8))
// short voting period
// update expedited voting period to avoid validation error
sut.ModifyGenesisJSON(
t,
SetGovVotingPeriod(t, time.Second*8),
SetGovExpeditedVotingPeriod(t, time.Second*7),
)

// get validator address
valAddr := gjson.Get(cli.Keys("keys", "list"), "0.address").String()
Expand Down
5 changes: 0 additions & 5 deletions tests/systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ func (s *SystemUnderTest) SetupChain() {
if err != nil {
panic(fmt.Sprintf("failed to set block max gas: %s", err))
}
// update expedited voting period to avoid validation error
genesisBz, err = sjson.SetRawBytes(genesisBz, "app_state.gov.params.expedited_voting_period", []byte(fmt.Sprintf(`"%s"`, "7s")))
if err != nil {
panic(fmt.Sprintf("failed to set expedited voting period: %s", err))
}
s.withEachNodeHome(func(i int, home string) {
if err := saveGenesis(home, genesisBz); err != nil {
panic(err)
Expand Down

0 comments on commit 96cbdc9

Please sign in to comment.