Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
themicp committed Nov 24, 2023
1 parent 20b1c5b commit e4d81b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
7 changes: 2 additions & 5 deletions feeder/src/eth/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ use crate::eth::execution::ExecutionRPC;
use crate::eth::utils::calc_slot_from_timestamp;
use crate::types::InternalMessage;
use consensus_types::lightclient::{CrossChainId, Message};
use ethers::abi::{AbiEncode, Bytes, RawLog};
use ethers::abi::{Bytes, RawLog};
use ethers::prelude::{EthEvent, Http};
use ethers::providers::{Middleware, Provider};
use ethers::types::Filter;
use ethers::types::{Address, Log, H256, U256};
use eyre::Result;
use hex::ToHex;
use std::sync::Arc;

pub struct Gateway {
Expand Down Expand Up @@ -58,9 +57,7 @@ impl Gateway {
let log_index = log.log_index.unwrap();
let cc_id = CrossChainId {
chain: "ethereum".parse().unwrap(),
id: format!("{}:{}", format!("0x{:x}", tx_hash), log_index)
.parse()
.unwrap(),
id: format!("0x{:x}:{}", tx_hash, log_index).parse().unwrap(),
};

InternalMessage {
Expand Down
2 changes: 1 addition & 1 deletion feeder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async fn main() {
let execution: ExecutionRPC = ExecutionRPC::new(EXECUTION_RPC);
let gateway: Gateway = Gateway::new(EXECUTION_RPC, GATEWAY_ADDR);
let prover = Prover::new(execution, consensus);
let wasm = WasmClient::new(NODE_URL.into(), ADDR.into());
let _wasm = WasmClient::new(NODE_URL.into(), ADDR.into());

let consensus: ConsensusRPC = ConsensusRPC::new(CONSENSUS_RPC);

Expand Down
4 changes: 2 additions & 2 deletions feeder/src/prover/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ pub fn generate_transaction_proof(block: &Block<Transaction>, index: u64) -> Res
*/
pub fn generate_receipt_proof(
block: &Block<Transaction>,
receipts: &Vec<TransactionReceipt>,
receipts: &[TransactionReceipt],
index: u64,
) -> Result<Vec<Vec<u8>>> {
let mut trie = generate_trie(receipts.clone(), encode_receipt);
let mut trie = generate_trie(receipts.to_owned(), encode_receipt);
let trie_root = trie.root().unwrap();

// Reality check
Expand Down
11 changes: 2 additions & 9 deletions feeder/src/prover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ use consensus_types::{
consensus::to_beacon_header,
lightclient::{EventVerificationData, ReceiptProof, UpdateVariant},
};
use ethers::{
types::{Transaction, TransactionReceipt},
utils::rlp::{self, Decodable},
};
use ethers::types::TransactionReceipt;
use eyre::{anyhow, Result};
use ssz_rs::{Merkleized, Node};

Expand Down Expand Up @@ -118,11 +115,7 @@ impl Prover {
})
}

fn get_tx_index(
&self,
receipts: &Vec<TransactionReceipt>,
cc_id: &CrossChainId,
) -> Result<u64> {
fn get_tx_index(&self, receipts: &[TransactionReceipt], cc_id: &CrossChainId) -> Result<u64> {
let tx_hash = cc_id.id.split_once(':').unwrap().0;

let tx_index = receipts
Expand Down
2 changes: 2 additions & 0 deletions feeder/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ use futures::executor::block_on;
use serde::de::DeserializeOwned;

#[derive(Debug)]
#[allow(dead_code)]
pub struct WasmClient {
_rpc: String,
address: String,
query_client: QueryClient<tonic::transport::Channel>,
}

#[allow(dead_code)]
impl WasmClient {
pub fn new(rpc: String, address: String) -> Self {
Self {
Expand Down

0 comments on commit e4d81b0

Please sign in to comment.