Skip to content

Commit

Permalink
sdk: Extract last-restart-slot crate (#3272)
Browse files Browse the repository at this point in the history
* sdk: Extract last-restart-slot crate

#### Problem

Just about all of the sysvars have been extract in some way from
solana-program, but the last restart slot sysvar has not.

#### Summary of changes

Following most of the other crates that have done this, move it out.

* Remove last_restart_slot.rs
  • Loading branch information
joncinque authored Oct 28, 2024
1 parent 890bed2 commit 4bb8793
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 11 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.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ solana-gossip = { path = "gossip", version = "=2.1.0" }
solana-hash = { path = "sdk/hash", version = "=2.1.0", default-features = false }
solana-inline-spl = { path = "inline-spl", version = "=2.1.0" }
solana-instruction = { path = "sdk/instruction", version = "=2.1.0", default-features = false }
solana-last-restart-slot = { path = "sdk/last-restart-slot", version = "=2.1.0" }
solana-lattice-hash = { path = "lattice-hash", version = "=2.1.0" }
solana-ledger = { path = "ledger", version = "=2.1.0" }
solana-loader-v4-program = { path = "programs/loader-v4", version = "=2.1.0" }
Expand Down
10 changes: 10 additions & 0 deletions programs/sbf/Cargo.lock

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

23 changes: 23 additions & 0 deletions sdk/last-restart-slot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "solana-last-restart-slot"
description = "Types and utilities for the Solana LastRestartSlot sysvar."
documentation = "https://docs.rs/solana-last-restart-slot"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-sdk-macro = { workspace = true }

[features]
serde = ["dep:serde", "dep:serde_derive"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]
15 changes: 15 additions & 0 deletions sdk/last-restart-slot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Information about the last restart slot (hard fork).
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

use solana_sdk_macro::CloneZeroed;

#[repr(C)]
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[derive(Debug, CloneZeroed, PartialEq, Eq, Default)]
pub struct LastRestartSlot {
/// The last restart `Slot`.
pub last_restart_slot: u64,
}
1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ solana-instruction = { workspace = true, default-features = false, features = [
"serde",
"std",
] }
solana-last-restart-slot = { workspace = true, features = ["serde"] }
solana-msg = { workspace = true }
solana-native-token = { workspace = true }
solana-program-entrypoint = { workspace = true }
Expand Down
10 changes: 0 additions & 10 deletions sdk/program/src/last_restart_slot.rs

This file was deleted.

3 changes: 2 additions & 1 deletion sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ pub mod incinerator;
pub mod instruction;
pub mod keccak;
pub mod lamports;
pub mod last_restart_slot;
pub mod loader_instruction;
pub mod loader_upgradeable_instruction;
pub mod loader_v4;
Expand Down Expand Up @@ -522,6 +521,8 @@ pub use solana_borsh::v0_10 as borsh0_10;
pub use solana_borsh::v1 as borsh1;
#[deprecated(since = "2.1.0", note = "Use `solana-fee-calculator` crate instead")]
pub use solana_fee_calculator as fee_calculator;
#[deprecated(since = "2.1.0", note = "Use `solana-last-restart-slot` crate instead")]
pub use solana_last_restart_slot as last_restart_slot;
#[deprecated(since = "2.1.0", note = "Use `solana-program-memory` crate instead")]
pub use solana_program_memory as program_memory;
#[deprecated(since = "2.1.0", note = "Use `solana-program-pack` crate instead")]
Expand Down

0 comments on commit 4bb8793

Please sign in to comment.