Skip to content

Commit 75013a8

Browse files
committed
feat: EVM dependencies
1 parent 861db83 commit 75013a8

39 files changed

Lines changed: 680 additions & 259 deletions

File tree

.gitmodules

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[submodule "llvm"]
22
path = llvm
33
url = https://github.com/matter-labs/era-compiler-llvm
4-
branch = main
5-
shallow = true
4+
branch = evm-pushdeployaddress-new
65
[submodule "era-solidity"]
76
path = era-solidity
87
url = https://github.com/matter-labs/era-solidity
9-
branch = app-libsolc
10-
shallow = true
8+
branch = 0.8.29

Cargo.lock

Lines changed: 44 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

era-solidity

Submodule era-solidity updated 1615 files

llvm

Submodule llvm updated 88 files

solx-solc/src/standard_json/input/settings/optimizer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Optimizer {
1313
pub mode: char,
1414
/// Whether to try to recompile with -Oz if the bytecode is too large.
1515
#[serde(default, skip_serializing)]
16-
pub fallback_to_optimizing_for_size: bool,
16+
pub size_fallback: bool,
1717

1818
/// Enable the solc optimizer.
1919
/// Always `true` in order to allow library inlining.
@@ -31,10 +31,10 @@ impl Optimizer {
3131
///
3232
/// A shortcut constructor.
3333
///
34-
pub fn new(mode: char, fallback_to_optimizing_for_size: bool) -> Self {
34+
pub fn new(mode: char, size_fallback: bool) -> Self {
3535
Self {
3636
mode,
37-
fallback_to_optimizing_for_size,
37+
size_fallback,
3838

3939
enabled: Self::default_enabled(),
4040
}

solx-solc/src/standard_json/output/contract/evm/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ impl EVM {
3535
///
3636
/// Sets the EVM and deploy and runtime bytecode.
3737
///
38-
pub fn modify_evm(&mut self, deploy_bytecode: String, runtime_bytecode: String) {
39-
let mut bytecode = deploy_bytecode;
40-
bytecode.push_str(runtime_bytecode.as_str());
38+
pub fn modify_evm(&mut self, bytecode: String) {
4139
self.bytecode = Some(Bytecode::new(bytecode));
4240
}
4341

solx-yul/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111

1212
pub mod util;
1313
pub mod yul;
14+
15+
pub use crate::yul::dependencies::Dependencies;

solx-yul/src/yul/dependencies.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//!
2+
//! Collection of Yul dependencies.
3+
//!
4+
5+
///
6+
/// This structure represents an ordered dependency collection
7+
/// in the order they are encountered in Yul from the top to the bottom.
8+
///
9+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
10+
pub struct Dependencies {
11+
/// Top-level object identifier.
12+
pub identifier: String,
13+
/// List of EVM dependencies.
14+
pub inner: Vec<String>,
15+
}
16+
17+
impl Dependencies {
18+
///
19+
/// Create a new instance of dependencies.
20+
///
21+
pub fn new(identifier: &str) -> Self {
22+
Self {
23+
identifier: identifier.to_owned(),
24+
inner: Vec::new(),
25+
}
26+
}
27+
28+
///
29+
/// Push a single dependency.
30+
///
31+
pub fn push(&mut self, dependency: String, is_runtime_code: bool) {
32+
if dependency == self.identifier || self.inner.contains(&dependency) {
33+
return;
34+
}
35+
36+
if is_runtime_code {
37+
self.inner.insert(0, dependency);
38+
} else {
39+
self.inner.push(dependency);
40+
}
41+
}
42+
}

solx-yul/src/yul/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! The Yul IR compiling tools.
33
//!
44
5+
pub mod dependencies;
56
pub mod error;
67
pub mod lexer;
78
pub mod parser;

0 commit comments

Comments
 (0)