Skip to content

Commit

Permalink
Merge branch 'main' into ph/mbt-pss
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jan 29, 2024
2 parents f60d715 + eb59396 commit 69baecc
Show file tree
Hide file tree
Showing 52 changed files with 1,733 additions and 964 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/1570-slashack-bech32.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32.
([\#1570](https://github.com/cosmos/interchain-security/pull/1570))
2 changes: 2 additions & 0 deletions .changelog/unreleased/state-breaking/1570-slashack-bech32.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32.
([\#1570](https://github.com/cosmos/interchain-security/pull/1570))
103 changes: 0 additions & 103 deletions .github/workflows/manual-e2e.yml

This file was deleted.

55 changes: 52 additions & 3 deletions .github/workflows/nightly-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Run integration tests nightly on main

# !! Relevant changes to this file should be propagated manual-integration.yml

name: nightly-e2e-main
on:
workflow_dispatch:
schedule:
# run every day at 03:00 UTC
# ┌───────────── minute (0 - 59)
Expand Down Expand Up @@ -114,6 +112,54 @@ jobs:
go-version: "1.21" # The Go version to download (if necessary) and use.
- name: E2E multi-consumer tests
run: go run ./tests/e2e/... --tc multiconsumer
consumer-misbehaviour-test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/checkout@v4
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21" # The Go version to download (if necessary) and use.
- name: E2E consumer-misbehaviour tests
run: go run ./tests/e2e/... --tc consumer-misbehaviour
consumer-double-sign-test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/checkout@v4
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21" # The Go version to download (if necessary) and use.
- name: E2E consumer-double-sign tests
run: go run ./tests/e2e/... --tc consumer-double-sign
consumer-double-downtime-test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/checkout@v4
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21" # The Go version to download (if necessary) and use.
- name: E2E consumer-double-downtime tests
run: go run ./tests/e2e/... --tc consumer-double-downtime

nightly-test-fail:
needs:
Expand All @@ -123,6 +169,9 @@ jobs:
- democracy-test
- slash-throttle-test
- multiconsumer-test
- consumer-misbehaviour-test
- consumer-double-sign-test
- consumer-double-downtime-test
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
**/go.sum
**/Makefile
Makefile
- uses: actions/cache@v3.3.3
- uses: actions/cache@v4.0.0
with:
path: |
~/.cache/go-build
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile.combined
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# syntax=docker/dockerfile:1

# Dockerfile.combined defines a docker image using different provider/consumer versions
# originated from other docker images.
# This image is used to test different versions of provider and consumer together.
#
# Use docker's build argument --build-arg to specify the consumer/provider image to be used
# e.g. docker build --build-arg CONSUMER_IMAGE=v3.1.0 --build-arg PROVIDER_IMAGE=v3.1.0

ARG PROVIDER_IMAGE
ARG CONSUMER_IMAGE

# The image from where the consumer implementation will be used
# Defaults to
FROM --platform=linux/amd64 ${PROVIDER_IMAGE} AS provider


# The image from where the consumer implementation will be used
# Defaults to
FROM --platform=linux/amd64 ${CONSUMER_IMAGE} AS consumer

# Get Hermes build
FROM --platform=linux/amd64 otacrew/hermes-ics:evidence-cmd AS hermes-builder


# Get GoRelayer
FROM ghcr.io/informalsystems/relayer-no-gas-sim:v2.3.0-rc4-no-gas-sim AS gorelayer-builder


FROM --platform=linux/amd64 fedora:39
RUN dnf update -y
RUN dnf install -y which iproute iputils procps-ng vim-minimal tmux net-tools htop jq
USER root

COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/
COPY --from=gorelayer-builder /bin/rly /usr/local/bin/

# Copy consumer from specified image
COPY --from=consumer /usr/local/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
COPY --from=consumer /usr/local/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd
COPY --from=consumer /usr/local/bin/interchain-security-sd /usr/local/bin/interchain-security-sd
COPY --from=consumer /testnet-scripts /consumer/testnet-scripts


# Copy provider from specified image
COPY --from=provider /usr/local/bin/interchain-security-pd /usr/local/bin/interchain-security-pd
COPY --from=provider /testnet-scripts /provider/testnet-scripts

#Copy cometmock from provider image
COPY --from=provider /usr/local/bin/cometmock /usr/local/bin

# Copy in the hermes config
ADD ./tests/e2e/testnet-scripts/hermes-config.toml /root/.hermes/config.toml
28 changes: 24 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
#!/usr/bin/make -f

BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')

# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif

sharedFlags = -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)

providerFlags := $(sharedFlags) -X github.com/cosmos/cosmos-sdk/version.AppName=interchain-security-pd -X github.com/cosmos/cosmos-sdk/version.Name=interchain-security-pd
consumerFlags := $(sharedFlags) -X github.com/cosmos/cosmos-sdk/version.AppName=interchain-security-cd -X github.com/cosmos/cosmos-sdk/version.Name=interchain-security-cd
democracyFlags := $(sharedFlags) -X github.com/cosmos/cosmos-sdk/version.AppName=interchain-security-cdd -X github.com/cosmos/cosmos-sdk/version.Name=interchain-security-cdd
standaloneFlags := $(sharedFlags) -X github.com/cosmos/cosmos-sdk/version.AppName=interchain-security-sd -X github.com/cosmos/cosmos-sdk/version.Name=interchain-security-sd

install: go.sum
export GOFLAGS='-buildmode=pie'
export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2"
export CGO_LDFLAGS="-Wl,-z,relro,-z,now -fstack-protector"
go install $(BUILD_FLAGS) ./cmd/interchain-security-pd
go install $(BUILD_FLAGS) ./cmd/interchain-security-cd
go install $(BUILD_FLAGS) ./cmd/interchain-security-cdd
go install $(BUILD_FLAGS) ./cmd/interchain-security-sd
go install -ldflags "$(providerFlags)" ./cmd/interchain-security-pd
go install -ldflags "$(consumerFlags)" ./cmd/interchain-security-cd
go install -ldflags "$(democracyFlags)" ./cmd/interchain-security-cdd
go install -ldflags "$(standaloneFlags)" ./cmd/interchain-security-sd

# run all tests: unit, integration, diff, and E2E
test: test-unit test-integration test-mbt test-e2e
Expand Down
22 changes: 21 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,29 @@ Upgrading a provider from `v3.3.0` to `v4.0.0` will require state migrations, se

### Consumer

***Note that consumer chains can upgrade directly from `v3.1.0` to `v4.0.0`.***

Upgrading a consumer from `v3.2.0` to `v4.0.0` will not require state migration, however, upgrading directly from `v3.1.0` to `v4.0.0` will require state migrations, see https://github.com/cosmos/interchain-security/blob/release/v4.0.x/x/ccv/consumer/keeper/migrations.go#L22.

Note that consumer chains can upgrade directly from `v3.1.0` to `v4.0.0`.
In addition, the following migration needs to be added to the upgrade handler of the consumer chain:
```golang
func migrateICSOutstandingDowntime(ctx sdk.Context, keepers *upgrades.UpgradeKeepers) error {
ctx.Logger().Info("Migrating ICS outstanding downtime...")

downtimes := keepers.ConsumerKeeper.GetAllOutstandingDowntimes(ctx)
for _, od := range downtimes {
consAddr, err := sdk.ConsAddressFromBech32(od.ValidatorConsensusAddress)
if err != nil {
return err
}
keepers.ConsumerKeeper.DeleteOutstandingDowntime(ctx, consAddr)
}

ctx.Logger().Info("Finished ICS outstanding downtime")

return nil
}
```

## [v3.3.x](https://github.com/cosmos/interchain-security/tree/release/v3.2.x)

Expand Down
12 changes: 6 additions & 6 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import (
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"

appparams "github.com/cosmos/interchain-security/v4/app/params"
appencoding "github.com/cosmos/interchain-security/v4/app/encoding"
testutil "github.com/cosmos/interchain-security/v4/testutil/integration"
consumer "github.com/cosmos/interchain-security/v4/x/ccv/consumer"
consumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper"
Expand All @@ -116,7 +116,7 @@ import (
const (
AppName = "interchain-security-cd"
upgradeName = "sovereign-changeover" // arbitrary name, define your own appropriately named upgrade
AccountAddressPrefix = "cosmos"
AccountAddressPrefix = "consumer"
)

var (
Expand Down Expand Up @@ -1005,17 +1005,17 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
// should be used only in tests or when creating a new app instance (NewApp*()).
// App user shouldn't create new codecs - use the app.AppCodec instead.
// [DEPRECATED]
func MakeTestEncodingConfig() appparams.EncodingConfig {
encodingConfig := appparams.MakeTestEncodingConfig()
func MakeTestEncodingConfig() appencoding.EncodingConfig {
encodingConfig := appencoding.MakeTestEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
}

func makeEncodingConfig() appparams.EncodingConfig {
encodingConfig := appparams.MakeTestEncodingConfig()
func makeEncodingConfig() appencoding.EncodingConfig {
encodingConfig := appencoding.MakeTestEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
Expand Down
4 changes: 2 additions & 2 deletions app/consumer/ante/disabled_modules_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"

"github.com/cosmos/interchain-security/v4/app/consumer/ante"
"github.com/cosmos/interchain-security/v4/app/params"
appencoding "github.com/cosmos/interchain-security/v4/app/encoding"
)

func TestDisabledModulesDecorator(t *testing.T) {
txCfg := params.MakeTestEncodingConfig().TxConfig
txCfg := appencoding.MakeTestEncodingConfig().TxConfig
authzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&slashingtypes.MsgUnjail{}})
authzMsgExecEvidence := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&evidencetypes.MsgSubmitEvidence{}})
nestedAuthzMsgExecSlashing := authz.NewMsgExec(sdk.AccAddress{}, []sdk.Msg{&authzMsgExecSlashing})
Expand Down
4 changes: 2 additions & 2 deletions app/consumer/ante/msg_filter_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/cosmos/interchain-security/v4/app/consumer/ante"
"github.com/cosmos/interchain-security/v4/app/params"
appencoding "github.com/cosmos/interchain-security/v4/app/encoding"
)

type consumerKeeper struct {
Expand All @@ -28,7 +28,7 @@ func noOpAnteDecorator() sdk.AnteHandler {
}

func TestMsgFilterDecorator(t *testing.T) {
txCfg := params.MakeTestEncodingConfig().TxConfig
txCfg := appencoding.MakeTestEncodingConfig().TxConfig

testCases := []struct {
name string
Expand Down
Loading

0 comments on commit 69baecc

Please sign in to comment.