Skip to content

Commit

Permalink
test(e2e): added test case for transfer packet originating in counter…
Browse files Browse the repository at this point in the history
…party (#6)

* random imps

* fix some issues

* imp: tests added

* e2e: works

* works
  • Loading branch information
srdtrk authored Jul 8, 2024
1 parent 271ca4e commit a4155e2
Show file tree
Hide file tree
Showing 11 changed files with 238 additions and 60 deletions.
64 changes: 36 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ cw-ibc-lite-ics02-client = { version = "0.1.0", path = "./contracts/ics02-client
cw-ibc-lite-ics26-router = { version = "0.1.0", path = "./contracts/ics26-router/", default-features = false }
sha2 = "0.10.8"
ibc-proto = { version = "0.46.0", default-features = false }
anybuf = "0.5.0"
derive_more = { version = "0.99.18", default-features = false, features = [ "from", "into", "display", "try_into" ] }
proc-macro2 = "1.0"
quote = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions contracts/ics20-transfer/src/ibc/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ pub fn on_recv_packet(
let ics20_packet: Ics20Packet = cosmwasm_std::from_json(packet.data)?;
let base_denom = utils::transfer::parse_voucher_denom(
&ics20_packet.denom,
port_id.as_str(),
packet.destination_channel.as_str(),
packet.source_port.as_str(),
packet.source_channel.as_str(),
)?;

// Subtract amount from the escrowed balance.
Expand Down
1 change: 1 addition & 0 deletions contracts/ics26-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ cw-ibc-lite-shared = { workspace = true }
cw-ibc-lite-ics02-client = { workspace = true }
ibc-client-cw = { workspace = true }
cw-ownable = { workspace = true }
anybuf = { workspace = true }
11 changes: 5 additions & 6 deletions contracts/ics26-router/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,11 @@ mod reply {
) -> Result<Response, ContractError> {
match result {
SubMsgResult::Ok(resp) => {
// TODO: allow depracated until we have working tests and then change it.
#[allow(deprecated)]
let ack: ibc::Acknowledgement = resp
.data
.ok_or(ContractError::RecvPacketCallbackNoResponse)?
.try_into()?;
let ack = ibc::Acknowledgement::new(
anybuf::Bufany::deserialize(&resp.msg_responses[0].value)?
.bytes(1)
.unwrap(),
);
let packet: ibc::Packet = cosmwasm_std::from_json(payload)?;

state::helpers::commit_packet_ack(deps.storage, &packet, &ack)?;
Expand Down
2 changes: 1 addition & 1 deletion e2e/interchaintestv8/chainconfig/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var DefaultChainSpecs = []*interchaintest.ChainSpec{
Images: []ibc.DockerImage{
{
Repository: "ghcr.io/cosmos/ibc-go-simd", // FOR LOCAL IMAGE USE: Docker Image Name
Version: "serdar-xxx-ibc-lite-e2e-image", // FOR LOCAL IMAGE USE: Docker Image Tag
Version: "serdar-xxx-ibc-lite-e2e-debug", // FOR LOCAL IMAGE USE: Docker Image Tag
UidGid: "1025:1025",
},
},
Expand Down
Loading

0 comments on commit a4155e2

Please sign in to comment.