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

sdk: evict rent collector #4160

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
52 changes: 52 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ members = [
"sdk/frozen-abi",
"sdk/frozen-abi/macro",
"sdk/gen-headers",
"sdk/genesis-config",
"sdk/hard-forks",
"sdk/hash",
"sdk/inflation",
Expand Down Expand Up @@ -166,6 +167,7 @@ members = [
"sdk/pubkey",
"sdk/quic-definitions",
"sdk/rent",
"sdk/rent-collector",
"sdk/rent-debits",
"sdk/reserved-account-keys",
"sdk/reward-info",
Expand Down Expand Up @@ -496,6 +498,7 @@ solana-frozen-abi-macro = { path = "sdk/frozen-abi/macro", version = "=2.2.0" }
solana-tps-client = { path = "tps-client", version = "=2.2.0" }
solana-file-download = { path = "sdk/file-download", version = "=2.2.0" }
solana-genesis = { path = "genesis", version = "=2.2.0" }
solana-genesis-config = { path = "sdk/genesis-config", version = "=2.2.0" }
solana-genesis-utils = { path = "genesis-utils", version = "=2.2.0" }
agave-geyser-plugin-interface = { path = "geyser-plugin-interface", version = "=2.2.0" }
solana-geyser-plugin-manager = { path = "geyser-plugin-manager", version = "=2.2.0" }
Expand Down Expand Up @@ -551,6 +554,7 @@ solana-quic-definitions = { path = "sdk/quic-definitions", version = "=2.2.0" }
solana-rayon-threadlimit = { path = "rayon-threadlimit", version = "=2.2.0" }
solana-remote-wallet = { path = "remote-wallet", version = "=2.2.0", default-features = false }
solana-rent = { path = "sdk/rent", version = "=2.2.0", default-features = false }
solana-rent-collector = { path = "sdk/rent-collector", version = "=2.2.0" }
solana-rent-debits = { path = "sdk/rent-debits", version = "=2.2.0" }
solana-reserved-account-keys = { path = "sdk/reserved-account-keys", version = "=2.2.0", default-features = false }
solana-reward-info = { path = "sdk/reward-info", version = "=2.2.0" }
Expand Down
46 changes: 46 additions & 0 deletions programs/sbf/Cargo.lock

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

10 changes: 10 additions & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ full = [
"dep:solana-cluster-type",
"dep:solana-ed25519-program",
"dep:solana-compute-budget-interface",
"dep:solana-genesis-config",
"dep:solana-hard-forks",
"dep:solana-keypair",
"dep:solana-offchain-message",
"dep:solana-precompile-error",
"dep:solana-precompiles",
"dep:solana-presigner",
"dep:solana-quic-definitions",
"dep:solana-rent-collector",
"dep:solana-secp256k1-program",
"dep:solana-seed-derivable",
"dep:solana-seed-phrase",
Expand Down Expand Up @@ -76,11 +78,13 @@ frozen-abi = [
"solana-fee-structure/frozen-abi",
"solana-account/frozen-abi",
"solana-cluster-type/frozen-abi",
"solana-genesis-config/frozen-abi",
"solana-hard-forks/frozen-abi",
"solana-inflation/frozen-abi",
"solana-poh-config/frozen-abi",
"solana-program/frozen-abi",
"solana-reward-info/frozen-abi",
"solana-rent-collector/frozen-abi",
"solana-short-vec/frozen-abi",
"solana-signature/frozen-abi",
"solana-transaction/frozen-abi",
Expand Down Expand Up @@ -143,6 +147,9 @@ solana-frozen-abi = { workspace = true, optional = true, features = [
solana-frozen-abi-macro = { workspace = true, optional = true, features = [
"frozen-abi",
] }
solana-genesis-config = { workspace = true, features = [
"serde",
], optional = true }
solana-hard-forks = { workspace = true, features = [
"serde",
], optional = true }
Expand All @@ -165,6 +172,9 @@ solana-pubkey = { workspace = true, default-features = false, features = [
"std",
] }
solana-quic-definitions = { workspace = true, optional = true }
solana-rent-collector = { workspace = true, features = [
"serde",
], optional = true }
solana-rent-debits = { workspace = true }
solana-reserved-account-keys = { workspace = true }
solana-reward-info = { workspace = true, features = ["serde"] }
Expand Down
47 changes: 47 additions & 0 deletions sdk/genesis-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "solana-genesis-config"
description = "The chain's genesis config."
documentation = "https://docs.rs/solana-genesis-config"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
bincode = { workspace = true }
chrono = { workspace = true }
memmap2 = { workspace = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-account = { workspace = true }
solana-clock = { workspace = true }
solana-cluster-type = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-fee-calculator = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-hash = { workspace = true }
solana-inflation = { workspace = true }
solana-keypair = { workspace = true }
solana-logger = { workspace = true }
solana-native-token = { workspace = true }
solana-poh-config = { workspace = true }
solana-pubkey = { workspace = true }
solana-rent = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-sha256-hasher = { workspace = true }
solana-shred-version = { workspace = true }
solana-signer = { workspace = true }
solana-time-utils = { workspace = true }

[features]
frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"]
serde = ["dep:serde", "dep:serde_derive"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[lints]
workspace = true
48 changes: 25 additions & 23 deletions sdk/src/genesis_config.rs → sdk/genesis-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
//! The chain's genesis config.

#![cfg(feature = "full")]
#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]

#[deprecated(
since = "2.2.0",
note = "Use `solana_cluster_type::ClusterType` instead."
)]
pub use solana_cluster_type::ClusterType;
#[cfg(feature = "frozen-abi")]
use solana_frozen_abi_macro::{frozen_abi, AbiExample};
use {
crate::{
clock::{UnixTimestamp, DEFAULT_TICKS_PER_SLOT},
epoch_schedule::EpochSchedule,
fee_calculator::FeeRateGovernor,
hash::{hash, Hash},
inflation::Inflation,
poh_config::PohConfig,
pubkey::Pubkey,
rent::Rent,
shred_version::compute_shred_version,
signature::{Keypair, Signer},
system_program,
timing::years_as_slots,
},
bincode::{deserialize, serialize},
chrono::{TimeZone, Utc},
memmap2::Mmap,
solana_account::{Account, AccountSharedData},
solana_clock::{UnixTimestamp, DEFAULT_TICKS_PER_SLOT},
solana_epoch_schedule::EpochSchedule,
solana_fee_calculator::FeeRateGovernor,
solana_hash::Hash,
solana_inflation::Inflation,
solana_keypair::Keypair,
solana_native_token::lamports_to_sol,
solana_poh_config::PohConfig,
solana_pubkey::Pubkey,
solana_rent::Rent,
solana_sdk_ids::system_program,
solana_sha256_hasher::hash,
solana_shred_version::compute_shred_version,
solana_signer::Signer,
solana_time_utils::years_as_slots,
std::{
collections::BTreeMap,
fmt,
Expand All @@ -49,7 +51,11 @@ pub const UNUSED_DEFAULT: u64 = 1024;
derive(AbiExample),
frozen_abi(digest = "D9VFRSj4fodCuKFC9omQY2zY2Uw8wo6SzJFLeMJaVigm")
)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[derive(Clone, Debug, PartialEq)]
pub struct GenesisConfig {
/// when the network (bootstrap validator) was started relative to the UNIX Epoch
pub creation_time: UnixTimestamp,
Expand Down Expand Up @@ -275,11 +281,7 @@ impl fmt::Display for GenesisConfig {

#[cfg(test)]
mod tests {
use {
super::*,
crate::signature::{Keypair, Signer},
std::path::PathBuf,
};
use {super::*, solana_signer::Signer, std::path::PathBuf};

fn make_tmp_path(name: &str) -> PathBuf {
let out_dir = std::env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
Expand Down Expand Up @@ -310,10 +312,10 @@ mod tests {
AccountSharedData::new(10_000, 0, &Pubkey::default()),
);
config.add_account(
solana_sdk::pubkey::new_rand(),
solana_pubkey::new_rand(),
AccountSharedData::new(1, 0, &Pubkey::default()),
);
config.add_native_instruction_processor("hi".to_string(), solana_sdk::pubkey::new_rand());
config.add_native_instruction_processor("hi".to_string(), solana_pubkey::new_rand());

assert_eq!(config.accounts.len(), 2);
assert!(config
Expand Down
Loading
Loading