Skip to content

Commit

Permalink
Release zksolc v1.3.17 and zkvyper v1.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Nov 13, 2023
1 parent 96acd69 commit 650488b
Show file tree
Hide file tree
Showing 46 changed files with 759 additions and 572 deletions.
850 changes: 425 additions & 425 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ members = [
"coverage_watcher",
"benchmark_analyzer",
]
resolver = "2"
2 changes: 1 addition & 1 deletion LLVM.lock
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
url = "https://github.com/matter-labs/era-compiler-llvm"
branch = "v1.3.4"
branch = "v1.3.7"
18 changes: 9 additions & 9 deletions compiler_tester/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "compiler-tester"
version = "1.3.2"
version = "1.3.3"
authors = [
"Alex Zarudnyy <[email protected]>",
"Oleksandr Zarudnyi <[email protected]>",
"Anton Dyadyuk <[email protected]>",
]
license = "MIT OR Apache-2.0"
edition = "2021"
description = "zkEVM Compiler Integration Testing Framework"
description = "EraVM Compiler Integration Testing Framework"

[[bin]]
name = "compiler-tester"
Expand All @@ -21,19 +21,19 @@ structopt = { version = "0.3", default-features = false }
anyhow = "1.0"
colored = "2.0"

serde = { version = "1.0", features = [ "derive" ] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
md5 = "0.7"
hex = "0.4"
sha3 = "0.10"
ron = "0.8"
regex = "1.9"
regex = "1.8"
glob = "0.3"
semver = { version = "1.0", features = [ "serde" ] }
semver = { version = "1.0", features = ["serde"] }
itertools = "0.10"
rayon = "1.7"
once_cell = "1.17"
rayon = "1.7"
lazy_static = "1.4"
bincode = "1.3"

Expand All @@ -55,7 +55,7 @@ default-features = false
features = ["rt-multi-thread"]

[dependencies.web3]
version = "0.18"
version = "0.19"
default-features = false
features = ["http-rustls-tls", "test", "signing"]

Expand All @@ -68,4 +68,4 @@ features = ["blocking"]
git = "https://github.com/matter-labs-forks/inkwell"
branch = "llvm-15"
default-features = false
features = ["llvm15-0", "no-libffi-linking", "target-syncvm"]
features = ["llvm15-0", "no-libffi-linking", "target-eravm"]
4 changes: 2 additions & 2 deletions compiler_tester/src/compiler_tester/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(
name = "compiler-tester",
about = "zkEVM Compiler Integration Testing Framework"
about = "EraVM Compiler Integration Testing Framework"
)]
pub struct Arguments {
/// The logging level.
Expand All @@ -28,7 +28,7 @@ pub struct Arguments {
pub debug: bool,

/// Saves all JSON traces produced by VM to `./trace/` directory.
/// If passed twice, dumps zkEVM instructions and registers to the terminal.
/// If passed twice, dumps EraVM instructions and registers to the terminal.
#[structopt(short = "T", long = "trace", parse(from_occurrences))]
pub trace: usize,

Expand Down
10 changes: 5 additions & 5 deletions compiler_tester/src/compiler_tester/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
);

inkwell::support::enable_llvm_pretty_stack_trace();
compiler_llvm_context::initialize_target();
compiler_llvm_context::initialize_target(compiler_llvm_context::Target::EraVM);
compiler_tester::LLVMOptions::initialize(
arguments.llvm_verify_each,
arguments.llvm_debug_logging,
Expand Down Expand Up @@ -167,8 +167,8 @@ mod tests {
quiet: false,
debug: false,
trace: 2,
modes: vec!["Y+M3B3 0.8.20".to_owned()],
paths: vec!["tests/solidity/simple/default.sol".to_owned()],
modes: vec!["Y+M3B3 0.8.21".to_owned()],
paths: vec!["./tests/solidity/simple/default.sol".to_owned()],
groups: vec![],
benchmark: None,
threads: Some(1),
Expand All @@ -177,8 +177,8 @@ mod tests {
disable_value_simulator: false,
zksolc: Some(PathBuf::from(compiler_solidity::DEFAULT_EXECUTABLE_NAME)),
zkvyper: Some(PathBuf::from(compiler_vyper::DEFAULT_EXECUTABLE_NAME)),
solc_bin_config_path: Some(PathBuf::from("configs/solc-bin-default.json")),
vyper_bin_config_path: Some(PathBuf::from("configs/vyper-bin-default.json")),
solc_bin_config_path: Some(PathBuf::from("./configs/solc-bin-default.json")),
vyper_bin_config_path: Some(PathBuf::from("./configs/vyper-bin-default.json")),
load_system_contracts: None,
save_system_contracts: None,
llvm_verify_each: false,
Expand Down
23 changes: 19 additions & 4 deletions compiler_tester/src/compilers/downloader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,19 @@ impl Downloader {
///
pub fn download(mut self, config_path: &Path) -> anyhow::Result<Config> {
let config_file = std::fs::File::open(config_path).map_err(|error| {
anyhow::anyhow!("Binaries download config opening error: {}", error)
anyhow::anyhow!(
"Binaries download config {:?} opening error: {}",
config_path,
error
)
})?;
let config_reader = std::io::BufReader::new(config_file);
let config: Config = serde_json::from_reader(config_reader).map_err(|error| {
anyhow::anyhow!("Binaries download config parsing error: {}", error)
anyhow::anyhow!(
"Binaries download config {:?} parsing error: {}",
config_path,
error
)
})?;

let platform_directory = config.get_remote_platform_directory()?;
Expand Down Expand Up @@ -77,8 +85,15 @@ impl Downloader {
binary.destination,
);

std::fs::copy(source_path.as_str(), binary.destination.as_str())
.map_err(|error| anyhow::anyhow!("Binary copying error: {}", error))?;
std::fs::copy(source_path.as_str(), binary.destination.as_str()).map_err(
|error| {
anyhow::anyhow!(
"Binary {:?} copying error: {}",
source_path.as_str(),
error
)
},
)?;
continue;
}
Protocol::HTTPS => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//!
//! The zkEVM compiler.
//! The EraVM compiler.
//!
use std::collections::BTreeMap;
use std::collections::HashMap;

use super::mode::zkevm::Mode as ZKEVMMode;
use super::mode::eravm::Mode as EraVMMode;
use super::mode::Mode;
use super::output::build::Build as zkEVMContractBuild;
use super::output::build::Build as EraVMContractBuild;
use super::output::Output;
use super::Compiler;

///
/// The zkEVM compiler.
/// The EraVM compiler.
///
#[allow(non_camel_case_types)]
pub struct zkEVMCompiler;
pub struct EraVMCompiler;

impl zkEVMCompiler {
impl EraVMCompiler {
///
/// A shortcut constructor.
///
Expand All @@ -26,9 +26,9 @@ impl zkEVMCompiler {
}
}

impl Compiler for zkEVMCompiler {
impl Compiler for EraVMCompiler {
fn modes(&self) -> Vec<Mode> {
vec![ZKEVMMode::default().into()]
vec![EraVMMode::default().into()]
}

fn compile(
Expand All @@ -46,10 +46,10 @@ impl Compiler for zkEVMCompiler {
.map(|(path, source_code)| {
zkevm_assembly::Assembly::try_from(source_code.to_owned())
.map_err(anyhow::Error::new)
.and_then(zkEVMContractBuild::new)
.and_then(EraVMContractBuild::new)
.map(|build| (path.to_string(), build))
})
.collect::<anyhow::Result<HashMap<String, zkEVMContractBuild>>>()?;
.collect::<anyhow::Result<HashMap<String, EraVMContractBuild>>>()?;

let last_contract = sources
.last()
Expand Down
19 changes: 7 additions & 12 deletions compiler_tester/src/compilers/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sha3::Digest;

use super::mode::llvm::Mode as LLVMMode;
use super::mode::Mode;
use super::output::build::Build as zkEVMContractBuild;
use super::output::build::Build as EraVMContractBuild;
use super::output::Output;
use super::Compiler;

Expand Down Expand Up @@ -46,7 +46,7 @@ impl LLVMCompiler {
name: &str,
mode: &LLVMMode,
debug_config: Option<compiler_llvm_context::DebugConfig>,
) -> anyhow::Result<zkEVMContractBuild> {
) -> anyhow::Result<EraVMContractBuild> {
let llvm = inkwell::context::Context::create();
let memory_buffer = inkwell::memory_buffer::MemoryBuffer::create_from_memory_range_copy(
source_code.as_bytes(),
Expand All @@ -58,19 +58,14 @@ impl LLVMCompiler {
let optimizer = compiler_llvm_context::Optimizer::new(mode.llvm_optimizer_settings.clone());
let source_hash = sha3::Keccak256::digest(source_code.as_bytes()).into();

let context = compiler_llvm_context::Context::<compiler_llvm_context::DummyDependency>::new(
&llvm,
module,
optimizer,
None,
true,
debug_config,
);
let context = compiler_llvm_context::EraVMContext::<
compiler_llvm_context::EraVMDummyDependency,
>::new(&llvm, module, optimizer, None, true, debug_config);
let build = context.build(name, Some(source_hash))?;
let assembly =
zkevm_assembly::Assembly::from_string(build.assembly_text, build.metadata_hash)?;

zkEVMContractBuild::new(assembly)
EraVMContractBuild::new(assembly)
}
}

Expand All @@ -97,7 +92,7 @@ impl Compiler for LLVMCompiler {
Self::compile_source(source, path, mode, debug_config.clone())
.map(|build| (path.to_owned(), build))
})
.collect::<anyhow::Result<HashMap<String, zkEVMContractBuild>>>()?;
.collect::<anyhow::Result<HashMap<String, EraVMContractBuild>>>()?;

let last_contract = sources
.last()
Expand Down
2 changes: 1 addition & 1 deletion compiler_tester/src/compilers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
pub mod cache;
pub mod downloader;
pub mod eravm;
pub mod llvm;
pub mod mode;
pub mod output;
pub mod solidity;
pub mod vyper;
pub mod yul;
pub mod zkevm;

use std::collections::BTreeMap;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//!
//! The compiler tester zkEVM mode.
//! The compiler tester EraVM mode.
//!
///
/// The compiler tester zkEVM mode.
/// The compiler tester EraVM mode.
///
#[derive(Debug, Default, Clone)]
pub struct Mode {}
Expand Down
48 changes: 40 additions & 8 deletions compiler_tester/src/compilers/mode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
//! The compiler mode.
//!
pub mod eravm;
pub mod llvm;
pub mod solidity;
pub mod vyper;
pub mod yul;
pub mod zkevm;

use self::eravm::Mode as EraVMMode;
use self::llvm::Mode as LLVMMode;
use self::solidity::Mode as SolidityMode;
use self::vyper::Mode as VyperMode;
use self::yul::Mode as YulMode;
use self::zkevm::Mode as zkEVMMode;

///
/// The compiler mode.
Expand All @@ -27,8 +27,8 @@ pub enum Mode {
Solidity(SolidityMode),
/// The `LLVM` mode.
LLVM(LLVMMode),
/// The `zkEVM` mode.
zkEVM(zkEVMMode),
/// The `EraVM` mode.
EraVM(EraVMMode),
/// The `Vyper` mode.
Vyper(VyperMode),
}
Expand Down Expand Up @@ -106,6 +106,19 @@ impl Mode {
}
}

///
/// Returns the LLVM optimizer settings.
///
pub fn llvm_optimizer_settings(&self) -> Option<&compiler_llvm_context::OptimizerSettings> {
match self {
Mode::Solidity(mode) => Some(&mode.llvm_optimizer_settings),
Mode::Yul(mode) => Some(&mode.llvm_optimizer_settings),
Mode::Vyper(mode) => Some(&mode.llvm_optimizer_settings),
Mode::LLVM(mode) => Some(&mode.llvm_optimizer_settings),
Mode::EraVM(_mode) => None,
}
}

///
/// Normalizes the mode according to the filter.
///
Expand Down Expand Up @@ -153,6 +166,25 @@ impl Mode {
.replace_all(current.as_str(), "B*")
.to_string();
}

if filter.starts_with('^') {
match self {
Self::Solidity(_) | Self::Vyper(_) => {
current = regex::Regex::new("[+]")
.expect("Always valid")
.replace_all(current.as_str(), "^")
.to_string();
}
Self::Yul(_) | Self::LLVM(_) => {
current = regex::Regex::new(".*M")
.expect("Always valid")
.replace_all(current.as_str(), "^M")
.to_string();
}
Self::EraVM(_) => {}
}
}

current
}
}
Expand All @@ -175,9 +207,9 @@ impl From<LLVMMode> for Mode {
}
}

impl From<zkEVMMode> for Mode {
fn from(inner: zkEVMMode) -> Self {
Self::zkEVM(inner)
impl From<EraVMMode> for Mode {
fn from(inner: EraVMMode) -> Self {
Self::EraVM(inner)
}
}

Expand All @@ -193,7 +225,7 @@ impl std::fmt::Display for Mode {
Self::Yul(inner) => write!(f, "{inner}"),
Self::Solidity(inner) => write!(f, "{inner}"),
Self::LLVM(inner) => write!(f, "{inner}"),
Self::zkEVM(inner) => write!(f, "{inner}"),
Self::EraVM(inner) => write!(f, "{inner}"),
Self::Vyper(inner) => write!(f, "{inner}"),
}
}
Expand Down
Loading

0 comments on commit 650488b

Please sign in to comment.