Remove blake3 from bpf program dependencies (#16506)
This commit is contained in:
parent
37afa00ffb
commit
f641429056
|
@ -17,7 +17,7 @@ codecov = { repository = "solana-labs/solana", branch = "master", service = "git
|
||||||
ahash = "0.6.1"
|
ahash = "0.6.1"
|
||||||
base64 = "0.12.3"
|
base64 = "0.12.3"
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
blake3 = "0.3.6"
|
blake3 = "0.3.7"
|
||||||
bv = { version = "0.11.1", features = ["serde"] }
|
bv = { version = "0.11.1", features = ["serde"] }
|
||||||
bs58 = "0.3.1"
|
bs58 = "0.3.1"
|
||||||
byteorder = "1.3.4"
|
byteorder = "1.3.4"
|
||||||
|
|
|
@ -12,7 +12,7 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayref = "0.3.6"
|
arrayref = "0.3.6"
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
blake3 = "0.3.6"
|
blake3 = "0.3.7"
|
||||||
bv = { version = "0.11.1", features = ["serde"] }
|
bv = { version = "0.11.1", features = ["serde"] }
|
||||||
byteorder = "1.3.4"
|
byteorder = "1.3.4"
|
||||||
bzip2 = "0.3.3"
|
bzip2 = "0.3.3"
|
||||||
|
|
|
@ -11,7 +11,6 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
blake3 = "0.3.7"
|
|
||||||
borsh = "0.8.1"
|
borsh = "0.8.1"
|
||||||
borsh-derive = "0.8.1"
|
borsh-derive = "0.8.1"
|
||||||
bs58 = "0.3.1"
|
bs58 = "0.3.1"
|
||||||
|
@ -33,7 +32,7 @@ solana-sdk-macro = { path = "../macro", version = "=1.7.0" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "bpf"))'.dependencies]
|
[target.'cfg(not(target_arch = "bpf"))'.dependencies]
|
||||||
blake3 = "0.3.6"
|
blake3 = "0.3.7"
|
||||||
curve25519-dalek = "2.1.0"
|
curve25519-dalek = "2.1.0"
|
||||||
rand = "0.7.0"
|
rand = "0.7.0"
|
||||||
solana-logger = { path = "../../logger", version = "=1.7.0" }
|
solana-logger = { path = "../../logger", version = "=1.7.0" }
|
||||||
|
|
|
@ -7,12 +7,11 @@ use crate::serialize_utils::{
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
|
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
|
||||||
hash::{Hash, HASH_BYTES},
|
hash::Hash,
|
||||||
instruction::{AccountMeta, CompiledInstruction, Instruction},
|
instruction::{AccountMeta, CompiledInstruction, Instruction},
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
short_vec, system_instruction, system_program, sysvar,
|
short_vec, system_instruction, system_program, sysvar,
|
||||||
};
|
};
|
||||||
use blake3::traits::digest::Digest;
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::{convert::TryFrom, str::FromStr};
|
use std::{convert::TryFrom, str::FromStr};
|
||||||
|
@ -298,17 +297,20 @@ impl Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the blake3 hash of this transaction's message
|
/// Compute the blake3 hash of this transaction's message
|
||||||
|
#[cfg(not(target_arch = "bpf"))]
|
||||||
pub fn hash(&self) -> Hash {
|
pub fn hash(&self) -> Hash {
|
||||||
let message_bytes = self.serialize();
|
let message_bytes = self.serialize();
|
||||||
Self::hash_raw_message(&message_bytes)
|
Self::hash_raw_message(&message_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the blake3 hash of a raw transaction message
|
/// Compute the blake3 hash of a raw transaction message
|
||||||
|
#[cfg(not(target_arch = "bpf"))]
|
||||||
pub fn hash_raw_message(message_bytes: &[u8]) -> Hash {
|
pub fn hash_raw_message(message_bytes: &[u8]) -> Hash {
|
||||||
|
use blake3::traits::digest::Digest;
|
||||||
let mut hasher = blake3::Hasher::new();
|
let mut hasher = blake3::Hasher::new();
|
||||||
hasher.update(b"solana-tx-message-v1");
|
hasher.update(b"solana-tx-message-v1");
|
||||||
hasher.update(message_bytes);
|
hasher.update(message_bytes);
|
||||||
Hash(<[u8; HASH_BYTES]>::try_from(hasher.finalize().as_slice()).unwrap())
|
Hash(<[u8; crate::hash::HASH_BYTES]>::try_from(hasher.finalize().as_slice()).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compile_instruction(&self, ix: &Instruction) -> CompiledInstruction {
|
pub fn compile_instruction(&self, ix: &Instruction) -> CompiledInstruction {
|
||||||
|
|
Loading…
Reference in New Issue