Skip to content

Commit 261ab9c

Browse files
authored
Merge branch 'main' into feat/implement-eth/69
2 parents 7017646 + 171076f commit 261ab9c

File tree

21 files changed

+195
-151
lines changed

21 files changed

+195
-151
lines changed

.github/workflows/main_prover.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO: uncomment "if: ${{ always() && github.event_name == 'merge_group' }}" lines when reenabling this workflow in the merge queue
12
name: L2 (SP1 Backend)
23
on:
34
push:
@@ -23,30 +24,30 @@ jobs:
2324
uses: dtolnay/rust-toolchain@stable
2425

2526
- name: Set up Rust cache
26-
if: ${{ always() && github.event_name == 'merge_group' }}
27+
# if: ${{ always() && github.event_name == 'merge_group' }}
2728
uses: Swatinem/rust-cache@v2
2829
with:
2930
cache-on-failure: "true"
3031

3132
- name: RISC-V SP1 toolchain install
32-
if: ${{ always() && github.event_name == 'merge_group' }}
33+
# if: ${{ always() && github.event_name == 'merge_group' }}
3334
run: |
3435
. "$HOME/.cargo/env"
3536
curl -L https://sp1.succinct.xyz | bash
3637
~/.sp1/bin/sp1up --version 4.1.7
3738
3839
- name: Set up Docker Buildx
39-
if: ${{ always() && github.event_name == 'merge_group' }}
40+
# if: ${{ always() && github.event_name == 'merge_group' }}
4041
uses: docker/setup-buildx-action@v3
4142

4243
# This step is needed because of an state bug in the GPU runner.
4344
# Issue to fix this: https://github.com/lambdaclass/ethrex/pull/2741.
4445
- name: Clean .env
45-
if: ${{ always() && github.event_name == 'merge_group' }}
46+
# if: ${{ always() && github.event_name == 'merge_group' }}
4647
run: rm -rf crates/l2/.env
4748

4849
- name: Bake docker images
49-
if: ${{ always() && github.event_name == 'merge_group' }}
50+
# if: ${{ always() && github.event_name == 'merge_group' }}
5051
uses: docker/bake-action@v6
5152
with:
5253
workdir: "crates/l2"
@@ -57,18 +58,18 @@ jobs:
5758
*.cache-from=type=gha
5859
5960
- name: Build prover
60-
if: ${{ always() && github.event_name == 'merge_group' }}
61+
# if: ${{ always() && github.event_name == 'merge_group' }}
6162
run: |
6263
cd crates/l2
6364
make build-prover
6465
6566
- name: Build test
66-
if: ${{ always() && github.event_name == 'merge_group' }}
67+
# if: ${{ always() && github.event_name == 'merge_group' }}
6768
run: |
6869
cargo test l2 --no-run --release
6970
7071
- name: Start L1 & Deploy contracts
71-
if: ${{ always() && github.event_name == 'merge_group' }}
72+
# if: ${{ always() && github.event_name == 'merge_group' }}
7273
run: |
7374
cd crates/l2
7475
touch .env
@@ -78,7 +79,7 @@ jobs:
7879
docker compose -f docker-compose-l2.yaml up contract_deployer
7980
8081
- name: Start Sequencer
81-
if: ${{ always() && github.event_name == 'merge_group' }}
82+
# if: ${{ always() && github.event_name == 'merge_group' }}
8283
run: |
8384
cd crates/l2
8485
CI_ETHREX_WORKDIR=/usr/local/bin \
@@ -87,7 +88,7 @@ jobs:
8788
docker compose -f docker-compose-l2.yaml up ethrex_l2 --detach
8889
8990
- name: Run test
90-
if: ${{ always() && github.event_name == 'merge_group' }}
91+
# if: ${{ always() && github.event_name == 'merge_group' }}
9192
run: |
9293
cd crates/l2
9394
RUST_LOG=info,ethrex_prover_lib=debug SP1_PROVER=cuda make init-prover &

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Perf
44

5+
### 2025-05-20
6+
7+
- Reduce account clone overhead when account data is retrieved [2684](https://github.com/lambdaclass/ethrex/pull/2684)
8+
59
### 2025-04-30
610

711
- Reduce transaction clone and Vec grow overhead in mempool [2637](https://github.com/lambdaclass/ethrex/pull/2637)

cmd/ef_tests/blockchain/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ impl From<Header> for BlockHeader {
275275
excess_blob_gas: val.excess_blob_gas.map(|x| x.as_u64()),
276276
parent_beacon_block_root: val.parent_beacon_block_root,
277277
requests_hash: val.requests_hash,
278+
..Default::default()
278279
}
279280
}
280281
}

