ethcore public interface cleanup
This commit is contained in:
parent
30dc9d857d
commit
cb98cbcd4b
@ -44,6 +44,7 @@ pub enum Error {
|
||||
},
|
||||
/// Returned on evm internal error. Should never be ignored during development.
|
||||
/// Likely to cause consensus issues.
|
||||
#[allow(dead_code)] // created only by jit
|
||||
Internal,
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
//! Evm factory.
|
||||
//!
|
||||
//! TODO: consider spliting it into two separate files.
|
||||
use std::fmt;
|
||||
use evm::Evm;
|
||||
|
||||
@ -6,6 +8,7 @@ use evm::Evm;
|
||||
/// TODO [Tomusdrw] Please document me
|
||||
pub enum VMType {
|
||||
/// TODO [Tomusdrw] Please document me
|
||||
#[allow(dead_code)] // crated only by jit
|
||||
Jit,
|
||||
/// TODO [Tomusdrw] Please document me
|
||||
Interpreter
|
||||
@ -20,6 +23,7 @@ impl fmt::Display for VMType {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl VMType {
|
||||
/// Return all possible VMs (JIT, Interpreter)
|
||||
#[cfg(feature="jit")]
|
||||
@ -53,6 +57,7 @@ impl Factory {
|
||||
}
|
||||
|
||||
/// Create new instance of specific `VMType` factory
|
||||
#[cfg(test)]
|
||||
pub fn new(evm: VMType) -> Factory {
|
||||
Factory {
|
||||
evm: evm
|
||||
@ -93,6 +98,7 @@ fn test_create_vm() {
|
||||
}
|
||||
|
||||
/// Create tests by injecting different VM factories
|
||||
#[macro_export]
|
||||
macro_rules! evm_test(
|
||||
($name_test: ident: $name_jit: ident, $name_int: ident) => {
|
||||
#[test]
|
||||
@ -108,6 +114,7 @@ macro_rules! evm_test(
|
||||
);
|
||||
|
||||
/// Create ignored tests by injecting different VM factories
|
||||
#[macro_export]
|
||||
macro_rules! evm_test_ignore(
|
||||
($name_test: ident: $name_jit: ident, $name_int: ident) => {
|
||||
#[test]
|
||||
|
@ -129,7 +129,7 @@ impl<'a> Executive<'a> {
|
||||
|
||||
let mut substate = Substate::new();
|
||||
|
||||
let res = match *t.action() {
|
||||
let res = match t.action {
|
||||
Action::Create => {
|
||||
let new_address = contract_address(&sender, &nonce);
|
||||
let params = ActionParams {
|
||||
|
@ -86,7 +86,7 @@ pub mod views;
|
||||
|
||||
mod common;
|
||||
mod basic_types;
|
||||
mod evm;
|
||||
#[macro_use] mod evm;
|
||||
mod log_entry;
|
||||
mod env_info;
|
||||
mod pod_account;
|
||||
|
@ -31,21 +31,6 @@ impl LogEntry {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns reference to address.
|
||||
pub fn address(&self) -> &Address {
|
||||
&self.address
|
||||
}
|
||||
|
||||
/// Returns reference to topics.
|
||||
pub fn topics(&self) -> &Vec<H256> {
|
||||
&self.topics
|
||||
}
|
||||
|
||||
/// Returns reference to data.
|
||||
pub fn data(&self) -> &Bytes {
|
||||
&self.data
|
||||
}
|
||||
|
||||
/// Calculates the bloom of this log entry.
|
||||
pub fn bloom(&self) -> LogBloom {
|
||||
self.topics.iter().fold(LogBloom::from_bloomed(&self.address.sha3()), |b, t| b.with_bloomed(&t.sha3()))
|
||||
|
@ -22,17 +22,17 @@ impl Default for Action {
|
||||
/// or contract creation operation.
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct Transaction {
|
||||
/// TODO [debris] Please document me
|
||||
/// Nonce.
|
||||
pub nonce: U256,
|
||||
/// TODO [debris] Please document me
|
||||
/// Gas price.
|
||||
pub gas_price: U256,
|
||||
/// TODO [debris] Please document me
|
||||
/// Gas paid up front for transaction execution.
|
||||
pub gas: U256,
|
||||
/// TODO [debris] Please document me
|
||||
/// Action, can be either call or contract create.
|
||||
pub action: Action,
|
||||
/// TODO [debris] Please document me
|
||||
/// Transfered value.
|
||||
pub value: U256,
|
||||
/// TODO [Gav Wood] Please document me
|
||||
/// Transaction data.
|
||||
pub data: Bytes,
|
||||
|
||||
// signature
|
||||
@ -98,19 +98,6 @@ impl Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the nonce of the transaction.
|
||||
pub fn nonce(&self) -> &U256 { &self.nonce }
|
||||
/// Get the gas price of the transaction.
|
||||
pub fn gas_price(&self) -> &U256 { &self.gas_price }
|
||||
/// Get the gas of the transaction.
|
||||
pub fn gas(&self) -> &U256 { &self.gas }
|
||||
/// Get the action of the transaction (Create or Call).
|
||||
pub fn action(&self) -> &Action { &self.action }
|
||||
/// Get the value of the transaction.
|
||||
pub fn value(&self) -> &U256 { &self.value }
|
||||
/// Get the data of the transaction.
|
||||
pub fn data(&self) -> &Bytes { &self.data }
|
||||
|
||||
/// Append object into RLP stream, optionally with or without the signature.
|
||||
pub fn rlp_append_opt(&self, s: &mut RlpStream, with_seal: Seal) {
|
||||
s.begin_list(6 + match with_seal { Seal::With => 3, _ => 0 });
|
||||
|
Loading…
Reference in New Issue
Block a user