Skip to content

Commit

Permalink
Refactor store_* and get_* methods to take *Path structs instead (#419)
Browse files Browse the repository at this point in the history
* Implement *Path for get_* and store_* methods

* Refactor Path structure to be singular

* cargo fmt

* Add changelog entry

* Fix some args

* Fix some other path args in ics04

* Mend some naming mistakes

* Pass path args by reference into store_* methods
  • Loading branch information
Farhad-Shabani authored Feb 13, 2023
1 parent 649e7bd commit d5a4416
Show file tree
Hide file tree
Showing 32 changed files with 892 additions and 851 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Refactor get_* and store_* methods to take *Path structs instead
([#382](https://github.com/cosmos/ibc-rs/issues/382))
8 changes: 5 additions & 3 deletions crates/ibc/src/applications/transfer/relay/send_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::applications::transfer::packet::PacketData;
use crate::applications::transfer::{is_sender_chain_source, Coin, PrefixedCoin};
use crate::core::ics04_channel::handler::send_packet::send_packet;
use crate::core::ics04_channel::packet::Packet;
use crate::core::ics24_host::path::{ChannelEndPath, SeqSendPath};
use crate::events::ModuleEvent;
use crate::handler::{HandlerOutput, HandlerOutputBuilder};
use crate::prelude::*;
Expand All @@ -25,9 +26,9 @@ where
if !ctx.is_send_enabled() {
return Err(TokenTransferError::SendDisabled);
}

let chan_end_path_on_a = ChannelEndPath::new(&msg.port_on_a, &msg.chan_on_a);
let chan_end_on_a = ctx
.channel_end(&msg.port_on_a, &msg.chan_on_a)
.channel_end(&chan_end_path_on_a)
.map_err(TokenTransferError::PacketError)?;

let port_on_b = chan_end_on_a.counterparty().port_id().clone();
Expand All @@ -41,8 +42,9 @@ where
.clone();

// get the next sequence
let seq_send_path_on_a = SeqSendPath::new(&msg.port_on_a, &msg.chan_on_a);
let sequence = ctx
.get_next_sequence_send(&msg.port_on_a, &msg.chan_on_a)
.get_next_sequence_send(&seq_send_path_on_a)
.map_err(TokenTransferError::PacketError)?;

let token = msg
Expand Down
259 changes: 116 additions & 143 deletions crates/ibc/src/clients/ics07_tendermint/client_state.rs

Large diffs are not rendered by default.

Loading

0 comments on commit d5a4416

Please sign in to comment.