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 Nov 1, 2024
1 parent a0241d5 commit ccf193e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 7 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.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ members = [
"sdk/cpi",
"sdk/decode-error",
"sdk/derivation-path",
"sdk/epoch-info",
"sdk/epoch-rewards",
"sdk/epoch-schedule",
"sdk/feature-set",
Expand Down Expand Up @@ -428,6 +429,7 @@ solana-derivation-path = { path = "sdk/derivation-path", version = "=2.2.0" }
solana-download-utils = { path = "download-utils", version = "=2.2.0" }
solana-entry = { path = "entry", version = "=2.2.0" }
solana-program-entrypoint = { path = "sdk/program-entrypoint", version = "=2.2.0" }
solana-epoch-info = { path = "sdk/epoch-info", version = "=2.2.0" }
solana-epoch-rewards = { path = "sdk/epoch-rewards", version = "=2.2.0" }
solana-epoch-schedule = { path = "sdk/epoch-schedule", version = "=2.2.0" }
solana-faucet = { path = "faucet", version = "=2.2.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 @@ -96,6 +96,7 @@ solana-bn254 = { workspace = true }
solana-commitment-config = { workspace = true, optional = true, features = ["serde"] }
solana-decode-error = { workspace = true }
solana-derivation-path = { workspace = true }
solana-epoch-info = { workspace = true, features = ["serde"] }
solana-feature-set = { workspace = true }
solana-fee-structure = { workspace = true, features = ["serde"] }
solana-frozen-abi = { workspace = true, optional = true, features = [
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 @@ -66,7 +66,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 @@ -115,6 +114,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.2.0", note = "Use `solana-fee-structure` crate instead")]
Expand Down

0 comments on commit ccf193e

Please sign in to comment.