Skip to content

Commit

Permalink
solana-ibc: remove unused storage fields
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mina86 committed Nov 17, 2023
1 parent 5fc2d59 commit 31ab913
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand All @@ -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(())
}

Expand Down Expand Up @@ -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(())
}

Expand Down
11 changes: 2 additions & 9 deletions solana/solana-ibc/programs/solana-ibc/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,23 @@ pub struct IBCPackets(pub Vec<PacketMsg>);
/// 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<InnerClientId, InnerClient>,
/// The client ids of the clients.
pub client_id_set: Vec<InnerClientId>,
pub client_counter: u64,
pub client_processed_times:
BTreeMap<InnerClientId, BTreeMap<Height, SolanaTimestamp>>,
pub client_processed_heights:
BTreeMap<InnerClientId, BTreeMap<Height, HostHeight>>,
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<InnerClientId, Vec<Height>>,
/// The connection ids of the connections.
pub connection_id_set: Vec<InnerConnectionId>,
pub connection_counter: u64,
pub connections: BTreeMap<InnerConnectionId, InnerConnectionEnd>,
pub channel_ends: BTreeMap<(InnerPortId, InnerChannelId), InnerChannelEnd>,
// Contains the client id corresponding to the connectionId
pub client_to_connection: BTreeMap<InnerClientId, InnerConnectionId>,
/// 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.
Expand Down

0 comments on commit 31ab913

Please sign in to comment.