Skip to content

Commit

Permalink
Merge branch 'main' into damian/add-capability-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan authored Sep 12, 2023
2 parents e23473e + 731da1a commit 7a6a8c0
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
if: ${{ inputs.build-and-push-docker-image }}
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: '1.21'

- name: Release
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
Expand All @@ -47,7 +47,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

Expand Down
31 changes: 27 additions & 4 deletions e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,46 @@ set -eo pipefail
TEST="${1}"
ENTRY_POINT="${2:-}"

function _verify_jq() {
if ! command -v jq > /dev/null ; then
echo "jq is required to extract test entrypoint."
exit 1
fi
}

function _verify_fzf() {
if ! command -v fzf > /dev/null ; then
echo "fzf is required to interactively select a test."
exit 1
fi
}

function _verify_dependencies() {
if [ -z "${TEST}" ]; then
# fzf is only required if we are not explicitly specifying a test.
_verify_fzf
fi
# jq is always required to determine the entrypoint of the test.
_verify_jq
}

# _get_test returns the test that should be used in the e2e test. If an argument is provided, that argument
# is returned. Otherwise, fzf is used to interactively choose from all available tests.
function _get_test(){
# if an argument is provided, it is used directly. This enables the drop down selection with fzf.
if [ -n "$1" ]; then
echo "$1"
return
# if fzf and jq are installed, we can use them to provide an interactive mechanism to select from all available tests.
elif command -v fzf > /dev/null && command -v jq > /dev/null; then
else
cd ..
go run -mod=readonly cmd/build_test_matrix/main.go | jq -r '.include[] | .test' | fzf
cd - > /dev/null
else
echo "TEST was not provided and both fzf and jq are not present. Unable to determine which test should be used."
exit 1
fi
}

_verify_dependencies

# if test is set, that is used directly, otherwise the test can be interactively provided if fzf is installed.
TEST="$(_get_test ${TEST})"

Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() {

t.Run("pass client update proposal", func(t *testing.T) {
proposal := clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subjectClientID, substituteClientID)
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
})

t.Run("check status of each client", func(t *testing.T) {
Expand Down Expand Up @@ -286,7 +286,7 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
s.Require().NotNil(authority)

msg := clienttypes.NewMsgUpdateParams(authority.String(), clienttypes.NewParams(allowedClient))
s.ExecuteGovProposalV1(ctx, msg, chainA, chainAWallet, 1)
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet, 1)
} else {
value, err := tmjson.Marshal([]string{allowedClient})
s.Require().NoError(err)
Expand All @@ -295,7 +295,7 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
s.Require().NotNil(authority)

msg := connectiontypes.NewMsgUpdateParams(authority.String(), connectiontypes.NewParams(delay))
s.ExecuteGovProposalV1(ctx, msg, chainA, chainAWallet, 1)
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet, 1)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(ibcexported.ModuleName, string(connectiontypes.KeyMaxExpectedTimePerBlock), fmt.Sprintf(`"%d"`, delay)),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) {
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version)
s.ExecuteGovProposalV1(ctx, msgRegisterAccount, chainA, controllerAccount, 1)
s.ExecuteGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount, 1)
})

t.Run("start relayer", func(t *testing.T) {
Expand Down Expand Up @@ -102,7 +102,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
}

msgSendTx := controllertypes.NewMsgSendTx(govModuleAddress.String(), ibctesting.FirstConnectionID, uint64(time.Hour.Nanoseconds()), packetData)
s.ExecuteGovProposalV1(ctx, msgSendTx, chainA, controllerAccount, 2)
s.ExecuteGovV1Proposal(ctx, msgSendTx, chainA, controllerAccount, 2)
})

t.Run("verify tokens transferred", func(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/interchain_accounts/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ func (s *InterchainAccountsParamsTestSuite) TestControllerEnabledParam() {
Signer: authority.String(),
Params: controllertypes.NewParams(false),
}
s.ExecuteGovProposalV1(ctx, &msg, chainA, controllerAccount, 1)
s.ExecuteGovV1Proposal(ctx, &msg, chainA, controllerAccount, 1)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(controllertypes.StoreKey, string(controllertypes.KeyControllerEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainA, controllerAccount, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, controllerAccount, proposal)
}
})

