Skip to content

Commit

Permalink
test: fix e2e-tests (#2234)
Browse files Browse the repository at this point in the history
* fix event name + inccorect gov status

* bump Hermes to from 1.10.0 to 1.10.2 fixing a parsing error when relaying VSC packets

* remove rogue file

* fix  bash script to query block at height 1 instead of 0
  • Loading branch information
sainoe authored Sep 6, 2024
1 parent f93a9a5 commit 216f395
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN go mod tidy
RUN make install

# Get Hermes build
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder

Check warning on line 32 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

# Get CometMock
FROM ghcr.io/informalsystems/cometmock:v0.38.x as cometmock-builder

Check warning on line 35 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.combined
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM --platform=linux/amd64 ${PROVIDER_IMAGE} AS provider
FROM --platform=linux/amd64 ${CONSUMER_IMAGE} AS consumer

# Get Hermes build
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder


# Get GoRelayer
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.gaia
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ WORKDIR /interchain-security
RUN make install

# Get Hermes build
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.0 AS hermes-builder
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:1.10.2 AS hermes-builder

FROM --platform=linux/amd64 fedora:39
RUN dnf update -y
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,12 @@ func (tr Chain) CreateConsumer(providerChain, consumerChain ChainID, validator V

consumerId := ""
for _, event := range txResponse.Events {
if event.Type != "consumer_creation" {
if event.Type != "create_consumer" {
continue
}
attr, exists := event.GetAttribute("consumer_id")
if !exists {
log.Fatalf("no event with consumer_id found in tx content of create-consumer: %v", event)
log.Fatalf("no event with consumer_id found in tx content of create_consumer: %v", event)
}
consumerId = attr.Value
}
Expand Down
5 changes: 2 additions & 3 deletions tests/e2e/json_marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"encoding/json"
"reflect"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -34,7 +33,7 @@ func TestProposalUnmarshal(t *testing.T) {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
}

type ProposalAndType struct {
Expand Down Expand Up @@ -101,7 +100,7 @@ var testCases = []ChainStateTestCase{
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/steps.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package main

import (
"strconv"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)

type Step struct {
Expand Down Expand Up @@ -208,7 +205,7 @@ func stepsInactiveValsTopNReproduce() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -229,7 +226,7 @@ func stepsInactiveValsTopNReproduce() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/steps_active_set_changes.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package main

import (
"strconv"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)

// stepsActiveSetChanges starts a top N provider chain and causes a change in the active set
Expand Down Expand Up @@ -49,7 +46,7 @@ func stepsActiveSetChanges() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand All @@ -75,7 +72,7 @@ func stepsActiveSetChanges() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/steps_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ package main
// sanity checks across different ICS versions.

import (
"strconv"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

providertypes "github.com/cosmos/interchain-security/v6/x/ccv/provider/types"
)
Expand Down Expand Up @@ -61,7 +58,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex
Chain: ChainID(consumerName),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), // breaking change in SDK: gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD).String(),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), // breaking change in SDK: gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD).String(),
},
},
// not supported across major versions
Expand Down Expand Up @@ -130,7 +127,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex
Chain: ChainID(consumerName),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), // TODO: CHECK if this is bug on SDK SIDE!!!: should be as before gov.ProposalStatus(gov.ProposalStatus_PROPOSAL_STATUS_PASSED).String(),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
ValBalances: &map[ValidatorID]uint{
Expand Down
9 changes: 3 additions & 6 deletions tests/e2e/steps_consumer_misbehaviour.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package main

import (
"strconv"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)

// starts a provider chain and an Opt-In consumer chain with one validator
Expand Down Expand Up @@ -52,7 +49,7 @@ func stepsStartChainsForConsumerMisbehaviour(consumerName string) []Step {
Chain: ChainID(consumerName),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand Down Expand Up @@ -103,7 +100,7 @@ func stepsStartChainsForConsumerMisbehaviour(consumerName string) []Step {
Chain: ChainID(consumerName),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
ValBalances: &map[ValidatorID]uint{
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/steps_democracy.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"strconv"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
)

Expand Down Expand Up @@ -91,7 +89,7 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool
Proposals: &map[uint]Proposal{
1: IBCTransferParamsProposal{
Deposit: 10000001,
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
Title: "Enable IBC Send",
Params: IBCTransferParams{SendEnabled: true, ReceiveEnabled: true},
},
Expand All @@ -118,7 +116,7 @@ func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool
Proposals: &map[uint]Proposal{
1: IBCTransferParamsProposal{
Deposit: 10000001,
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
Title: "Enable IBC Send",
Params: IBCTransferParams{SendEnabled: true, ReceiveEnabled: true},
},
Expand Down
25 changes: 11 additions & 14 deletions tests/e2e/steps_inactive_vals.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package main

import (
"strconv"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)

// stepsInactiveValidatorsOnConsumer tests situations where validators that are *not* in the active set on the
Expand Down Expand Up @@ -373,7 +370,7 @@ func setupOptInChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -402,7 +399,7 @@ func setupOptInChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down Expand Up @@ -531,7 +528,7 @@ func stepsInactiveProviderValidatorsGovernance() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -555,7 +552,7 @@ func stepsInactiveProviderValidatorsGovernance() []Step {
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
// the proposal should have passed because carol voted for it.
// carol alone is enough to pass the quorum, because stake of the other validators is not counted
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down Expand Up @@ -618,7 +615,7 @@ func stepsInactiveProviderValidatorsGovernanceBasecase() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -642,7 +639,7 @@ func stepsInactiveProviderValidatorsGovernanceBasecase() []Step {
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
// the proposal should *not* have passed because only carol voted for it,
// and carol is not enough to pass the quorum
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_REJECTED.String(),
},
},
},
Expand Down Expand Up @@ -703,7 +700,7 @@ func stepsMinStake() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -727,7 +724,7 @@ func stepsMinStake() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down Expand Up @@ -821,7 +818,7 @@ func stepsInactiveValsWithTopN() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -842,7 +839,7 @@ func stepsInactiveValsWithTopN() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down
13 changes: 6 additions & 7 deletions tests/e2e/steps_partial_set_security.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"strconv"
"time"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
Expand Down Expand Up @@ -576,7 +575,7 @@ func stepsTopNChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand Down Expand Up @@ -609,7 +608,7 @@ func stepsTopNChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down Expand Up @@ -1258,7 +1257,7 @@ func stepsValidatorsPowerCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -1343,7 +1342,7 @@ func stepsValidatorsPowerCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down Expand Up @@ -2174,7 +2173,7 @@ func stepsModifyChain() []Step {
1: ConsumerAdditionProposal{
Deposit: 10000001,
Chain: ChainID("consu"),
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(),
},
},
},
Expand All @@ -2193,7 +2192,7 @@ func stepsModifyChain() []Step {
1: ConsumerAdditionProposal{
Deposit: 10000001,
Chain: ChainID("consu"),
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(),
},
},
},
Expand Down
Loading

0 comments on commit 216f395

Please sign in to comment.