Skip to content

Commit

Permalink
feat(voyager): use new evm events in block fetching
Browse files Browse the repository at this point in the history
allowed us to remove an entire aggregation step since the events now
contain more data
  • Loading branch information
benluelo committed May 15, 2024
1 parent 2288aaf commit 02699af
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 345 deletions.
22 changes: 18 additions & 4 deletions evm/contracts/core/03-connection/IBCConnection.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ library IBCConnectionLib {
string connectionId, string clientId, string counterpartyClientId
);
event ConnectionOpenTry(
string connectionId, string clientId, string counterpartyClientId
string connectionId,
string clientId,
string counterpartyClientId,
string counterpartyConnectionId
);
event ConnectionOpenAck(
string connectionId, string clientId, string counterpartyClientId
string connectionId,
string clientId,
string counterpartyClientId,
string counterpartyConnectionId
);
event ConnectionOpenConfirm(
string connectionId, string clientId, string counterpartyClientId
string connectionId,
string clientId,
string counterpartyClientId,
string counterpartyConnectionId
);

error ErrConnectionAlreadyExists();
Expand Down Expand Up @@ -443,7 +452,10 @@ contract IBCConnection is IBCStore, IIBCConnectionHandshake {
updateConnectionCommitment(connectionId);

emit IBCConnectionLib.ConnectionOpenTry(
connectionId, msg_.clientId, msg_.counterparty.client_id
connectionId,
msg_.clientId,
msg_.counterparty.client_id,
msg_.counterparty.connection_id
);

return connectionId;
Expand Down Expand Up @@ -525,6 +537,7 @@ contract IBCConnection is IBCStore, IIBCConnectionHandshake {
emit IBCConnectionLib.ConnectionOpenAck(
msg_.connectionId,
connection.client_id,
connection.counterparty.client_id,
connection.counterparty.connection_id
);
}
Expand Down Expand Up @@ -581,6 +594,7 @@ contract IBCConnection is IBCStore, IIBCConnectionHandshake {
emit IBCConnectionLib.ConnectionOpenConfirm(
msg_.connectionId,
connection.client_id,
connection.counterparty.client_id,
connection.counterparty.connection_id
);
}
Expand Down
30 changes: 23 additions & 7 deletions generated/rust/contracts/src/ibc_connection.rs

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions lib/block-message/src/chain_impls/arbitrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use unionlabs::{ethereum::config::Mainnet, traits::Chain};
use crate::{
aggregate::{Aggregate, AnyAggregate},
chain_impls::ethereum::{
fetch_beacon_block_range, fetch_channel, fetch_connection, fetch_get_logs,
AggregateWithChannel, AggregateWithConnection, ChannelData, ConnectionData,
FetchBeaconBlockRange, FetchChannel, FetchConnection, FetchEvents, FetchGetLogs,
fetch_beacon_block_range, fetch_channel, fetch_get_logs, AggregateWithChannel, ChannelData,
ConnectionData, FetchBeaconBlockRange, FetchChannel, FetchEvents, FetchGetLogs,
},
data::{AnyData, ChainEvent, Data},
fetch::{AnyFetch, DoFetch, DoFetchBlockRange, Fetch, FetchBlockRange},
Expand Down Expand Up @@ -66,7 +65,6 @@ where
fetch_beacon_block_range(c, beacon_block_range, &c.l1.beacon_api_client).await
}
ArbitrumFetch::FetchChannel(channel) => fetch_channel(c, channel).await,
ArbitrumFetch::FetchConnection(connection) => fetch_connection(c, connection).await,
}
}
}
Expand All @@ -79,7 +77,6 @@ pub enum ArbitrumFetch {
FetchBeaconBlockRange(FetchBeaconBlockRange),

FetchChannel(FetchChannel<Arbitrum>),
FetchConnection(FetchConnection<Arbitrum>),
}

#[queue_msg]
Expand All @@ -92,7 +89,6 @@ pub struct FetchBatchIndex {
#[derive(Enumorph)]
pub enum ArbitrumAggregate {
AggregateWithChannel(AggregateWithChannel<Arbitrum>),
AggregateWithConnection(AggregateWithConnection<Arbitrum>),
}

impl DoAggregate for Identified<Arbitrum, ArbitrumAggregate>
Expand All @@ -108,9 +104,6 @@ where
) -> QueueMsg<BlockMessageTypes> {
match t {
ArbitrumAggregate::AggregateWithChannel(msg) => do_aggregate(id(chain_id, msg), data),
ArbitrumAggregate::AggregateWithConnection(msg) => {
do_aggregate(id(chain_id, msg), data)
}
}
}
}
Expand Down
Loading

0 comments on commit 02699af

Please sign in to comment.