Update wallet to pass full ELFs (#1738)

This commit is contained in:
jackcmay
2018-11-08 09:03:48 -08:00
committed by GitHub
parent 6721bdde3d
commit d2dc585974
2 changed files with 14 additions and 10 deletions

View File

@ -117,6 +117,14 @@ $ solana-wallet send-timestamp <PUBKEY> <PROCESS_ID> --date 2018-12-24T23:59:00
<TX_SIGNATURE> <TX_SIGNATURE>
``` ```
### Deploy program
```
// Command
$ solana-wallet deploy <PATH>
// Return
<PROGRAM_ID>
```
## Javascript solana-web3.js Interface ## Javascript solana-web3.js Interface

View File

@ -7,7 +7,6 @@ use chrono::prelude::*;
use clap::ArgMatches; use clap::ArgMatches;
use cluster_info::NodeInfo; use cluster_info::NodeInfo;
use drone::DroneRequest; use drone::DroneRequest;
use elf;
use fullnode::Config; use fullnode::Config;
use hash::Hash; use hash::Hash;
use loader_transaction::LoaderTransaction; use loader_transaction::LoaderTransaction;
@ -31,7 +30,6 @@ use std::{error, fmt, mem};
use system_transaction::SystemTransaction; use system_transaction::SystemTransaction;
use transaction::Transaction; use transaction::Transaction;
const PLATFORM_SECTION_C: &str = ".text.entrypoint";
const USERDATA_CHUNK_SIZE: usize = 256; const USERDATA_CHUNK_SIZE: usize = 256;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -396,16 +394,14 @@ pub fn process_command(config: &WalletConfig) -> Result<String, Box<error::Error
let last_id = get_last_id(&config)?; let last_id = get_last_id(&config)?;
let program = Keypair::new(); let program = Keypair::new();
let program_userdata = elf::File::open_path(program_location) let mut program_userdata = Vec::new();
File::open(program_location)
.map_err(|_| { .map_err(|_| {
WalletError::DynamicProgramError("Could not parse program file".to_string()) WalletError::DynamicProgramError("Could not parse program file".to_string())
})?.get_section(PLATFORM_SECTION_C) })?.read_to_end(&mut program_userdata)
.ok_or_else(|| { .map_err(|_| {
WalletError::DynamicProgramError( WalletError::DynamicProgramError("Could not read program file".to_string())
"Could not find entrypoint in program file".to_string(), })?;
)
})?.data
.clone();
let tx = Transaction::system_create( let tx = Transaction::system_create(
&config.id, &config.id,