Expand Down Expand Up @@ -131,14 +131,14 @@ func (s *InterchainAccountsParamsTestSuite) TestHostEnabledParam() {
Signer: authority.String(),
Params: hosttypes.NewParams(false, []string{hosttypes.AllowAllHostMsgs}),
}
s.ExecuteGovProposalV1(ctx, &msg, chainB, chainBUser, 1)
s.ExecuteGovV1Proposal(ctx, &msg, chainB, chainBUser, 1)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(hosttypes.StoreKey, string(hosttypes.KeyHostEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainB, chainBUser, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainB, chainBUser, proposal)
}
})

Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ func (s *TransferTestSuite) TestSendEnabledParam() {
t.Run("change send enabled parameter to disabled", func(t *testing.T) {
if isSelfManagingParams {
msg := transfertypes.NewMsgUpdateParams(govModuleAddress.String(), transfertypes.NewParams(false, true))
s.ExecuteGovProposalV1(ctx, msg, chainA, chainAWallet, 1)
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet, 1)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(transfertypes.StoreKey, string(transfertypes.KeySendEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down Expand Up @@ -366,14 +366,14 @@ func (s *TransferTestSuite) TestReceiveEnabledParam() {
t.Run("change receive enabled parameter to disabled ", func(t *testing.T) {
if isSelfManagingParams {
msg := transfertypes.NewMsgUpdateParams(govModuleAddress.String(), transfertypes.NewParams(false, false))
s.ExecuteGovProposalV1(ctx, msg, chainA, chainAWallet, 1)
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet, 1)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(transfertypes.StoreKey, string(transfertypes.KeyReceiveEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s *UpgradeTestSuite) UpgradeChain(ctx context.Context, chain *cosmos.Cosmo
}

upgradeProposal := upgradetypes.NewSoftwareUpgradeProposal(fmt.Sprintf("upgrade from %s to %s", currentVersion, upgradeVersion), "upgrade chain E2E test", plan)
s.ExecuteGovProposal(ctx, chain, wallet, upgradeProposal)
s.ExecuteGovV1Beta1Proposal(ctx, chain, wallet, upgradeProposal)

height, err := chain.Height(ctx)
s.Require().NoError(err, "error fetching height before upgrade")
Expand Down
4 changes: 2 additions & 2 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ func (s *E2ETestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Cha
return res.CounterpartyPayee, nil
}

// QueryProposal queries the governance proposal on the given chain with the given proposal ID.
func (s *E2ETestSuite) QueryProposal(ctx context.Context, chain ibc.Chain, proposalID uint64) (govtypesv1beta1.Proposal, error) {
// QueryProposalV1Beta1 queries the governance proposal on the given chain with the given proposal ID.
func (s *E2ETestSuite) QueryProposalV1Beta1(ctx context.Context, chain ibc.Chain, proposalID uint64) (govtypesv1beta1.Proposal, error) {
queryClient := s.GetChainGRCPClients(chain).GovQueryClient
res, err := queryClient.Proposal(ctx, &govtypesv1beta1.QueryProposalRequest{
ProposalId: proposalID,
Expand Down
14 changes: 7 additions & 7 deletions e2e/testsuite/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ If this is a compatibility test, ensure that the fields are being sanitized in t
return errorMsg
}

// ExecuteGovProposalV1 submits a governance proposal using the provided user and message and uses all validators
// ExecuteGovV1Proposal submits a v1 governance proposal using the provided user and message and uses all validators
// to vote yes on the proposal. It ensures the proposal successfully passes.
func (s *E2ETestSuite) ExecuteGovProposalV1(ctx context.Context, msg sdk.Msg, chain *cosmos.CosmosChain, user ibc.Wallet, proposalID uint64) {
func (s *E2ETestSuite) ExecuteGovV1Proposal(ctx context.Context, msg sdk.Msg, chain *cosmos.CosmosChain, user ibc.Wallet, proposalID uint64) {
sender, err := sdk.AccAddressFromBech32(user.FormattedAddress())
s.Require().NoError(err)

Expand Down Expand Up @@ -165,9 +165,9 @@ func (s *E2ETestSuite) ExecuteGovProposalV1(ctx context.Context, msg sdk.Msg, ch
s.Require().Equal(govtypesv1.StatusPassed, proposal.Status)
}

// ExecuteGovProposal submits the given governance proposal using the provided user and uses all validators to vote yes on the proposal.
// ExecuteGovV1Beta1Proposal submits the given v1beta1 governance proposal using the provided user and uses all validators to vote yes on the proposal.
// It ensures the proposal successfully passes.
func (s *E2ETestSuite) ExecuteGovProposal(ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, content govtypesv1beta1.Content) {
func (s *E2ETestSuite) ExecuteGovV1Beta1Proposal(ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, content govtypesv1beta1.Content) {
sender, err := sdk.AccAddressFromBech32(user.FormattedAddress())
s.Require().NoError(err)

Expand All @@ -180,21 +180,21 @@ func (s *E2ETestSuite) ExecuteGovProposal(ctx context.Context, chain *cosmos.Cos
// TODO: replace with parsed proposal ID from MsgSubmitProposalResponse
// https://github.com/cosmos/ibc-go/issues/2122

proposal, err := s.QueryProposal(ctx, chain, 1)
proposal, err := s.QueryProposalV1Beta1(ctx, chain, 1)
s.Require().NoError(err)
s.Require().Equal(govtypesv1beta1.StatusVotingPeriod, proposal.Status)

err = chain.VoteOnProposalAllValidators(ctx, "1", cosmos.ProposalVoteYes)
s.Require().NoError(err)

// ensure voting period has not passed before validators finished voting
proposal, err = s.QueryProposal(ctx, chain, 1)
proposal, err = s.QueryProposalV1Beta1(ctx, chain, 1)
s.Require().NoError(err)
s.Require().Equal(govtypesv1beta1.StatusVotingPeriod, proposal.Status)

time.Sleep(testvalues.VotingPeriod) // pass proposal

proposal, err = s.QueryProposal(ctx, chain, 1)
proposal, err = s.QueryProposalV1Beta1(ctx, chain, 1)
s.Require().NoError(err)
s.Require().Equal(govtypesv1beta1.StatusPassed, proposal.Status)
}
Expand Down

0 comments on commit 7a6a8c0

Please sign in to comment.