Skip to content

Commit

Permalink
extract vote-interface crate (#4482)
Browse files Browse the repository at this point in the history
* extract vote-interface crate

* remove thiserror

* fmt

* update digests

* update digests

* update digest

* trigger ci

* trigger ci
  • Loading branch information
kevinheavey authored Jan 19, 2025
1 parent 73650a1 commit 46b1f9a
Show file tree
Hide file tree
Showing 21 changed files with 433 additions and 210 deletions.
31 changes: 31 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 @@ -198,6 +198,7 @@ members = [
"sdk/transaction-context",
"sdk/transaction-error",
"sdk/validator-exit",
"sdk/vote-interface",
"send-transaction-service",
"stake-accounts",
"storage-bigtable",
Expand Down Expand Up @@ -626,6 +627,7 @@ solana-udp-client = { path = "udp-client", version = "=2.2.0" }
solana-validator-exit = { path = "sdk/validator-exit", version = "=2.2.0" }
solana-version = { path = "version", version = "=2.2.0" }
solana-vote = { path = "vote", version = "=2.2.0" }
solana-vote-interface = { path = "sdk/vote-interface", version = "=2.2.0" }
solana-vote-program = { path = "programs/vote", version = "=2.2.0", default-features = false }
solana-wen-restart = { path = "wen-restart", version = "=2.2.0" }
solana-zk-elgamal-proof-program = { path = "programs/zk-elgamal-proof", version = "=2.2.0" }
Expand Down
2 changes: 1 addition & 1 deletion core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub(crate) enum BlockhashStatus {
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample),
frozen_abi(digest = "9ziHa1vA7WG5RCvXiE3g1f2qjSTNa47FB7e2czo7en7a")
frozen_abi(digest = "FcHteDgmzjrtyFD9D6EQ2hY9FRz42gs2S7eJ1DyHWP7s")
)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct Tower {
Expand Down
2 changes: 1 addition & 1 deletion core/src/consensus/tower1_14_11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample),
frozen_abi(digest = "6VhLW7DSHNzrcswtxbNo4cb47oGrKLcKuDmCWVpUMLLM")
frozen_abi(digest = "6Z9SDTJAihx2mVbdcifTvNN96keT4DyJ9BKGazgVUkzD")
)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct Tower1_14_11 {
Expand Down
2 changes: 1 addition & 1 deletion core/src/consensus/tower1_7_14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample),
frozen_abi(digest = "5bwSGBqA1BVmgNtnTenfYtEt123cciEzpfqt6bUX1dJo")
frozen_abi(digest = "CL1BKbtF3yMkpPnVi8sGnveybhnzf16nBqCqC8TKVNX")
)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct Tower1_7_14 {
Expand Down
23 changes: 23 additions & 0 deletions programs/sbf/Cargo.lock

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

2 changes: 1 addition & 1 deletion programs/vote/src/vote_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use {
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample, AbiEnumVisitor),
frozen_abi(digest = "3dbyMxwfCN43orGKa5YiyY1EqN2K97pTicNhKYTZSUQH")
frozen_abi(digest = "4BdRo6We16yDbjz69H1oFq6C4nXUZKDchZR76TvvGmBi")
)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum VoteTransaction {
Expand Down
1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ solana-stable-layout = { workspace = true }
solana-system-interface = { workspace = true, features = ["bincode"] }
solana-sysvar = { workspace = true, features = ["bincode", "bytemuck"] }
solana-sysvar-id = { workspace = true }
solana-vote-interface = { workspace = true, features = ["bincode"] }
thiserror = { workspace = true }

# This is currently needed to build on-chain programs reliably.
Expand Down
3 changes: 2 additions & 1 deletion sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ pub mod syscalls;
pub mod system_instruction;
pub mod system_program;
pub mod sysvar;
pub mod vote;
pub mod wasm;

#[deprecated(since = "2.2.0", note = "Use `solana-big-mod-exp` crate instead")]
Expand Down Expand Up @@ -549,6 +548,8 @@ pub use solana_short_vec as short_vec;
pub use solana_stable_layout as stable_layout;
#[cfg(not(target_os = "solana"))]
pub use solana_sysvar::program_stubs;
#[deprecated(since = "2.2.0", note = "Use `solana-vote-interface` crate instead")]
pub use solana_vote_interface as vote;
#[cfg(target_arch = "wasm32")]
pub use wasm_bindgen::prelude::wasm_bindgen;
pub use {
Expand Down
112 changes: 0 additions & 112 deletions sdk/program/src/vote/error.rs

This file was deleted.

78 changes: 78 additions & 0 deletions sdk/vote-interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[package]
name = "solana-vote-interface"
description = "Solana vote interface."
documentation = "https://docs.rs/solana-vote-interface"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
bincode = { workspace = true, optional = true }
num-derive = { workspace = true }
num-traits = { workspace = true }
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-clock = { workspace = true }
solana-decode-error = { workspace = true }
solana-frozen-abi = { workspace = true, features = [
"frozen-abi",
], optional = true }
solana-frozen-abi-macro = { workspace = true, features = [
"frozen-abi",
], optional = true }
solana-hash = { workspace = true }
solana-instruction = { workspace = true, features = ["std"] }
solana-pubkey = { workspace = true }
solana-rent = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-serde-varint = { workspace = true, optional = true }
solana-serialize-utils = { workspace = true, optional = true }
solana-short-vec = { workspace = true, optional = true }
solana-system-interface = { workspace = true, features = ["bincode"], optional = true }

[target.'cfg(target_os = "solana")'.dependencies]
solana-serialize-utils = { workspace = true }

[dev-dependencies]
arbitrary = { workspace = true, features = ["derive"] }
itertools = { workspace = true }
rand = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-logger = { workspace = true }
solana-pubkey = { workspace = true, features = ["dev-context-only-utils"] }
solana-vote-interface = { path = ".", features = ["dev-context-only-utils"] }

[features]
bincode = [
"dep:bincode",
"dep:solana-serialize-utils",
"dep:solana-system-interface",
"serde"
]
dev-context-only-utils = ["bincode"]
frozen-abi = [
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"serde",
"solana-hash/frozen-abi",
"solana-pubkey/frozen-abi"
]
serde = [
"dep:serde",
"dep:serde_derive",
"dep:solana-serde-varint",
"dep:solana-short-vec",
"solana-hash/serde",
"solana-pubkey/serde"
]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#[cfg(test)]
use arbitrary::Arbitrary;
use {
crate::pubkey::Pubkey,
serde_derive::{Deserialize, Serialize},
solana_clock::Epoch,
std::collections::BTreeMap,
};

#[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone)]
#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
use {solana_clock::Epoch, solana_pubkey::Pubkey, std::collections::BTreeMap};

#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[derive(Debug, Default, PartialEq, Eq, Clone)]
#[cfg_attr(test, derive(Arbitrary))]
pub struct AuthorizedVoters {
authorized_voters: BTreeMap<Epoch, Pubkey>,
Expand Down
Loading

0 comments on commit 46b1f9a

Please sign in to comment.