From 8d4b46103286e2ce2d9e388d53896b9958a8403a Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Mon, 14 Jul 2025 12:27:19 +0300 Subject: [PATCH] Fix formtting and clippy --- crates/node/src/kitchensink.rs | 81 ++++++++++++++++------------------ 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/crates/node/src/kitchensink.rs b/crates/node/src/kitchensink.rs index de6d216..239fe13 100644 --- a/crates/node/src/kitchensink.rs +++ b/crates/node/src/kitchensink.rs @@ -12,15 +12,22 @@ use std::{ }; use alloy::{ - consensus::{BlockHeader, TxEnvelope}, hex, network::{ + consensus::{BlockHeader, TxEnvelope}, + hex, + network::{ Ethereum, EthereumWallet, Network, TransactionBuilder, TransactionBuilderError, UnbuiltTransactionError, - }, primitives::{Address, BlockNumber, Bloom, Bytes, B256, B64, U256}, providers::{ext::DebugApi, Provider, ProviderBuilder}, rpc::types::{ - eth::{Block, Header, Transaction}, trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame}, TransactionReceipt - } + }, + primitives::{Address, B64, B256, BlockNumber, Bloom, Bytes, U256}, + providers::{Provider, ProviderBuilder, ext::DebugApi}, + rpc::types::{ + TransactionReceipt, + eth::{Block, Header, Transaction}, + trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame}, + }, }; +use serde::{Deserialize, Serialize}; use serde_json::{Value as JsonValue, json}; -use serde::{Serialize, Deserialize}; use sp_core::crypto::Ss58Codec; use sp_runtime::AccountId32; @@ -435,21 +442,17 @@ impl TransactionBuilder for ::Transacti } fn from(&self) -> Option
{ - <::TransactionRequest as TransactionBuilder>::from( - self, - ) + <::TransactionRequest as TransactionBuilder>::from(self) } fn set_from(&mut self, from: Address) { <::TransactionRequest as TransactionBuilder>::set_from( - self, from + self, from, ) } fn kind(&self) -> Option { - <::TransactionRequest as TransactionBuilder>::kind( - self, - ) + <::TransactionRequest as TransactionBuilder>::kind(self) } fn clear_kind(&mut self) { @@ -460,37 +463,33 @@ impl TransactionBuilder for ::Transacti fn set_kind(&mut self, kind: alloy::primitives::TxKind) { <::TransactionRequest as TransactionBuilder>::set_kind( - self, kind + self, kind, ) } fn value(&self) -> Option { - <::TransactionRequest as TransactionBuilder>::value( - self - ) + <::TransactionRequest as TransactionBuilder>::value(self) } fn set_value(&mut self, value: alloy::primitives::U256) { <::TransactionRequest as TransactionBuilder>::set_value( - self, value + self, value, ) } fn gas_price(&self) -> Option { - <::TransactionRequest as TransactionBuilder>::gas_price( - self, - ) + <::TransactionRequest as TransactionBuilder>::gas_price(self) } fn set_gas_price(&mut self, gas_price: u128) { <::TransactionRequest as TransactionBuilder>::set_gas_price( - self, gas_price + self, gas_price, ) } fn max_fee_per_gas(&self) -> Option { <::TransactionRequest as TransactionBuilder>::max_fee_per_gas( - self, + self, ) } @@ -502,7 +501,7 @@ impl TransactionBuilder for ::Transacti fn max_priority_fee_per_gas(&self) -> Option { <::TransactionRequest as TransactionBuilder>::max_priority_fee_per_gas( - self, + self, ) } @@ -513,26 +512,25 @@ impl TransactionBuilder for ::Transacti } fn gas_limit(&self) -> Option { - <::TransactionRequest as TransactionBuilder>::gas_limit( - self, - ) + <::TransactionRequest as TransactionBuilder>::gas_limit(self) } fn set_gas_limit(&mut self, gas_limit: u64) { <::TransactionRequest as TransactionBuilder>::set_gas_limit( - self, gas_limit + self, gas_limit, ) } fn access_list(&self) -> Option<&alloy::rpc::types::AccessList> { <::TransactionRequest as TransactionBuilder>::access_list( - self, + self, ) } fn set_access_list(&mut self, access_list: alloy::rpc::types::AccessList) { <::TransactionRequest as TransactionBuilder>::set_access_list( - self, access_list + self, + access_list, ) } @@ -541,37 +539,35 @@ impl TransactionBuilder for ::Transacti ty: ::TxType, ) -> Result<(), Vec<&'static str>> { <::TransactionRequest as TransactionBuilder>::complete_type( - self, ty + self, ty, ) } fn can_submit(&self) -> bool { <::TransactionRequest as TransactionBuilder>::can_submit( - self, + self, ) } fn can_build(&self) -> bool { - <::TransactionRequest as TransactionBuilder>::can_build( - self, - ) + <::TransactionRequest as TransactionBuilder>::can_build(self) } fn output_tx_type(&self) -> ::TxType { <::TransactionRequest as TransactionBuilder>::output_tx_type( - self, + self, ) } fn output_tx_type_checked(&self) -> Option<::TxType> { <::TransactionRequest as TransactionBuilder>::output_tx_type_checked( - self, + self, ) } fn prep_for_submission(&mut self) { <::TransactionRequest as TransactionBuilder>::prep_for_submission( - self, + self, ) } @@ -586,7 +582,7 @@ impl TransactionBuilder for ::Transacti Ok(unsigned_tx) => Ok(unsigned_tx), Err(UnbuiltTransactionError { request, error }) => { Err(UnbuiltTransactionError:: { - request: request, + request, error: match error { TransactionBuilderError::InvalidTransactionRequest(tx_type, items) => { TransactionBuilderError::InvalidTransactionRequest(tx_type, items) @@ -617,8 +613,7 @@ impl TransactionBuilder for ::Transacti } } -#[derive(Clone, Debug, PartialEq, Eq, Hash)] -#[derive(Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct KitchenSinkHeader { /// The Keccak 256-bit hash of the parent @@ -652,7 +647,7 @@ pub struct KitchenSinkHeader { #[serde(with = "alloy::serde::quantity")] pub number: BlockNumber, /// A scalar value equal to the current limit of gas expenditure per block; formally Hl. - // This is the main difference over the Ethereum network implementation. We use u128 here and + // This is the main difference over the Ethereum network implementation. We use u128 here and // not u64. #[serde(with = "alloy::serde::quantity")] pub gas_limit: u128, @@ -764,8 +759,8 @@ impl BlockHeader for KitchenSinkHeader { self.number } - // There's sadly nothing that we can do about this. We're required to implement this trait on - // any type that represents a header and the gas limit type used here is a u64. + // There's sadly nothing that we can do about this. We're required to implement this trait on + // any type that represents a header and the gas limit type used here is a u64. fn gas_limit(&self) -> u64 { self.gas_limit.try_into().unwrap_or(u64::MAX) }