diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml new file mode 100644 index 00000000..860d0b08 --- /dev/null +++ b/.github/workflows/interchaintest.yml @@ -0,0 +1,94 @@ +name: Interchaintest + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, labeled] + +env: + GO_VERSION: "1.21.0" + GOPRIVATE: github.com/sedaprotocol/vrf-go + GITHUB_TOKEN: ${{ secrets.PAT }} + TAR_PATH: /tmp/seda-docker-image.tar + IMAGE_NAME: seda-docker-image + SEDA_EXPONENT: 6 + +permissions: + contents: read + repository-projects: read + packages: read + +concurrency: + group: ci-${{ github.ref }}-interchaintest + cancel-in-progress: true + +jobs: + build-docker-image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: interchaintest/go.sum + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and export + uses: docker/build-push-action@v5 + with: + context: ./dockerfiles + file: Dockerfile.e2e + tags: seda:local + outputs: type=docker,dest=${{ env.TAR_PATH }} + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.IMAGE_NAME }} + path: ${{ env.TAR_PATH }} + + interchaintest: + needs: build-docker-image + runs-on: ubuntu-latest + strategy: + matrix: + test: + - "ictest-sdk-commands" + - "ictest-sdk-boundaries" + - "ictest-chain-start" + - "ictest-conformance" + - "ictest-state-sync" + - "ictest-ibc-xfer" + - "ictest-packet-forward-middleware" + fail-fast: false + + steps: + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: interchaintest/go.sum + + - name: checkout chain + uses: actions/checkout@v4 + + - name: Download Tarball Artifact + uses: actions/download-artifact@v3 + with: + name: ${{ env.IMAGE_NAME }} + path: /tmp + + - name: Load Docker Image + run: | + docker image load -i ${{ env.TAR_PATH }} + docker image ls -a + + - name: Run Test + run: make ${{ matrix.test }} diff --git a/Makefile b/Makefile index f215d7aa..8ed901da 100644 --- a/Makefile +++ b/Makefile @@ -224,6 +224,33 @@ endif .PHONY: cover-html run-tests $(TEST_TARGETS) test test-race docker-build-e2e +############################################################################### +### interchaintest ### +############################################################################### + +ictest-sdk-commands: rm-testcache + cd interchaintest && go test -race -v -run TestCoreSDKCommands . + +ictest-sdk-boundaries: rm-testcache + cd interchaintest && go test -race -v -run TestSDKBoundaries . + +ictest-chain-start: rm-testcache + cd interchaintest && go test -race -v -run TestChainStart . + +ictest-conformance: rm-testcache + cd interchaintest && go test -race -v -run TestConformance . + +ictest-state-sync: rm-testcache + cd interchaintest && go test -race -v -run TestStateSync . + +ictest-ibc-xfer: rm-testcache + cd interchaintest && go test -race -v -run TestIBCTransfer . + +ictest-packet-forward-middleware: rm-testcache + cd interchaintest && go test -race -v -run TestPacketForwardMiddleware . + +rm-testcache: + go clean -testcache ############################################################################### ### Release ### diff --git a/app/params/config.go b/app/params/config.go index c393b7ae..7279210b 100644 --- a/app/params/config.go +++ b/app/params/config.go @@ -1,6 +1,9 @@ package params import ( + "os" + "strconv" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" @@ -10,10 +13,8 @@ import ( ) const ( - HumanCoinUnit = "seda" - BaseCoinUnit = "aseda" // atto (10^-18) - SedaExponent = 18 - + HumanCoinUnit = "seda" + BaseCoinUnit = "aseda" // atto (10^-18) DefaultBondDenom = BaseCoinUnit // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address. @@ -21,6 +22,7 @@ const ( ) var ( + SedaExponent int64 // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key. Bech32PrefixAccPub = Bech32PrefixAccAddr + "pub" // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address. @@ -33,7 +35,22 @@ var ( Bech32PrefixConsPub = Bech32PrefixAccAddr + "valconspub" ) +func getSedaExponent() int64 { + sedaExponent := os.Getenv("SEDA_EXPONENT") + if sedaExponent == "" { + return 18 // default value + } + + value, err := strconv.Atoi(sedaExponent) + if err != nil { + panic(err) + } + + return int64(value) +} + func init() { + SedaExponent = getSedaExponent() SetAddressPrefixes() RegisterDenoms() } diff --git a/interchaintest/ibc_transfer_test.go b/interchaintest/ibc_transfer_test.go index 3b94167e..9f2b0723 100644 --- a/interchaintest/ibc_transfer_test.go +++ b/interchaintest/ibc_transfer_test.go @@ -17,9 +17,9 @@ import ( transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) -// TestSedaGaiaIBCTransfer spins up a Seda and Gaia network, initializes an IBC connection between them, +// TestIBCTransfer spins up a Seda and Gaia network, initializes an IBC connection between them, // and sends an ICS20 token transfer from Seda->Gaia and then back from Gaia->Seda. -func TestSedaGaiaIBCTransfer(t *testing.T) { +func TestIBCTransfer(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") }