Skip to content

Commit

Permalink
core(deps): Upgrade PFM to IBC v8 and SDK v0.50.x (#152)
Browse files Browse the repository at this point in the history
* init commit

* updates

* fix

* lint++

* cosmos/relayer main branch

* upgrade linter version

* fix: e2e upgrade v7.0.1 -> v8.0.0 (local img)

* re-enable ENV `NON_REFUNDABLE_TEST=true`

* use `DefaultRelayer` for timeout test

* remove build/

---------

Co-authored-by: Reece Williams <[email protected]>
  • Loading branch information
alexanderbez and Reecepbcups authored Jan 5, 2024
1 parent 18248c3 commit 76989c8
Show file tree
Hide file tree
Showing 54 changed files with 1,706 additions and 1,182 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/packet-forward-middleware.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: packet-forward-middleware
on:
on:
pull_request:
paths:
- 'middleware/packet-forward-middleware/**'
- '.github/workflows/packet-forward-middleware.yml'

env:
LINT_VERSION: v1.52
LINT_VERSION: v1.55.2
GO_VERSION: 1.21.0
WORKING_DIRECTORY: middleware/packet-forward-middleware

DOCKER_TAG: pfm:local
TAR_PATH: /tmp/pfm-docker-image.tar
IMAGE_NAME: pfm-docker-image

jobs:
golangci:
name: Linter
runs-on: ubuntu-latest
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -51,14 +51,14 @@ jobs:
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ env.GO_VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v3

- name: Build and export
uses: docker/build-push-action@v5
with:
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.DOCKER_TAG }}
outputs: type=docker,dest=${{ env.TAR_PATH }}
Expand All @@ -68,15 +68,15 @@ jobs:
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.TAR_PATH }}

e2e-tests:
needs: build-docker
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
strategy:
matrix:
matrix:
test:
- "ictest-forward"
- "ictest-timeout"
Expand All @@ -88,8 +88,8 @@ jobs:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4

- name: Download Tarball Artifact
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@

target/

go.work.sum
go.work.sum
go.work

build/
8 changes: 8 additions & 0 deletions go.work.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
go 1.21

toolchain go1.21.0

use (
./middleware/packet-forward-middleware
./middleware/packet-forward-middleware/e2e
)
4 changes: 2 additions & 2 deletions middleware/packet-forward-middleware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ mocks: $(MOCKS_DIR)
mockgen -package=mock -destination=./test/mock/distribution_keeper.go $(GOMOD)/packetforward/types DistributionKeeper
mockgen -package=mock -destination=./test/mock/bank_keeper.go $(GOMOD)/packetforward/types BankKeeper
mockgen -package=mock -destination=./test/mock/channel_keeper.go $(GOMOD)/packetforward/types ChannelKeeper
mockgen -package=mock -destination=./test/mock/ics4_wrapper.go github.com/cosmos/ibc-go/v7/modules/core/05-port/types ICS4Wrapper
mockgen -package=mock -destination=./test/mock/ibc_module.go github.com/cosmos/ibc-go/v7/modules/core/05-port/types IBCModule
mockgen -package=mock -destination=./test/mock/ics4_wrapper.go github.com/cosmos/ibc-go/v8/modules/core/05-port/types ICS4Wrapper
mockgen -package=mock -destination=./test/mock/ibc_module.go github.com/cosmos/ibc-go/v8/modules/core/05-port/types IBCModule

.PHONY: mocks

Expand Down
8 changes: 4 additions & 4 deletions middleware/packet-forward-middleware/docs/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Integration of the PFM should take approximately 20 minutes.

// Import the packet forward middleware
import (
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
)

...
Expand Down Expand Up @@ -169,4 +169,4 @@ packet amount if the fee percentage is non-zero.
- Retries On Timeout - how many times will a forward be re-attempted in the case of a timeout.
- Timeout Period - how long can a forward be in progress before giving up.
- Refund Timeout - how long can a forward be in progress before issuing a refund back to the original source chain.
- Fee Percentage - % of the forwarded packet amount which will be subtracted and distributed to the community pool.
- Fee Percentage - % of the forwarded packet amount which will be subtracted and distributed to the community pool.
19 changes: 11 additions & 8 deletions middleware/packet-forward-middleware/e2e/forward_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"time"

"cosmossdk.io/math"
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
chantypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/strangelove-ventures/interchaintest/v7/testreporter"
"github.com/strangelove-ventures/interchaintest/v7/testutil"
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
chantypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
Expand Down Expand Up @@ -63,6 +64,8 @@ func TestTimeoutOnForward(t *testing.T) {
r := interchaintest.NewBuiltinRelayerFactory(
ibc.CosmosRly,
zaptest.NewLogger(t),
relayer.DockerImage(&DefaultRelayer),
relayer.StartupFlags("--processor", "events", "--block-history", "100"),
).Build(t, client, network)

const pathAB = "ab"
Expand Down Expand Up @@ -120,7 +123,7 @@ func TestTimeoutOnForward(t *testing.T) {

// Fund user accounts with initial balances and get the transfer channel information between each set of chains
initBal := math.NewInt(10_000_000_000)
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), initBal.Int64(), chainA, chainB, chainC, chainD)
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), initBal, chainA, chainB, chainC, chainD)

abChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainIdA, chainIdB)
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 76989c8

Please sign in to comment.