Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind ELF to ProofData #1647

Merged
merged 28 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
550de8d
Bind elf to ProofData and add tests
jfldde Dec 24, 2024
91a1a8d
Add missing import
jfldde Dec 24, 2024
b9b7bfa
With structs v1
jfldde Dec 24, 2024
cfcea45
fix pre fork1 batch proof guest serialization
eyusufatik Dec 25, 2024
e67099d
implement use_latest_elf for batch prover
eyusufatik Dec 26, 2024
aff6562
fix mock e2e tests
eyusufatik Dec 26, 2024
058e5fb
add todo
eyusufatik Dec 26, 2024
6de2754
add short prefix elf for genesis fork batch proof
eyusufatik Dec 26, 2024
bc9d694
add light client prover to fork elf switch test
eyusufatik Jan 2, 2025
9a58b5d
Merge branch 'nightly' into elf-switch
eyusufatik Jan 2, 2025
2c049dc
fix sys-getenv bug1
eyusufatik Jan 2, 2025
02b2abe
fix FromEnv test
eyusufatik Jan 2, 2025
862575b
Merge branch 'nightly' into elf-switch
jfldde Jan 2, 2025
f92b5fe
fix some tests
eyusufatik Jan 2, 2025
a69ebad
fix some more tests
eyusufatik Jan 2, 2025
798971b
fix forkmanager and some tests
eyusufatik Jan 2, 2025
814e8de
fix test_prover_transaction_chaining test
eyusufatik Jan 2, 2025
698eb70
get fork_from_block_number as an arg for evm query functions
eyusufatik Jan 3, 2025
6802fc0
Remove env debug
jfldde Jan 3, 2025
79c34cc
Fix native warning
jfldde Jan 3, 2025
406edc7
ProofData as struct and pub visibility
jfldde Jan 3, 2025
c79020c
Merge branch 'nightly' into elf-switch
jfldde Jan 3, 2025
1d12d48
update evm tests with always fork1
eyusufatik Jan 3, 2025
3841e9a
Fix ProofData struct in tests
jfldde Jan 3, 2025
4ca3f7e
Add missing import
jfldde Jan 3, 2025
552ceb8
Use expect directly
jfldde Jan 3, 2025
f1a6f94
Merge branch 'nightly' into elf-switch
jfldde Jan 3, 2025
f6659f6
Fix bind elf tests (#1663)
ercecan Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/citrea/tests/bitcoin_e2e/light_client_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl TestCase for LightClientProvingTestMultipleProofs {

fn sequencer_config() -> SequencerConfig {
SequencerConfig {
min_soft_confirmations_per_commitment: 20,
min_soft_confirmations_per_commitment: 50,
da_update_interval_ms: 500,
mempool_conf: SequencerMempoolConfig {
pending_tx_size: 2000,
Expand Down
8 changes: 4 additions & 4 deletions crates/batch-prover/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ where
.clone()
.try_into()
.context("Failed to parse transactions")?;
// Register this new block with the fork manager to active
// the new fork on the next block
self.fork_manager.register_block(l2_height)?;

let current_spec = self.fork_manager.active_fork().spec_id;
let soft_confirmation_result = self.stf.apply_soft_confirmation(
current_spec,
Expand Down Expand Up @@ -473,10 +477,6 @@ where
SoftConfirmationNumber(l2_height),
)?;

// Register this new block with the fork manager to active
// the new fork on the next block
self.fork_manager.register_block(l2_height)?;

// Only errors when there are no receivers
let _ = self.soft_confirmation_tx.send(l2_height);

Expand Down
9 changes: 5 additions & 4 deletions crates/fullnode/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ where
.clone()
.try_into()
.context("Failed to parse transactions")?;

// Register this new block with the fork manager to active
// the new fork on the next block.
self.fork_manager.register_block(l2_height)?;

let current_spec = self.fork_manager.active_fork().spec_id;
let soft_confirmation_result = self.stf.apply_soft_confirmation(
current_spec,
Expand Down Expand Up @@ -296,10 +301,6 @@ where
SoftConfirmationNumber(l2_height),
)?;

// Register this new block with the fork manager to active
// the new fork on the next block.
self.fork_manager.register_block(l2_height)?;

// Only errors when there are no receivers
let _ = self.soft_confirmation_tx.send(l2_height);

Expand Down
8 changes: 4 additions & 4 deletions crates/sequencer/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ where
.lock()
.fetch_deposits(self.config.deposit_mempool_fetch_limit);

// Register this new block with the fork manager to active
// the new fork on the next block
self.fork_manager.register_block(l2_height)?;

let active_fork_spec = self.fork_manager.active_fork().spec_id;

let soft_confirmation_info = HookSoftConfirmationInfo {
Expand Down Expand Up @@ -584,10 +588,6 @@ where
SoftConfirmationNumber(l2_height),
)?;

// Register this new block with the fork manager to active
// the new fork on the next block
self.fork_manager.register_block(l2_height)?;

let l1_height = da_block.header().height();
info!(
"New block #{}, DA #{}, Tx count: #{}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,6 @@ where
let mut previous_batch_hash = soft_confirmations[0][0].prev_hash();
let mut last_commitment_end_height: Option<u64> = None;

let mut fork_manager = ForkManager::new(forks, sequencer_commitments_range.0 as u64);

// should panic if number of sequencer commitments, soft confirmations, slot headers and witnesses don't match
for (((sequencer_commitment, soft_confirmations), da_block_headers), witnesses) in
sequencer_commitments_iter
Expand Down Expand Up @@ -658,6 +656,8 @@ where

let mut l2_height = sequencer_commitment.l2_start_block_number;

let mut fork_manager = ForkManager::new(forks, l2_height);

// now that we verified the claimed root, we can apply the soft confirmations
// should panic if the number of witnesses and soft confirmations don't match
for (mut soft_confirmation, (state_witness, offchain_witness)) in
Expand All @@ -673,6 +673,12 @@ where
"Soft confirmation heights not sequential"
);

// Notify fork manager about the block so that the next spec / fork
// is transitioned into if criteria is met.
if let Err(e) = fork_manager.register_block(l2_height) {
panic!("Fork transition failed {}", e);
}
eyusufatik marked this conversation as resolved.
Show resolved Hide resolved

let result = self
.apply_soft_confirmation(
fork_manager.active_fork().spec_id,
Expand All @@ -693,11 +699,6 @@ where
current_state_root = result.state_root_transition.final_root;
state_diff.extend(result.state_diff);

// Notify fork manager about the block so that the next spec / fork
// is transitioned into if criteria is met.
if let Err(e) = fork_manager.register_block(l2_height) {
panic!("Fork transition failed {}", e);
}
l2_height += 1;
}
assert_eq!(sequencer_commitment.l2_end_block_number, l2_height - 1);
Expand Down
Loading