Skip to content

Commit

Permalink
chore: fix build for upstream merge 57bb12e (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec authored Nov 5, 2024
1 parent 435ebef commit 22e7f15
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 76 deletions.
70 changes: 40 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/cheatcodes/src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1441,9 +1441,9 @@ where {
// At the root call to test function or script `run()`/`setUp()` functions, we are
// decreasing sender nonce to ensure that it matches on-chain nonce once we start
// broadcasting.
if ecx.journaled_state.depth == 0 {
let sender = ecx.env.tx.caller;
let account = match super::evm::journaled_account(ecx, sender) {
if ecx_inner.journaled_state.depth == 0 {
let sender = ecx_inner.env.tx.caller;
let account = match super::evm::journaled_account(ecx_inner, sender) {
Ok(account) => account,
Err(err) => {
return Some(CallOutcome {
Expand Down
17 changes: 8 additions & 9 deletions crates/common/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ impl ProjectCompiler {

// TODO: avoid process::exit
// exit with error if any contract exceeds the size limit, excluding test contracts.
if size_report.exceeds_size_limit() {
if size_report.exceeds_runtime_size_limit() {
std::process::exit(1);
}

// Check size limits only if not ignoring EIP-3860
if !self.ignore_eip_3860 && size_report.exceeds_initcode_size_limit() {
std::process::exit(1);
}
}
Expand Down Expand Up @@ -477,14 +482,8 @@ impl ProjectCompiler {
.collect();

for (name, artifact) in artifacts {
let bytecode = artifact.get_bytecode_object().unwrap_or_default();
let size = match bytecode.as_ref() {
BytecodeObject::Bytecode(bytes) => bytes.len(),
BytecodeObject::Unlinked(_) => {
// TODO: This should never happen on zksolc, maybe error somehow
0
}
};
let runtime_size = contract_size(artifact, false).unwrap_or_default();
let init_size = contract_size(artifact, true).unwrap_or_default();

let is_dev_contract = artifact
.abi
Expand Down
16 changes: 15 additions & 1 deletion crates/config/src/zksync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ use foundry_compilers::{
solc::CliSettings,
zksolc::{
settings::{
BytecodeHash, Codegen, Optimizer, OptimizerDetails, SettingsMetadata, ZkSolcSettings,
BytecodeHash, Codegen, Optimizer, OptimizerDetails, SettingsMetadata, ZkSolcError,
ZkSolcSettings, ZkSolcWarning,
},
ZkSettings,
},
};

use revm_primitives::HashSet;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

Expand Down Expand Up @@ -61,6 +63,12 @@ pub struct ZkSyncConfig {

/// zkSolc optimizer details
pub optimizer_details: Option<OptimizerDetails>,

// zksolc suppressed warnings.
pub suppressed_warnings: HashSet<ZkSolcWarning>,

// zksolc suppressed errors.
pub suppressed_errors: HashSet<ZkSolcError>,
}

impl Default for ZkSyncConfig {
Expand All @@ -80,6 +88,8 @@ impl Default for ZkSyncConfig {
optimizer: true,
optimizer_mode: '3',
optimizer_details: Default::default(),
suppressed_errors: Default::default(),
suppressed_warnings: Default::default(),
}
}
}
Expand Down Expand Up @@ -130,6 +140,10 @@ impl ZkSyncConfig {
},
},
codegen: if self.force_evmla { Codegen::EVMLA } else { Codegen::Yul },
suppressed_warnings: Default::default(), /* TODO(zk): take from self when `FromStr`
* impl is provided */
suppressed_errors: Default::default(), /* TODO(zk): take from self when `FromStr`
* impl is provided */
};

// `cli_settings` get set from `Project` values when building `ZkSolcVersionedInput`
Expand Down
Loading

0 comments on commit 22e7f15

Please sign in to comment.