Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Eureka forwarding #7588

Closed
wants to merge 171 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
8d10fed
Cherry-pick: Add MsgRegisterCounterparty Struct and Handler from ibc-…
sangier Jul 31, 2024
15f3368
chore: move status checks from connection verify_* functions to 02-cl…
DimitrisJim Aug 1, 2024
2ff4aa9
chore: split out packet handling rpcs (#7007)
DimitrisJim Aug 1, 2024
44215f7
Add versions to packet and create Eureka packet commitment (#6986)
AdityaSripal Aug 1, 2024
c1f0e4e
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Aug 4, 2024
dcff30b
feat(tests): add helper functions, keeper test suite. (#7052)
DimitrisJim Aug 6, 2024
567e730
feat(core/eureka): add packet handler (#7048)
AdityaSripal Aug 6, 2024
94ad62a
feat(core/eureka): add recv handler (#7041)
DimitrisJim Aug 6, 2024
8c3a9a4
feat(core/eureka): add timeout handler (#7060)
AdityaSripal Aug 6, 2024
2b8a96d
feat(core/eureka): add writeack, ack handler. (#7049)
DimitrisJim Aug 7, 2024
8a499b1
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Aug 7, 2024
366ab9d
feat(core): Wire packet handler to core message server (#7091)
DimitrisJim Aug 8, 2024
2a07e6e
feat(eureka): fix condition in commit packet, added test for zero tim…
crodriguezvega Aug 9, 2024
0743c09
refactor: reduce channel lookup for timeout flow (#7149)
colin-axner Aug 13, 2024
6efbdec
imp: require stricter usage of app version in packet (#7146)
colin-axner Aug 15, 2024
eb2830f
chore: remove unnecessary comments (#7155)
colin-axner Aug 15, 2024
0a9b799
imp: add tests for BuildMerklePath, make merkle path non-nullable in …
colin-axner Aug 18, 2024
1971ad5
chore: add godoc to packet server handlers (#7156)
colin-axner Aug 19, 2024
a673f74
Merge branch 'main' into feat/ibc-eureka
crodriguezvega Aug 20, 2024
a7c3de4
feat(eureka): add tests for `MsgProvideCounterparty` (#7179)
crodriguezvega Aug 20, 2024
88f6a3f
add submodule to logger (#7196)
chandiniv1 Aug 22, 2024
ad5748e
tests: msg server tests for eureka (#7162)
colin-axner Aug 22, 2024
f34c0f7
Merge branch 'main' into feat/ibc-eureka
crodriguezvega Aug 26, 2024
1c5e886
Validate MerklePathPrefix and Path (#7193)
AdityaSripal Aug 26, 2024
e66223c
add helper to retrieve handler and module based on protocol version (…
chandiniv1 Aug 26, 2024
5d62925
feat(eureka): Add gRPC query for Counterparty for a given client iden…
vishal-kanna Aug 26, 2024
ed164c3
feat(eureka): add CLI to submit `MsgProvideCounterparty` (#7118)
vishal-kanna Aug 26, 2024
f4783d1
Use client and counterparty terminology in packet server (#7195)
chandiniv1 Aug 26, 2024
8a324c2
chore: require app version be non-empty when protocol version is vers…
DimitrisJim Aug 27, 2024
d98549b
chore(tests): add case for latest height err case. (#7212)
DimitrisJim Aug 27, 2024
d4d1dc6
feat(events): dont emit channel information for eureka handlers) (#7230)
DimitrisJim Sep 2, 2024
4638933
feat(02-client/cli): add query for client counterparty. (#7235)
DimitrisJim Sep 4, 2024
70ceada
chore: move handler implementations into a relay.go file. (#7271)
DimitrisJim Sep 10, 2024
37d3d39
refactor: Move Counterparty to packet server (#7280)
DimitrisJim Sep 11, 2024
5c951b2
chore(packet-server): add queryServer to packet-server (#7283)
DimitrisJim Sep 12, 2024
a432b0e
feat(packet-server): add client. (#7284)
DimitrisJim Sep 12, 2024
b52a438
Add PacketV2 Protos and CommitmentV2 function (#7287)
chatton Sep 16, 2024
5f07393
chore: add conversion function from PacketV1 to PacketV2 (#7292)
Sep 16, 2024
2a64425
merge main into feat/ibc-eureka
Sep 17, 2024
f7cf24d
Merge pull request #7300 from cosmos/bznein/eureka/mergemain
chatton Sep 17, 2024
f2f46bc
refactor: change counterparty structure. (#7328)
DimitrisJim Sep 30, 2024
a42e1c7
chore: move PacketV2 to channel/v2 proto and rename it to Packet (#7357)
Oct 1, 2024
78bb3be
Add fallback function to grab counterparty for non-eureka channels (#…
DimitrisJim Oct 1, 2024
688302f
Add channel keeper v2 (#7377)
chatton Oct 2, 2024
d82e1cd
chore: Added SendPacket RPC skeleton and relative proto message (#7364)
Oct 2, 2024
17d3487
Add new keys and getter / setter functions (#7378)
chatton Oct 2, 2024
d2ac656
chore: add MsgRecvPacket skeleton (#7379)
Oct 2, 2024
304cb0a
chore: add MsgTimeout skeleton (#7380)
Oct 2, 2024
bb0bfa5
chore: add Acknowledgement message proto. (#7381)
Oct 3, 2024
1ee4ec0
chore: Add PacketV2 ValidateBasic() function (#7389)
Oct 3, 2024
a8fa564
refactor: Add CreateChannel rpc (#7382)
DimitrisJim Oct 3, 2024
ef8b0ab
chore: adding implementation for SendPacket message server (#7383)
chatton Oct 3, 2024
6e61910
Adding router v2 (#7392)
chatton Oct 7, 2024
8271fce
Add mock ibc module v2 (#7398)
chatton Oct 7, 2024
049497d
chore: add RecvPacket to V2 (#7399)
Oct 7, 2024
759ff43
chore: create helper function for counterparty falllback. (#7405)
Oct 7, 2024
753673a
chore: Add Timeout to Channel Keeper (#7400)
Oct 8, 2024
7dac4be
chore: register v2 msg service and rename (#7407)
damiannolan Oct 8, 2024
6a19337
Wire up simapp to use mock v2 modules (#7401)
chatton Oct 8, 2024
9264b1c
chore: add pluming necessary for testing CreateChannel (#7406)
DimitrisJim Oct 8, 2024
1683b4f
chore: add OnRecvPacket to IBCModule V2 interface (#7415)
Oct 8, 2024
115749f
chore: add OnTimeoutPacket to IBCModule V2 interface (#7418)
Oct 8, 2024
a42ed56
refactor: host keys apis to use uint64 sequence and fmt big endian by…
damiannolan Oct 9, 2024
8e9b8cc
feat: create channel before invoking provide counterparty. (#7420)
DimitrisJim Oct 9, 2024
b509c50
chore: clean up ProvideCounterparty tx. (#7422)
DimitrisJim Oct 9, 2024
7e02a96
Rename Id Fields to Channel for Packet V2 (#7428)
AdityaSripal Oct 9, 2024
f1102b2
packetserver: Rename Counterparty to Channel (#7429)
AdityaSripal Oct 10, 2024
b595284
feat: add acknowledgePacket handler to channel/v2 (#7412)
damiannolan Oct 10, 2024
56be85b
channel/v2: Rename Counterparty to Channel (#7432)
AdityaSripal Oct 10, 2024
756b94e
Implement MsgSendPacket RPC handler and tests (#7413)
chatton Oct 10, 2024
cfd1fba
chore: ensure correct usage of ids. (#7433)
DimitrisJim Oct 10, 2024
26b2cd5
chore: cleanup ids in eureka branch (#7434)
damiannolan Oct 10, 2024
5fdd344
chore: move tx's to channel/v2 (#7435)
DimitrisJim Oct 14, 2024
4ed7543
chore: Add OnAcknowledgmentPacket to IBCModule V2 Interface (#7438)
Oct 14, 2024
a539936
nit: reorder proto msgs (#7446)
damiannolan Oct 14, 2024
a282c1a
chore: fix naming of parameters sourceID/destinationID (#7448)
Oct 14, 2024
50ead0f
Implement v2 RecvPacket rpc handler (#7421)
chatton Oct 14, 2024
b49b466
chore: Move initialization of next sequence send to create channel rp…
DimitrisJim Oct 14, 2024
063814c
chore: Implement v2 Acknowledgement rpc handler (#7452)
Oct 14, 2024
6dc1249
chore: replace stale references to clientId. (#7457)
DimitrisJim Oct 15, 2024
ef74ad6
fix: start error code from 2. (#7458)
DimitrisJim Oct 15, 2024
d670ab8
chore: add cli/tx for create channel. (#7460)
DimitrisJim Oct 15, 2024
8ed9222
chore: remove stale references to packet-server in channel/v2. (#7451)
DimitrisJim Oct 15, 2024
68756ec
Remove duplication of ConvertToErrorEvents (#7467)
chatton Oct 15, 2024
d793472
chore: add ValidateBasic for MsgSendPacket (#7468)
Oct 15, 2024
1682792
Add helper functions for MsgSendPacket, MsgRecvPacket and MsgAcknowle…
chatton Oct 15, 2024
e99b370
chore: add ValidateBasic and test for MsgRecvPacket (#7470)
Oct 17, 2024
4074c58
chore: Implement v2 Timeout rpc handler (#7463)
Oct 17, 2024
a3a61ff
channel/v2: Add Keeper Tests (#7456)
AdityaSripal Oct 17, 2024
9b665ca
fix: timeout tests after timeout as seconds. (#7480)
DimitrisJim Oct 18, 2024
bad6098
chore: add validation for MsgAcknowledgement. (#7473)
DimitrisJim Oct 18, 2024
0a3b4be
chore: remove packet-server. (#7481)
DimitrisJim Oct 18, 2024
e77a0f4
chore: add ValidateBasic for MsgTimeout in ChannelKeeper V2 (#7482)
Oct 18, 2024
aeb9980
chore: rename PacketData to Payload (#7483)
Oct 21, 2024
b40e730
Merge branch 'main' into merge-main
chatton Oct 21, 2024
c2e20c6
chore: remove copyloopvar check
chatton Oct 21, 2024
a29f2c8
Merge pull request #7487 from cosmos/merge-main
chatton Oct 21, 2024
6078dda
chore: further renaming of packetdata to payload (#7485)
Oct 21, 2024
dd675cf
chore: generate distinct channel identifiers in testing library. (#7489)
DimitrisJim Oct 21, 2024
1cf3539
chore: limit packet data to length of one. (#7484)
DimitrisJim Oct 21, 2024
cc51d29
chore: remove fallback logic for GetChannel in timeout handler (#7490)
Oct 21, 2024
1462fd2
chore: remove unecessary KeyChannelStorePrefix (#7496)
DimitrisJim Oct 22, 2024
fb7509b
tests: fix ProvideCounterparty test. (#7501)
DimitrisJim Oct 22, 2024
610bf85
chore: clean up ctx unwrapping in channel/v2/keeper. (#7497)
DimitrisJim Oct 22, 2024
e0a60a0
chore: remove notion of protocol version, revert packet/v1 diffs. (#7…
DimitrisJim Oct 22, 2024
ead49f2
chore: Undo split to packet-server in 04-channel/v1. Move v2 testing …
DimitrisJim Oct 22, 2024
8b7889c
chore: revert v1 event changes. (#7499)
DimitrisJim Oct 22, 2024
60f20f0
chore: add tests for Channel.Validate (#7504)
Oct 22, 2024
7a257c3
chore: adding ibc module v2 and on recv implementation with hard code…
chatton Oct 23, 2024
3cb1e3c
refactor: check timeouts directly in channel/v2 (#7464)
damiannolan Oct 23, 2024
6f49135
chore: rename apis to align with spec (#7511)
damiannolan Oct 23, 2024
4e5e5c3
chore: add v2 packet commitment query (#7494)
damiannolan Oct 23, 2024
15877e8
chore: impl packet acknowledgement query (#7507)
damiannolan Oct 23, 2024
e752c0d
chore: remove creator field from channel query (#7523)
damiannolan Oct 29, 2024
e0b40f0
Merge branch 'main' into feat/ibc-eureka
Oct 29, 2024
a5bff0b
chore: impl packet receipt query (#7513)
damiannolan Oct 29, 2024
5e436da
Merge branch 'main' into feat/ibc-eureka
Oct 31, 2024
28b6a89
Add MaxTimeout condition (#7521)
sangier Nov 1, 2024
3c47bd7
chore: remove usage of v1 errors from v2 (#7528)
Nov 1, 2024
1429f6d
chore: reduce number of timeout errors, cleanup (#7529)
damiannolan Nov 4, 2024
4e5b07c
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Nov 4, 2024
870e830
chore: add redundancy checks for V2 Msgs (#7509)
Nov 4, 2024
09d14d6
chore: create ResultType for ChannelV2 (#7534)
Nov 5, 2024
6506494
Merge branch 'main' into feat/ibc-eureka
Nov 5, 2024
e3b46ff
feat: add protobuf files for channel/v2 genesis storage. (#7502)
DimitrisJim Nov 6, 2024
c7670b3
wire channel query server v2 (#7537)
gjermundgaraba Nov 6, 2024
ed714a9
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Nov 7, 2024
9239d5d
fix: channel must exist before channel creator check (#7538)
gjermundgaraba Nov 7, 2024
cae86e6
feat: add paginated packet commitments query to channel/v2 (#7533)
damiannolan Nov 11, 2024
58324cf
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Nov 11, 2024
b176e45
chore: revert re-ordering for v1 channel msg.
DimitrisJim Nov 11, 2024
e769eeb
chore: revert exporting of deletePacketCommitment.
DimitrisJim Nov 11, 2024
5b3ce55
Match commitment to specification (#7544)
AdityaSripal Nov 12, 2024
cb29978
chore: drop usage of 'channeltypesv2'.
DimitrisJim Nov 12, 2024
369fde5
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Nov 12, 2024
5031af8
chore: fix post-merge test failure.
DimitrisJim Nov 12, 2024
0050523
ICS24: Change Provable keys (#7517)
AdityaSripal Nov 12, 2024
d416dc3
chore: amend event emitted for create channel. (#7557)
DimitrisJim Nov 12, 2024
6b237fc
chore: add event for register counterparty (#7556)
DimitrisJim Nov 12, 2024
3abeb0b
chore: add next sequence send query. (#7550)
DimitrisJim Nov 12, 2024
43584bf
chore: make AliasV1Channel a private function.
DimitrisJim Nov 12, 2024
831a351
nit: consistent import name for 24-host/v2
DimitrisJim Nov 12, 2024
595e98b
Simplify Acknowledgement structure (#7555)
AdityaSripal Nov 13, 2024
e261683
support client identifiers as channels in ics20 denom hops (#7551)
gjermundgaraba Nov 14, 2024
a2d377c
chore: add unreceived acks rpc (#7562)
DimitrisJim Nov 14, 2024
107ab75
make packet commitments fixed length (#7564)
gjermundgaraba Nov 14, 2024
2acc7f6
feat: add custom querier to wasm image (#7559)
gjermundgaraba Nov 15, 2024
f08fc12
chore: add unreceived packets rpc (#7561)
lacsomot Nov 19, 2024
7ccd1c0
Ibcmodulev2 transfer application spike (#7524)
Nov 19, 2024
fe6a6dc
Merge branch 'main' into feat/ibc-eureka
Nov 19, 2024
798b892
Merge branch 'main' into feat/ibc-eureka
Nov 20, 2024
5afcf1d
chore: use encoding fields for packet data unmarshaling (#7574)
Nov 20, 2024
5332645
feat: add type constructors/validation for genesis types. (#7554)
DimitrisJim Nov 21, 2024
f3afb2c
chore: add events for send packet (#7577)
DimitrisJim Nov 21, 2024
f5c19b1
Merge branch 'main' into feat/ibc-eureka
DimitrisJim Nov 21, 2024
8bae734
chore: add events for recv packet. (#7582)
DimitrisJim Nov 21, 2024
66f3b25
[wip] currently broken
Nov 6, 2024
ac1a5c9
wip
Nov 11, 2024
6b74df6
wip
Nov 14, 2024
5f257ee
wip
Nov 15, 2024
1d43ed9
add functions to return keys to store fwd packets' sequence and destC…
Nov 15, 2024
36c6721
conversion functions between v1 and v2 hops
Nov 15, 2024
9c0ac61
move ack len check to handler
Nov 15, 2024
66f6afe
wip
Nov 18, 2024
f5473db
wip
Nov 18, 2024
de0a8c2
wip
Nov 18, 2024
4cc4d5c
Merge branch 'feat/ibc-eureka' into bznein/transferV2Spike/Forwarding
Nov 22, 2024
e1b23e7
wip
Nov 22, 2024
38293fe
wip
Nov 25, 2024
1fa1dab
chore: removed v2 query files
chatton Nov 25, 2024
9b1e644
wip and cleanup
Nov 26, 2024
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
32 changes: 22 additions & 10 deletions .github/workflows/build-wasm-simd-image-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,36 @@ jobs:
with:
ref: "${{ env.GIT_TAG }}"
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: make python-install-deps

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
version="$(scripts/get-libwasm-version.py --get-version)"
checksum="$(scripts/get-libwasm-version.py --get-checksum)"

# remove all `/` or `+` characters from the docker tag and replace them with a -.
# this ensures the docker tag is valid.
docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')"
docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" -f modules/light-clients/08-wasm/Dockerfile --build-arg LIBWASM_VERSION=${version} --build-arg LIBWASM_CHECKSUM=${checksum}
docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}"

- name: Get arguments and docker tag
run: |
echo "LIBWASM_VERSION=$(scripts/get-libwasm-version.py --get-version)" >> $GITHUB_ENV
# remove all `/` or `+` characters from the docker tag and replace them with a -.
# this ensures the docker tag is valid.
echo "DOCKER_TAG=$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,
push: true
tags: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}
file: modules/light-clients/08-wasm/Dockerfile
build-args: LIBWASM_VERSION=${{ env.LIBWASM_VERSION }}
2 changes: 1 addition & 1 deletion .github/workflows/wasm-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install compiler for arm64.
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu build-essential
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
if: matrix.go-arch == 'arm64'
- name: Build wasm-client
Expand Down
2 changes: 2 additions & 0 deletions e2e/testsuite/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types"
channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"
solomachine "github.com/cosmos/ibc-go/v9/modules/light-clients/06-solomachine"
ibctmtypes "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v9/testing"
Expand Down Expand Up @@ -71,6 +72,7 @@ func codecAndEncodingConfig() (*codec.ProtoCodec, testutil.TestEncodingConfig) {
connectiontypes.RegisterInterfaces(cfg.InterfaceRegistry)
ibctmtypes.RegisterInterfaces(cfg.InterfaceRegistry)
wasmtypes.RegisterInterfaces(cfg.InterfaceRegistry)
channeltypesv2.RegisterInterfaces(cfg.InterfaceRegistry)

// all other types
upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/ica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (suite *FeeTestSuite) TestFeeInterchainAccounts() {
packet := buildInterchainAccountsPacket(path, icaPacketData.GetBytes(), 1)

// write packet commitment to state on chainA and commit state
commitment := channeltypes.CommitPacket(suite.chainA.GetSimApp().AppCodec(), packet)
commitment := channeltypes.CommitPacket(packet)
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, commitment)
suite.chainA.NextBlock()

Expand Down
1 change: 1 addition & 0 deletions modules/apps/callbacks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ require (
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.2.0 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/danieljoos/wincred v1.2.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions modules/apps/callbacks/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM=
github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU=
github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0=
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=
Expand Down
8 changes: 4 additions & 4 deletions modules/apps/transfer/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (im IBCModule) OnRecvPacket(
events.EmitOnRecvPacketEvent(ctx, data, ack, ackErr)
}()

data, ackErr = types.UnmarshalPacketData(packet.GetData(), channelVersion)
data, ackErr = types.UnmarshalPacketData(packet.GetData(), channelVersion, "")
if ackErr != nil {
ack = channeltypes.NewErrorAcknowledgement(ackErr)
im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence))
Expand Down Expand Up @@ -221,7 +221,7 @@ func (im IBCModule) OnAcknowledgementPacket(
return errorsmod.Wrapf(ibcerrors.ErrUnknownRequest, "cannot unmarshal ICS-20 transfer packet acknowledgement: %v", err)
}

data, err := types.UnmarshalPacketData(packet.GetData(), channelVersion)
data, err := types.UnmarshalPacketData(packet.GetData(), channelVersion, "")
if err != nil {
return err
}
Expand All @@ -242,7 +242,7 @@ func (im IBCModule) OnTimeoutPacket(
packet channeltypes.Packet,
relayer sdk.AccAddress,
) error {
data, err := types.UnmarshalPacketData(packet.GetData(), channelVersion)
data, err := types.UnmarshalPacketData(packet.GetData(), channelVersion, "")
if err != nil {
return err
}
Expand Down Expand Up @@ -305,6 +305,6 @@ func (im IBCModule) UnmarshalPacketData(ctx context.Context, portID string, chan
return types.FungibleTokenPacketDataV2{}, "", errorsmod.Wrapf(ibcerrors.ErrNotFound, "app version not found for port %s and channel %s", portID, channelID)
}

ftpd, err := types.UnmarshalPacketData(bz, ics20Version)
ftpd, err := types.UnmarshalPacketData(bz, ics20Version, "")
return ftpd, ics20Version, err
}
13 changes: 4 additions & 9 deletions modules/apps/transfer/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func (k Keeper) GetAllDenomTraces(ctx sdk.Context) []internaltypes.DenomTrace {
return traces
}

// TokenFromCoin is a wrapper around tokenFromCoin for testing purposes.
func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, error) {
return k.tokenFromCoin(ctx, coin)
}
// // TokenFromCoin is a wrapper around tokenFromCoin for testing purposes.
// func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, error) {
// return k.tokenFromCoin(ctx, coin)
// }

// UnwindHops is a wrapper around unwindHops for testing purposes.
func (k Keeper) UnwindHops(ctx sdk.Context, msg *types.MsgTransfer) (*types.MsgTransfer, error) {
Expand All @@ -54,11 +54,6 @@ func (k Keeper) GetAllForwardedPackets(ctx sdk.Context) []types.ForwardedPacket
return k.getAllForwardedPackets(ctx)
}

// IsBlockedAddr is a wrapper around isBlockedAddr for testing purposes
func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool {
return k.isBlockedAddr(addr)
}

// CreatePacketDataBytesFromVersion is a wrapper around createPacketDataBytesFromVersion for testing purposes
func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, hops []types.Hop) ([]byte, error) {
return createPacketDataBytesFromVersion(appVersion, sender, receiver, memo, tokens, hops)
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/transfer/keeper/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (k Keeper) forwardPacket(ctx context.Context, data types.FungibleTokenPacke
}

// sending from module account (used as a temporary forward escrow) to the original receiver address.
sender := k.authKeeper.GetModuleAddress(types.ModuleName)
sender := k.AuthKeeper.GetModuleAddress(types.ModuleName)

msg := types.NewMsgTransfer(
data.Forwarding.Hops[0].PortId,
Expand Down Expand Up @@ -68,7 +68,7 @@ func (k Keeper) revertForwardedPacket(ctx context.Context, forwardedPacket chann
2. Burning voucher tokens if the funds are foreign
*/

forwardingAddr := k.authKeeper.GetModuleAddress(types.ModuleName)
forwardingAddr := k.AuthKeeper.GetModuleAddress(types.ModuleName)
escrow := types.GetEscrowAddress(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel)

// we can iterate over the received tokens of forwardedPacket by iterating over the sent tokens of failedPacketData
Expand All @@ -83,12 +83,12 @@ func (k Keeper) revertForwardedPacket(ctx context.Context, forwardedPacket chann
// given that the packet is being reversed, we check the DestinationChannel and DestinationPort
// of the forwardedPacket to see if a hop was added to the trace during the receive step
if token.Denom.HasPrefix(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel) {
if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(coin)); err != nil {
if err := k.BankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(coin)); err != nil {
return err
}
} else {
// send it back to the escrow address
if err := k.escrowCoin(ctx, forwardingAddr, escrow, coin); err != nil {
if err := k.EscrowCoin(ctx, forwardingAddr, escrow, coin); err != nil {
return err
}
}
Expand All @@ -101,7 +101,7 @@ func (k Keeper) revertForwardedPacket(ctx context.Context, forwardedPacket chann
func (k Keeper) getReceiverFromPacketData(data types.FungibleTokenPacketDataV2) (sdk.AccAddress, error) {
if data.HasForwarding() {
// since data.Receiver can potentially be a non-CosmosSDK AccAddress, we return early if the packet should be forwarded
return k.authKeeper.GetModuleAddress(types.ModuleName), nil
return k.AuthKeeper.GetModuleAddress(types.ModuleName), nil
}

receiver, err := sdk.AccAddressFromBech32(data.Receiver)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) {

for _, denom := range state.Denoms {
k.SetDenom(ctx, denom)
k.setDenomMetadata(ctx, denom)
k.SetDenomMetadata(ctx, denom)
}

k.SetParams(ctx, state.Params)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TotalEscrowPerDenomInvariants(k *Keeper) sdk.Invariant {
transferChannels := k.channelKeeper.GetAllChannelsWithPortPrefix(ctx, portID)
for _, channel := range transferChannels {
escrowAddress := types.GetEscrowAddress(portID, channel.ChannelId)
escrowBalances := k.bankKeeper.GetAllBalances(ctx, escrowAddress)
escrowBalances := k.BankKeeper.GetAllBalances(ctx, escrowAddress)

actualTotalEscrowed = actualTotalEscrowed.Add(escrowBalances...)
}
Expand Down
35 changes: 25 additions & 10 deletions modules/apps/transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
cmtbytes "github.com/cometbft/cometbft/libs/bytes"

"github.com/cosmos/ibc-go/v9/modules/apps/transfer/types"
typesv2 "github.com/cosmos/ibc-go/v9/modules/apps/transfer/v2/types"
channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types"
porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types"
host "github.com/cosmos/ibc-go/v9/modules/core/24-host"
Expand All @@ -34,8 +35,8 @@ type Keeper struct {

ics4Wrapper porttypes.ICS4Wrapper
channelKeeper types.ChannelKeeper
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
AuthKeeper types.AccountKeeper
BankKeeper types.BankKeeper

// the address capable of executing a MsgUpdateParams message. Typically, this
// should be the x/gov module account.
Expand Down Expand Up @@ -68,8 +69,8 @@ func NewKeeper(
legacySubspace: legacySubspace,
ics4Wrapper: ics4Wrapper,
channelKeeper: channelKeeper,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
AuthKeeper: authKeeper,
BankKeeper: bankKeeper,
authority: authority,
}
}
Expand Down Expand Up @@ -195,8 +196,8 @@ func (k Keeper) IterateDenoms(ctx context.Context, cb func(denom types.Denom) bo
}
}

// setDenomMetadata sets an IBC token's denomination metadata
func (k Keeper) setDenomMetadata(ctx context.Context, denom types.Denom) {
// SetDenomMetadata sets an IBC token's denomination metadata
func (k Keeper) SetDenomMetadata(ctx context.Context, denom types.Denom) {
metadata := banktypes.Metadata{
Description: fmt.Sprintf("IBC token from %s", denom.Path()),
DenomUnits: []*banktypes.DenomUnit{
Expand All @@ -214,7 +215,7 @@ func (k Keeper) setDenomMetadata(ctx context.Context, denom types.Denom) {
Symbol: strings.ToUpper(denom.Base),
}

k.bankKeeper.SetDenomMetaData(ctx, metadata)
k.BankKeeper.SetDenomMetaData(ctx, metadata)
}

// GetTotalEscrowForDenom gets the total amount of source chain tokens that
Expand Down Expand Up @@ -346,6 +347,20 @@ func (k Keeper) getAllForwardedPackets(ctx context.Context) []types.ForwardedPac
return packets
}

// TODO This should go in keeperV2, bu there's no storeService there.
// SetForwardedPacketSequenceAndDestinationChannel stores the sequence and the destinationChannel for a forwarded packet.
func (k Keeper) SetForwardedPacketSequenceAndDestinationChannel(ctx context.Context, portID, channelID string, sequence uint64, destChannel string) {
store := k.storeService.OpenKVStore(ctx)
bigEndianBz := sdk.Uint64ToBigEndian(sequence)
destChannelBz := []byte(destChannel)
if err := store.Set(typesv2.ForwardedPacketSequenceKey(portID, channelID), bigEndianBz); err != nil {
panic(err)
}
if err := store.Set(typesv2.ForwardedPacketDestinationChannelKey(portID, channelID), destChannelBz); err != nil {
panic(err)
}
}

// iterateForwardedPackets iterates over the forward packets in the store and performs a callback function.
func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet types.ForwardedPacket) bool) {
store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
Expand Down Expand Up @@ -385,11 +400,11 @@ func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet type

// IsBlockedAddr checks if the given address is allowed to send or receive tokens.
// The module account is always allowed to send and receive tokens.
func (k Keeper) isBlockedAddr(addr sdk.AccAddress) bool {
moduleAddr := k.authKeeper.GetModuleAddress(types.ModuleName)
func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool {
moduleAddr := k.AuthKeeper.GetModuleAddress(types.ModuleName)
if addr.Equals(moduleAddr) {
return false
}

return k.bankKeeper.BlockedAddr(addr)
return k.BankKeeper.BlockedAddr(addr)
}
6 changes: 3 additions & 3 deletions modules/apps/transfer/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (m Migrator) MigrateDenomMetadata(ctx sdk.Context) error {
m.keeper.iterateDenomTraces(ctx,
func(dt internaltypes.DenomTrace) (stop bool) {
// check if the metadata for the given denom trace does not already exist
if !m.keeper.bankKeeper.HasDenomMetaData(ctx, dt.IBCDenom()) {
if !m.keeper.BankKeeper.HasDenomMetaData(ctx, dt.IBCDenom()) {
m.keeper.setDenomMetadataWithDenomTrace(ctx, dt)
}
return false
Expand All @@ -61,7 +61,7 @@ func (m Migrator) MigrateTotalEscrowForDenom(ctx sdk.Context) error {
transferChannels := m.keeper.channelKeeper.GetAllChannelsWithPortPrefix(ctx, portID)
for _, channel := range transferChannels {
escrowAddress := types.GetEscrowAddress(portID, channel.ChannelId)
escrowBalances := m.keeper.bankKeeper.GetAllBalances(ctx, escrowAddress)
escrowBalances := m.keeper.BankKeeper.GetAllBalances(ctx, escrowAddress)

totalEscrowed = totalEscrowed.Add(escrowBalances...)
}
Expand Down Expand Up @@ -164,5 +164,5 @@ func (k Keeper) setDenomMetadataWithDenomTrace(ctx sdk.Context, denomTrace inter
Symbol: strings.ToUpper(denomTrace.BaseDenom),
}

k.bankKeeper.SetDenomMetaData(ctx, metadata)
k.BankKeeper.SetDenomMetaData(ctx, metadata)
}
10 changes: 5 additions & 5 deletions modules/apps/transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.

coins := msg.GetCoins()

if err := k.bankKeeper.IsSendEnabledCoins(ctx, coins...); err != nil {
if err := k.BankKeeper.IsSendEnabledCoins(ctx, coins...); err != nil {
return nil, errorsmod.Wrapf(types.ErrSendDisabled, err.Error())
}

if k.isBlockedAddr(sender) {
if k.IsBlockedAddr(sender) {
return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", sender)
}

Expand Down Expand Up @@ -82,7 +82,7 @@ func (k Keeper) unwindHops(ctx sdk.Context, msg *types.MsgTransfer) (*types.MsgT
msg.Forwarding.Hops = append(unwindHops[1:], msg.Forwarding.Hops...)
msg.Forwarding.Unwind = false

// Message is validate again, this would only fail if hops now exceeds maximum allowed.
// Message is validated again, this would only fail if hops now exceeds maximum allowed.
if err := msg.ValidateBasic(); err != nil {
return nil, err
}
Expand All @@ -98,7 +98,7 @@ func (k Keeper) getUnwindHops(ctx sdk.Context, coins sdk.Coins) ([]types.Hop, er
return nil, errorsmod.Wrap(types.ErrInvalidForwarding, "coins cannot be empty")
}

token, err := k.tokenFromCoin(ctx, coins[0])
token, err := k.TokenFromCoin(ctx, coins[0])
if err != nil {
return nil, err
}
Expand All @@ -109,7 +109,7 @@ func (k Keeper) getUnwindHops(ctx sdk.Context, coins sdk.Coins) ([]types.Hop, er

unwindTrace := token.Denom.Trace
for _, coin := range coins[1:] {
token, err := k.tokenFromCoin(ctx, coin)
token, err := k.TokenFromCoin(ctx, coin)
if err != nil {
return nil, err
}
Expand Down
Loading
Loading