Move KeyedAccount into Account

Now programs don't need to depend on dynamic_program and its
dependencies.
This commit is contained in:
Greg Fitzgerald 2018-09-26 20:23:59 -06:00
parent b7ae5b712a
commit 874addc51a
7 changed files with 13 additions and 15 deletions

View File

@ -2,7 +2,7 @@ extern crate bincode;
extern crate solana;
use bincode::deserialize;
use solana::dynamic_program::KeyedAccount;
use solana::account::KeyedAccount;
#[no_mangle]
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, data: &[u8]) {

View File

@ -1,6 +1,6 @@
extern crate solana;
use solana::dynamic_program::KeyedAccount;
use solana::account::KeyedAccount;
#[no_mangle]
pub extern "C" fn process(_infos: &mut Vec<KeyedAccount>, _data: &[u8]) {}

View File

@ -1,6 +1,6 @@
extern crate solana;
use solana::dynamic_program::KeyedAccount;
use solana::account::KeyedAccount;
#[no_mangle]
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, _data: &[u8]) {

View File

@ -21,3 +21,9 @@ impl Account {
}
}
}
#[derive(Debug)]
pub struct KeyedAccount<'a> {
pub key: &'a Pubkey,
pub account: &'a mut Account,
}

View File

@ -3,13 +3,13 @@
//! on behalf of the caller, and a low-level API for when they have
//! already been signed and verified.
use account::Account;
use account::{Account, KeyedAccount};
use bincode::deserialize;
use bincode::serialize;
use budget_program::BudgetState;
use budget_transaction::BudgetTransaction;
use counter::Counter;
use dynamic_program::{DynamicProgram, KeyedAccount};
use dynamic_program::DynamicProgram;
use entry::Entry;
use hash::{hash, Hash};
use itertools::Itertools;

View File

@ -1,10 +1,9 @@
extern crate bincode;
extern crate generic_array;
use account::Account;
use account::KeyedAccount;
use libc;
use libloading;
use pubkey::Pubkey;
use std::path::PathBuf;
#[cfg(debug_assertions)]
@ -40,12 +39,6 @@ fn create_library_path(name: &str) -> PathBuf {
path
}
#[derive(Debug)]
pub struct KeyedAccount<'a> {
pub key: &'a Pubkey,
pub account: &'a mut Account,
}
// All programs export a symbol named process()
const ENTRYPOINT: &str = "process";
type Entrypoint = unsafe extern "C" fn(infos: &mut Vec<KeyedAccount>, data: &[u8]);

View File

@ -97,9 +97,8 @@ impl SystemProgram {
}
#[cfg(test)]
mod test {
use account::Account;
use account::{Account, KeyedAccount};
use bincode::serialize;
use dynamic_program::KeyedAccount;
use hash::Hash;
use pubkey::Pubkey;
use signature::{Keypair, KeypairUtil};