Skip to content

Commit

Permalink
extract epoch-info crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Oct 16, 2024
1 parent a8aef04 commit 5b256d2
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 8 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ members = [
"sdk/clock",
"sdk/decode-error",
"sdk/derivation-path",
"sdk/epoch-info",
"sdk/epoch-schedule",
"sdk/feature-set",
"sdk/gen-headers",
Expand Down Expand Up @@ -410,7 +411,7 @@ solana-define-syscall = { path = "define-syscall", version = "=2.1.0" }
solana-derivation-path = { path = "sdk/derivation-path", version = "=2.1.0" }
solana-download-utils = { path = "download-utils", version = "=2.1.0" }
solana-entry = { path = "entry", version = "=2.1.0" }
solana-program-entrypoint = { path = "sdk/program-entrypoint", version = "=2.1.0" }
solana-epoch-info = { path = "sdk/epoch-info", version = "=2.1.0" }
solana-epoch-schedule = { path = "sdk/epoch-schedule", version = "=2.1.0" }
solana-faucet = { path = "faucet", version = "=2.1.0" }
solana-feature-set = { path = "sdk/feature-set", version = "=2.1.0" }
Expand Down Expand Up @@ -447,6 +448,7 @@ solana-poh = { path = "poh", version = "=2.1.0" }
solana-poseidon = { path = "poseidon", version = "=2.1.0" }
solana-precompile-error = { path = "sdk/precompile-error", version = "=2.1.0" }
solana-program = { path = "sdk/program", version = "=2.1.0", default-features = false }
solana-program-entrypoint = { path = "sdk/program-entrypoint", version = "=2.1.0" }
solana-program-error = { path = "sdk/program-error", version = "=2.1.0" }
solana-program-memory = { path = "sdk/program-memory", version = "=2.1.0" }
solana-program-option = { path = "sdk/program-option", 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/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ solana-account = { workspace = true, features = ["bincode"] }
solana-bn254 = { workspace = true }
solana-decode-error = { workspace = true }
solana-derivation-path = { workspace = true }
solana-epoch-info = { workspace = true, features = ["serde"] }
solana-feature-set = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
Expand Down
23 changes: 23 additions & 0 deletions sdk/epoch-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "solana-epoch-info"
description = "Information about the current Solana epoch."
documentation = "https://docs.rs/solana-epoch-info"
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 }

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

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

[lints]
workspace = true
14 changes: 8 additions & 6 deletions sdk/src/epoch_info.rs → sdk/epoch-info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
//!
//! [`getEpochInfo`]: https://solana.com/docs/rpc/http/getepochinfo
use crate::clock::{Epoch, Slot};

#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize),
serde(rename_all = "camelCase")
)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct EpochInfo {
/// The current epoch
pub epoch: Epoch,
pub epoch: u64,

/// The current slot, relative to the start of the current epoch
pub slot_index: u64,
Expand All @@ -19,7 +21,7 @@ pub struct EpochInfo {
pub slots_in_epoch: u64,

/// The absolute current slot
pub absolute_slot: Slot,
pub absolute_slot: u64,

/// The current block height
pub block_height: u64,
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ pub mod deserialize_utils;
pub mod ed25519_instruction;
pub mod entrypoint;
pub mod entrypoint_deprecated;
pub mod epoch_info;
pub mod epoch_rewards_hasher;
pub mod example_mocks;
pub mod exit;
Expand Down Expand Up @@ -118,6 +117,8 @@ pub use solana_bn254 as alt_bn128;
pub use solana_decode_error as decode_error;
#[deprecated(since = "2.1.0", note = "Use `solana-derivation-path` crate instead")]
pub use solana_derivation_path as derivation_path;
#[deprecated(since = "2.1.0", note = "Use `solana-epoch-info` crate instead")]
pub use solana_epoch_info as epoch_info;
#[deprecated(since = "2.1.0", note = "Use `solana-feature-set` crate instead")]
pub use solana_feature_set as feature_set;
#[deprecated(since = "2.1.0", note = "Use `solana-program-memory` crate instead")]
Expand Down

0 comments on commit 5b256d2

Please sign in to comment.