Skip to content

Commit

Permalink
feat(error): use unexpected error instead (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfourzerofour committed Aug 7, 2024
1 parent a88a4c7 commit d1eaffd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
submodules: 'recursive'

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.79.0
with:
components: llvm-tools-preview

Expand Down
11 changes: 8 additions & 3 deletions crates/pool/src/server/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,14 @@ impl LocalPoolHandle {
response: send,
})
.await
.map_err(|_| anyhow::anyhow!("LocalPoolServer closed"))?;
recv.await
.map_err(|_| anyhow::anyhow!("LocalPoolServer closed"))?
.map_err(|_| {
error!("LocalPoolServer sender closed");
PoolError::UnexpectedResponse
})?;
recv.await.map_err(|_| {
error!("LocalPoolServer receiver closed");
PoolError::UnexpectedResponse
})?
}
}

Expand Down
6 changes: 5 additions & 1 deletion crates/sim/src/gas/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use std::{cmp, fmt::Debug, sync::Arc};

use anyhow::Context;
use anyhow::{bail, Context};
use ethers::types::U256;
use rundler_provider::{EntryPoint, L1GasProvider, Provider};
use rundler_types::{
Expand Down Expand Up @@ -84,6 +84,10 @@ pub async fn calc_required_pre_verification_gas<
op.max_fee_per_gas(),
);

if gas_price.is_zero() {
bail!("Gas price cannot be zero")
}

let dynamic_gas = entry_point
.calc_l1_gas(entry_point.address(), op.clone(), gas_price)
.await?;
Expand Down
1 change: 0 additions & 1 deletion crates/sim/src/precheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ where
) -> anyhow::Result<U256> {
gas::calc_required_pre_verification_gas(&self.chain_spec, &self.entry_point, &op, base_fee)
.await
.context("should calculate pre-verification gas")
}
}

Expand Down

0 comments on commit d1eaffd

Please sign in to comment.