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

extract epoch-info crate #3028

Merged
merged 2 commits into from
Nov 19, 2024
Merged
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
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 @@ -112,6 +112,7 @@ members = [
"sdk/define-syscall",
"sdk/derivation-path",
"sdk/ed25519-program",
"sdk/epoch-info",
"sdk/epoch-rewards",
"sdk/epoch-schedule",
"sdk/feature-set",
Expand Down Expand Up @@ -443,6 +444,7 @@ solana-download-utils = { path = "download-utils", version = "=2.2.0" }
solana-ed25519-program = { path = "sdk/ed25519-program", 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 @@ -106,6 +106,7 @@ solana-commitment-config = { workspace = true, optional = true, features = ["ser
solana-decode-error = { workspace = true }
solana-derivation-path = { workspace = true }
solana-ed25519-program = { workspace = true, optional = 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 a 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 client;
pub mod compute_budget;
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 @@ -121,6 +120,8 @@ pub use solana_derivation_path as derivation_path;
#[cfg(feature = "full")]
#[deprecated(since = "2.2.0", note = "Use `solana-ed25519-program` crate instead")]
pub use solana_ed25519_program as ed25519_instruction;
#[deprecated(since = "2.2.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
Loading