merkle-tree: fix build when targeting bpf (bp #16335) (#16342)

* merkle-tree: Add Xargo.toml

(cherry picked from commit a1d9b53cd7)

* merkle-tree: Get `Hash` et. al from program instead of sdk

(cherry picked from commit ddc0a16cec)

* merkle-tree: Use `matches` crate when targeting eBPF

(cherry picked from commit a44c32694f)

Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
mergify[bot]
2021-04-05 21:57:26 +00:00
committed by GitHub
parent 57da68d563
commit f2f4f28c0b
5 changed files with 15 additions and 3 deletions

3
Cargo.lock generated
View File

@ -4792,7 +4792,8 @@ version = "1.6.5"
dependencies = [
"fast-math",
"hex",
"solana-sdk",
"matches",
"solana-program 1.6.5",
]
[[package]]

View File

@ -10,9 +10,13 @@ documentation = "https://docs.rs/solana-merkle-tree"
edition = "2018"
[dependencies]
solana-sdk = { path = "../sdk", version = "=1.6.5" }
solana-program = { path = "../sdk/program", version = "=1.6.5" }
fast-math = "0.1"
# This can go once the BPF toolchain target Rust 1.42.0+
[target.bpfel-unknown-unknown.dependencies]
matches = "0.1.8"
[dev-dependencies]
hex = "0.4.2"

2
merkle-tree/Xargo.toml Normal file
View File

@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []

View File

@ -1,3 +1,8 @@
#![allow(clippy::integer_arithmetic)]
#[cfg(target_arch = "bpf")]
#[macro_use]
extern crate matches;
pub mod merkle_tree;
pub use merkle_tree::MerkleTree;

View File

@ -1,4 +1,4 @@
use solana_sdk::hash::{hashv, Hash};
use solana_program::hash::{hashv, Hash};
// We need to discern between leaf and intermediate nodes to prevent trivial second
// pre-image attacks.