Skip to content

Feat/v15 packet forward middleware#665

Closed
TheAlchemist616 wants to merge 3 commits into
classic-terra:mainfrom
TheAlchemist616:feat/v15-packet-forward-middleware
Closed

Feat/v15 packet forward middleware#665
TheAlchemist616 wants to merge 3 commits into
classic-terra:mainfrom
TheAlchemist616:feat/v15-packet-forward-middleware

Conversation

@TheAlchemist616

Copy link
Copy Markdown

Summary

Integrates Packet Forward Middleware (PFM, v10.6.0) into the IBC transfer stack as the v15 upgrade, giving Terra Classic multi-hop IBC routing: a single MsgTransfer can route atomically through Terra Classic to a third chain (chain-A → Terra Classic → chain-B), with automatic refund/timeout handling.

Motivation

Today Terra Classic can only move assets across channels it holds directly — reaching a chain it has no direct channel with takes multiple manual transactions, or isn't possible in a single flow. PFM is the standard multi-hop component run by Osmosis, Stride, Injective, Sei and most major Cosmos chains. Adding it:

  • lets LUNC and other assets reach the whole IBC network in one hop (e.g. via Osmosis / the Hub) without opening a channel to every counterparty;
  • ensures assets bridged onto Terra Classic aren't stranded — they can flow onward across IBC;
  • composes with the existing ibc-hooks module (a routed packet can also trigger a CosmWasm contract);
  • supports an optional fee_percentage that skims forwarded packets to the community pool (shipped at 0 here; governance can raise it later via MsgUpdateParams).

Changes

  • New module packetfowardmiddleware (name is the upstream spelling, frozen for state compat): one KV store, one module account (intermediate receiver for in-flight forwarded packets), one params subspace. Registered in ModuleBasics, the module manager, and the begin/end/init-genesis orderings.
  • Transfer stack re-composed to channel → ibc-hooks → packet-forward → transfer (the Osmosis ordering), in app/keepers/routers.go.
  • v15 upgrade handler (app/upgrades/v15/): adds the PFM store via StoreUpgrades.Added; RunMigrations initializes the module's default genesis (fee_percentage = 0). No bespoke state migration.

Dependency changes (please review)

Module Before After
cosmos/ibc-apps/middleware/packet-forward-middleware/v10 v10.6.0 (new)
cosmos/ibc-go/v10 v10.5.0 v10.6.0 (transitive minor bump pulled by PFM)

Flagging the ibc-go bump explicitly so it's clear this PR is not only PFM — it's a minor patch release pulled in transitively, and it compiles + tests clean.

Testing

  • go build ./... — clean.
  • terrad init — module registers and appears in default genesis.
  • tests/interchaintest/ibc_pfm_terra_hop_test.go::TestTerraAsPFMHop — a new live 3-chain test (gaia → Terra (this build) → osmosis) with a relayer. It asserts that Terra itself emits the onward send_packet after receiving from gaia, and that osmosis credits the forwarded funds. Passes end-to-end (ok … 202s).

This closes a real coverage gap: the existing PFM tests (TestTerraPFM, TestTerraGaiaOsmoPFM) only exercise Osmosis as the forwarding hop, with Terra as source/destination — they never test Terra Classic doing the forwarding.

Risk

Low. Consensus-breaking only in that it adds a module store, so it must be applied at a governance-set height via the standard Cosmovisor / coordinated-swap drill. No parameter changes to any existing module. PFM is battle-tested across the Cosmos ecosystem, and non-forwarded IBC transfers are unaffected.

Notes for reviewers

  • app/upgrades/v15/README.md documents the change; app/upgrades/v15/PROPOSAL.md contains the governance MsgSoftwareUpgrade runbook.
  • The PFM keeper's ics4Wrapper is wired to IBCKeeper.ChannelKeeper; the ibc-hooks + PFM stack ordering matches the Osmosis reference and is confirmed working by TestTerraAsPFMHop.

Checklist

  • Builds (go build ./...)
  • New interchaintest passes (TestTerraAsPFMHop)
  • Upgrade handler + store registration added (v15)
  • No changes to existing module params
  • Reviewed by L1JTF / maintainers

thealchemicgamer added 3 commits June 1, 2026 04:50
Wire cosmos/ibc-apps packet-forward-middleware/v10 into the IBC transfer stack (channel -> ibc-hooks -> packet-forward -> transfer), enabling multi-hop IBC routing. Adds the packetforward module (store key, module account, params subspace, module-manager + ordering registration) and a v15 software-upgrade handler that mounts the new store and initializes default params (FeePercentage = 0) via RunMigrations.
TestTerraAsPFMHop drives gaia -> terra(PFM) -> osmosis and asserts Terra itself emits the onward send_packet (the coverage gap: existing PFM tests only use Osmosis as the hop). go mod tidy locks packet-forward-middleware v10.6.0, which transitively bumps ibc-go v10.5.0 -> v10.6.0 (minor patch, compiles clean).
Document the Packet Forward Middleware integration (stack order, dependency changes incl. ibc-go v10.5.0->v10.6.0, default fee_percentage=0, interchaintest coverage) and provide a governance MsgSoftwareUpgrade proposal runbook. Also commit the tidied tests/interchaintest go.mod/go.sum.
Comment thread app/upgrades/v15/PROPOSAL.md
@TheAlchemist616

TheAlchemist616 commented Jun 1, 2026 via email

Copy link
Copy Markdown
Author

@StrathCole

Copy link
Copy Markdown
Collaborator

Apologies, pull request made by mistake

Shall I close it?

@TheAlchemist616

Copy link
Copy Markdown
Author

Done
Thank you
Will still use it for discussion on Discourse, will repush to appropriate locations if/when it passes/fails on the eventual governance vote down the road.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants