Check ELF file for errors before deploy (#12741)
* Check ELF file for errors before deploy * Update cli/src/cli.rs Co-authored-by: Michael Vines <mvines@gmail.com> * Fix formatting * Bump solana_rbpf Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
parent
859eb606da
commit
6bbf6a79b7
|
@ -3569,6 +3569,7 @@ dependencies = [
|
|||
"serde_derive",
|
||||
"serde_json",
|
||||
"solana-account-decoder",
|
||||
"solana-bpf-loader-program",
|
||||
"solana-clap-utils",
|
||||
"solana-cli-config",
|
||||
"solana-cli-output",
|
||||
|
@ -3586,6 +3587,7 @@ dependencies = [
|
|||
"solana-version",
|
||||
"solana-vote-program",
|
||||
"solana-vote-signer",
|
||||
"solana_rbpf",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"url 2.1.1",
|
||||
|
|
|
@ -28,6 +28,7 @@ serde = "1.0.112"
|
|||
serde_derive = "1.0.103"
|
||||
serde_json = "1.0.56"
|
||||
solana-account-decoder = { path = "../account-decoder", version = "1.5.0" }
|
||||
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.5.0" }
|
||||
solana-clap-utils = { path = "../clap-utils", version = "1.5.0" }
|
||||
solana-cli-config = { path = "../cli-config", version = "1.5.0" }
|
||||
solana-cli-output = { path = "../cli-output", version = "1.5.0" }
|
||||
|
@ -36,6 +37,7 @@ solana-config-program = { path = "../programs/config", version = "1.5.0" }
|
|||
solana-faucet = { path = "../faucet", version = "1.5.0" }
|
||||
solana-logger = { path = "../logger", version = "1.5.0" }
|
||||
solana-net-utils = { path = "../net-utils", version = "1.5.0" }
|
||||
solana_rbpf = "=0.1.32"
|
||||
solana-remote-wallet = { path = "../remote-wallet", version = "1.5.0" }
|
||||
solana-runtime = { path = "../runtime", version = "1.5.0" }
|
||||
solana-sdk = { path = "../sdk", version = "1.5.0" }
|
||||
|
|
|
@ -7,6 +7,7 @@ use log::*;
|
|||
use num_traits::FromPrimitive;
|
||||
use serde_json::{self, json, Value};
|
||||
use solana_account_decoder::{UiAccount, UiAccountEncoding};
|
||||
use solana_bpf_loader_program::bpf_verifier;
|
||||
use solana_clap_utils::{
|
||||
self,
|
||||
commitment::commitment_arg_with_default,
|
||||
|
@ -36,6 +37,7 @@ use solana_client::{
|
|||
use solana_faucet::faucet::request_airdrop_transaction;
|
||||
#[cfg(test)]
|
||||
use solana_faucet::faucet_mock::request_airdrop_transaction;
|
||||
use solana_rbpf::vm::EbpfVm;
|
||||
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
|
||||
use solana_sdk::{
|
||||
bpf_loader, bpf_loader_deprecated,
|
||||
|
@ -1144,6 +1146,9 @@ fn process_deploy(
|
|||
CliError::DynamicProgramError(format!("Unable to read program file: {}", err))
|
||||
})?;
|
||||
|
||||
EbpfVm::create_executable_from_elf(&program_data, Some(|x| bpf_verifier::check(x, true)))
|
||||
.map_err(|err| CliError::DynamicProgramError(format!("ELF error: {}", err)))?;
|
||||
|
||||
let loader_id = if use_deprecated_loader {
|
||||
bpf_loader_deprecated::id()
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue