From 29fde42ce5269d50615f2531b7ffb88e3892c235 Mon Sep 17 00:00:00 2001 From: benluelo Date: Wed, 18 Dec 2024 21:40:18 +0000 Subject: [PATCH] wip --- cosmwasm/union-ibc/README.md | 2 +- lib/ibc-union-spec/src/lib.rs | 18 +++++++- .../event-source/cosmos-sdk/src/ibc_events.rs | 2 +- .../event-source/cosmos-sdk/src/main.rs | 18 ++++---- .../plugins/event-source/ethereum/src/main.rs | 42 +++++++++---------- 5 files changed, 49 insertions(+), 33 deletions(-) diff --git a/cosmwasm/union-ibc/README.md b/cosmwasm/union-ibc/README.md index 61d988f1d3..722db772a3 100644 --- a/cosmwasm/union-ibc/README.md +++ b/cosmwasm/union-ibc/README.md @@ -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) diff --git a/lib/ibc-union-spec/src/lib.rs b/lib/ibc-union-spec/src/lib.rs index 2da40772ae..f0ee5f779e 100644 --- a/lib/ibc-union-spec/src/lib.rs +++ b/lib/ibc-union-spec/src/lib.rs @@ -659,7 +659,7 @@ 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(); @@ -667,12 +667,14 @@ pub fn log_event(e: &FullEvent) { 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, @@ -680,6 +682,7 @@ pub fn log_event(e: &FullEvent) { ), 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, @@ -687,6 +690,7 @@ pub fn log_event(e: &FullEvent) { ), 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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/voyager/plugins/event-source/cosmos-sdk/src/ibc_events.rs b/voyager/plugins/event-source/cosmos-sdk/src/ibc_events.rs index 8d29eb67f6..600b66c44e 100644 --- a/voyager/plugins/event-source/cosmos-sdk/src/ibc_events.rs +++ b/voyager/plugins/event-source/cosmos-sdk/src/ibc_events.rs @@ -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, diff --git a/voyager/plugins/event-source/cosmos-sdk/src/main.rs b/voyager/plugins/event-source/cosmos-sdk/src/main.rs index 483ba6e339..6931fe564f 100644 --- a/voyager/plugins/event-source/cosmos-sdk/src/main.rs +++ b/voyager/plugins/event-source/cosmos-sdk/src/main.rs @@ -1015,7 +1015,7 @@ impl PluginServer 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(), @@ -1049,7 +1049,7 @@ impl PluginServer 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(), @@ -1084,7 +1084,7 @@ impl PluginServer 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(), @@ -1121,7 +1121,7 @@ impl PluginServer 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(), @@ -1158,7 +1158,7 @@ impl PluginServer 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(), @@ -1195,7 +1195,7 @@ impl PluginServer 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(), @@ -1244,7 +1244,7 @@ impl PluginServer 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(), @@ -1305,7 +1305,7 @@ impl PluginServer 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(), @@ -1384,7 +1384,7 @@ impl PluginServer 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(), diff --git a/voyager/plugins/event-source/ethereum/src/main.rs b/voyager/plugins/event-source/ethereum/src/main.rs index a745008f3c..dd3647a98e 100644 --- a/voyager/plugins/event-source/ethereum/src/main.rs +++ b/voyager/plugins/event-source/ethereum/src/main.rs @@ -286,7 +286,7 @@ impl PluginServer 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(), @@ -323,7 +323,7 @@ impl PluginServer 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(), @@ -356,7 +356,7 @@ impl PluginServer 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(), @@ -389,7 +389,7 @@ impl PluginServer 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(), @@ -422,7 +422,7 @@ impl PluginServer 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(), @@ -455,7 +455,7 @@ impl PluginServer 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(), @@ -513,7 +513,7 @@ impl PluginServer 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(), @@ -572,7 +572,7 @@ impl PluginServer 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(), @@ -631,7 +631,7 @@ impl PluginServer 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(), @@ -690,7 +690,7 @@ impl PluginServer 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(), @@ -735,7 +735,7 @@ impl PluginServer 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(), @@ -772,7 +772,7 @@ impl PluginServer 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(), @@ -810,7 +810,7 @@ impl PluginServer 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(), @@ -849,7 +849,7 @@ impl PluginServer 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(), @@ -887,7 +887,7 @@ impl PluginServer 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(), @@ -1019,14 +1019,14 @@ impl PluginServer 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)