From 31ab913aa5bb2bcde4e47746e9c36c8927971bc8 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Fri, 17 Nov 2023 22:39:10 +0100 Subject: [PATCH] solana-ibc: remove unused storage fields Some of them were only ever set. connection_id_set was never even changed. The identifier sets can be determined from other fields so if off-chain code needs that information it can easily get it. --- .../programs/solana-ibc/src/execution_context.rs | 3 --- solana/solana-ibc/programs/solana-ibc/src/storage.rs | 11 ++--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs index e57a155a..179a9c33 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs @@ -48,7 +48,6 @@ impl ClientExecutionContext for IbcStorage<'_, '_> { )?; let key = path.0.to_string(); store.private.clients.insert(key.clone(), serialized); - store.private.client_id_set.push(key); Ok(()) } @@ -71,7 +70,6 @@ impl ClientExecutionContext for IbcStorage<'_, '_> { let height = Height::new(path.epoch, path.height)?; let key = (path.client_id.to_string(), height); store.private.consensus_states.insert(key, serialized); - store.private.height = height; Ok(()) } @@ -299,7 +297,6 @@ impl ExecutionContext for IbcStorage<'_, '_> { )?; let key = (path.0.to_string(), path.1.to_string()); store.private.channel_ends.insert(key.clone(), serialized); - store.private.port_channel_id_set.push(key); Ok(()) } diff --git a/solana/solana-ibc/programs/solana-ibc/src/storage.rs b/solana/solana-ibc/programs/solana-ibc/src/storage.rs index cd2707a5..2ae22d26 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/storage.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/storage.rs @@ -82,10 +82,7 @@ pub struct IBCPackets(pub Vec); /// All the structs from IBC are stored as String since they dont implement /// AnchorSerialize and AnchorDeserialize pub(crate) struct PrivateStorage { - pub height: Height, pub clients: BTreeMap, - /// The client ids of the clients. - pub client_id_set: Vec, pub client_counter: u64, pub client_processed_times: BTreeMap>, @@ -93,19 +90,15 @@ pub(crate) struct PrivateStorage { BTreeMap>, pub consensus_states: BTreeMap<(InnerClientId, Height), InnerConsensusState>, - /// This collection contains the heights corresponding to all consensus states of - /// all clients stored in the contract. + /// This collection contains the heights corresponding to all consensus + /// states of all clients stored in the contract. pub client_consensus_state_height_sets: BTreeMap>, - /// The connection ids of the connections. - pub connection_id_set: Vec, pub connection_counter: u64, pub connections: BTreeMap, pub channel_ends: BTreeMap<(InnerPortId, InnerChannelId), InnerChannelEnd>, // Contains the client id corresponding to the connectionId pub client_to_connection: BTreeMap, - /// The port and channel id tuples of the channels. - pub port_channel_id_set: Vec<(InnerPortId, InnerChannelId)>, pub channel_counter: u64, /// The sequence numbers of the packet commitments.