Skip to content

Commit

Permalink
Resolve smaller nits
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Oct 1, 2024
1 parent 7b31944 commit 1179fc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion core/node/api_server/src/execution_sandbox/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl<S: ReadStorage> StorageWithOverrides<S> {
let code_key = get_code_key(account);
let code_hash = code.hash();
self.overridden_slots.insert(code_key, code_hash);
// FIXME: is this addition correct?
let known_code_key = get_known_code_key(&code_hash);
self.overridden_slots
.insert(known_code_key, H256::from_low_u64_be(1));
Expand Down
11 changes: 5 additions & 6 deletions core/node/api_server/src/tx_sender/gas_estimation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ use zksync_multivm::{
adjust_pubdata_price_for_tx, derive_base_fee_and_gas_per_pubdata, derive_overhead,
get_max_batch_gas_limit,
},
zk_evm_latest::ethereum_types::H256,
};
use zksync_system_constants::MAX_L2_TX_GAS_LIMIT;
use zksync_types::{
api::state_override::StateOverride, fee::Fee, fee_model::BatchFeeInput, get_code_key,
ExecuteTransactionCommon, PackedEthSignature, ProtocolVersionId, Transaction,
ExecuteTransactionCommon, PackedEthSignature, ProtocolVersionId, Transaction, H256,
};

use super::{result::ApiCallResult, SubmitTxError, TxSender};
Expand Down Expand Up @@ -59,12 +58,13 @@ impl TxSender {
let (bounds, initial_pivot) = match kind {
BinarySearchKind::Full => {
let lower_bound = initial_estimate.gas_charged_for_pubdata;
let upper_bound = MAX_L2_TX_GAS_LIMIT;
let upper_bound = MAX_L2_TX_GAS_LIMIT + initial_estimate.gas_charged_for_pubdata;
(lower_bound..=upper_bound, None)
}
BinarySearchKind::Optimized => {
let lower_bound = optimized_lower_bound.unwrap_or(0);
let upper_bound = MAX_L2_TX_GAS_LIMIT;
let lower_bound =
optimized_lower_bound.unwrap_or(initial_estimate.gas_charged_for_pubdata);
let upper_bound = MAX_L2_TX_GAS_LIMIT + initial_estimate.gas_charged_for_pubdata;
let initial_pivot = optimistic_gas_limit.filter(|&gas| {
// If `optimistic_gas_limit` is greater than the ordinary binary search pivot, there's no sense using it.
gas < (lower_bound + upper_bound) / 2
Expand Down Expand Up @@ -387,7 +387,6 @@ impl<'a> GasEstimator<'a> {
.context("estimate_gas step failed")?;
// If the transaction has failed with such a large gas limit, we return an API error here right away,
// since the inferred gas bounds would be unreliable in this case.
// FIXME: double-check that returning early is OK
result.check_api_call_result()?;

// It is assumed that there is no overflow here
Expand Down

0 comments on commit 1179fc2

Please sign in to comment.