finish purging x! from parity, remove x! and xx! macros

This commit is contained in:
Robert Habermeier 2016-05-31 17:25:25 +02:00
parent 3abaeadcf3
commit c62bfcddef
5 changed files with 9 additions and 23 deletions

View File

@ -150,10 +150,10 @@ pub trait MinerService : Send + Sync {
fn last_nonce(&self, address: &Address) -> Option<U256>; fn last_nonce(&self, address: &Address) -> Option<U256>;
/// Suggested gas price. /// Suggested gas price.
fn sensible_gas_price(&self) -> U256 { x!(20000000000u64) } fn sensible_gas_price(&self) -> U256 { 20000000000u64.into() }
/// Suggested gas limit. /// Suggested gas limit.
fn sensible_gas_limit(&self) -> U256 { x!(21000) } fn sensible_gas_limit(&self) -> U256 { 21000.into() }
/// Latest account balance in pending state. /// Latest account balance in pending state.
fn balance(&self, chain: &BlockChainClient, address: &Address) -> U256; fn balance(&self, chain: &BlockChainClient, address: &Address) -> U256;

View File

@ -137,7 +137,7 @@ impl Miner {
Err(Error::Execution(ExecutionError::BlockGasLimitReached { gas_limit, gas_used, .. })) => { Err(Error::Execution(ExecutionError::BlockGasLimitReached { gas_limit, gas_used, .. })) => {
trace!(target: "miner", "Skipping adding transaction to block because of gas limit: {:?}", hash); trace!(target: "miner", "Skipping adding transaction to block because of gas limit: {:?}", hash);
// Exit early if gas left is smaller then min_tx_gas // Exit early if gas left is smaller then min_tx_gas
let min_tx_gas: U256 = x!(21000); // TODO: figure this out properly. let min_tx_gas: U256 = 21000.into(); // TODO: figure this out properly.
if gas_limit - gas_used < min_tx_gas { if gas_limit - gas_used < min_tx_gas {
break; break;
} }
@ -337,11 +337,11 @@ impl MinerService for Miner {
fn sensible_gas_price(&self) -> U256 { fn sensible_gas_price(&self) -> U256 {
// 10% above our minimum. // 10% above our minimum.
*self.transaction_queue.lock().unwrap().minimal_gas_price() * x!(110) / x!(100) *self.transaction_queue.lock().unwrap().minimal_gas_price() * 110.into() / 100.into()
} }
fn sensible_gas_limit(&self) -> U256 { fn sensible_gas_limit(&self) -> U256 {
*self.gas_floor_target.read().unwrap() / x!(5) *self.gas_floor_target.read().unwrap() / 5.into()
} }
fn transactions_limit(&self) -> usize { fn transactions_limit(&self) -> usize {

View File

@ -1310,8 +1310,8 @@ mod tests {
fn get_dummy_block(order: u32, parent_hash: H256) -> Bytes { fn get_dummy_block(order: u32, parent_hash: H256) -> Bytes {
let mut header = Header::new(); let mut header = Header::new();
header.gas_limit = x!(0); header.gas_limit = 0.into();
header.difficulty = x!(order * 100); header.difficulty = (order * 100).into();
header.timestamp = (order * 10) as u64; header.timestamp = (order * 10) as u64;
header.number = order as u64; header.number = order as u64;
header.parent_hash = parent_hash; header.parent_hash = parent_hash;
@ -1327,7 +1327,7 @@ mod tests {
fn get_dummy_blocks(order: u32, parent_hash: H256) -> Bytes { fn get_dummy_blocks(order: u32, parent_hash: H256) -> Bytes {
let mut rlp = RlpStream::new_list(1); let mut rlp = RlpStream::new_list(1);
rlp.append_raw(&get_dummy_block(order, parent_hash), 1); rlp.append_raw(&get_dummy_block(order, parent_hash), 1);
let difficulty: U256 = x!(100 * order); let difficulty: U256 = (100 * order).into();
rlp.append(&difficulty); rlp.append(&difficulty);
rlp.out() rlp.out()
} }

View File

@ -68,20 +68,6 @@ macro_rules! mapx {
}} }}
} }
#[macro_export]
macro_rules! x {
( $x:expr ) => {
From::from($x)
}
}
#[macro_export]
macro_rules! xx {
( $x:expr ) => {
From::from(From::from($x))
}
}
#[macro_export] #[macro_export]
macro_rules! flush { macro_rules! flush {
($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*)))); ($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*))));

View File

@ -627,7 +627,7 @@ mod tests {
sstore.sign(&address, &H256::random()).unwrap() sstore.sign(&address, &H256::random()).unwrap()
}; };
assert!(signature != x!(0)); assert!(signature != 0.into());
} }
#[test] #[test]