Skip to content

Commit

Permalink
Merge with the latest releases
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Jan 17, 2024
1 parent 0007ed2 commit 35acc06
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 40 deletions.
8 changes: 4 additions & 4 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_def
zkevm-assembly = { git = "https://github.com/matter-labs/era-zkEVM-assembly", branch = "v1.3.2" }

compiler-common = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" }
compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "main" }
compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "az-cpr-872-integrate-an-evm-execution-environment-into-the-compiler" }

[dependencies.inkwell]
git = "https://github.com/matter-labs-forks/inkwell"
branch = "llvm-15"
branch = "az-evm-support"
default-features = false
features = ["llvm15-0", "no-libffi-linking", "target-eravm"]
features = ["llvm15-0", "no-libffi-linking", "target-eravm", "target-evm"]

[target.'cfg(target_env = "musl")'.dependencies]
mimalloc = { version = "*", default-features = false }
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn standard_output(
if let Some(ref debug_config) = debug_config {
for path in input_files.iter() {
let lll_debug = vyper.lll_debug(path.as_path(), true)?;
debug_config.dump_lll(path.to_string_lossy().as_ref(), lll_debug.as_str())?;
debug_config.dump_lll(path.to_string_lossy().as_ref(), None, lll_debug.as_str())?;
}
}

Expand Down Expand Up @@ -157,7 +157,7 @@ pub fn combined_json(
if let Some(ref debug_config) = debug_config {
for path in input_files.iter() {
let lll_debug = vyper.lll_debug(path.as_path(), vyper_optimizer_enabled)?;
debug_config.dump_lll(path.to_string_lossy().as_ref(), lll_debug.as_str())?;
debug_config.dump_lll(path.to_string_lossy().as_ref(), None, lll_debug.as_str())?;
}
}

Expand Down
26 changes: 13 additions & 13 deletions src/project/contract/vyper/expression/instruction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,10 @@ impl Instruction {
.code_type()
.ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?
{
compiler_llvm_context::EraVMCodeType::Deploy => {
compiler_llvm_context::CodeType::Deploy => {
Ok(Some(context.field_const(0).as_basic_value_enum()))
}
compiler_llvm_context::EraVMCodeType::Runtime => {
compiler_llvm_context::CodeType::Runtime => {
compiler_llvm_context::eravm_evm_calldata::load(
context,
arguments[0].into_int_value(),
Expand All @@ -1003,10 +1003,10 @@ impl Instruction {
.code_type()
.ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?
{
compiler_llvm_context::EraVMCodeType::Deploy => {
compiler_llvm_context::CodeType::Deploy => {
Ok(Some(context.field_const(0).as_basic_value_enum()))
}
compiler_llvm_context::EraVMCodeType::Runtime => {
compiler_llvm_context::CodeType::Runtime => {
compiler_llvm_context::eravm_evm_calldata::size(context).map(Some)
}
}
Expand All @@ -1018,10 +1018,10 @@ impl Instruction {
.code_type()
.ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?
{
compiler_llvm_context::EraVMCodeType::Deploy => {
compiler_llvm_context::CodeType::Deploy => {
compiler_llvm_context::eravm_evm_calldata::size(context)?
}
compiler_llvm_context::EraVMCodeType::Runtime => {
compiler_llvm_context::CodeType::Runtime => {
arguments[1].into_int_value().as_basic_value_enum()
}
}
Expand All @@ -1044,13 +1044,13 @@ impl Instruction {
"Immutables are not available if the contract part is undefined"
);
}
Some(compiler_llvm_context::EraVMCodeType::Deploy) => {
Some(compiler_llvm_context::CodeType::Deploy) => {
compiler_llvm_context::eravm_evm_calldata::load(
context,
arguments[0].into_int_value(),
)
}
Some(compiler_llvm_context::EraVMCodeType::Runtime) => {
Some(compiler_llvm_context::CodeType::Runtime) => {
compiler_llvm_context::eravm_evm_immutable::load(
context,
arguments[0].into_int_value(),
Expand All @@ -1068,15 +1068,15 @@ impl Instruction {
"Immutables are not available if the contract part is undefined"
);
}
Some(compiler_llvm_context::EraVMCodeType::Deploy) => {
Some(compiler_llvm_context::CodeType::Deploy) => {
compiler_llvm_context::eravm_evm_calldata::copy(
context,
arguments[0].into_int_value(),
arguments[1].into_int_value(),
arguments[2].into_int_value(),
)
}
Some(compiler_llvm_context::EraVMCodeType::Runtime) => immutable::load_bytes(
Some(compiler_llvm_context::CodeType::Runtime) => immutable::load_bytes(
context,
arguments[0].into_int_value(),
arguments[1].into_int_value(),
Expand All @@ -1090,10 +1090,10 @@ impl Instruction {
.code_type()
.ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?
{
compiler_llvm_context::EraVMCodeType::Deploy => {
compiler_llvm_context::CodeType::Deploy => {
compiler_llvm_context::eravm_evm_calldata::size(context).map(Some)
}
compiler_llvm_context::EraVMCodeType::Runtime => {
compiler_llvm_context::CodeType::Runtime => {
let code_source =
compiler_llvm_context::eravm_general::code_source(context)?;
compiler_llvm_context::eravm_evm_ext_code::size(
Expand All @@ -1105,7 +1105,7 @@ impl Instruction {
}
}
Self::CODECOPY(arguments) => {
if let compiler_llvm_context::EraVMCodeType::Runtime = context
if let compiler_llvm_context::CodeType::Runtime = context
.code_type()
.ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?
{
Expand Down
24 changes: 6 additions & 18 deletions src/project/contract/vyper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,37 +245,25 @@ where
let mut function_expressions = deploy_code
.extract_functions()?
.into_iter()
.map(|(label, expression)| {
(
label,
expression,
compiler_llvm_context::EraVMCodeType::Deploy,
)
})
.collect::<Vec<(String, Expression, compiler_llvm_context::EraVMCodeType)>>();
.map(|(label, expression)| (label, expression, compiler_llvm_context::CodeType::Deploy))
.collect::<Vec<(String, Expression, compiler_llvm_context::CodeType)>>();
function_expressions.extend(
runtime_code
.extract_functions()?
.into_iter()
.map(|(label, expression)| {
(
label,
expression,
compiler_llvm_context::EraVMCodeType::Runtime,
)
(label, expression, compiler_llvm_context::CodeType::Runtime)
})
.collect::<Vec<(String, Expression, compiler_llvm_context::EraVMCodeType)>>(),
.collect::<Vec<(String, Expression, compiler_llvm_context::CodeType)>>(),
);

let mut functions = Vec::with_capacity(function_expressions.capacity());
for (label, expression, code_type) in function_expressions.into_iter() {
let mut metadata_label = label
.strip_suffix(format!("_{}", compiler_llvm_context::EraVMCodeType::Deploy).as_str())
.strip_suffix(format!("_{}", compiler_llvm_context::CodeType::Deploy).as_str())
.unwrap_or(label.as_str());
metadata_label = label
.strip_suffix(
format!("_{}", compiler_llvm_context::EraVMCodeType::Runtime).as_str(),
)
.strip_suffix(format!("_{}", compiler_llvm_context::CodeType::Runtime).as_str())
.unwrap_or(metadata_label);
metadata_label = label
.strip_suffix(format!("_{}", crate::r#const::LABEL_SUFFIX_COMMON).as_str())
Expand Down

0 comments on commit 35acc06

Please sign in to comment.