Skip to content

Commit

Permalink
Port programs to solana-program-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Oct 24, 2020
1 parent 63db324 commit fe68f7f
Show file tree
Hide file tree
Showing 56 changed files with 113 additions and 253 deletions.
54 changes: 28 additions & 26 deletions programs/bpf/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 programs/bpf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fn main() {
let rust_programs = [
"128bit",
"alloc",
"call_depth",
"custom_heap",
"dep_crate",
"deprecated_loader",
Expand Down
10 changes: 2 additions & 8 deletions programs/bpf/rust/128bit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[package]
name = "solana-bpf-rust-128bit"
version = "1.5.0"
Expand All @@ -11,12 +9,8 @@ homepage = "https://solana.com/"
edition = "2018"

[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.5.0", default-features = false }
solana-bpf-rust-128bit-dep = { path = "../128bit_dep", version = "1.5.0", default-features = false }

[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }
solana-bpf-rust-128bit-dep = { path = "../128bit_dep", version = "1.5.0" }

[lib]
name = "solana_bpf_rust_128bit"
Expand Down
4 changes: 2 additions & 2 deletions programs/bpf/rust/128bit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! @brief Example Rust-based BPF program tests loop iteration
extern crate solana_sdk;
use solana_sdk::entrypoint::SUCCESS;
extern crate solana_program_sdk;
use solana_program_sdk::entrypoint::SUCCESS;

#[no_mangle]
pub extern "C" fn entrypoint(_input: *mut u8) -> u64 {
Expand Down
8 changes: 1 addition & 7 deletions programs/bpf/rust/128bit_dep/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[package]
name = "solana-bpf-rust-128bit-dep"
version = "1.5.0"
Expand All @@ -11,11 +9,7 @@ homepage = "https://solana.com/"
edition = "2018"

[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.5.0", default-features = false }

[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
2 changes: 1 addition & 1 deletion programs/bpf/rust/128bit_dep/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! @brief Solana Rust-based BPF program utility functions and types
extern crate solana_sdk;
extern crate solana_program_sdk;

pub fn uadd(x: u128, y: u128) -> u128 {
x + y
Expand Down
8 changes: 1 addition & 7 deletions programs/bpf/rust/alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[package]
name = "solana-bpf-rust-alloc"
version = "1.5.0"
Expand All @@ -11,11 +9,7 @@ homepage = "https://solana.com/"
edition = "2018"

[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.5.0", default-features = false }

[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }

[lib]
name = "solana_bpf_rust_alloc"
Expand Down
3 changes: 1 addition & 2 deletions programs/bpf/rust/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#[macro_use]
extern crate alloc;
extern crate solana_sdk;
use solana_sdk::{entrypoint::SUCCESS, info};
use solana_program_sdk::{entrypoint::SUCCESS, info};
use std::{alloc::Layout, mem};

#[no_mangle]
Expand Down
10 changes: 2 additions & 8 deletions programs/bpf/rust/call_depth/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@


[package]
name = "solana-bpf-rust-call-depth"
version = "1.4.0"
version = "1.5.0"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <[email protected]>"]
repository = "https://github.com/solana-labs/solana"
Expand All @@ -11,11 +9,7 @@ homepage = "https://solana.com/"
edition = "2018"

[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.4.0", default-features = false }

[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }

[lib]
name = "solana_bpf_rust_call_depth"
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/rust/call_depth/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! @brief Example Rust-based BPF program that tests call depth and stack usage
use solana_sdk::{entrypoint::SUCCESS, info};
use solana_program_sdk::{entrypoint::SUCCESS, info};

#[inline(never)]
pub fn recurse(data: &mut [u8]) {
Expand Down
7 changes: 2 additions & 5 deletions programs/bpf/rust/custom_heap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[package]
name = "solana-bpf-rust-custom-heap"
version = "1.5.0"
Expand All @@ -11,12 +9,11 @@ homepage = "https://solana.com/"
edition = "2018"

[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.5.0", default-features = false }
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }

[features]
default = ["custom-heap"]
custom-heap = []
program = ["custom-heap", "solana-sdk/program"]
default = ["program", "solana-sdk/default"]

[lib]
name = "solana_bpf_rust_custom_heap"
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/rust/custom_heap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! @brief Example Rust-based BPF that tests out using a custom heap
use solana_sdk::{
use solana_program_sdk::{
account_info::AccountInfo,
entrypoint,
entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
Expand Down
8 changes: 1 addition & 7 deletions programs/bpf/rust/dep_crate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


[package]
name = "solana-bpf-rust-dep-crate"
version = "1.5.0"
Expand All @@ -12,11 +10,7 @@ edition = "2018"

[dependencies]
byteorder = { version = "1", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.5.0", default-features = false }

[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
solana-program-sdk = { path = "../../../../sdk/program", version = "1.5.0" }

[lib]
name = "solana_bpf_rust_dep_crate"
Expand Down
Loading

0 comments on commit fe68f7f

Please sign in to comment.