parent
d158d45051
commit
777342a1ef
|
@ -1896,6 +1896,15 @@ dependencies = [
|
|||
"solana-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-bpf-rust-rand"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"rand",
|
||||
"solana-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-bpf-rust-sanity"
|
||||
version = "1.4.0"
|
||||
|
|
|
@ -52,6 +52,7 @@ members = [
|
|||
"rust/panic",
|
||||
"rust/param_passing",
|
||||
"rust/param_passing_dep",
|
||||
"rust/rand",
|
||||
"rust/sanity",
|
||||
"rust/sysval",
|
||||
]
|
||||
|
|
|
@ -80,6 +80,7 @@ fn main() {
|
|||
"noop",
|
||||
"panic",
|
||||
"param_passing",
|
||||
"rand",
|
||||
"sanity",
|
||||
"sysval",
|
||||
];
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
# Note: This crate must be built using do.sh
|
||||
|
||||
[package]
|
||||
name = "solana-bpf-rust-rand"
|
||||
version = "1.4.0"
|
||||
description = "Solana BPF test program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
getrandom = { version = "0.1.14", features = ["dummy"] }
|
||||
rand = "0.7"
|
||||
solana-sdk = { path = "../../../../sdk/", version = "1.4.0", default-features = false }
|
||||
|
||||
[features]
|
||||
program = ["solana-sdk/program"]
|
||||
default = ["program", "solana-sdk/default"]
|
||||
|
||||
[lib]
|
||||
name = "solana_bpf_rust_rand"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
|
@ -0,0 +1,2 @@
|
|||
[target.bpfel-unknown-unknown.dependencies.std]
|
||||
features = []
|
|
@ -0,0 +1,18 @@
|
|||
//! @brief Example Rust-based BPF program that tests rand behavior
|
||||
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
extern crate solana_sdk;
|
||||
use solana_sdk::{
|
||||
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, info, pubkey::Pubkey,
|
||||
};
|
||||
|
||||
entrypoint!(process_instruction);
|
||||
fn process_instruction(
|
||||
_program_id: &Pubkey,
|
||||
_accounts: &[AccountInfo],
|
||||
_instruction_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
info!("rand");
|
||||
Ok(())
|
||||
}
|
|
@ -152,6 +152,7 @@ fn test_program_bpf_sanity() {
|
|||
("solana_bpf_rust_noop", true),
|
||||
("solana_bpf_rust_panic", false),
|
||||
("solana_bpf_rust_param_passing", true),
|
||||
("solana_bpf_rust_rand", true),
|
||||
("solana_bpf_rust_sanity", true),
|
||||
("solana_bpf_rust_sysval", true),
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue