Rust 2018 cleanup

This commit is contained in:
Michael Vines
2018-12-14 20:39:10 -08:00
committed by Grimes
parent aaa5cd4615
commit fd562cb9e2
59 changed files with 109 additions and 209 deletions

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
/// An Account with userdata that is stored on chain
#[repr(C)]

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
pub const BPF_LOADER_PROGRAM_ID: [u8; 32] = [
128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -3,9 +3,9 @@
//! which it uses to reduce the payment plan. When the budget is reduced to a
//! `Payment`, the payment is executed.
use crate::payment_plan::{Payment, Witness};
use crate::pubkey::Pubkey;
use chrono::prelude::*;
use payment_plan::{Payment, Witness};
use pubkey::Pubkey;
use std::mem;
/// A data type representing a `Witness` that the payment plan is waiting on.
@ -141,7 +141,7 @@ impl BudgetExpr {
#[cfg(test)]
mod tests {
use super::*;
use signature::{Keypair, KeypairUtil};
use crate::signature::{Keypair, KeypairUtil};
#[test]
fn test_signature_satisfied() {

View File

@ -1,4 +1,4 @@
use budget_expr::BudgetExpr;
use crate::budget_expr::BudgetExpr;
use chrono::prelude::{DateTime, Utc};
/// A smart contract.

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
pub const BUDGET_PROGRAM_ID: [u8; 32] = [
129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -1,17 +1,17 @@
//! The `budget_transaction` module provides functionality for creating Budget transactions.
use crate::budget_expr::{BudgetExpr, Condition};
use crate::budget_instruction::Instruction;
use crate::budget_program;
use crate::hash::Hash;
use crate::payment_plan::Payment;
use crate::pubkey::Pubkey;
use crate::signature::{Keypair, KeypairUtil};
use crate::system_instruction::SystemInstruction;
use crate::system_program;
use crate::transaction::{self, Transaction};
use bincode::deserialize;
use budget_expr::{BudgetExpr, Condition};
use budget_instruction::Instruction;
use budget_program;
use chrono::prelude::*;
use hash::Hash;
use payment_plan::Payment;
use pubkey::Pubkey;
use signature::{Keypair, KeypairUtil};
use system_instruction::SystemInstruction;
use system_program;
use transaction::{self, Transaction};
pub trait BudgetTransaction {
fn budget_new_taxed(

View File

@ -23,16 +23,5 @@ pub mod transaction;
pub mod vote_program;
pub mod vote_transaction;
extern crate bincode;
extern crate bs58;
extern crate byteorder;
extern crate chrono;
extern crate generic_array;
extern crate log;
extern crate ring;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate sha2;
extern crate untrusted;

View File

@ -1,10 +1,10 @@
//! The `loader_transaction` module provides functionality for loading and calling a program
use hash::Hash;
use loader_instruction::LoaderInstruction;
use pubkey::Pubkey;
use signature::Keypair;
use transaction::Transaction;
use crate::hash::Hash;
use crate::loader_instruction::LoaderInstruction;
use crate::pubkey::Pubkey;
use crate::signature::Keypair;
use crate::transaction::Transaction;
pub trait LoaderTransaction {
fn loader_write(

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
pub const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -1,5 +1,5 @@
use account::KeyedAccount;
use pubkey::Pubkey;
use crate::account::KeyedAccount;
use crate::pubkey::Pubkey;
use std;
/// Reasons a program might have rejected an instruction.

View File

@ -3,8 +3,8 @@
//! which it uses to reduce the payment plan. When the plan is reduced to a
//! `Payment`, the payment is executed.
use crate::pubkey::Pubkey;
use chrono::prelude::*;
use pubkey::Pubkey;
/// The types of events a payment plan can process.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]

View File

@ -1,9 +1,9 @@
//! The `signature` module provides functionality for public, and private keys.
use crate::pubkey::Pubkey;
use bs58;
use generic_array::typenum::U64;
use generic_array::GenericArray;
use pubkey::Pubkey;
use ring::signature::Ed25519KeyPair;
use ring::{rand, signature};
use serde_json;

View File

@ -1,7 +1,7 @@
use hash::Hash;
use pubkey::Pubkey;
use signature::{Keypair, KeypairUtil};
use transaction::Transaction;
use crate::hash::Hash;
use crate::pubkey::Pubkey;
use crate::signature::{Keypair, KeypairUtil};
use crate::transaction::Transaction;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum StorageProgram {

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum SystemInstruction {

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
pub const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32];

View File

@ -1,11 +1,11 @@
//! The `system_transaction` module provides functionality for creating system transactions.
use hash::Hash;
use pubkey::Pubkey;
use signature::Keypair;
use system_instruction::SystemInstruction;
use system_program;
use transaction::{Instruction, Transaction};
use crate::hash::Hash;
use crate::pubkey::Pubkey;
use crate::signature::Keypair;
use crate::system_instruction::SystemInstruction;
use crate::system_program;
use crate::transaction::{Instruction, Transaction};
pub trait SystemTransaction {
fn system_create(
@ -137,7 +137,7 @@ impl SystemTransaction for Transaction {
#[cfg(test)]
mod tests {
use super::*;
use signature::KeypairUtil;
use crate::signature::KeypairUtil;
#[test]
fn test_move_many() {

View File

@ -1,5 +1,5 @@
//! An ERC20-like Token
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
const TOKEN_PROGRAM_ID: [u8; 32] = [
131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -1,10 +1,10 @@
//! The `transaction` module provides functionality for creating log transactions.
use crate::hash::{Hash, Hasher};
use crate::pubkey::Pubkey;
use crate::signature::{Keypair, KeypairUtil, Signature};
use bincode::serialize;
use hash::{Hash, Hasher};
use pubkey::Pubkey;
use serde::Serialize;
use signature::{Keypair, KeypairUtil, Signature};
use std::mem::size_of;
pub const SIG_OFFSET: usize = size_of::<u64>();

View File

@ -1,10 +1,10 @@
//! Vote program
//! Receive and processes votes from validators
use crate::native_program::ProgramError;
use crate::pubkey::Pubkey;
use bincode::{deserialize, serialize};
use byteorder::{ByteOrder, LittleEndian};
use native_program::ProgramError;
use pubkey::Pubkey;
use std::collections::VecDeque;
use std::mem;

View File

@ -1,13 +1,13 @@
//! The `vote_transaction` module provides functionality for creating vote transactions.
use crate::hash::Hash;
use crate::pubkey::Pubkey;
use crate::signature::Keypair;
use crate::system_instruction::SystemInstruction;
use crate::system_program;
use crate::transaction::{Instruction, Transaction};
use crate::vote_program::{self, Vote, VoteInstruction};
use bincode::deserialize;
use hash::Hash;
use pubkey::Pubkey;
use signature::Keypair;
use system_instruction::SystemInstruction;
use system_program;
use transaction::{Instruction, Transaction};
use vote_program::{self, Vote, VoteInstruction};
pub trait VoteTransaction {
fn vote_new(vote_account: &Keypair, vote: Vote, last_id: Hash, fee: u64) -> Self;