Skip to content

Commit 5ee42c3

Browse files
pablodeymoxqft
authored andcommitted
feat(l1,l2): setting avx2 flags for compilation and adding features asm to crates (#5189)
**Motivation** We want to take advantage of AVX2 processor features, and we are using `asm` features of dependencies in case it's possible. **Description** This PR sets compilation flag with AVX2 with the configuration: ``` target-cpu=x86-64-v3 ``` At the same time, it changes Cargo.toml files in the following way: * `c-kzg`: no default features, and add `std` and `ethereum_kzg_settings`. * `ark-ff`: with `asm` feature. * `sha3`: unified in Cargo.toml of the workspace and `asm` feature added. <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #issue_number
1 parent 6627773 commit 5ee42c3

File tree

7 files changed

+19
-10
lines changed

7 files changed

+19
-10
lines changed

.cargo/config.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[target.x86_64-unknown-linux-gnu]
2-
rustflags = ["-Ctarget-cpu=x86-64-v2"]
2+
rustflags = [
3+
"-Ctarget-cpu=x86-64-v3",
4+
"-Ctarget-feature=+avx2,+sse2,+ssse3,+sse4.1,+sse4.2,+bmi1,+lzcnt,+pclmulqdq",
5+
]

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ hex-literal = "0.4.1"
8585
crc32fast = "1.4.2"
8686
lazy_static = "1.5.0"
8787
sha2 = "0.10.8"
88-
sha3 = "0.10.8"
88+
sha3 = { version = "0.10.8", features = ["asm"] }
8989
tokio-util = { version = "0.7.15", features = ["rt"] }
9090
jsonwebtoken = "9.3.0"
9191
rand = "0.8.5"

crates/blockchain/payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use crate::{
4343
};
4444

4545
use thiserror::Error;
46-
use tracing::{debug, error, warn};
46+
use tracing::{debug, warn};
4747

4848
#[derive(Debug)]
4949
pub struct PayloadBuildTask {

crates/common/crypto/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ path = "./lib.rs"
1010

1111
[dependencies]
1212
# TODO(#1102): Move to Lambdaworks in the future
13-
c-kzg = { version = "2.1.1", optional = true }
13+
c-kzg = { version = "2.1.1", default-features = false, optional = true, features = [
14+
"ethereum_kzg_settings",
15+
"std",
16+
] }
1417
kzg-rs.workspace = true
1518

1619
thiserror.workspace = true

crates/networking/p2p/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rocksdb = { workspace = true, optional = true }
3737
prometheus = "0.14.0"
3838

3939
tokio-stream = "0.1.17"
40-
sha3 = "0.10.8"
40+
sha3.workspace = true
4141

4242
serde_json = "1.0.117"
4343

crates/networking/rpc/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ethrex-common.workspace = true
2020
ethrex-storage.workspace = true
2121
ethrex-vm.workspace = true
2222
ethrex-blockchain.workspace = true
23-
ethrex-p2p = {workspace = true, features = ["test-utils"]}
23+
ethrex-p2p = { workspace = true, features = ["test-utils"] }
2424
ethrex-rlp.workspace = true
2525
ethrex-trie.workspace = true
2626
ethrex-storage-rollup = { workspace = true, optional = true }
@@ -32,9 +32,12 @@ jsonwebtoken.workspace = true
3232
rand.workspace = true
3333
tokio-util = { workspace = true, features = ["codec"] }
3434
reqwest.workspace = true
35-
sha3 = "0.10.8"
35+
sha3.workspace = true
3636
sha2.workspace = true
37-
jemalloc_pprof = { version = "0.8.0", optional = true, features = ["flamegraph", "symbolize"] }
37+
jemalloc_pprof = { version = "0.8.0", optional = true, features = [
38+
"flamegraph",
39+
"symbolize",
40+
] }
3841
spawned-rt.workspace = true
3942
spawned-concurrency.workspace = true
4043

crates/vm/levm/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ thiserror.workspace = true
1717
serde = { workspace = true, features = ["derive", "rc"] }
1818
serde_json.workspace = true
1919

20-
sha3 = "0.10.8"
20+
sha3.workspace = true
2121
datatest-stable = "0.2.9"
2222
walkdir = "2.5.0"
2323
secp256k1.workspace = true
@@ -39,7 +39,7 @@ bls12_381 = { git = "https://github.com/lambdaclass/bls12_381", branch = "expose
3939
] }
4040
ark-bn254 = "0.5.0"
4141
ark-ec = "0.5.0"
42-
ark-ff = "0.5.0"
42+
ark-ff = { version = "0.5.0", features = ["asm"] }
4343
strum = { version = "0.27.1", features = ["derive"] }
4444
k256 = "0.13.4"
4545
substrate-bn = { version = "0.6.0", optional = true }

0 commit comments

Comments
 (0)