chore: fix lints (#329)
This commit is contained in:
parent
7b68c70cd9
commit
0453ea84df
|
@ -1,7 +1,4 @@
|
||||||
use ethers::{
|
use ethers::{contract::ContractFactory, types::H256};
|
||||||
contract::ContractFactory,
|
|
||||||
types::{BlockId, H256},
|
|
||||||
};
|
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
pub use common::*;
|
pub use common::*;
|
||||||
|
@ -12,7 +9,7 @@ mod eth_tests {
|
||||||
use ethers::{
|
use ethers::{
|
||||||
contract::{LogMeta, Multicall},
|
contract::{LogMeta, Multicall},
|
||||||
providers::{Http, Middleware, PendingTransaction, Provider, StreamExt},
|
providers::{Http, Middleware, PendingTransaction, Provider, StreamExt},
|
||||||
types::{Address, U256},
|
types::{Address, BlockId, U256},
|
||||||
utils::Ganache,
|
utils::Ganache,
|
||||||
};
|
};
|
||||||
use std::{convert::TryFrom, sync::Arc};
|
use std::{convert::TryFrom, sync::Arc};
|
||||||
|
|
|
@ -537,7 +537,7 @@ mod tests {
|
||||||
fn parses_event() {
|
fn parses_event() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
AbiParser::default()
|
AbiParser::default()
|
||||||
.parse_event(&mut "event Foo (address indexed x, uint y, bytes32[] z)")
|
.parse_event("event Foo (address indexed x, uint y, bytes32[] z)")
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
Event {
|
Event {
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
|
@ -567,7 +567,7 @@ mod tests {
|
||||||
fn parses_anonymous_event() {
|
fn parses_anonymous_event() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
AbiParser::default()
|
AbiParser::default()
|
||||||
.parse_event(&mut "event Foo() anonymous")
|
.parse_event("event Foo() anonymous")
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
Event {
|
Event {
|
||||||
anonymous: true,
|
anonymous: true,
|
||||||
|
@ -581,7 +581,7 @@ mod tests {
|
||||||
fn parses_unnamed_event() {
|
fn parses_unnamed_event() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
AbiParser::default()
|
AbiParser::default()
|
||||||
.parse_event(&mut "event Foo(address)")
|
.parse_event("event Foo(address)")
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
Event {
|
Event {
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
|
@ -599,7 +599,7 @@ mod tests {
|
||||||
fn parses_unnamed_indexed_event() {
|
fn parses_unnamed_indexed_event() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
AbiParser::default()
|
AbiParser::default()
|
||||||
.parse_event(&mut "event Foo(address indexed)")
|
.parse_event("event Foo(address indexed)")
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
Event {
|
Event {
|
||||||
anonymous: false,
|
anonymous: false,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! This module contains an 256-bit signed integer implementation.
|
//! This module contains an 256-bit signed integer implementation.
|
||||||
//! This module was derived for ethers-core via https://github.com/gnosis/ethcontract-rs/
|
//! This module was derived for ethers-core via https://github.com/gnosis/ethcontract-rs/
|
||||||
|
#![allow(clippy::wrong_self_convention)]
|
||||||
use crate::abi::{InvalidOutputType, Token, Tokenizable};
|
use crate::abi::{InvalidOutputType, Token, Tokenizable};
|
||||||
use crate::types::U256;
|
use crate::types::U256;
|
||||||
use ethabi::ethereum_types::FromDecStrErr;
|
use ethabi::ethereum_types::FromDecStrErr;
|
||||||
|
@ -1135,6 +1135,7 @@ macro_rules! impl_shift {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Implements the logical shift right operation
|
||||||
impl ops::Shr<$t> for I256 {
|
impl ops::Shr<$t> for I256 {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
|
|
|
@ -446,18 +446,18 @@ mod tests {
|
||||||
let addr: Address = "f817796F60D268A36a57b8D2dF1B97B14C0D0E1d".parse().unwrap();
|
let addr: Address = "f817796F60D268A36a57b8D2dF1B97B14C0D0E1d".parse().unwrap();
|
||||||
let filter = Filter::new();
|
let filter = Filter::new();
|
||||||
|
|
||||||
let ser = serialize(&filter.clone());
|
let ser = serialize(&filter);
|
||||||
assert_eq!(ser, json!({ "topics": [] }));
|
assert_eq!(ser, json!({ "topics": [] }));
|
||||||
|
|
||||||
let filter = filter.address(addr);
|
let filter = filter.address(addr);
|
||||||
|
|
||||||
let ser = serialize(&filter.clone());
|
let ser = serialize(&filter);
|
||||||
assert_eq!(ser, json!({"address" : addr, "topics": []}));
|
assert_eq!(ser, json!({"address" : addr, "topics": []}));
|
||||||
|
|
||||||
let filter = filter.event(event);
|
let filter = filter.event(event);
|
||||||
|
|
||||||
// 0
|
// 0
|
||||||
let ser = serialize(&filter.clone());
|
let ser = serialize(&filter);
|
||||||
assert_eq!(ser, json!({ "address" : addr, "topics": [t0]}));
|
assert_eq!(ser, json!({ "address" : addr, "topics": [t0]}));
|
||||||
|
|
||||||
// 1
|
// 1
|
||||||
|
@ -497,7 +497,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
// 1 & 2 & 3
|
// 1 & 2 & 3
|
||||||
let ser = serialize(&filter.clone().topic1(t1).topic2(t2).topic3(t3));
|
let ser = serialize(&filter.topic1(t1).topic2(t2).topic3(t3));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ser,
|
ser,
|
||||||
json!({ "address" : addr, "topics": [t0, t1_padded, t2, t3_padded]})
|
json!({ "address" : addr, "topics": [t0, t1_padded, t2, t3_padded]})
|
||||||
|
|
|
@ -134,6 +134,7 @@ impl Signature {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Copies and serializes `self` into a new `Vec` with the recovery id included
|
/// Copies and serializes `self` into a new `Vec` with the recovery id included
|
||||||
|
#[allow(clippy::wrong_self_convention)]
|
||||||
pub fn to_vec(&self) -> Vec<u8> {
|
pub fn to_vec(&self) -> Vec<u8> {
|
||||||
self.into()
|
self.into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
pending_map.insert(
|
pending_map.insert(
|
||||||
Address::from_str("201354729f8d0f8b64e9a0c353c672c6a66b3857").unwrap(),
|
Address::from_str("201354729f8d0f8b64e9a0c353c672c6a66b3857").unwrap(),
|
||||||
pending_map_inner.clone(),
|
pending_map_inner,
|
||||||
);
|
);
|
||||||
let mut queued_map = BTreeMap::new();
|
let mut queued_map = BTreeMap::new();
|
||||||
let mut queued_map_inner = BTreeMap::new();
|
let mut queued_map_inner = BTreeMap::new();
|
||||||
|
@ -400,7 +400,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
queued_map.insert(
|
queued_map.insert(
|
||||||
Address::from_str("307e8f249bcccfa5b245449256c5d7e6e079943e").unwrap(),
|
Address::from_str("307e8f249bcccfa5b245449256c5d7e6e079943e").unwrap(),
|
||||||
queued_map_inner.clone(),
|
queued_map_inner,
|
||||||
);
|
);
|
||||||
|
|
||||||
TxpoolInspect {
|
TxpoolInspect {
|
||||||
|
|
|
@ -89,6 +89,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::float_cmp)]
|
||||||
fn behaves_with_realistic_values() {
|
fn behaves_with_realistic_values() {
|
||||||
let oracle = GeometricGasPrice::new(1.25, 10u64, None::<u64>);
|
let oracle = GeometricGasPrice::new(1.25, 10u64, None::<u64>);
|
||||||
const GWEI: f64 = 1000000000.0;
|
const GWEI: f64 = 1000000000.0;
|
||||||
|
|
|
@ -21,7 +21,7 @@ async fn gas_escalator_live() {
|
||||||
let address = wallet.address();
|
let address = wallet.address();
|
||||||
let provider = SignerMiddleware::new(provider, wallet);
|
let provider = SignerMiddleware::new(provider, wallet);
|
||||||
|
|
||||||
let escalator = GeometricGasPrice::new(5.0, 10u64, Some(2000_000_000_000u64));
|
let escalator = GeometricGasPrice::new(5.0, 10u64, Some(2_000_000_000_000u64));
|
||||||
|
|
||||||
let provider = GasEscalatorMiddleware::new(provider, escalator, Frequency::Duration(3000));
|
let provider = GasEscalatorMiddleware::new(provider, escalator, Frequency::Duration(3000));
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn assert_hex(hash: H256, val: &str) {
|
fn assert_hex(hash: H256, val: &str) {
|
||||||
let v = if val.starts_with("0x") {
|
let v = if let Some(stripped) = val.strip_prefix("0x") {
|
||||||
&val[2..]
|
stripped
|
||||||
} else {
|
} else {
|
||||||
val
|
val
|
||||||
};
|
};
|
||||||
|
|
|
@ -899,10 +899,10 @@ mod tests {
|
||||||
let provider = Provider::<Http>::try_from(ganache.endpoint())
|
let provider = Provider::<Http>::try_from(ganache.endpoint())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.with_sender(ganache.addresses()[0]);
|
.with_sender(ganache.addresses()[0]);
|
||||||
assert_eq!(provider.is_signer().await, true);
|
assert!(provider.is_signer().await);
|
||||||
|
|
||||||
let provider = Provider::<Http>::try_from(ganache.endpoint()).unwrap();
|
let provider = Provider::<Http>::try_from(ganache.endpoint()).unwrap();
|
||||||
assert_eq!(provider.is_signer().await, false);
|
assert!(!provider.is_signer().await);
|
||||||
|
|
||||||
let sender = Address::from_str("635B4764D1939DfAcD3a8014726159abC277BecC")
|
let sender = Address::from_str("635B4764D1939DfAcD3a8014726159abC277BecC")
|
||||||
.expect("should be able to parse hex address");
|
.expect("should be able to parse hex address");
|
||||||
|
@ -911,7 +911,7 @@ mod tests {
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.with_sender(sender);
|
.with_sender(sender);
|
||||||
assert_eq!(provider.is_signer().await, false);
|
assert!(!provider.is_signer().await);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
@ -323,7 +323,7 @@ mod tests {
|
||||||
if let Some(ref sent) = sent {
|
if let Some(ref sent) = sent {
|
||||||
assert_eq!(sent.len(), watch_received.len());
|
assert_eq!(sent.len(), watch_received.len());
|
||||||
let sent_txs = sent
|
let sent_txs = sent
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|tx| tx.transaction_hash)
|
.map(|tx| tx.transaction_hash)
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
assert_eq!(sent_txs, watch_received.iter().map(|tx| tx.hash).collect());
|
assert_eq!(sent_txs, watch_received.iter().map(|tx| tx.hash).collect());
|
||||||
|
|
|
@ -10,7 +10,7 @@ async fn txpool() {
|
||||||
let geth = Geth::new().block_time(20u64).spawn();
|
let geth = Geth::new().block_time(20u64).spawn();
|
||||||
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();
|
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();
|
||||||
|
|
||||||
let account = provider.get_accounts().await.unwrap()[0].clone();
|
let account = provider.get_accounts().await.unwrap()[0];
|
||||||
let value: u64 = 42;
|
let value: u64 = 42;
|
||||||
let gas_price = ethers::types::U256::from_dec_str("221435145689").unwrap();
|
let gas_price = ethers::types::U256::from_dec_str("221435145689").unwrap();
|
||||||
let mut tx = TransactionRequest::new()
|
let mut tx = TransactionRequest::new()
|
||||||
|
|
|
@ -180,7 +180,7 @@ impl LedgerEthereum {
|
||||||
let v = result[0] as u64;
|
let v = result[0] as u64;
|
||||||
let r = H256::from_slice(&result[1..33]);
|
let r = H256::from_slice(&result[1..33]);
|
||||||
let s = H256::from_slice(&result[33..]);
|
let s = H256::from_slice(&result[33..]);
|
||||||
Ok(Signature { v, r, s })
|
Ok(Signature { r, s, v })
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper which converts a derivation path to bytes
|
// helper which converts a derivation path to bytes
|
||||||
|
|
Loading…
Reference in New Issue