Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Dec 18, 2024
1 parent 1d9a01f commit 29fde42
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion cosmwasm/union-ibc/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- `union-ibc`: [union17e93ukhcyesrvu72cgfvamdhyracghrx4f7ww89rqjg944ntdegscxepme](https://explorer.testnet-9.union.build/union/cosmwasm/0/transactions?contract=union17e93ukhcyesrvu72cgfvamdhyracghrx4f7ww89rqjg944ntdegscxepme)
- `etheruem-light-client`: [union198amaja0zfw53czzfph55xlhwf736qkrcvppx6y3a5rkqmxaj9fshqmczk](https://explorer.testnet-9.union.build/union/cosmwasm/0/transactions?contract=union198amaja0zfw53czzfph55xlhwf736qkrcvppx6y3a5rkqmxaj9fshqmczk)
- `union-ibc-ucs00-pingpong`: [union194e3rchcaqyynwcj6qr6647ge7lheymrgkhq9tdknw35050ufhuqzqz2he](https://explorer.testnet-9.union.build/union/cosmwasm/0/transactions?contract=union194e3rchcaqyynwcj6qr6647ge7lheymrgkhq9tdknw35050ufhuqzqz2he)
- `union-ibc-ucs00-pingpong`: [union1aj2z8mf6ppg4pjsj787t69phxy3mx8p7ce8ncem05lls5j29haxsumypzd](https://explorer.testnet-9.union.build/union/cosmwasm/0/transactions?contract=union194e3rchcaqyynwcj6qr6647ge7lheymrgkhq9tdknw35050ufhuqzqz2he)
18 changes: 17 additions & 1 deletion lib/ibc-union-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,34 +659,38 @@ pub struct ConnectionMetadata {
}

#[cfg(feature = "tracing")]
pub fn log_event(e: &FullEvent) {
pub fn log_event(e: &FullEvent, chain_id: &voyager_core::ChainId) {
use tracing::info;

let event = e.name();

match e {
FullEvent::CreateClient(e) => info!(
event,
%chain_id,
data.client_id = %e.client_id,
data.client_type = %e.client_type,
"event"
),
FullEvent::UpdateClient(e) => info!(
event,
%chain_id,
data.client_id = %e.client_id,
data.client_type = %e.client_type,
data.height = e.height,
"event"
),
FullEvent::ConnectionOpenInit(e) => info!(
event,
%chain_id,
data.connection_id = %e.connection_id,
data.client_id = %e.client_id,
data.counterparty_client_id = %e.counterparty_client_id,
"event"
),
FullEvent::ConnectionOpenTry(e) => info!(
event,
%chain_id,
data.connection_id = %e.connection_id,
data.client_id = %e.client_id,
data.counterparty_client_id = %e.counterparty_client_id,
Expand All @@ -695,6 +699,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ConnectionOpenAck(e) => info!(
event,
%chain_id,
data.connection_id = %e.connection_id,
data.client_id = %e.client_id,
data.counterparty_client_id = %e.counterparty_client_id,
Expand All @@ -703,6 +708,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ConnectionOpenConfirm(e) => info!(
event,
%chain_id,
data.connection_id = %e.connection_id,
data.client_id = %e.client_id,
data.counterparty_client_id = %e.counterparty_client_id,
Expand All @@ -711,6 +717,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ChannelOpenInit(e) => info!(
event,
%chain_id,
data.port_id = %e.port_id,
data.channel_id = %e.channel_id,
data.counterparty_port_id = %e.counterparty_port_id,
Expand All @@ -723,6 +730,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ChannelOpenTry(e) => info!(
event,
%chain_id,
data.port_id = %e.port_id,
data.channel_id = %e.channel_id,
data.counterparty_port_id = %e.counterparty_port_id,
Expand All @@ -736,6 +744,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ChannelOpenAck(e) => info!(
event,
%chain_id,
data.port_id = %e.port_id,
data.channel_id = %e.channel_id,
data.counterparty_port_id = %e.counterparty_port_id,
Expand All @@ -749,6 +758,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::ChannelOpenConfirm(e) => info!(
event,
%chain_id,
data.port_id = %e.port_id,
data.channel_id = %e.channel_id,
data.counterparty_port_id = %e.counterparty_port_id,
Expand All @@ -764,6 +774,7 @@ pub fn log_event(e: &FullEvent) {
FullEvent::ChannelCloseConfirm(e) => info!(event, "event"),
FullEvent::PacketSend(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,

data.packet.source_channel.channel_id = %e.packet.source_channel.channel_id,
Expand All @@ -782,6 +793,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::PacketRecv(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,
data.relayer_msg = %e.relayer_msg,

Expand All @@ -801,6 +813,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::IntentPacketRecv(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,
data.market_maker_msg = %e.market_maker_msg,

Expand All @@ -820,6 +833,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::WriteAck(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,
data.acknowledgement = %e.acknowledgement,

Expand All @@ -839,6 +853,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::PacketAck(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,
data.acknowledgement = %e.acknowledgement,

Expand All @@ -858,6 +873,7 @@ pub fn log_event(e: &FullEvent) {
),
FullEvent::PacketTimeout(e) => info!(
event,
%chain_id,
data.packet_data = %e.packet_data,

data.packet.source_channel.channel_id = %e.packet.source_channel.channel_id,
Expand Down
2 changes: 1 addition & 1 deletion voyager/plugins/event-source/cosmos-sdk/src/ibc_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ event! {
connection_id: u32,
},

#[event(tag = "wasm-send_packet")]
#[event(tag = "wasm-packet_send")]
UnionSendPacket {
#[parse(serde_json::from_str)]
packet: ibc_solidity::Packet,
Expand Down
18 changes: 9 additions & 9 deletions voyager/plugins/event-source/cosmos-sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1049,7 +1049,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1084,7 +1084,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1121,7 +1121,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1158,7 +1158,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1195,7 +1195,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1244,7 +1244,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1305,7 +1305,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1384,7 +1384,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down
42 changes: 21 additions & 21 deletions voyager/plugins/event-source/ethereum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -323,7 +323,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -356,7 +356,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -389,7 +389,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -422,7 +422,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -455,7 +455,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -513,7 +513,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -572,7 +572,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -631,7 +631,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -690,7 +690,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -735,7 +735,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -772,7 +772,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -810,7 +810,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -849,7 +849,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -887,7 +887,7 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
}
.into();

ibc_union_spec::log_event(&event);
ibc_union_spec::log_event(&event, &self.chain_id);

Ok(data(ChainEvent {
chain_id: self.chain_id.clone(),
Expand Down Expand Up @@ -1019,14 +1019,14 @@ impl PluginServer<ModuleCall, ModuleCallback> for Module {
Ibc::IbcEvents::ChannelCloseConfirm(
channel_close_confirm,
) => IbcEvents::ChannelCloseConfirm(channel_close_confirm),
Ibc::IbcEvents::PacketSend(send_packet) => {
IbcEvents::PacketSend(send_packet)
Ibc::IbcEvents::PacketSend(packet_send) => {
IbcEvents::PacketSend(packet_send)
}
Ibc::IbcEvents::PacketRecv(recv_packet) => {
IbcEvents::PacketRecv(recv_packet)
Ibc::IbcEvents::PacketRecv(packet_recv) => {
IbcEvents::PacketRecv(packet_recv)
}
Ibc::IbcEvents::IntentPacketRecv(recv_intent_packet) => {
IbcEvents::IntentPacketRecv(recv_intent_packet)
Ibc::IbcEvents::IntentPacketRecv(intent_packet_recv) => {
IbcEvents::IntentPacketRecv(intent_packet_recv)
}
Ibc::IbcEvents::WriteAck(write_acknowledgement) => {
IbcEvents::WriteAck(write_acknowledgement)
Expand Down

0 comments on commit 29fde42

Please sign in to comment.