-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove frozen ABI modules from solana-sdk
- Loading branch information
Showing
38 changed files
with
240 additions
and
106 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ members = [ | |
"dos", | ||
"download-utils", | ||
"faucet", | ||
"frozen-abi", | ||
"perf", | ||
"validator", | ||
"genesis", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../sdk/build.rs | ||
../frozen-abi/build.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "solana-frozen-abi" | ||
version = "1.5.0" | ||
description = "Solana Frozen ABI" | ||
authors = ["Solana Maintainers <[email protected]>"] | ||
repository = "https://github.com/solana-labs/solana" | ||
homepage = "https://solana.com/" | ||
license = "Apache-2.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
bs58 = "0.3.1" | ||
bv = { version = "0.11.1", features = ["serde"] } | ||
log = "0.4.8" | ||
serde = "1.0.112" | ||
serde_derive = "1.0.103" | ||
sha2 = "0.8.2" | ||
solana-frozen-abi-macro = { path = "macro", version = "1.5.0" } | ||
thiserror = "1.0" | ||
|
||
[target.'cfg(not(target_arch = "bpf"))'.dependencies] | ||
solana-logger = { path = "../logger", version = "1.5.0" } | ||
generic-array = { version = "0.14.3", default-features = false, features = ["serde", "more_lengths"]} | ||
memmap = "0.7.0" | ||
|
||
[build-dependencies] | ||
rustc_version = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extern crate rustc_version; | ||
use rustc_version::{version_meta, Channel}; | ||
|
||
fn main() { | ||
// Copied and adapted from | ||
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example | ||
// Licensed under Apache-2.0 + MIT | ||
match version_meta().unwrap().channel { | ||
Channel::Stable => { | ||
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION"); | ||
} | ||
Channel::Beta => { | ||
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION"); | ||
} | ||
Channel::Nightly => { | ||
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION"); | ||
} | ||
Channel::Dev => { | ||
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION"); | ||
// See https://github.com/solana-labs/solana/issues/11055 | ||
// We may be running the custom `rust-bpf-builder` toolchain, | ||
// which currently needs `#![feature(proc_macro_hygiene)]` to | ||
// be applied. | ||
println!("cargo:rustc-cfg=RUSTC_NEEDS_PROC_MACRO_HYGIENE"); | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
sdk/macro-frozen-abi/Cargo.toml → frozen-abi/macro/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "solana-sdk-macro-frozen-abi" | ||
name = "solana-frozen-abi-macro" | ||
version = "1.5.0" | ||
description = "Solana SDK Macro frozen abi" | ||
description = "Solana Frozen ABI Macro" | ||
authors = ["Solana Maintainers <[email protected]>"] | ||
repository = "https://github.com/solana-labs/solana" | ||
homepage = "https://solana.com/" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use sha2::{Digest, Sha256}; | ||
use std::{convert::TryFrom, fmt}; | ||
|
||
const HASH_BYTES: usize = 32; | ||
#[derive(AbiExample)] | ||
pub struct Hash(pub [u8; HASH_BYTES]); | ||
|
||
#[derive(Default)] | ||
pub struct Hasher { | ||
hasher: Sha256, | ||
} | ||
|
||
impl Hasher { | ||
pub fn hash(&mut self, val: &[u8]) { | ||
self.hasher.input(val); | ||
} | ||
pub fn result(self) -> Hash { | ||
// At the time of this writing, the sha2 library is stuck on an old version | ||
// of generic_array (0.9.0). Decouple ourselves with a clone to our version. | ||
Hash(<[u8; HASH_BYTES]>::try_from(self.hasher.result().as_slice()).unwrap()) | ||
} | ||
} | ||
|
||
impl fmt::Display for Hash { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}", bs58::encode(self.0).into_string()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))] | ||
#![cfg_attr(RUSTC_NEEDS_PROC_MACRO_HYGIENE, feature(proc_macro_hygiene))] | ||
|
||
// Allows macro expansion of `use ::solana_frozen_abi::*` to work within this crate | ||
extern crate self as solana_frozen_abi; | ||
|
||
#[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
pub mod abi_digester; | ||
#[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
pub mod abi_example; | ||
|
||
#[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
mod hash; | ||
|
||
#[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
#[macro_use] | ||
extern crate solana_frozen_abi_macro; | ||
|
||
#[cfg(RUSTC_WITH_SPECIALIZATION)] | ||
#[cfg(test)] | ||
#[macro_use] | ||
extern crate serde_derive; |
Oops, something went wrong.