crates/blockchain/payload.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub fn create_payload(args: &BuildPayloadArgs, storage: &Store) -> Result<Block,
127127
requests_hash: chain_config
128128
.is_prague_activated(args.timestamp)
129129
.then_some(*DEFAULT_REQUESTS_HASH),
130+
..Default::default()
130131
};
131132

132133
let body = BlockBody {

crates/common/types/block.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,15 @@ lazy_static! {
3636
pub struct Block {
3737
pub header: BlockHeader,
3838
pub body: BlockBody,
39-
#[serde(skip)]
40-
hash: OnceCell<BlockHash>,
4139
}
4240

4341
impl Block {
4442
pub fn new(header: BlockHeader, body: BlockBody) -> Block {
45-
Block {
46-
header,
47-
body,
48-
hash: OnceCell::new(),
49-
}
43+
Block { header, body }
5044
}
5145

5246
pub fn hash(&self) -> BlockHash {
53-
*self.hash.get_or_init(|| self.header.compute_block_hash())
47+
self.header.hash()
5448
}
5549
}
5650

@@ -87,6 +81,8 @@ impl RLPDecode for Block {
8781
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Default, Deserialize)]
8882
#[serde(rename_all = "camelCase")]
8983
pub struct BlockHeader {
84+
#[serde(skip)]
85+
pub hash: OnceCell<BlockHash>,
9086
pub parent_hash: H256,
9187
#[serde(rename = "sha3Uncles")]
9288
pub ommers_hash: H256, // ommer = uncle
@@ -188,6 +184,7 @@ impl RLPDecode for BlockHeader {
188184

189185
Ok((
190186
BlockHeader {
187+
hash: OnceCell::new(),
191188
parent_hash,
192189
ommers_hash,
193190
coinbase,
@@ -304,6 +301,10 @@ impl BlockHeader {
304301
self.encode(&mut buf);
305302
keccak(buf)
306303
}
304+
305+
fn hash(&self) -> H256 {
306+
*self.hash.get_or_init(|| self.compute_block_hash())
307+
}
307308
}
308309

309310
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
@@ -746,6 +747,7 @@ mod test {
746747
excess_blob_gas: Some(0x00),
747748
parent_beacon_block_root: Some(H256::zero()),
748749
requests_hash: Some(*EMPTY_KECCACK_HASH),
750+
..Default::default()
749751
};
750752
let block = BlockHeader {
751753
parent_hash: H256::from_str(
@@ -789,6 +791,7 @@ mod test {
789791
excess_blob_gas: Some(0x00),
790792
parent_beacon_block_root: Some(H256::zero()),
791793
requests_hash: Some(*EMPTY_KECCACK_HASH),
794+
..Default::default()
792795
};
793796
assert!(validate_block_header(&block, &parent_block, ELASTICITY_MULTIPLIER).is_ok())
794797
}

crates/common/types/genesis.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ impl Genesis {
351351
.config
352352
.is_prague_activated(self.timestamp)
353353
.then_some(self.requests_hash.unwrap_or(*DEFAULT_REQUESTS_HASH)),
354+
..Default::default()
354355
}
355356
}
356357

crates/networking/rpc/eth/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub mod test_utils {
7070
excess_blob_gas: Some(0x00),
7171
parent_beacon_block_root: Some(H256::zero()),
7272
requests_hash: Some(*DEFAULT_REQUESTS_HASH),
73+
..Default::default()
7374
}
7475
}
7576

crates/networking/rpc/types/block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ mod test {
149149
excess_blob_gas: Some(0x00),
150150
parent_beacon_block_root: Some(H256::zero()),
151151
requests_hash: Some(*EMPTY_KECCACK_HASH),
152+
..Default::default()
152153
};
153154

154155
let tx = EIP1559Transaction {

crates/networking/rpc/types/payload.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ impl ExecutionPayload {
132132
parent_beacon_block_root,
133133
// TODO: set the value properly
134134
requests_hash,
135+
..Default::default()
135136
};
136137

137138
Ok(Block::new(header, body))

crates/storage/store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ mod tests {
12611261
excess_blob_gas: Some(0x00),
12621262
parent_beacon_block_root: Some(H256::zero()),
12631263
requests_hash: Some(*EMPTY_KECCACK_HASH),
1264+
..Default::default()
12641265
};
12651266
let block_body = BlockBody {
12661267
transactions: vec![Transaction::decode(&hex::decode("b86f02f86c8330182480114e82f618946177843db3138ae69679a54b95cf345ed759450d870aa87bee53800080c080a0151ccc02146b9b11adf516e6787b59acae3e76544fdcd75e77e67c6b598ce65da064c5dd5aae2fbb535830ebbdad0234975cd7ece3562013b63ea18cc0df6c97d4").unwrap()).unwrap(),

0 commit comments

Comments
 (0)