Skip to content

Commit

Permalink
remove solana-program from solana-account (#3681)
Browse files Browse the repository at this point in the history
* remove solana-program from solana-account

* activate feature that was previously activated by solana-sdk

* fix sysvar dep
  • Loading branch information
kevinheavey authored Nov 21, 2024
1 parent fa7d553 commit 108c6bb
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 24 deletions.
5 changes: 4 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion account-decoder-client-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = { workspace = true }

[dependencies]
base64 = { workspace = true }
bs58 = { workspace = true }
bs58 = { workspace = true, features = ["std"] }
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
Expand Down
6 changes: 5 additions & 1 deletion programs/sbf/Cargo.lock

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

25 changes: 19 additions & 6 deletions sdk/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,39 @@ qualifier_attr = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_bytes = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-account-info = { workspace = true }
solana-clock = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-instruction = { workspace = true, optional = true }
solana-instruction = { workspace = true }
solana-logger = { workspace = true, optional = true }
solana-program = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-sysvar = { workspace = true, features = ["bincode"], optional = true }

[dev-dependencies]
solana-account = { path = ".", features = ["dev-context-only-utils"] }
solana-pubkey = { workspace = true }

[features]
bincode = ["dep:bincode", "dep:solana-instruction", "serde"]
bincode = [
"dep:bincode",
"dep:solana-sysvar",
"solana-instruction/serde",
"serde",
]
dev-context-only-utils = ["bincode", "dep:qualifier_attr"]
frozen-abi = [
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"dep:solana-logger",
"solana-program/frozen-abi",
"solana-pubkey/frozen-abi",
]
serde = [
"dep:serde",
"dep:serde_bytes",
"dep:serde_derive",
"solana-pubkey/serde",
]
serde = ["dep:serde", "dep:serde_bytes", "dep:serde_derive"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
23 changes: 10 additions & 13 deletions sdk/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ use serde::ser::{Serialize, Serializer};
#[cfg(feature = "frozen-abi")]
use solana_frozen_abi_macro::{frozen_abi, AbiExample};
#[cfg(feature = "bincode")]
use solana_program::sysvar::Sysvar;
use solana_sysvar::Sysvar;
use {
solana_program::{
account_info::AccountInfo,
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
clock::{Epoch, INITIAL_RENT_EPOCH},
debug_account_data::*,
lamports::LamportsError,
loader_v4,
pubkey::Pubkey,
},
solana_account_info::{debug_account_data::*, AccountInfo},
solana_clock::{Epoch, INITIAL_RENT_EPOCH},
solana_instruction::error::LamportsError,
solana_pubkey::Pubkey,
solana_sdk_ids::{bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, loader_v4},
std::{
cell::{Ref, RefCell},
fmt,
Expand Down Expand Up @@ -67,7 +63,8 @@ mod account_serialize {
use {
crate::ReadableAccount,
serde::{ser::Serializer, Serialize},
solana_program::{clock::Epoch, pubkey::Pubkey},
solana_clock::Epoch,
solana_pubkey::Pubkey,
};
#[repr(C)]
#[cfg_attr(
Expand Down Expand Up @@ -722,7 +719,7 @@ pub fn create_account_with_fields<S: Sysvar>(
(lamports, rent_epoch): InheritableAccountFields,
) -> Account {
let data_len = S::size_of().max(bincode::serialized_size(sysvar).unwrap() as usize);
let mut account = Account::new(lamports, data_len, &solana_program::sysvar::id());
let mut account = Account::new(lamports, data_len, &solana_sdk_ids::sysvar::id());
to_account::<S, Account>(sysvar, &mut account).unwrap();
account.rent_epoch = rent_epoch;
account
Expand Down Expand Up @@ -764,7 +761,7 @@ pub fn to_account<S: Sysvar, T: WritableAccount>(sysvar: &S, account: &mut T) ->

/// Return the information required to construct an `AccountInfo`. Used by the
/// `AccountInfo` conversion implementations.
impl solana_program::account_info::Account for Account {
impl solana_account_info::Account for Account {
fn get(&mut self) -> (&mut u64, &mut [u8], &Pubkey, bool, Epoch) {
(
&mut self.lamports,
Expand Down
3 changes: 2 additions & 1 deletion sdk/pubkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ default = ["std"]
dev-context-only-utils = ["dep:arbitrary", "rand"]
frozen-abi = [
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro"
"dep:solana-frozen-abi-macro",
"std",
]
rand = ["dep:rand", "std"]
serde = ["dep:serde", "dep:serde_derive"]
Expand Down
6 changes: 5 additions & 1 deletion svm/examples/Cargo.lock

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

0 comments on commit 108c6bb

Please sign in to comment.