[dependencies]: remove util/macros (#11501)
* [dependencies]: remove `util/macros` * fix typo: `flish` -> flush` * [json tests]: add log if `write` or `flush` fails `write` is performed to `stdout` `logging` is performed to `stderr` * [rocksdb-migration]: remove unused `Progress` * [rpc test]: BTreeMap -> `btreemap!`
This commit is contained in:
@@ -139,8 +139,8 @@ pub struct PricingAt {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Builtin, BuiltinCompat, BTreeMap, Pricing, PricingAt, Linear, Modexp, AltBn128ConstOperations};
|
||||
use macros::map;
|
||||
use super::{Builtin, BuiltinCompat, Pricing, PricingAt, Linear, Modexp, AltBn128ConstOperations};
|
||||
use maplit::btreemap;
|
||||
|
||||
#[test]
|
||||
fn builtin_deserialization() {
|
||||
@@ -150,7 +150,7 @@ mod tests {
|
||||
}"#;
|
||||
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
|
||||
assert_eq!(builtin.name, "ecrecover");
|
||||
assert_eq!(builtin.pricing, map![
|
||||
assert_eq!(builtin.pricing, btreemap![
|
||||
0 => PricingAt {
|
||||
info: None,
|
||||
price: Pricing::Linear(Linear { base: 3000, word: 0 })
|
||||
@@ -174,7 +174,7 @@ mod tests {
|
||||
}"#;
|
||||
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
|
||||
assert_eq!(builtin.name, "ecrecover");
|
||||
assert_eq!(builtin.pricing, map![
|
||||
assert_eq!(builtin.pricing, btreemap![
|
||||
0 => PricingAt {
|
||||
info: None,
|
||||
price: Pricing::Linear(Linear { base: 3000, word: 0 })
|
||||
@@ -195,7 +195,7 @@ mod tests {
|
||||
}"#;
|
||||
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
|
||||
assert_eq!(builtin.name, "blake2_f");
|
||||
assert_eq!(builtin.pricing, map![
|
||||
assert_eq!(builtin.pricing, btreemap![
|
||||
0xffffff => PricingAt {
|
||||
info: None,
|
||||
price: Pricing::Blake2F { gas_per_round: 123 }
|
||||
@@ -215,10 +215,10 @@ mod tests {
|
||||
}"#;
|
||||
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
|
||||
assert_eq!(builtin.name, "alt_bn128_mul");
|
||||
assert_eq!(builtin.pricing, map![
|
||||
assert_eq!(builtin.pricing, btreemap![
|
||||
100500 => PricingAt {
|
||||
info: None,
|
||||
price: Pricing::AltBn128ConstOperations(AltBn128ConstOperations {
|
||||
price: Pricing::AltBn128ConstOperations(AltBn128ConstOperations {
|
||||
price: 123,
|
||||
}),
|
||||
}
|
||||
@@ -235,7 +235,7 @@ mod tests {
|
||||
|
||||
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
|
||||
assert_eq!(builtin.name, "late_start");
|
||||
assert_eq!(builtin.pricing, map![
|
||||
assert_eq!(builtin.pricing, btreemap![
|
||||
100_000 => PricingAt {
|
||||
info: None,
|
||||
price: Pricing::Modexp(Modexp { divisor: 5 })
|
||||
|
||||
@@ -121,15 +121,12 @@ pub struct Env {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
str::FromStr
|
||||
};
|
||||
use std::str::FromStr;
|
||||
use super::{Address, Bytes, Call, Env, H256, MaybeEmpty, State, Transaction, Uint, Vm};
|
||||
|
||||
use crate::spec::{Account, HashOrMap};
|
||||
use ethereum_types::{U256, H160 as Hash160, H256 as Hash256};
|
||||
use macros::map;
|
||||
use maplit::btreemap;
|
||||
use rustc_hex::FromHex;
|
||||
|
||||
const TEST_CODE: &str = "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01600055";
|
||||
@@ -207,14 +204,14 @@ mod tests {
|
||||
assert_eq!(vm.output, Some(Bytes::new(Vec::new())));
|
||||
assert_eq!(vm.pre_state, State(
|
||||
HashOrMap::Map(
|
||||
map![
|
||||
btreemap![
|
||||
Address(Hash160::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap()) => Account {
|
||||
builtin: None,
|
||||
balance: Some(Uint(0x0de0b6b3a7640000_u64.into())),
|
||||
code: Some(Bytes::new(TEST_CODE.from_hex().unwrap())),
|
||||
constructor: None,
|
||||
nonce: Some(Uint(0.into())),
|
||||
storage: Some(map![]),
|
||||
storage: Some(btreemap![]),
|
||||
version: None,
|
||||
}
|
||||
]))
|
||||
@@ -222,14 +219,14 @@ mod tests {
|
||||
assert_eq!(vm.post_state, Some(
|
||||
State(
|
||||
HashOrMap::Map(
|
||||
map![
|
||||
btreemap![
|
||||
Address(Hash160::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap()) => Account {
|
||||
builtin: None,
|
||||
balance: Some(Uint(0x0de0b6b3a7640000_u64.into())),
|
||||
code: Some(Bytes::new(TEST_CODE.from_hex().unwrap())),
|
||||
constructor: None,
|
||||
nonce: Some(Uint(0.into())),
|
||||
storage: Some(map![
|
||||
storage: Some(btreemap![
|
||||
Uint(0.into()) => Uint(U256::from_str("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe").unwrap())
|
||||
]),
|
||||
version: None,
|
||||
|
||||
Reference in New Issue
Block a user