Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
58e0268
chore: update minor dependencies
DeshErBojhaa Apr 7, 2025
863799f
feat: move packet_forward_middleware from ibc-app to ibc-go repo.
DeshErBojhaa Apr 9, 2025
2f0b0b0
fix: run go mod tidy
DeshErBojhaa Apr 9, 2025
048215d
Merge branch 'main' into tamjid/pfm-homecoming
DeshErBojhaa Apr 13, 2025
7b7a159
feat: Unit tests for Packet Forward Middleware (#8313)
DeshErBojhaa May 7, 2025
ae228c4
e2e: Port tests for packet forward middleware module (#8292)
DeshErBojhaa May 9, 2025
695ee1d
chore: bump sdk math to 1.5.3 (#8293)
gjermundgaraba Apr 13, 2025
fadf346
test(07-tendermint): remove unused expPass in TestSetAndGetParams (#8…
hungdinh82 Apr 13, 2025
e665141
test(08-wasm): replace expPass with expError in TestNewKeeper (#8280)
hungdinh82 Apr 13, 2025
554de1c
chore: bump go-ethereum to v1.15.8 (#8295)
gjermundgaraba Apr 13, 2025
76e2ef2
docs: add versioned docs for v10 (#8279)
gjermundgaraba Apr 14, 2025
ca1cbdb
rename total_escrow query path (#8287)
vladjdk Apr 14, 2025
4f48209
docs: set v10 as default (#8301)
gjermundgaraba Apr 14, 2025
209f0cd
feat: allow scaling of trusting period for client upgrades (#8185)
damiannolan Apr 14, 2025
187fdf3
chore: prep v10.2.x mergify (#8305)
gjermundgaraba Apr 15, 2025
e48f6df
chore: fix test TestSetGetTotalEscrowForDenom, use expected errors (#…
hungdinh82 Apr 15, 2025
580420c
chore: bump deps (#8304)
gjermundgaraba Apr 15, 2025
11f5a79
chore: remove datahash from ica account creation (#8307)
gjermundgaraba Apr 16, 2025
093b44f
feat: sdk v53 upgrade (#8254)
Apr 17, 2025
7234ec5
chore: bump cosmossdk.io/api from v0.9.0 to v0.9.2 (#8326)
gjermundgaraba Apr 29, 2025
6652880
chore(deps): bump github.com/ethereum/go-ethereum from 1.15.8 to 1.15…
dependabot[bot] Apr 29, 2025
6e9ba42
chore: update to official sdk v0.53 release (#8329)
Apr 30, 2025
17724ed
chore: add changelog for v10.2.0 (#8331)
gjermundgaraba Apr 30, 2025
4ead143
chore: fixed proto-lint errors (#8336)
srdtrk May 2, 2025
d9f49a2
chore: bumped go version used by wasm dockerfile (#8354)
srdtrk May 7, 2025
f883b96
chore: remove modules/core/specs (#8350)
gjermundgaraba May 7, 2025
64ca973
feat: Prefix-based routing in IBCv2 Router (#8303)
kulikthebird May 8, 2025
6c785a8
chore: remove e2e fork and draft restrictions (#8359)
gjermundgaraba May 9, 2025
3cfc3f6
bump wasmvm to v2.2.4, go-etheruem to v1.15.11, spf13/cast to v1.8.0 …
gjermundgaraba May 12, 2025
618a409
e2e: Create only required number of chains. (#8371)
DeshErBojhaa May 12, 2025
4bf9be1
chore: update minor dependencies
DeshErBojhaa Apr 7, 2025
7dda020
feat: move packet_forward_middleware from ibc-app to ibc-go repo.
DeshErBojhaa Apr 9, 2025
7317ae2
fix: run go mod tidy
DeshErBojhaa Apr 9, 2025
0b6af28
feat: Unit tests for Packet Forward Middleware (#8313)
DeshErBojhaa May 7, 2025
9b399c7
e2e: Port tests for packet forward middleware module (#8292)
DeshErBojhaa May 9, 2025
f5de71c
sync dep
DeshErBojhaa May 12, 2025
36fa262
fix: lint - Shutup Meg!
DeshErBojhaa May 12, 2025
6bbbd0b
feat: sdk v53 upgrade (#8254)
Apr 17, 2025
67abf32
chore: update to official sdk v0.53 release (#8329)
Apr 30, 2025
575f650
e2e: Create only required number of chains. (#8371)
DeshErBojhaa May 12, 2025
1f5a087
feat: move packet_forward_middleware from ibc-app to ibc-go repo.
DeshErBojhaa Apr 9, 2025
2749602
feat: Unit tests for Packet Forward Middleware (#8313)
DeshErBojhaa May 7, 2025
983a045
e2e: Port tests for packet forward middleware module (#8292)
DeshErBojhaa May 9, 2025
05fd50e
feat: sdk v53 upgrade (#8254)
Apr 17, 2025
eb227b6
chore: update to official sdk v0.53 release (#8329)
Apr 30, 2025
18b514b
e2e: Create only required number of chains. (#8371)
DeshErBojhaa May 12, 2025
c8b8ac2
Merge branch 'main' of github.com:cosmos/ibc-go into tamjid/pfm-homec…
DeshErBojhaa May 12, 2025
735636d
sync dep: WTF!!
DeshErBojhaa May 12, 2025
8819f59
fix lint: Shutup Meg!
DeshErBojhaa May 12, 2025
0aa1e9f
fix e2e
DeshErBojhaa May 12, 2025
2fcf66c
changelog
DeshErBojhaa May 12, 2025
bc5df6a
fix markdown lint
DeshErBojhaa May 12, 2025
b2433d0
Merge remote-tracking branch 'origin/main' into tamjid/pfm-homecoming
gjermundgaraba May 13, 2025
deab81c
Merge branch 'main' into tamjid/pfm-homecoming
gjermundgaraba May 13, 2025
0fe788e
address pr comment
DeshErBojhaa May 14, 2025
0adb957
add comment
DeshErBojhaa May 14, 2025
d4f5dbf
fix: removed unused key
DeshErBojhaa May 14, 2025
a1ac2e0
refactor: removed unused func from expected keepers
DeshErBojhaa May 14, 2025
38ca1d9
fix: Removed duplicated makefile
DeshErBojhaa May 14, 2025
665fed0
Removed unused tar files
DeshErBojhaa May 14, 2025
9dec322
refactor: remove unused param subspace
DeshErBojhaa May 14, 2025
b6ec134
refactor: simplify logic for getting inflight packets from KV store
DeshErBojhaa May 14, 2025
1143ceb
refactor: remove unclear function
DeshErBojhaa May 14, 2025
0018d29
refactor: remove dup interface
DeshErBojhaa May 14, 2025
b225209
chore: bump deps + lint (#8383)
gjermundgaraba May 14, 2025
affe099
fix dep
DeshErBojhaa May 14, 2025
596d4ee
fix dep
DeshErBojhaa May 14, 2025
4d63041
sync dep
DeshErBojhaa May 14, 2025
e8306cd
Merge branch 'main' of github.com:cosmos/ibc-go into tamjid/pfm-homec…
DeshErBojhaa May 14, 2025
94ed241
refactor: rename function param
DeshErBojhaa May 15, 2025
f6ab855
Merge branch 'main' of github.com:cosmos/ibc-go into tamjid/pfm-homec…
DeshErBojhaa May 15, 2025
d31125d
move CallbacksCompatibleModuleV2 to api
gjermundgaraba May 15, 2025
f24e6a9
rename CallbacksCompatibleModuleV2 to PacketUnmarshalarModuleV2
gjermundgaraba May 15, 2025
1947674
Merge branch 'main' into tamjid/pfm-homecoming
gjermundgaraba May 15, 2025
16134a6
add note on module name spelling mistake
gjermundgaraba May 15, 2025
f2a204a
remove commented out import in genesis.proto
gjermundgaraba May 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ on:
description: 'The tag to use for chain B'
required: true
type: string
chain-c-tag:
description: 'The tag to use for chain C'
required: true
type: string
default: main
chain-d-tag:
default: main
description: 'The tag to use for chain D'
required: true
type: string
# upgrade-plan-name is only required during upgrade tests, and is otherwise ignored.
upgrade-plan-name:
default: ''
Expand Down Expand Up @@ -78,6 +88,8 @@ jobs:
echo "Chain Image: ${{ inputs.chain-image }}"
echo "Chain A Tag: ${{ inputs.chain-a-tag }}"
echo "Chain B Tag: ${{ inputs.chain-b-tag }}"
echo "Chain C Tag: ${{ inputs.chain-c-tag }}"
echo "Chain D Tag: ${{ inputs.chain-d-tag }}"
echo "Upgrade Plan Name: ${{ inputs.upgrade-plan-name }}"
echo "Test Entry Point: ${{ inputs.test-entry-point }}"
echo "Test: ${{ inputs.test }}"
Expand Down Expand Up @@ -205,6 +217,8 @@ jobs:
CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}'
CHAIN_A_TAG: '${{ inputs.chain-a-tag }}'
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
CHAIN_C_TAG: '${{ inputs.chain-c-tag }}'
CHAIN_D_TAG: '${{ inputs.chain-d-tag }}'
E2E_CONFIG_PATH: '${{ inputs.e2e-config-path }}'
strategy:
fail-fast: false
Expand Down Expand Up @@ -243,6 +257,8 @@ jobs:
CHAIN_IMAGE: '${{ inputs.chain-image }}'
CHAIN_A_TAG: '${{ inputs.chain-a-tag }}'
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
CHAIN_C_TAG: '${{ inputs.chain-c-tag }}'
CHAIN_D_TAG: '${{ inputs.chain-d-tag }}'
E2E_CONFIG_PATH: '${{ inputs.e2e-config-path }}'
strategy:
fail-fast: false
Expand All @@ -256,6 +272,7 @@ jobs:
- entrypoint: TestTransferLocalhostTestSuite
- entrypoint: TestConnectionTestSuite
- entrypoint: TestInterchainAccountsGovTestSuite
- entrypoint: TestForwardTransferSuite
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ jobs:
CHAIN_IMAGE: '${{ env.DOCKER_IMAGE_NAME }}'
CHAIN_A_TAG: '${{ matrix.test-config.tag }}'
CHAIN_B_TAG: '${{ matrix.test-config.tag }}'
CHAIN_C_TAG: '${{ matrix.test-config.tag }}'
CHAIN_D_TAG: '${{ matrix.test-config.tag }}'
CHAIN_UPGRADE_PLAN: '${{ matrix.test-config.upgrade-plan }}'
E2E_CONFIG_PATH: 'ci-e2e-config.yaml'
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ jobs:
CHAIN_IMAGE: '${{ env.DOCKER_IMAGE_NAME }}'
CHAIN_A_TAG: '${{ needs.determine-image-tag.outputs.simd-tag }}'
CHAIN_B_TAG: '${{ needs.determine-image-tag.outputs.simd-tag }}'
CHAIN_C_TAG: '${{ needs.determine-image-tag.outputs.simd-tag }}'
CHAIN_D_TAG: '${{ needs.determine-image-tag.outputs.simd-tag }}'
E2E_CONFIG_PATH: 'ci-e2e-config.yaml'
run: |
cd e2e
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* [\#8285](https://github.com/cosmos/ibc-go/pull/8285) Packet forward middleware.

### Dependencies

* [\#8369](https://github.com/cosmos/ibc-go/pull/8369) Bump **github.com/CosmWasm/wasmvm** to **2.2.4**
Expand Down
172 changes: 172 additions & 0 deletions docs/docs/02-apps/03-packet-forward-middleware/integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# Integration

This document provides instructions on integrating and configuring the Packet Forward Middleware (PFM) within your
existing chain implementation. This document is *NOT* a guide on developing with the Cosmos SDK or ibc-go and makes
the assumption that you have some existing codebase for your chain with IBC already enabled.

The integration steps include the following:

1. Import the PFM, initialize the PFM Module & Keeper, initialize the store keys and module params, and initialize the Begin/End Block logic and InitGenesis order.
2. Configure the IBC application stack including the transfer module.
3. Configuration of additional options such as timeout period, number of retries on timeout, refund timeout period, and fee percentage.

Integration of the PFM should take approximately 20 minutes.

## Example integration of the Packet Forward Middleware

```go
// app.go

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

...

// Register the AppModule for the packet forward middleware module
ModuleBasics = module.NewBasicManager(
...
packetforward.AppModuleBasic{},
...
)

...

// Add packet forward middleware Keeper
type App struct {
...
PacketForwardKeeper *packetforwardkeeper.Keeper
...
}

...

// Create store keys
keys := sdk.NewKVStoreKeys(
...
packetforwardtypes.StoreKey,
...
)

...

// Initialize the packet forward middleware Keeper
// It's important to note that the PFM Keeper must be initialized before the Transfer Keeper
app.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
appCodec,
keys[packetforwardtypes.StoreKey],
nil, // will be zero-value here, reference is set later on with SetTransferKeeper.
app.IBCKeeper.ChannelKeeper,
appKeepers.DistrKeeper,
app.BankKeeper,
app.IBCKeeper.ChannelKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// Initialize the transfer module Keeper
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
app.GetSubspace(ibctransfertypes.ModuleName),
app.PacketForwardKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
app.BankKeeper,
scopedTransferKeeper,
)

app.PacketForwardKeeper.SetTransferKeeper(app.TransferKeeper)

// See the section below for configuring an application stack with the packet forward middleware

...

// Register packet forward middleware AppModule
app.moduleManager = module.NewManager(
...
packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
)

...

// Add packet forward middleware to begin blocker logic
app.moduleManager.SetOrderBeginBlockers(
...
packetforwardtypes.ModuleName,
...
)

// Add packet forward middleware to end blocker logic
app.moduleManager.SetOrderEndBlockers(
...
packetforwardtypes.ModuleName,
...
)

// Add packet forward middleware to init genesis logic
app.moduleManager.SetOrderInitGenesis(
...
packetforwardtypes.ModuleName,
...
)

// Add packet forward middleware to init params keeper
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
...
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
...
}
```

## Configuring the transfer application stack with Packet Forward Middleware

Here is an example of how to create an application stack using `transfer` and `packet-forward-middleware`.
The following `transferStack` is configured in `app/app.go` and added to the IBC `Router`.
The in-line comments describe the execution flow of packets between the application stack and IBC core.

For more information on configuring an IBC application stack see the ibc-go docs [here](https://github.com/cosmos/ibc-go/blob/e69a833de764fa0f5bdf0338d9452fd6e579a675/docs/docs/04-middleware/01-ics29-fee/02-integration.md#configuring-an-application-stack-with-fee-middleware).

```go
// Create Transfer Stack
// SendPacket, since it is originating from the application to core IBC:
// transferKeeper.SendPacket -> packetforward.SendPacket -> channel.SendPacket

// RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way
// channel.RecvPacket -> packetforward.OnRecvPacket -> transfer.OnRecvPacket

// transfer stack contains (from top to bottom):
// - Packet Forward Middleware
// - Transfer
var transferStack ibcporttypes.IBCModule
transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = packetforward.NewIBCMiddleware(
transferStack,
app.PacketForwardKeeper,
0, // retries on timeout
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
)

// Add transfer stack to IBC Router
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
```

## Configurable options in the Packet Forward Middleware

The Packet Forward Middleware has several configurable options available when initializing the IBC application stack.
You can see these passed in as arguments to `packetforward.NewIBCMiddleware` and they include the number of retries that
will be performed on a forward timeout, the timeout period that will be used for a forward, and the timeout period that
will be used for performing refunds in the case that a forward is taking too long.

Additionally, there is a fee percentage parameter that can be set in `InitGenesis`, this is an optional parameter that
can be used to take a fee from each forwarded packet which will then be distributed to the community pool. In the
`OnRecvPacket` callback `ForwardTransferPacket` is invoked which will attempt to subtract a fee from the forwarded
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.
1 change: 1 addition & 0 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ require (
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huandu/skiplist v1.2.1 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,8 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr
github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w=
github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc=
github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
Expand Down
20 changes: 19 additions & 1 deletion e2e/sample.config.extended.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# | CHAIN_IMAGE | The image that will be used for the chain | ghcr.io/cosmos/ibc-go-simd |
# | CHAIN_A_TAG | The tag used for chain A | N/A (must be set) |
# | CHAIN_B_TAG | The tag used for chain B | N/A (must be set) |
# | CHAIN_C_TAG | The tag used for chain C | Optional (fallback to A) |
# | CHAIN_D_TAG | The tag used for chain D | Optional (fallback to A) |
# | CHAIN_BINARY | The binary used in the container | simd |
# | RELAYER_TAG | The tag used for the relayer | 1.10.4 |
# | RELAYER_ID | The type of relayer to use (rly/hermes) | hermes |
Expand All @@ -23,13 +25,29 @@ chains:
tag: main # override with CHAIN_A_TAG
binary: simd # override with CHAIN_BINARY

# the entry at index 1 corresponds to CHAIN_B
# the entry at index 1 corresponds to CHAIN_B
- chainId: chainB-1
numValidators: 4
numFullNodes: 1
image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
tag: main # override with CHAIN_B_TAG
binary: simd # override with CHAIN_BINARY

# the entry at index 2 corresponds to CHAIN_C
- chainId: chainC-1
numValidators: 4
numFullNodes: 1
image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
tag: main # override with CHAIN_C_TAG
binary: simd # override with CHAIN_BINARY

# the entry at index 3 corresponds to CHAIN_D
- chainId: chainD-1
numValidators: 4
numFullNodes: 1
image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
tag: main # override with CHAIN_D_TAG
binary: simd # override with CHAIN_BINARY

# activeRelayer must match the id of a relayer specified in the relayers list below.
activeRelayer: hermes # override with RELAYER_ID
Expand Down
4 changes: 4 additions & 0 deletions e2e/sample.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ chains:
chainId: chainA-1
- tag: main # override with CHAIN_B_TAG
chainId: chainB-1
- tag: main # override with CHAIN_C_TAG
chainId: chainC-1
- tag: main # override with CHAIN_D_TAG
chainId: chainD-1
2 changes: 1 addition & 1 deletion e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *ConnectionTestSuite) SetupSuite() {
}

func (s *ConnectionTestSuite) CreateConnectionTestPath(testName string) (ibc.Relayer, ibc.ChannelOutput) {
return s.CreatePaths(ibc.DefaultClientOpts(), s.TransferChannelOptions(), testName), s.GetChainAChannelForTest(testName)
return s.CreatePaths(ibc.DefaultClientOpts(), s.TransferChannelOptions(), testName), s.GetChainAToChainBChannel(testName)
}

// QueryMaxExpectedTimePerBlockParam queries the on-chain max expected time per block param for 03-connection
Expand Down
Loading
Loading