Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Dec 20, 2024
1 parent 05c5a65 commit 848d8bb
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 36 deletions.
12 changes: 6 additions & 6 deletions lib/ibc-union-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ impl Datagram {
Self::ConnectionOpenTry(msg) => Some(Height::new(msg.proof_height)),
Self::ConnectionOpenAck(msg) => Some(Height::new(msg.proof_height)),
Self::ConnectionOpenConfirm(msg) => Some(Height::new(msg.proof_height)),
Self::ChannelOpenInit(_msg) => todo!(),
Self::ChannelOpenTry(_msg) => todo!(),
Self::ChannelOpenAck(_msg) => todo!(),
Self::ChannelOpenConfirm(_msg) => todo!(),
Self::ChannelOpenInit(msg) => None,
Self::ChannelOpenTry(msg) => Some(Height::new(msg.proof_height)),
Self::ChannelOpenAck(msg) => Some(Height::new(msg.proof_height)),
Self::ChannelOpenConfirm(msg) => Some(Height::new(msg.proof_height)),
Self::ChannelCloseInit(_msg) => todo!(),
Self::ChannelCloseConfirm(_msg) => todo!(),
Self::PacketRecv(_msg) => todo!(),
Self::PacketAcknowledgement(_msg) => todo!(),
Self::PacketRecv(msg) => Some(Height::new(msg.proof_height)),
Self::PacketAcknowledgement(msg) => Some(Height::new(msg.proof_height)),
Self::PacketTimeout(_msg) => todo!(),
Self::IntentPacketRecv(_msg) => todo!(),
Self::BatchSend(_msg) => todo!(),
Expand Down
2 changes: 0 additions & 2 deletions voyager/plugins/event-source/cosmos-sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,8 +1028,6 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}))
}
IbcEvent::UnionUpdateClient(update_client) => {
dbg!(&update_client);

let client_info = voyager_client
.client_info::<IbcUnion>(self.chain_id.clone(), update_client.client_id)
.await?;
Expand Down
72 changes: 46 additions & 26 deletions voyager/plugins/transaction/cosmos-sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use jsonrpsee::{
use prost::Message;
use serde::{Deserialize, Serialize};
use sha2::Digest;
use tracing::{debug, error, info, instrument, warn};
use tracing::{debug, error, info, instrument, trace, warn};
use unionlabs::{
self,
bech32::Bech32,
Expand Down Expand Up @@ -175,7 +175,7 @@ impl Module {
.with(|signer| {
let msgs = msgs.clone();

dbg!(&msgs);
trace!(?msgs);

async move {
// TODO: Figure out a way to thread this value through
Expand Down Expand Up @@ -355,8 +355,6 @@ impl Module {

auth_info.fee = self.gas_config.mk_fee(simulation_gas_info.gas_used);

// dbg!(&auth_info.fee);

info!(
fee = %auth_info.fee.amount[0].amount,
gas_multiplier = %self.gas_config.gas_multiplier,
Expand Down Expand Up @@ -474,10 +472,11 @@ impl Module {
"cosmos transaction failed"
);

if let Some(union_ibc_error) = tx.tx_result.log.split(": ").find_map(|x| {
// dbg!(x);
union_ibc::ContractErrorKind::parse_from_error_message(x)
}) {
if let Some(union_ibc_error) =
tx.tx_result.log.split(": ").find_map(|x| {
union_ibc::ContractErrorKind::parse_from_error_message(x)
})
{
break Err(BroadcastTxCommitError::UnionIbcError(union_ibc_error));
} else {
break Err(BroadcastTxCommitError::Tx(error));
Expand Down Expand Up @@ -1004,10 +1003,26 @@ fn process_msgs(
.unwrap(),
funds: vec![],
}),
ibc_union_spec::Datagram::ChannelOpenInit(_msg_channel_open_init) => todo!(),
ibc_union_spec::Datagram::ChannelOpenTry(msg_channel_open_try) => {
dbg!(&msg_channel_open_try);
ibc_union_spec::Datagram::ChannelOpenInit(msg_channel_open_init) => {
let channel_open_init = union_ibc_msg::msg::ExecuteMsg::ChannelOpenInit(
union_ibc_msg::msg::MsgChannelOpenInit {
port_id: String::from_utf8(msg_channel_open_init.port_id.to_vec())
.unwrap(),
relayer: signer.to_string(),
counterparty_port_id: msg_channel_open_init.counterparty_port_id,
connection_id: msg_channel_open_init.connection_id,
version: msg_channel_open_init.version,
},
);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
msg: serde_json::to_vec(&channel_open_init).unwrap(),
funds: vec![],
})
}
ibc_union_spec::Datagram::ChannelOpenTry(msg_channel_open_try) => {
let channel_open_try = union_ibc_msg::msg::ExecuteMsg::ChannelOpenTry(
union_ibc_msg::msg::MsgChannelOpenTry {
port_id: String::from_utf8(msg_channel_open_try.port_id.to_vec())
Expand All @@ -1020,19 +1035,34 @@ fn process_msgs(
},
);

dbg!(&channel_open_try);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
msg: serde_json::to_vec(&channel_open_try).unwrap(),
funds: vec![],
})
}
ibc_union_spec::Datagram::ChannelOpenAck(_msg_channel_open_ack) => todo!(),
ibc_union_spec::Datagram::ChannelOpenConfirm(msg_channel_open_confirm) => {
dbg!(&msg_channel_open_confirm);
ibc_union_spec::Datagram::ChannelOpenAck(msg_channel_open_ack) => {
let channel_open_ack = union_ibc_msg::msg::ExecuteMsg::ChannelOpenAck(
union_ibc_msg::msg::MsgChannelOpenAck {
channel_id: msg_channel_open_ack.channel_id,
counterparty_version: msg_channel_open_ack.counterparty_version,
counterparty_channel_id: msg_channel_open_ack
.counterparty_channel_id,
proof_try: msg_channel_open_ack.proof_try,
proof_height: msg_channel_open_ack.proof_height,
relayer: signer.to_string(),
},
);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
msg: serde_json::to_vec(&channel_open_ack).unwrap(),
funds: vec![],
})
}
ibc_union_spec::Datagram::ChannelOpenConfirm(msg_channel_open_confirm) => {
let channel_open_confirm =
union_ibc_msg::msg::ExecuteMsg::ChannelOpenConfirm(
union_ibc_msg::msg::MsgChannelOpenConfirm {
Expand All @@ -1043,8 +1073,6 @@ fn process_msgs(
},
);

dbg!(&channel_open_confirm);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
Expand All @@ -1057,8 +1085,6 @@ fn process_msgs(
todo!()
}
ibc_union_spec::Datagram::PacketRecv(msg_packet_recv) => {
dbg!(&msg_packet_recv);

let packet_recv = union_ibc_msg::msg::ExecuteMsg::PacketRecv(
union_ibc_msg::msg::MsgPacketRecv {
packets: msg_packet_recv.packets,
Expand All @@ -1069,8 +1095,6 @@ fn process_msgs(
},
);

dbg!(&packet_recv);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
Expand All @@ -1079,8 +1103,6 @@ fn process_msgs(
})
}
ibc_union_spec::Datagram::PacketAcknowledgement(msg_packet_acknowledgement) => {
dbg!(&msg_packet_acknowledgement);

let packet_recv = union_ibc_msg::msg::ExecuteMsg::PacketAck(
union_ibc_msg::msg::MsgPacketAcknowledgement {
packets: msg_packet_acknowledgement.packets,
Expand All @@ -1091,8 +1113,6 @@ fn process_msgs(
},
);

dbg!(&packet_recv);

mk_any(&protos::cosmwasm::wasm::v1::MsgExecuteContract {
sender: signer.to_string(),
contract: ibc_host_contract_address.to_string(),
Expand Down
4 changes: 2 additions & 2 deletions voyager/plugins/transaction/ethereum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use jsonrpsee::{
Extensions,
};
use serde::{Deserialize, Serialize};
use tracing::{error, info, info_span, instrument, warn, Instrument};
use tracing::{error, info, info_span, instrument, trace, warn, Instrument};
use unionlabs::{
hash::{H160, H256},
ErrorReporter,
Expand Down Expand Up @@ -510,7 +510,7 @@ fn process_msgs<T: Transport + Clone, P: Provider<T>>(
msgs: Vec<Datagram>,
relayer: H160,
) -> RpcResult<Vec<(Datagram, RawCallBuilder<T, &P>)>> {
dbg!(&msgs);
trace!(?msgs);

msgs.clone()
.into_iter()
Expand Down

0 comments on commit 848d8bb

Please sign in to comment.