Deduplicate registrar contract & calling logic (#11110)
* Rename RegistryInfo -> RegistryInfoDeprecated * Add BlockId parameter to Registrar::get_address and RegistrarClient::call_contract * Remove RegistrarClient::Call (use async for now); add RegistrarClient::get_address * Remove Registrar type in favour of naked trait * Use CallContract trait bound instead of separate call_contract method * Make RegistrarClient::get_address and URLHint::resolve synchronous * RegistrarClient::get_address: return check if address is zero * Modify RegistryInfo::registry_address to take &str * return Result from RegistryInfo::registry_address * Replace RegistryInfo with RegistrarClient - Modifed RegistrarClient::registrar_address to return Option - Removed BlockChainClient::registrar_address * Fix other build configs * Fix unit test builds * Remove local RegistrarClient type from run::execute_impl * Remove registrar.json from ethcore * Formatting/line breaks * Update RegistrarClient docs, remove explicit lifetime * Weak ref to ethcore client from hash fetch client * Fix unit tests
This commit is contained in:
@@ -63,7 +63,8 @@ use types::{
|
||||
use vm::{Schedule, LastHashes};
|
||||
|
||||
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
||||
use call_contract::{CallContract, RegistryInfo};
|
||||
use call_contract::CallContract;
|
||||
use registrar::RegistrarClient;
|
||||
use client::{
|
||||
ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock, Call,
|
||||
EngineInfo, BlockProducer, SealedBlockImporter,
|
||||
@@ -532,7 +533,20 @@ impl BlockInfo for TestBlockChainClient {
|
||||
}
|
||||
|
||||
impl CallContract for TestBlockChainClient {
|
||||
fn call_contract(&self, _id: BlockId, _address: Address, _data: Bytes) -> Result<Bytes, String> { Ok(vec![]) }
|
||||
fn call_contract(
|
||||
&self,
|
||||
_block_id: BlockId,
|
||||
_address: Address,
|
||||
_data: Bytes
|
||||
) -> Result<Bytes, String> {
|
||||
Ok(vec![])
|
||||
}
|
||||
}
|
||||
|
||||
impl RegistrarClient for TestBlockChainClient {
|
||||
fn registrar_address(&self) -> Option<Address> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl TransactionInfo for TestBlockChainClient {
|
||||
@@ -543,10 +557,6 @@ impl TransactionInfo for TestBlockChainClient {
|
||||
|
||||
impl BlockChain for TestBlockChainClient {}
|
||||
|
||||
impl RegistryInfo for TestBlockChainClient {
|
||||
fn registry_address(&self, _name: String, _block: BlockId) -> Option<Address> { None }
|
||||
}
|
||||
|
||||
impl ImportBlock for TestBlockChainClient {
|
||||
fn import_block(&self, unverified: Unverified) -> EthcoreResult<H256> {
|
||||
let header = unverified.header;
|
||||
@@ -916,8 +926,6 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
let signed = SignedTransaction::new(transaction.with_signature(sig, chain_id)).unwrap();
|
||||
self.miner.import_own_transaction(self, signed.into())
|
||||
}
|
||||
|
||||
fn registrar_address(&self) -> Option<Address> { None }
|
||||
}
|
||||
|
||||
impl IoClient for TestBlockChainClient {
|
||||
|
||||
Reference in New Issue
Block a user