Skip to content

Commit

Permalink
Merge branch 'main' into prover_cli_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ilitteri authored May 8, 2024
2 parents aab6481 + 8ddd039 commit 63c3d3f
Show file tree
Hide file tree
Showing 15 changed files with 825 additions and 83 deletions.
14 changes: 3 additions & 11 deletions core/lib/eth_client/src/clients/http/decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,17 @@ pub(super) trait L1EthNamespace {
async fn get_transaction_count(
&self,
address: Address,
block: Option<web3::BlockNumber>,
block: web3::BlockNumber,
) -> RpcResult<U256>;

#[method(name = "gasPrice")]
async fn gas_price(&self) -> RpcResult<U256>;

#[method(name = "call")]
async fn call(
&self,
req: web3::CallRequest,
block: Option<web3::BlockId>,
) -> RpcResult<web3::Bytes>;
async fn call(&self, req: web3::CallRequest, block: web3::BlockId) -> RpcResult<web3::Bytes>;

#[method(name = "getBalance")]
async fn get_balance(
&self,
address: Address,
block: Option<web3::BlockNumber>,
) -> RpcResult<U256>;
async fn get_balance(&self, address: Address, block: web3::BlockNumber) -> RpcResult<U256>;

#[method(name = "getLogs")]
async fn get_logs(&self, filter: web3::Filter) -> RpcResult<Vec<web3::Log>>;
Expand Down
20 changes: 10 additions & 10 deletions core/lib/eth_client/src/clients/http/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ impl EthInterface for QueryClient {
) -> Result<U256, Error> {
COUNTERS.call[&(Method::NonceAtForAccount, self.component)].inc();
let latency = LATENCIES.direct[&Method::NonceAtForAccount].start();
let nonce = self
.web3
.get_transaction_count(account, Some(block))
.await?;
let nonce = self.web3.get_transaction_count(account, block).await?;
latency.observe();
Ok(nonce)
}
Expand Down Expand Up @@ -203,11 +200,10 @@ impl EthInterface for QueryClient {
access_list: None,
};

let err = self
.web3
.call(call_request, receipt.block_number.map(Into::into))
.await
.err();
let block_number = receipt
.block_number
.map_or_else(|| web3::BlockNumber::Latest.into(), Into::into);
let err = self.web3.call(call_request, block_number).await.err();

let failure_info = match err {
Some(ClientError::Call(call_err)) => {
Expand Down Expand Up @@ -246,6 +242,7 @@ impl EthInterface for QueryClient {
block: Option<web3::BlockId>,
) -> Result<web3::Bytes, Error> {
let latency = LATENCIES.direct[&Method::CallContractFunction].start();
let block = block.unwrap_or_else(|| web3::BlockNumber::Latest.into());
let output_bytes = self.web3.call(request, block).await?;
latency.observe();
Ok(output_bytes)
Expand All @@ -262,7 +259,10 @@ impl EthInterface for QueryClient {
async fn eth_balance(&self, address: Address) -> Result<U256, Error> {
COUNTERS.call[&(Method::EthBalance, self.component)].inc();
let latency = LATENCIES.direct[&Method::EthBalance].start();
let balance = self.web3.get_balance(address, None).await?;
let balance = self
.web3
.get_balance(address, web3::BlockNumber::Latest)
.await?;
latency.observe();
Ok(balance)
}
Expand Down
4 changes: 2 additions & 2 deletions core/node/node_framework/src/service/runnables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub(super) struct Runnables {

impl fmt::Debug for Runnables {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Macro that iterates over a `Vec`, invokes `.name()` method and collects the results into a Vec<String>.
// Returns a reference to created vec to satisfy the `.field` method signature.
// Macro that iterates over a `Vec`, invokes `.name()` method and collects the results into a `Vec<String>`.
// Returns a reference to created `Vec` to satisfy the `.field` method signature.
macro_rules! names {
($vec:expr) => {
&$vec.iter().map(|x| x.name()).collect::<Vec<_>>()
Expand Down
Loading

0 comments on commit 63c3d3f

Please sign in to comment.