fix remainder of build
This commit is contained in:
parent
91753c53cd
commit
f169c8dbb0
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use util::{U256, H256, Address, Bytes, FixedHash};
|
use util::{U256, H256, Address, Bytes, FixedHash, trie};
|
||||||
use ethcore::client::EnvInfo;
|
use ethcore::client::EnvInfo;
|
||||||
use ethcore::evm::{self, Ext, ContractCreateResult, MessageCallResult, Schedule, CallType};
|
use ethcore::evm::{self, Ext, ContractCreateResult, MessageCallResult, Schedule, CallType};
|
||||||
|
|
||||||
@ -39,27 +39,28 @@ impl Default for FakeExt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Ext for FakeExt {
|
impl Ext for FakeExt {
|
||||||
fn storage_at(&self, key: &H256) -> H256 {
|
fn storage_at(&self, key: &H256) -> trie::Result<H256> {
|
||||||
self.store.get(key).unwrap_or(&H256::new()).clone()
|
Ok(self.store.get(key).unwrap_or(&H256::new()).clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_storage(&mut self, key: H256, value: H256) {
|
fn set_storage(&mut self, key: H256, value: H256) -> trie::Result<()> {
|
||||||
self.store.insert(key, value);
|
self.store.insert(key, value);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exists(&self, _address: &Address) -> bool {
|
fn exists(&self, _address: &Address) -> trie::Result<bool> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exists_and_not_null(&self, _address: &Address) -> bool {
|
fn exists_and_not_null(&self, _address: &Address) -> trie::Result<bool> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn origin_balance(&self) -> U256 {
|
fn origin_balance(&self) -> trie::Result<U256> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn balance(&self, _address: &Address) -> U256 {
|
fn balance(&self, _address: &Address) -> trie::Result<U256> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +84,11 @@ impl Ext for FakeExt {
|
|||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extcode(&self, _address: &Address) -> Arc<Bytes> {
|
fn extcode(&self, _address: &Address) -> trie::Result<Arc<Bytes>> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extcodesize(&self, _address: &Address) -> usize {
|
fn extcodesize(&self, _address: &Address) -> trie::Result<usize> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ impl Ext for FakeExt {
|
|||||||
Ok(*gas)
|
Ok(*gas)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn suicide(&mut self, _refund_address: &Address) {
|
fn suicide(&mut self, _refund_address: &Address) -> trie::Result<()> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +124,10 @@ pub fn state_pruned() -> Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn state_corrupt() -> Error {
|
||||||
|
internal("State corrupt", "")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn exceptional() -> Error {
|
pub fn exceptional() -> Error {
|
||||||
Error {
|
Error {
|
||||||
code: ErrorCode::ServerError(codes::EXCEPTION_ERROR),
|
code: ErrorCode::ServerError(codes::EXCEPTION_ERROR),
|
||||||
@ -288,6 +292,7 @@ pub fn from_rlp_error(error: DecoderError) -> Error {
|
|||||||
pub fn from_call_error(error: CallError) -> Error {
|
pub fn from_call_error(error: CallError) -> Error {
|
||||||
match error {
|
match error {
|
||||||
CallError::StatePruned => state_pruned(),
|
CallError::StatePruned => state_pruned(),
|
||||||
|
CallError::StateCorrupt => state_corrupt(),
|
||||||
CallError::Exceptional => exceptional(),
|
CallError::Exceptional => exceptional(),
|
||||||
CallError::Execution(e) => execution(e),
|
CallError::Execution(e) => execution(e),
|
||||||
CallError::TransactionNotFound => internal("{}, this should not be the case with eth_call, most likely a bug.", CallError::TransactionNotFound),
|
CallError::TransactionNotFound => internal("{}, this should not be the case with eth_call, most likely a bug.", CallError::TransactionNotFound),
|
||||||
|
@ -349,7 +349,13 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
|
|||||||
let address = address.into();
|
let address = address.into();
|
||||||
|
|
||||||
let res = match num.0.clone() {
|
let res = match num.0.clone() {
|
||||||
BlockNumber::Pending => Ok(take_weakf!(self.miner).balance(&*take_weakf!(self.client), &address).into()),
|
BlockNumber::Pending => {
|
||||||
|
let client = take_weakf!(self.client);
|
||||||
|
match take_weakf!(self.miner).balance(&*client, &address) {
|
||||||
|
Some(balance) => Ok(balance.into()),
|
||||||
|
None => Err(errors::internal("Unable to load balance from database", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
id => {
|
id => {
|
||||||
let client = take_weakf!(self.client);
|
let client = take_weakf!(self.client);
|
||||||
|
|
||||||
@ -369,7 +375,13 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
|
|||||||
let position: U256 = RpcU256::into(pos);
|
let position: U256 = RpcU256::into(pos);
|
||||||
|
|
||||||
let res = match num.0.clone() {
|
let res = match num.0.clone() {
|
||||||
BlockNumber::Pending => Ok(take_weakf!(self.miner).storage_at(&*take_weakf!(self.client), &address, &H256::from(position)).into()),
|
BlockNumber::Pending => {
|
||||||
|
let client = take_weakf!(self.client);
|
||||||
|
match take_weakf!(self.miner).storage_at(&*client, &address, &H256::from(position)) {
|
||||||
|
Some(s) => Ok(s.into()),
|
||||||
|
None => Err(errors::internal("Unable to load storage from database", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
id => {
|
id => {
|
||||||
let client = take_weakf!(self.client);
|
let client = take_weakf!(self.client);
|
||||||
|
|
||||||
@ -387,7 +399,13 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
|
|||||||
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> {
|
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> {
|
||||||
let address: Address = RpcH160::into(address);
|
let address: Address = RpcH160::into(address);
|
||||||
let res = match num.0.clone() {
|
let res = match num.0.clone() {
|
||||||
BlockNumber::Pending => Ok(take_weakf!(self.miner).nonce(&*take_weakf!(self.client), &address).into()),
|
BlockNumber::Pending => {
|
||||||
|
let client = take_weakf!(self.client);
|
||||||
|
match take_weakf!(self.miner).nonce(&*client, &address) {
|
||||||
|
Some(nonce) => Ok(nonce.into()),
|
||||||
|
None => Err(errors::internal("Unable to load nonce from database", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
id => {
|
id => {
|
||||||
let client = take_weakf!(self.client);
|
let client = take_weakf!(self.client);
|
||||||
|
|
||||||
@ -437,7 +455,13 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
|
|||||||
let address: Address = RpcH160::into(address);
|
let address: Address = RpcH160::into(address);
|
||||||
|
|
||||||
let res = match num.0.clone() {
|
let res = match num.0.clone() {
|
||||||
BlockNumber::Pending => Ok(take_weakf!(self.miner).code(&*take_weakf!(self.client), &address).map_or_else(Bytes::default, Bytes::new)),
|
BlockNumber::Pending => {
|
||||||
|
let client = take_weakf!(self.client);
|
||||||
|
match take_weakf!(self.miner).code(&*client, &address) {
|
||||||
|
Some(code) => Ok(code.map_or_else(Bytes::default, Bytes::new)),
|
||||||
|
None => Err(errors::internal("Unable to load code from database", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
id => {
|
id => {
|
||||||
let client = take_weakf!(self.client);
|
let client = take_weakf!(self.client);
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use devtools::RandomTempPath;
|
|
||||||
use ethcore::client::{BlockChainClient, Client, ClientConfig};
|
use ethcore::client::{BlockChainClient, Client, ClientConfig};
|
||||||
use ethcore::ids::BlockId;
|
use ethcore::ids::BlockId;
|
||||||
use ethcore::spec::{Genesis, Spec};
|
use ethcore::spec::{Genesis, Spec};
|
||||||
|
@ -254,26 +254,39 @@ impl MinerService for TestMinerService {
|
|||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn balance(&self, _chain: &MiningBlockChainClient, address: &Address) -> U256 {
|
fn balance(&self, _chain: &MiningBlockChainClient, address: &Address) -> Option<U256> {
|
||||||
self.latest_closed_block.lock().as_ref().map_or_else(U256::zero, |b| b.block().fields().state.balance(address).clone())
|
self.latest_closed_block.lock()
|
||||||
|
.as_ref()
|
||||||
|
.map(|b| b.block().fields().state.balance(address))
|
||||||
|
.map(|b| b.ok())
|
||||||
|
.unwrap_or(Some(U256::default()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&self, _chain: &MiningBlockChainClient, _t: &SignedTransaction, _analytics: CallAnalytics) -> Result<Executed, CallError> {
|
fn call(&self, _chain: &MiningBlockChainClient, _t: &SignedTransaction, _analytics: CallAnalytics) -> Result<Executed, CallError> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn storage_at(&self, _chain: &MiningBlockChainClient, address: &Address, position: &H256) -> H256 {
|
fn storage_at(&self, _chain: &MiningBlockChainClient, address: &Address, position: &H256) -> Option<H256> {
|
||||||
self.latest_closed_block.lock().as_ref().map_or_else(H256::default, |b| b.block().fields().state.storage_at(address, position).clone())
|
self.latest_closed_block.lock()
|
||||||
|
.as_ref()
|
||||||
|
.map(|b| b.block().fields().state.storage_at(address, position))
|
||||||
|
.map(|s| s.ok())
|
||||||
|
.unwrap_or(Some(H256::default()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn nonce(&self, _chain: &MiningBlockChainClient, address: &Address) -> U256 {
|
fn nonce(&self, _chain: &MiningBlockChainClient, address: &Address) -> Option<U256> {
|
||||||
// we assume all transactions are in a pending block, ignoring the
|
// we assume all transactions are in a pending block, ignoring the
|
||||||
// reality of gas limits.
|
// reality of gas limits.
|
||||||
self.last_nonce(address).unwrap_or(U256::zero())
|
Some(self.last_nonce(address).unwrap_or(U256::zero()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn code(&self, _chain: &MiningBlockChainClient, address: &Address) -> Option<Bytes> {
|
fn code(&self, _chain: &MiningBlockChainClient, address: &Address) -> Option<Option<Bytes>> {
|
||||||
self.latest_closed_block.lock().as_ref().map_or(None, |b| b.block().fields().state.code(address).map(|c| (*c).clone()))
|
self.latest_closed_block.lock()
|
||||||
|
.as_ref()
|
||||||
|
.map(|b| b.block().fields().state.code(address))
|
||||||
|
.map(|c| c.ok())
|
||||||
|
.unwrap_or(None)
|
||||||
|
.map(|c| c.map(|c| (&*c).clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sensible_gas_price(&self) -> U256 {
|
fn sensible_gas_price(&self) -> U256 {
|
||||||
|
Loading…
Reference in New Issue
Block a user