Skip to content
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
66 changes: 27 additions & 39 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 interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ solana-pubkey = { version = "4.2.0", default-features = false }
solana-system-interface = "3.0.0"
solana-sysvar = { version = "4.0.0", optional = true }
solana-sysvar-id = { version = "3.1.0", optional = true }
wincode = { version = "0.5.2", features = ["derive"], optional = true }

[target.'cfg(not(target_os = "solana"))'.dependencies]
serde_json = { version = "1.0", optional = true }
Expand Down Expand Up @@ -82,3 +83,4 @@ frozen-abi = [
]
serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde", "solana-sysvar/serde"]
sysvar = ["dep:solana-sysvar", "dep:solana-sysvar-id"]
wincode = ["dep:wincode", "solana-pubkey/wincode"]
1 change: 1 addition & 0 deletions interface/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub enum StakeError {
// 0
/// Not enough credits to redeem.
Expand Down
2 changes: 2 additions & 0 deletions interface/src/stake_flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};

/// Additional flags for stake state.
#[repr(transparent)]
#[cfg_attr(feature = "codama", derive(codama_macros::CodamaType))]
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -14,6 +15,7 @@ use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct StakeFlags {
bits: u8,
}
Expand Down
2 changes: 2 additions & 0 deletions interface/src/stake_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub const MAX_ENTRIES: usize = 512; // it should never take as many as 512 epoch
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
#[derive(Debug, PartialEq, Eq, Default, Clone)]
pub struct StakeHistoryEntry {
pub effective: u64, // effective stake at this epoch
Expand Down Expand Up @@ -62,6 +63,7 @@ impl std::ops::Add for StakeHistoryEntry {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
#[derive(Debug, PartialEq, Eq, Default, Clone)]
pub struct StakeHistory(Vec<(Epoch, StakeHistoryEntry)>);

Expand Down
12 changes: 12 additions & 0 deletions interface/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl StakeState {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
#[allow(clippy::large_enum_variant)]
pub enum StakeStateV2 {
#[default]
Expand Down Expand Up @@ -282,11 +283,13 @@ impl StakeStateV2 {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub enum StakeAuthorize {
Staker,
Withdrawer,
}

#[repr(C)]
#[cfg_attr(feature = "codama", derive(CodamaType))]
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -299,6 +302,7 @@ pub enum StakeAuthorize {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct Lockup {
/// `UnixTimestamp` at which this stake will allow withdrawal, unless the
/// transaction is signed by the custodian
Expand All @@ -319,6 +323,7 @@ impl Lockup {
}
}

#[repr(C)]
#[cfg_attr(feature = "codama", derive(CodamaType))]
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -331,6 +336,7 @@ impl Lockup {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct Authorized {
pub staker: Pubkey,
pub withdrawer: Pubkey,
Expand Down Expand Up @@ -402,6 +408,7 @@ impl Authorized {
}
}

#[repr(C)]
#[cfg_attr(feature = "codama", derive(CodamaType))]
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -414,6 +421,7 @@ impl Authorized {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct Meta {
#[deprecated(
since = "3.0.1",
Expand Down Expand Up @@ -462,6 +470,7 @@ impl Meta {
}
}

#[repr(C)]
#[cfg_attr(feature = "codama", derive(CodamaType))]
#[derive(Debug, PartialEq, Clone, Copy)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -474,6 +483,7 @@ impl Meta {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct Delegation {
/// to whom the stake is delegated
pub voter_pubkey: Pubkey,
Expand Down Expand Up @@ -702,6 +712,7 @@ impl Delegation {
}
}

#[repr(C)]
#[cfg_attr(feature = "codama", derive(CodamaType))]
#[derive(Debug, Default, PartialEq, Clone, Copy)]
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
Expand All @@ -714,6 +725,7 @@ impl Delegation {
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
pub struct Stake {
pub delegation: Delegation,
/// credits observed is credits from vote account state when delegated or redeemed
Expand Down
Loading