diff --git a/etherlink/CHANGES_KERNEL.md b/etherlink/CHANGES_KERNEL.md index 1592db6cbf372ae2e36e80af68ed54d91a71107b..a19dd84a6178de51e4631d42b3c3ab45fdae6911 100644 --- a/etherlink/CHANGES_KERNEL.md +++ b/etherlink/CHANGES_KERNEL.md @@ -9,7 +9,7 @@ ### Internal - Rework block production to simplify data flow and remove unnecessary - IO. (!16661 !16684 !16685) + IO. (!16661 !16684 !16685 !16618) ## Next proposal diff --git a/etherlink/kernel_evm/kernel/src/block.rs b/etherlink/kernel_evm/kernel/src/block.rs index 9e0fbf9f52c6aa67d8ce05159eb8b422e6e63123..acfa7c92d6c8aefb3c43a615a0c75d9be0e4ebca 100644 --- a/etherlink/kernel_evm/kernel/src/block.rs +++ b/etherlink/kernel_evm/kernel/src/block.rs @@ -9,7 +9,7 @@ use crate::apply::{ apply_transaction, ExecutionInfo, ExecutionResult, Validity, WITHDRAWAL_OUTBOX_QUEUE, }; use crate::block_storage; -use crate::blueprint_storage::{drop_blueprint, read_next_blueprint}; +use crate::blueprint_storage::{drop_blueprint, read_blueprint}; use crate::configuration::ConfigurationMode; use crate::configuration::Limits; use crate::delayed_inbox::DelayedInbox; @@ -254,7 +254,7 @@ fn next_bip_from_blueprints( kernel_upgrade: &Option, minimum_base_fee_per_gas: U256, ) -> Result { - let (blueprint, size) = read_next_blueprint(host, config)?; + let (blueprint, size) = read_blueprint(host, config, current_block_number)?; log!(host, Benchmarking, "Size of blueprint: {}", size); match blueprint { Some(blueprint) => { @@ -593,6 +593,7 @@ mod tests { use super::*; use crate::block_storage; use crate::blueprint::Blueprint; + use crate::blueprint_storage::read_next_blueprint; use crate::blueprint_storage::store_inbox_blueprint; use crate::blueprint_storage::store_inbox_blueprint_by_number; use crate::fees::DA_FEE_PER_BYTE; diff --git a/etherlink/kernel_evm/kernel/src/blueprint_storage.rs b/etherlink/kernel_evm/kernel/src/blueprint_storage.rs index fc94fdf31f45dafc647f040d0e5c57f5f0806fa3..0548f72af084bbbd90e864d145fcf0d9cd1ba87b 100644 --- a/etherlink/kernel_evm/kernel/src/blueprint_storage.rs +++ b/etherlink/kernel_evm/kernel/src/blueprint_storage.rs @@ -423,11 +423,11 @@ fn read_all_chunks_and_validate( } } -pub fn read_next_blueprint( +pub fn read_blueprint( host: &mut Host, config: &mut Configuration, + number: U256, ) -> anyhow::Result<(Option, usize)> { - let number = read_next_blueprint_number(host)?; let blueprint_path = blueprint_path(number)?; let exists = host.store_has(&blueprint_path)?.is_some(); if exists { @@ -468,6 +468,15 @@ pub fn read_next_blueprint( } } +#[cfg(test)] +pub fn read_next_blueprint( + host: &mut Host, + config: &mut Configuration, +) -> anyhow::Result<(Option, usize)> { + let number = read_next_blueprint_number(host)?; + read_blueprint(host, config, number) +} + pub fn drop_blueprint(host: &mut Host, number: U256) -> Result<(), Error> { let path = blueprint_path(number)?; host.store_delete(&path).map_err(Error::from)