Skip to content

Commit

Permalink
extract stable-layout crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Sep 13, 2024
1 parent b4ed7a4 commit 98f9cb0
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ members = [
"sdk/serde-varint",
"sdk/sha256-hasher",
"sdk/signature",
"sdk/stable-layout",
"send-transaction-service",
"short-vec",
"stake-accounts",
Expand Down Expand Up @@ -450,6 +451,7 @@ solana-sdk-macro = { path = "sdk/macro", version = "=2.1.0" }
solana-secp256k1-recover = { path = "curves/secp256k1-recover", version = "=2.1.0", default-features = false }
solana-send-transaction-service = { path = "send-transaction-service", version = "=2.1.0" }
solana-short-vec = { path = "short-vec", version = "=2.1.0" }
solana-stable-layout = { path = "sdk/stable-layout", version = "=2.1.0" }
solana-stake-program = { path = "programs/stake", version = "=2.1.0" }
solana-storage-bigtable = { path = "storage-bigtable", version = "=2.1.0" }
solana-storage-proto = { path = "storage-proto", version = "=2.1.0" }
Expand Down
9 changes: 9 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ solana-secp256k1-recover = { workspace = true }
solana-serde-varint = { workspace = true }
solana-sha256-hasher = { workspace = true, features = ["sha2"] }
solana-short-vec = { workspace = true }
solana-stable-layout = { workspace = true }
thiserror = { workspace = true }

# This is currently needed to build on-chain programs reliably.
Expand Down
3 changes: 2 additions & 1 deletion sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ pub mod secp256k1_program;
pub mod serialize_utils;
pub mod slot_hashes;
pub mod slot_history;
pub mod stable_layout;
pub mod stake;
pub mod stake_history;
pub mod syscalls;
Expand All @@ -536,6 +535,8 @@ pub use solana_secp256k1_recover as secp256k1_recover;
pub use solana_serde_varint as serde_varint;
#[deprecated(since = "2.1.0", note = "Use `solana-short-vec` crate instead")]
pub use solana_short_vec as short_vec;
#[deprecated(since = "2.1.0", note = "Use `solana-stable-layout` crate instead")]
pub use solana_stable_layout as stable_layout;
#[cfg(target_arch = "wasm32")]
pub use wasm_bindgen::prelude::wasm_bindgen;
pub use {
Expand Down
19 changes: 19 additions & 0 deletions sdk/stable-layout/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "solana-stable-layout"
description = "Solana types with stable memory layouts. Internal use only."
documentation = "https://docs.rs/solana-stable-layout"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
solana-instruction = { workspace = true, default-features = false, features = [
"std",
] }
solana-pubkey = { workspace = true, default-features = false }

[dev-dependencies]
memoffset = { workspace = true }
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! `Instruction`, with a stable memory layout
use {
crate::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
stable_layout::stable_vec::StableVec,
},
crate::stable_vec::StableVec,
solana_instruction::{AccountMeta, Instruction},
solana_pubkey::Pubkey,
std::fmt::Debug,
};

Expand All @@ -21,7 +19,9 @@ use {
/// Creating a `StableInstruction` from an `Instruction`
///
/// ```
/// # use solana_program::{instruction::Instruction, pubkey::Pubkey, stable_layout::stable_instruction::StableInstruction};
/// # use solana_instruction::Instruction;
/// # use solana_pubkey::Pubkey;
/// # use solana_stable_layout::stable_instruction::StableInstruction;
/// # let program_id = Pubkey::default();
/// # let accounts = Vec::default();
/// # let data = Vec::default();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::{marker::PhantomData, mem::ManuallyDrop, ptr::NonNull};
/// Creating a `StableVec` from a `Vec`
///
/// ```
/// # use solana_program::stable_layout::stable_vec::StableVec;
/// # use solana_stable_layout::stable_vec::StableVec;
/// let vec = vec!["meow", "woof", "moo"];
/// let vec = StableVec::from(vec);
/// ```
Expand Down

0 comments on commit 98f9cb0

Please sign in to comment.