Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solana-ibc: make some modules public #119

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions solana/solana-ibc/programs/solana-ibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ use ibc::core::ics24_host::identifier::PortId;
use ibc::core::router::{Module, ModuleId, Router};
use ibc::core::MsgEnvelope;

const CHAIN_SEED: &[u8] = b"chain";
const PACKET_SEED: &[u8] = b"packet";
const SOLANA_IBC_STORAGE_SEED: &[u8] = b"private";
const TRIE_SEED: &[u8] = b"trie";
pub const CHAIN_SEED: &[u8] = b"chain";
pub const PACKET_SEED: &[u8] = b"packet";
pub const SOLANA_IBC_STORAGE_SEED: &[u8] = b"private";
pub const TRIE_SEED: &[u8] = b"trie";

declare_id!("EnfDJsAK7BGgetnmKzBx86CsgC5kfSPcsktFCQ4YLC81");

mod chain;
mod client_state;
mod consensus_state;
pub mod chain;
pub mod client_state;
pub mod consensus_state;
mod ed25519;
mod error;
mod events;
pub mod events;
mod execution_context;
mod host;
mod storage;
pub mod storage;
#[cfg(test)]
mod tests;
mod transfer;
Expand Down
22 changes: 11 additions & 11 deletions solana/solana-ibc/programs/solana-ibc/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ mod ibc {
pub use ibc::Height;
}

pub(crate) mod ids;
pub(crate) mod trie_key;
pub mod ids;
pub mod trie_key;

pub(crate) type SolanaTimestamp = u64;
pub(crate) type InnerPortId = String;
Expand All @@ -39,21 +39,21 @@ pub(crate) type InnerChannelId = String;
borsh::BorshSerialize,
borsh::BorshDeserialize,
)]
pub(crate) struct SequenceTriple {
pub struct SequenceTriple {
sequences: [u64; 3],
mask: u8,
}

#[derive(Clone, Copy)]
pub(crate) enum SequenceTripleIdx {
pub enum SequenceTripleIdx {
Send = 0,
Recv = 1,
Ack = 2,
}

impl SequenceTriple {
/// Returns sequence at given index or `None` if it wasn’t set yet.
pub(crate) fn get(&self, idx: SequenceTripleIdx) -> Option<ibc::Sequence> {
pub fn get(&self, idx: SequenceTripleIdx) -> Option<ibc::Sequence> {
if self.mask & (1 << (idx as u32)) == 1 {
Some(ibc::Sequence::from(self.sequences[idx as usize]))
} else {
Expand Down Expand Up @@ -84,7 +84,7 @@ impl SequenceTriple {

/// Per-client private storage.
#[derive(Clone, Debug, borsh::BorshSerialize, borsh::BorshDeserialize)]
pub(crate) struct ClientStore {
pub struct ClientStore {
pub client_id: ibc::ClientId,
pub connection_id: Option<ids::ConnectionIdx>,

Expand All @@ -108,7 +108,7 @@ impl ClientStore {
}

/// A shared reference to a [`ClientStore`] together with its index.
pub(crate) struct ClientRef<'a> {
pub struct ClientRef<'a> {
#[allow(dead_code)]
pub index: ids::ClientIdx,
pub store: &'a ClientStore,
Expand All @@ -120,7 +120,7 @@ impl<'a> core::ops::Deref for ClientRef<'a> {
}

/// An exclusive reference to a [`ClientStore`] together with its index.
pub(crate) struct ClientMut<'a> {
pub struct ClientMut<'a> {
pub index: ids::ClientIdx,
pub store: &'a mut ClientStore,
}
Expand All @@ -142,12 +142,12 @@ pub struct IbcPackets(pub Vec<ibc::PacketMsg>);
#[account]
#[derive(Debug)]
/// The private IBC storage, i.e. data which doesn’t require proofs.
pub(crate) struct PrivateStorage {
pub struct PrivateStorage {
/// Per-client information.
///
/// Entry at index `N` corresponds to the client with IBC identifier
/// `client-<N>`.
clients: Vec<ClientStore>,
pub clients: Vec<ClientStore>,

/// Information about the counterparty on given connection.
///
Expand Down Expand Up @@ -345,7 +345,7 @@ impl<'a, 'b> IbcStorage<'a, 'b> {
/// must less than 64 KiB. Solana’s heap is only half that so this limit isn’t
/// an issue.
#[derive(Clone, Default, Debug)]
pub(crate) struct Serialised<T>(Vec<u8>, core::marker::PhantomData<T>);
pub struct Serialised<T>(Vec<u8>, core::marker::PhantomData<T>);

impl<T> Serialised<T> {
pub fn empty() -> Self { Self(Vec::new(), core::marker::PhantomData) }
Expand Down
Loading