From 058ce8d9a468addb81bf248bcaf0a6d810c078b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 11:33:10 +0100 Subject: [PATCH 1/8] Etherlink/Kernel/Stage 2: remove is_first_block_of_reboot Now that we reboot between each block, each block is the first of its reboot. --- etherlink/kernel_evm/kernel/src/block.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index 49d59578decc..1d993f0014bc 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -100,7 +100,6 @@ fn compute( block_constants: &BlockConstants, precompiles: &PrecompileBTreeMap, evm_account_storage: &mut EthereumAccountStorage, - is_first_block_of_reboot: bool, sequencer_pool_address: Option, limits: &Limits, tracer_input: Option, @@ -125,7 +124,7 @@ fn compute( data_size, ); - let retriable = !is_first_transaction || !is_first_block_of_reboot; + let retriable = !is_first_transaction; if allocated_ticks == 0 { if retriable { log!( @@ -288,7 +287,6 @@ fn compute_bip( precompiles: &PrecompileBTreeMap, evm_account_storage: &mut EthereumAccountStorage, tick_counter: &mut TickCounter, - first_block_of_reboot: &mut bool, sequencer_pool_address: Option, limits: &Limits, tracer_input: Option, @@ -311,7 +309,6 @@ fn compute_bip( &constants, precompiles, evm_account_storage, - *first_block_of_reboot, sequencer_pool_address, limits, tracer_input, @@ -345,8 +342,6 @@ fn compute_bip( *current_block_parent_hash = new_block.hash; *previous_receipts_root = new_block.receipts_root; *previous_transactions_root = new_block.transactions_root; - - *first_block_of_reboot = false; } } Ok(result) @@ -454,7 +449,6 @@ pub fn produce( let mut evm_account_storage = init_account_storage().context("Failed to initialize EVM account storage")?; let mut tick_counter = TickCounter::new(0u64); - let mut first_block_of_reboot = true; let at_most_one_block = host.store_has(&AT_MOST_ONE_BLOCK)?.is_some(); @@ -479,7 +473,6 @@ pub fn produce( &precompiles, &mut evm_account_storage, &mut tick_counter, - &mut first_block_of_reboot, sequencer_pool_address, &config.limits, tracer_input, @@ -564,7 +557,6 @@ pub fn produce( &precompiles, &mut evm_account_storage, &mut tick_counter, - &mut first_block_of_reboot, sequencer_pool_address, &config.limits, tracer_input, @@ -1347,7 +1339,6 @@ mod tests { &block_constants, &precompiles, &mut evm_account_storage, - true, None, &limits, None, -- GitLab From 25e893b2011f74df6a52aeb7a2ca2f9cc199f11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 11:42:24 +0100 Subject: [PATCH 2/8] Etherlink/Kernel/Stage 2: custom enum for provenance of BIP This commit introduces the BlockInProgressProvenance enum to replace the boolean used to discriminate the provenance of BIPs when reverting or promoting a block. --- etherlink/kernel_evm/kernel/src/block.rs | 41 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index 1d993f0014bc..3e341b8b76da 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -73,6 +73,12 @@ pub enum ComputationResult { Finished, } +// A block in progress can either come directly from the storage (when the previous run did not have enough ticks to apply the full block) or from a blueprint +enum BlockInProgressProvenance { + Storage, + Blueprint, +} + fn on_invalid_transaction( host: &mut Host, transaction: &Transaction, @@ -349,7 +355,7 @@ fn compute_bip( fn revert_block( safe_host: &mut SafeStorage<&mut Host>, - block_in_progress: bool, + block_in_progress_provenance: &BlockInProgressProvenance, number: U256, error: anyhow::Error, ) -> anyhow::Result<()> { @@ -357,7 +363,14 @@ fn revert_block( safe_host, Error, "Block{} {} failed with '{:?}'. Reverting.", - if block_in_progress { "InProgress" } else { "" }, + match block_in_progress_provenance { + BlockInProgressProvenance::Storage => { + "InProgress" + } + BlockInProgressProvenance::Blueprint => { + "" + } + }, number, error ); @@ -380,12 +393,12 @@ fn clean_delayed_transactions( fn promote_block( safe_host: &mut SafeStorage<&mut Host>, outbox_queue: &OutboxQueue<'_, impl Path>, - block_in_progress: bool, + block_in_progress_provenance: &BlockInProgressProvenance, number: U256, config: &mut Configuration, delayed_txs: Vec, ) -> anyhow::Result<()> { - if block_in_progress { + if let BlockInProgressProvenance::Storage = block_in_progress_provenance { storage::delete_block_in_progress(safe_host)?; } safe_host.promote()?; @@ -461,6 +474,7 @@ pub fn produce( match storage::read_block_in_progress(&safe_host)? { None => (), Some(block_in_progress) => { + let block_in_progress_provenance = BlockInProgressProvenance::Storage; let processed_blueprint = block_in_progress.number; match compute_bip( &mut safe_host, @@ -487,7 +501,7 @@ pub fn produce( promote_block( &mut safe_host, &outbox_queue, - true, + &block_in_progress_provenance, processed_blueprint, config, included_delayed_transactions, @@ -503,7 +517,12 @@ pub fn produce( return Ok(ComputationResult::RebootNeeded); } Err(err) => { - revert_block(&mut safe_host, true, processed_blueprint, err)?; + revert_block( + &mut safe_host, + &block_in_progress_provenance, + processed_blueprint, + err, + )?; // The block was reverted because it failed. We don't know at // which point did it fail nor why. We cannot make assumption // on how many ticks it consumed before failing. Therefore @@ -540,6 +559,7 @@ pub fn produce( return Ok(ComputationResult::Finished); } }; + let block_in_progress_provenance = BlockInProgressProvenance::Blueprint; // We are going to execute a new block, we copy the storage to allow // to revert if the block fails. safe_host.start()?; @@ -571,7 +591,7 @@ pub fn produce( promote_block( &mut safe_host, &outbox_queue, - false, + &block_in_progress_provenance, processed_blueprint, config, included_delayed_transactions, @@ -594,7 +614,12 @@ pub fn produce( Ok(ComputationResult::RebootNeeded) } Err(err) => { - revert_block(&mut safe_host, false, processed_blueprint, err)?; + revert_block( + &mut safe_host, + &block_in_progress_provenance, + processed_blueprint, + err, + )?; // The block was reverted because it failed. We don't know at // which point did it fail nor why. We cannot make assumption // on how many ticks it consumed before failing. Therefore -- GitLab From bb8290ccb688d6d9d84a49080cec36cffe6fc870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 11:52:11 +0100 Subject: [PATCH 3/8] Etherlink/Kernel/Stage 2: check provenance before benchmark logging Benchmark logging is absent in the case where the BIP comes from the storage. This is the only remaining difference between both cases of BIP provenance. This commit adds provenance check so that the code can be reused in the case of BIP coming from storage. --- etherlink/kernel_evm/kernel/src/block.rs | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index 3e341b8b76da..f216742903eb 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -605,12 +605,15 @@ pub fn produce( Ok(BlockComputationResult::RebootNeeded) => { // The computation will resume at next reboot, we leave the // storage untouched. - log!( - safe_host, - Benchmarking, - "Estimated ticks: {}", - tick_counter.c - ); + if let BlockInProgressProvenance::Blueprint = &block_in_progress_provenance + { + log!( + safe_host, + Benchmarking, + "Estimated ticks: {}", + tick_counter.c + ) + }; Ok(ComputationResult::RebootNeeded) } Err(err) => { @@ -624,12 +627,16 @@ pub fn produce( // which point did it fail nor why. We cannot make assumption // on how many ticks it consumed before failing. Therefore // the safest solution is to simply reboot after a failure. - log!( - safe_host, - Benchmarking, - "Estimated ticks: {}", - tick_counter.c - ); + if let BlockInProgressProvenance::Blueprint = + &block_in_progress_provenance + { + log!( + safe_host, + Benchmarking, + "Estimated ticks: {}", + tick_counter.c + ) + }; Ok(ComputationResult::RebootNeeded) } } -- GitLab From 259b0efe042a1e67d82453836281a6a163fb89c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 12:05:47 +0100 Subject: [PATCH 4/8] Etherlink/Kernel/Stage 2: swap branches in a match --- etherlink/kernel_evm/kernel/src/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index f216742903eb..da7437e3cd31 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -472,7 +472,6 @@ pub fn produce( // Check if there's a BIP in storage to resume its execution match storage::read_block_in_progress(&safe_host)? { - None => (), Some(block_in_progress) => { let block_in_progress_provenance = BlockInProgressProvenance::Storage; let processed_blueprint = block_in_progress.number; @@ -531,6 +530,7 @@ pub fn produce( } } } + None => (), } // Using `safe_host.host` allows to escape from the failsafe storage, which is necessary -- GitLab From 8c873048eb6082d01835245ef3b313f3bc8423f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 13:28:05 +0100 Subject: [PATCH 5/8] Etherlink/Kernel/Stage 2: wrap a match in let() This is just to avoid mixing indentation changes and code change in the next commits. --- etherlink/kernel_evm/kernel/src/block.rs | 114 ++++++++++++----------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index da7437e3cd31..f3c4a6b80ab0 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -471,67 +471,69 @@ pub fn produce( precompiles::precompile_set::>(config.enable_fa_bridge); // Check if there's a BIP in storage to resume its execution - match storage::read_block_in_progress(&safe_host)? { - Some(block_in_progress) => { - let block_in_progress_provenance = BlockInProgressProvenance::Storage; - let processed_blueprint = block_in_progress.number; - match compute_bip( - &mut safe_host, - &outbox_queue, - block_in_progress, - &mut current_block_number, - &mut current_block_parent_hash, - &mut previous_receipts_root, - &mut previous_transactions_root, - &precompiles, - &mut evm_account_storage, - &mut tick_counter, - sequencer_pool_address, - &config.limits, - tracer_input, - chain_id, - minimum_base_fee_per_gas, - da_fee_per_byte, - coinbase, - ) { - Ok(BlockComputationResult::Finished { - included_delayed_transactions, - }) => { - promote_block( - &mut safe_host, - &outbox_queue, - &block_in_progress_provenance, - processed_blueprint, - config, + #[allow(clippy::let_unit_value)] + let () = // Dummy comment + match storage::read_block_in_progress(&safe_host)? { + Some(block_in_progress) => { + let block_in_progress_provenance = BlockInProgressProvenance::Storage; + let processed_blueprint = block_in_progress.number; + match compute_bip( + &mut safe_host, + &outbox_queue, + block_in_progress, + &mut current_block_number, + &mut current_block_parent_hash, + &mut previous_receipts_root, + &mut previous_transactions_root, + &precompiles, + &mut evm_account_storage, + &mut tick_counter, + sequencer_pool_address, + &config.limits, + tracer_input, + chain_id, + minimum_base_fee_per_gas, + da_fee_per_byte, + coinbase, + ) { + Ok(BlockComputationResult::Finished { included_delayed_transactions, - )?; - if at_most_one_block { - return Ok(ComputationResult::Finished); - } else { + }) => { + promote_block( + &mut safe_host, + &outbox_queue, + &block_in_progress_provenance, + processed_blueprint, + config, + included_delayed_transactions, + )?; + if at_most_one_block { + return Ok(ComputationResult::Finished); + } else { + return Ok(ComputationResult::RebootNeeded); + } + } + Ok(BlockComputationResult::RebootNeeded) => { + // The computation still needs to reboot, we do nothing. + return Ok(ComputationResult::RebootNeeded); + } + Err(err) => { + revert_block( + &mut safe_host, + &block_in_progress_provenance, + processed_blueprint, + err, + )?; + // The block was reverted because it failed. We don't know at + // which point did it fail nor why. We cannot make assumption + // on how many ticks it consumed before failing. Therefore + // the safest solution is to simply reboot after a failure. return Ok(ComputationResult::RebootNeeded); } - } - Ok(BlockComputationResult::RebootNeeded) => { - // The computation still needs to reboot, we do nothing. - return Ok(ComputationResult::RebootNeeded); - } - Err(err) => { - revert_block( - &mut safe_host, - &block_in_progress_provenance, - processed_blueprint, - err, - )?; - // The block was reverted because it failed. We don't know at - // which point did it fail nor why. We cannot make assumption - // on how many ticks it consumed before failing. Therefore - // the safest solution is to simply reboot after a failure. - return Ok(ComputationResult::RebootNeeded); } } - } - None => (), - } + None => (), + }; // Using `safe_host.host` allows to escape from the failsafe storage, which is necessary // because the sequencer pool address is located outside of `/evm/world_state`. -- GitLab From e1adcc513ea92d8542f7a3924059b0f6871b164c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 13:11:35 +0100 Subject: [PATCH 6/8] Etherlink/Kernel/Stage 2: move fetching of next bip --- etherlink/kernel_evm/kernel/src/block.rs | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index f3c4a6b80ab0..b63a6d4c2c9a 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -471,8 +471,7 @@ pub fn produce( precompiles::precompile_set::>(config.enable_fa_bridge); // Check if there's a BIP in storage to resume its execution - #[allow(clippy::let_unit_value)] - let () = // Dummy comment + let (processed_blueprint, block_in_progress_provenance, block_in_progress) = match storage::read_block_in_progress(&safe_host)? { Some(block_in_progress) => { let block_in_progress_provenance = BlockInProgressProvenance::Storage; @@ -532,46 +531,47 @@ pub fn produce( } } } - None => (), - }; - - // Using `safe_host.host` allows to escape from the failsafe storage, which is necessary - // because the sequencer pool address is located outside of `/evm/world_state`. - upgrade::possible_sequencer_upgrade(safe_host.host)?; - - // Execute at most one of the stored blueprints - { - let block_in_progress = match next_bip_from_blueprints( - safe_host.host, - current_block_number, - current_block_parent_hash, - &tick_counter, - config, - &kernel_upgrade, - minimum_base_fee_per_gas, - )? { - BlueprintParsing::Next(bip) => bip, - BlueprintParsing::None => { - log!( - safe_host, - Benchmarking, - "Estimated ticks: {}", - tick_counter.c - ); - return Ok(ComputationResult::Finished); + None => { + // Using `safe_host.host` allows to escape from the failsafe storage, which is necessary + // because the sequencer pool address is located outside of `/evm/world_state`. + upgrade::possible_sequencer_upgrade(safe_host.host)?; + + // Execute at most one of the stored blueprints + let block_in_progress = match next_bip_from_blueprints( + safe_host.host, + current_block_number, + current_block_parent_hash, + &tick_counter, + config, + &kernel_upgrade, + minimum_base_fee_per_gas, + )? { + BlueprintParsing::Next(bip) => bip, + BlueprintParsing::None => { + log!( + safe_host, + Benchmarking, + "Estimated ticks: {}", + tick_counter.c + ); + return Ok(ComputationResult::Finished); + } + }; + // We are going to execute a new block, we copy the storage to allow + // to revert if the block fails. + safe_host.start()?; + ( + current_block_number, + BlockInProgressProvenance::Blueprint, + *block_in_progress, + ) } }; - let block_in_progress_provenance = BlockInProgressProvenance::Blueprint; - // We are going to execute a new block, we copy the storage to allow - // to revert if the block fails. - safe_host.start()?; - - let processed_blueprint = current_block_number; - + { match compute_bip( &mut safe_host, &outbox_queue, - *block_in_progress, + block_in_progress, &mut current_block_number, &mut current_block_parent_hash, &mut previous_receipts_root, -- GitLab From b433a29863692a41fd496786668aee3b181a2d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 12:22:33 +0100 Subject: [PATCH 7/8] Etherlink/Kernel/Stage 2: factorize the produce function --- etherlink/kernel_evm/kernel/src/block.rs | 63 ++---------------------- 1 file changed, 5 insertions(+), 58 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index b63a6d4c2c9a..068a7d90c2bb 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -473,64 +473,11 @@ pub fn produce( // Check if there's a BIP in storage to resume its execution let (processed_blueprint, block_in_progress_provenance, block_in_progress) = match storage::read_block_in_progress(&safe_host)? { - Some(block_in_progress) => { - let block_in_progress_provenance = BlockInProgressProvenance::Storage; - let processed_blueprint = block_in_progress.number; - match compute_bip( - &mut safe_host, - &outbox_queue, - block_in_progress, - &mut current_block_number, - &mut current_block_parent_hash, - &mut previous_receipts_root, - &mut previous_transactions_root, - &precompiles, - &mut evm_account_storage, - &mut tick_counter, - sequencer_pool_address, - &config.limits, - tracer_input, - chain_id, - minimum_base_fee_per_gas, - da_fee_per_byte, - coinbase, - ) { - Ok(BlockComputationResult::Finished { - included_delayed_transactions, - }) => { - promote_block( - &mut safe_host, - &outbox_queue, - &block_in_progress_provenance, - processed_blueprint, - config, - included_delayed_transactions, - )?; - if at_most_one_block { - return Ok(ComputationResult::Finished); - } else { - return Ok(ComputationResult::RebootNeeded); - } - } - Ok(BlockComputationResult::RebootNeeded) => { - // The computation still needs to reboot, we do nothing. - return Ok(ComputationResult::RebootNeeded); - } - Err(err) => { - revert_block( - &mut safe_host, - &block_in_progress_provenance, - processed_blueprint, - err, - )?; - // The block was reverted because it failed. We don't know at - // which point did it fail nor why. We cannot make assumption - // on how many ticks it consumed before failing. Therefore - // the safest solution is to simply reboot after a failure. - return Ok(ComputationResult::RebootNeeded); - } - } - } + Some(block_in_progress) => ( + block_in_progress.number, + BlockInProgressProvenance::Storage, + block_in_progress, + ), None => { // Using `safe_host.host` allows to escape from the failsafe storage, which is necessary // because the sequencer pool address is located outside of `/evm/world_state`. -- GitLab From 0a97cddbd038afcd32e01cc3af8bbf348c9a8883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Fri, 17 Jan 2025 12:57:09 +0100 Subject: [PATCH 8/8] Etherlink/Kernel/Stage 2: remove now useless braces --- etherlink/kernel_evm/kernel/src/block.rs | 138 +++++++++++------------ 1 file changed, 67 insertions(+), 71 deletions(-) diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index 068a7d90c2bb..e03f78ab87e4 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -514,81 +514,77 @@ pub fn produce( ) } }; - { - match compute_bip( - &mut safe_host, - &outbox_queue, - block_in_progress, - &mut current_block_number, - &mut current_block_parent_hash, - &mut previous_receipts_root, - &mut previous_transactions_root, - &precompiles, - &mut evm_account_storage, - &mut tick_counter, - sequencer_pool_address, - &config.limits, - tracer_input, - chain_id, - minimum_base_fee_per_gas, - da_fee_per_byte, - coinbase, - ) { - Ok(BlockComputationResult::Finished { + + match compute_bip( + &mut safe_host, + &outbox_queue, + block_in_progress, + &mut current_block_number, + &mut current_block_parent_hash, + &mut previous_receipts_root, + &mut previous_transactions_root, + &precompiles, + &mut evm_account_storage, + &mut tick_counter, + sequencer_pool_address, + &config.limits, + tracer_input, + chain_id, + minimum_base_fee_per_gas, + da_fee_per_byte, + coinbase, + ) { + Ok(BlockComputationResult::Finished { + included_delayed_transactions, + }) => { + promote_block( + &mut safe_host, + &outbox_queue, + &block_in_progress_provenance, + processed_blueprint, + config, included_delayed_transactions, - }) => { - promote_block( - &mut safe_host, - &outbox_queue, - &block_in_progress_provenance, - processed_blueprint, - config, - included_delayed_transactions, - )?; - if at_most_one_block { - Ok(ComputationResult::Finished) - } else { - Ok(ComputationResult::RebootNeeded) - } - } - Ok(BlockComputationResult::RebootNeeded) => { - // The computation will resume at next reboot, we leave the - // storage untouched. - if let BlockInProgressProvenance::Blueprint = &block_in_progress_provenance - { - log!( - safe_host, - Benchmarking, - "Estimated ticks: {}", - tick_counter.c - ) - }; - Ok(ComputationResult::RebootNeeded) - } - Err(err) => { - revert_block( - &mut safe_host, - &block_in_progress_provenance, - processed_blueprint, - err, - )?; - // The block was reverted because it failed. We don't know at - // which point did it fail nor why. We cannot make assumption - // on how many ticks it consumed before failing. Therefore - // the safest solution is to simply reboot after a failure. - if let BlockInProgressProvenance::Blueprint = - &block_in_progress_provenance - { - log!( - safe_host, - Benchmarking, - "Estimated ticks: {}", - tick_counter.c - ) - }; + )?; + if at_most_one_block { + Ok(ComputationResult::Finished) + } else { Ok(ComputationResult::RebootNeeded) } } + Ok(BlockComputationResult::RebootNeeded) => { + // The computation will resume at next reboot, we leave the + // storage untouched. + if let BlockInProgressProvenance::Blueprint = &block_in_progress_provenance { + log!( + safe_host, + Benchmarking, + "Estimated ticks: {}", + tick_counter.c + ) + }; + Ok(ComputationResult::RebootNeeded) + } + Err(err) => { + revert_block( + &mut safe_host, + &block_in_progress_provenance, + processed_blueprint, + err, + )?; + // The block was reverted because it failed. We don't know at + // which point did it fail nor why. We cannot make assumption + // on how many ticks it consumed before failing. Therefore + // the safest solution is to simply reboot after a failure. + if let BlockInProgressProvenance::Blueprint = &block_in_progress_provenance { + log!( + safe_host, + Benchmarking, + "Estimated ticks: {}", + tick_counter.c + ) + }; + Ok(ComputationResult::RebootNeeded) + } } } -- GitLab