Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

break dependency of programs on solana core #1371

Merged
merged 2 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ serde_cbor = "0.9.0"
serde_derive = "1.0.27"
serde_json = "1.0.10"
socket2 = "0.3.8"
solana_program_interface = { path = "common" }
sys-info = "0.5.6"
tokio = "0.1"
tokio-codec = "0.1"
Expand Down Expand Up @@ -133,12 +134,14 @@ name = "sigverify"
[workspace]
members = [
".",
"common",
"programs/noop",
"programs/print",
"programs/move_funds",
]
default-members = [
".",
"common",
"programs/noop",
"programs/print",
"programs/move_funds",
Expand Down
22 changes: 22 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "solana_program_interface"
version = "0.1.0"
authors = [
"Anatoly Yakovenko <[email protected]>",
"Greg Fitzgerald <[email protected]>",
"Stephen Akridge <[email protected]>",
"Michael Vines <[email protected]>",
"Rob Walker <[email protected]>",
"Pankaj Garg <[email protected]>",
"Tyera Eulberg <[email protected]>",
"Jack May <[email protected]>",
]

[dependencies]
bincode = "1.0.0"
bs58 = "0.2.0"
generic-array = { version = "0.12.0", default-features = false, features = ["serde"] }
serde = "1.0.27"
serde_derive = "1.0.27"


File renamed without changes.
7 changes: 7 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub mod account;
pub mod pubkey;
extern crate bincode;
extern crate bs58;
extern crate generic_array;
#[macro_use]
extern crate serde_derive;
File renamed without changes.
3 changes: 1 addition & 2 deletions programs/move_funds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ authors = [
[dependencies]
bincode = "1.0.0"
generic-array = { version = "0.12.0", default-features = false, features = ["serde"] }
libloading = "0.5.0"
solana = { path = "../.." }
solana_program_interface = { path = "../../common" }

[lib]
name = "move_funds"
Expand Down
8 changes: 4 additions & 4 deletions programs/move_funds/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extern crate bincode;
extern crate solana;
extern crate solana_program_interface;

use bincode::deserialize;
use solana::account::KeyedAccount;
use solana_program_interface::account::KeyedAccount;

#[no_mangle]
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, data: &[u8]) {
Expand All @@ -22,8 +22,8 @@ pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, data: &[u8]) {
mod tests {
use super::*;
use bincode::serialize;
use solana::account::Account;
use solana::pubkey::Pubkey;
use solana_program_interface::account::Account;
use solana_program_interface::pubkey::Pubkey;

#[test]
fn test_move_funds() {
Expand Down
3 changes: 1 addition & 2 deletions programs/noop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ authors = [
]

[dependencies]
libloading = "0.5.0"
solana = { path = "../.." }
solana_program_interface = { path = "../../common" }

[lib]
name = "noop"
Expand Down
4 changes: 2 additions & 2 deletions programs/noop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate solana;
extern crate solana_program_interface;

use solana::account::KeyedAccount;
use solana_program_interface::account::KeyedAccount;

#[no_mangle]
pub extern "C" fn process(_infos: &mut Vec<KeyedAccount>, _data: &[u8]) {}
3 changes: 1 addition & 2 deletions programs/print/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ authors = [
]

[dependencies]
libloading = "0.5.0"
solana = { path = "../.." }
solana_program_interface = { path = "../../common" }

[lib]
name = "print"
Expand Down
4 changes: 2 additions & 2 deletions programs/print/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate solana;
extern crate solana_program_interface;

use solana::account::KeyedAccount;
use solana_program_interface::account::KeyedAccount;

#[no_mangle]
pub extern "C" fn process(infos: &mut Vec<KeyedAccount>, _data: &[u8]) {
Expand Down
4 changes: 2 additions & 2 deletions src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! on behalf of the caller, and a low-level API for when they have
//! already been signed and verified.

use account::{Account, KeyedAccount};
use bincode::deserialize;
use bincode::serialize;
use budget_program::BudgetState;
Expand All @@ -17,8 +16,9 @@ use ledger::Block;
use log::Level;
use mint::Mint;
use payment_plan::Payment;
use pubkey::Pubkey;
use signature::{Keypair, Signature};
use solana_program_interface::account::{Account, KeyedAccount};
use solana_program_interface::pubkey::Pubkey;
use std;
use std::collections::{BTreeMap, HashMap, VecDeque};
use std::result;
Expand Down
2 changes: 1 addition & 1 deletion src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ mod tests {
use entry::Entry;
use ledger::next_entries_mut;
use mint::Mint;
use pubkey::Pubkey;
use service::Service;
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std::cmp;
use std::sync::atomic::AtomicBool;
use std::sync::mpsc::{channel, Sender};
Expand Down
2 changes: 1 addition & 1 deletion src/budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use chrono::prelude::*;
use payment_plan::{Payment, Witness};
use pubkey::Pubkey;
use solana_program_interface::pubkey::Pubkey;
use std::mem;

/// A data type representing a `Witness` that the payment plan is waiting on.
Expand Down
8 changes: 4 additions & 4 deletions src/budget_program.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! budget program
use account::Account;
use bincode::{self, deserialize, serialize_into, serialized_size};
use budget::Budget;
use budget_instruction::Instruction;
use chrono::prelude::{DateTime, Utc};
use payment_plan::Witness;
use pubkey::Pubkey;
use solana_program_interface::account::Account;
use solana_program_interface::pubkey::Pubkey;
use std::io;
use transaction::Transaction;

Expand Down Expand Up @@ -265,14 +265,14 @@ impl BudgetState {
}
#[cfg(test)]
mod test {
use account::Account;
use bincode::serialize;
use budget_program::{BudgetError, BudgetState};
use budget_transaction::BudgetTransaction;
use chrono::prelude::{DateTime, NaiveDate, Utc};
use hash::Hash;
use pubkey::Pubkey;
use signature::{GenKeys, Keypair, KeypairUtil};
use solana_program_interface::account::Account;
use solana_program_interface::pubkey::Pubkey;
use transaction::Transaction;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/budget_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use budget_program::BudgetState;
use chrono::prelude::*;
use hash::Hash;
use payment_plan::Payment;
use pubkey::Pubkey;
use signature::Keypair;
use solana_program_interface::pubkey::Pubkey;
use transaction::Transaction;

pub trait BudgetTransaction {
Expand Down
4 changes: 2 additions & 2 deletions src/choose_gossip_peer_strategy.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crdt::{CrdtError, NodeInfo};
use pubkey::Pubkey;
use rand::distributions::{Distribution, Weighted, WeightedChoice};
use rand::thread_rng;
use result::Result;
use solana_program_interface::pubkey::Pubkey;
use std;
use std::collections::HashMap;

Expand Down Expand Up @@ -192,8 +192,8 @@ impl<'a> ChooseGossipPeerStrategy for ChooseWeightedPeerStrategy<'a> {
mod tests {
use choose_gossip_peer_strategy::{ChooseWeightedPeerStrategy, DEFAULT_WEIGHT};
use logger;
use pubkey::Pubkey;
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std;
use std::collections::HashMap;

Expand Down
4 changes: 2 additions & 2 deletions src/crdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ use ledger::LedgerWindow;
use log::Level;
use netutil::{bind_in_range, bind_to, multi_bind_in_range};
use packet::{to_blob, Blob, BlobRecycler, SharedBlob, BLOB_SIZE};
use pubkey::Pubkey;
use rand::{thread_rng, Rng};
use rayon::prelude::*;
use result::{Error, Result};
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std;
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
Expand Down Expand Up @@ -1409,9 +1409,9 @@ mod tests {
use ledger::{LedgerWindow, LedgerWriter};
use logger;
use packet::BlobRecycler;
use pubkey::Pubkey;
use result::Error;
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std::fs::remove_dir_all;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};
Expand Down
2 changes: 1 addition & 1 deletion src/drone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use bincode::{deserialize, serialize};
use bytes::Bytes;
use influx_db_client as influxdb;
use metrics;
use pubkey::Pubkey;
use signature::{Keypair, Signature};
use solana_program_interface::pubkey::Pubkey;
use std::io;
use std::io::{Error, ErrorKind};
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
Expand Down
6 changes: 3 additions & 3 deletions src/dynamic_program.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extern crate bincode;
extern crate generic_array;

use account::KeyedAccount;
use libc;
use libloading;
use solana_program_interface::account::KeyedAccount;
use std::path::PathBuf;

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -98,9 +98,9 @@ impl DynamicProgram {
#[cfg(test)]
mod tests {
use super::*;
use account::Account;
use bincode::serialize;
use pubkey::Pubkey;
use solana_program_interface::account::Account;
use solana_program_interface::pubkey::Pubkey;
use std::path::Path;
use std::thread;

Expand Down
2 changes: 1 addition & 1 deletion src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use budget_transaction::BudgetTransaction;
use hash::Hash;
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE};
use poh::Poh;
use pubkey::Pubkey;
use rayon::prelude::*;
use solana_program_interface::pubkey::Pubkey;
use std::io::Cursor;
use std::net::SocketAddr;
use std::sync::mpsc::{Receiver, Sender};
Expand Down
4 changes: 2 additions & 2 deletions src/erasure.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Support erasure coding
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE, BLOB_HEADER_SIZE};
use pubkey::Pubkey;
use solana_program_interface::pubkey::Pubkey;
use std::cmp;
use std::mem;
use std::result;
Expand Down Expand Up @@ -603,9 +603,9 @@ mod test {
use erasure;
use logger;
use packet::{BlobRecycler, BLOB_DATA_SIZE, BLOB_HEADER_SIZE, BLOB_SIZE};
use pubkey::Pubkey;
use rand::{thread_rng, Rng};
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
// use std::sync::{Arc, RwLock};
use window::{index_blobs, WindowSlot};

Expand Down
2 changes: 1 addition & 1 deletion src/fullnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use drone::DRONE_PORT;
use entry::Entry;
use ledger::read_ledger;
use ncp::Ncp;
use pubkey::Pubkey;
use rpc::{JsonRpcService, RPC_PORT};
use rpu::Rpu;
use service::Service;
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std::net::UdpSocket;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::atomic::{AtomicBool, Ordering};
Expand Down
2 changes: 1 addition & 1 deletion src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use log::Level::Trace;
#[cfg(test)]
use mint::Mint;
use packet::{self, SharedBlob, BLOB_DATA_SIZE};
use pubkey::Pubkey;
use rayon::prelude::*;
use result::{Error, Result};
#[cfg(test)]
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use std::fs::{create_dir_all, remove_dir_all, File, OpenOptions};
use std::io::prelude::*;
use std::io::{self, BufReader, BufWriter, Seek, SeekFrom};
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#![cfg_attr(feature = "unstable", feature(test))]
#[macro_use]
pub mod counter;
pub mod account;
pub mod bank;
pub mod banking_stage;
pub mod blob_fetch_stage;
Expand Down Expand Up @@ -41,7 +40,6 @@ pub mod packet;
pub mod payment_plan;
pub mod poh;
pub mod poh_recorder;
pub mod pubkey;
pub mod recvmmsg;
pub mod recycler;
pub mod replicate_stage;
Expand Down Expand Up @@ -84,6 +82,7 @@ extern crate generic_array;
extern crate ipnetwork;
extern crate itertools;
extern crate jsonrpc_core;
extern crate solana_program_interface;
#[macro_use]
extern crate jsonrpc_macros;
extern crate jsonrpc_http_server;
Expand Down
2 changes: 1 addition & 1 deletion src/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use entry::Entry;
use hash::{hash, Hash};
use pubkey::Pubkey;
use ring::rand::SystemRandom;
use signature::{Keypair, KeypairUtil};
use solana_program_interface::pubkey::Pubkey;
use system_transaction::SystemTransaction;
use transaction::Transaction;
use untrusted::Input;
Expand Down
2 changes: 1 addition & 1 deletion src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use hash::Hash;
#[cfg(test)]
use ledger::{next_entries_mut, Block};
use log::Level;
use pubkey::Pubkey;
use recvmmsg::{recv_mmsg, NUM_RCVMMSGS};
use recycler;
use result::{Error, Result};
use serde::Serialize;
use solana_program_interface::pubkey::Pubkey;
use std::fmt;
use std::io;
use std::mem::size_of;
Expand Down
2 changes: 1 addition & 1 deletion src/payment_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! `Payment`, the payment is executed.

use chrono::prelude::*;
use pubkey::Pubkey;
use solana_program_interface::pubkey::Pubkey;

/// The types of events a payment plan can process.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
Expand Down
Loading