From e15ed3e7d54274a952d2e407e6c290e0fff7865e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Thu, 13 Jun 2024 15:53:24 +0200 Subject: [PATCH 1/2] Kernel SDK: don't put DAL host functions behind proto-alpha ff This commit makes the DAL host functions available even when the SDK is not compiled with the proto-alpha feature flag. --- etherlink/kernel_evm/evm_evaluation/src/evalhost.rs | 1 - etherlink/kernel_evm/kernel/src/safe_storage.rs | 3 --- src/kernel_sdk/core/src/rollup_host.rs | 1 - src/kernel_sdk/core/src/smart_rollup_core.rs | 3 --- src/kernel_sdk/entrypoint/src/host.rs | 1 - src/kernel_sdk/host/src/runtime.rs | 10 ++-------- src/kernel_sdk/mock/src/host.rs | 1 - .../sdk/src/entrypoint/internal/static_input_host.rs | 3 --- src/kernel_sdk/sdk/src/lib.rs | 1 - 9 files changed, 2 insertions(+), 22 deletions(-) diff --git a/etherlink/kernel_evm/evm_evaluation/src/evalhost.rs b/etherlink/kernel_evm/evm_evaluation/src/evalhost.rs index d4260a03f600..df8e9849936d 100644 --- a/etherlink/kernel_evm/evm_evaluation/src/evalhost.rs +++ b/etherlink/kernel_evm/evm_evaluation/src/evalhost.rs @@ -127,7 +127,6 @@ unsafe impl SmartRollupCore for EvalHost { self.host.reveal_metadata(destination_addr, max_bytes) } - #[cfg(feature = "proto-alpha")] unsafe fn reveal( &self, _payload_addr: *const u8, diff --git a/etherlink/kernel_evm/kernel/src/safe_storage.rs b/etherlink/kernel_evm/kernel/src/safe_storage.rs index 2df7b5dcbfd9..99dd9afb71b4 100644 --- a/etherlink/kernel_evm/kernel/src/safe_storage.rs +++ b/etherlink/kernel_evm/kernel/src/safe_storage.rs @@ -7,7 +7,6 @@ use crate::internal_storage::{ExtendedRuntime, InternalRuntime}; use tezos_smart_rollup_core::PREIMAGE_HASH_SIZE; -#[cfg(feature = "proto-alpha")] use tezos_smart_rollup_host::dal_parameters::RollupDalParameters; use tezos_smart_rollup_host::{ input::Message, @@ -185,7 +184,6 @@ impl Runtime for SafeStorage<&mut Host, &mut Intern self.host.reveal_metadata() } - #[cfg(all(feature = "alloc", feature = "proto-alpha"))] fn reveal_dal_page( &self, published_level: i32, @@ -197,7 +195,6 @@ impl Runtime for SafeStorage<&mut Host, &mut Intern .reveal_dal_page(published_level, slot_index, page_index, destination) } - #[cfg(feature = "proto-alpha")] fn reveal_dal_parameters(&self) -> RollupDalParameters { self.host.reveal_dal_parameters() } diff --git a/src/kernel_sdk/core/src/rollup_host.rs b/src/kernel_sdk/core/src/rollup_host.rs index 7af71709fcc7..3e722bad45f3 100644 --- a/src/kernel_sdk/core/src/rollup_host.rs +++ b/src/kernel_sdk/core/src/rollup_host.rs @@ -120,7 +120,6 @@ unsafe impl SmartRollupCore for RollupHost { core::reveal_preimage(hash_addr, hash_len, destination_addr, max_bytes) } - #[cfg(feature = "proto-alpha")] unsafe fn reveal( &self, payload_addr: *const u8, diff --git a/src/kernel_sdk/core/src/smart_rollup_core.rs b/src/kernel_sdk/core/src/smart_rollup_core.rs index a492c6c19e19..cad442896def 100644 --- a/src/kernel_sdk/core/src/smart_rollup_core.rs +++ b/src/kernel_sdk/core/src/smart_rollup_core.rs @@ -135,7 +135,6 @@ extern "C" { /// `payload_len` is the same as the one used by the Tezos protocol. /// /// Returns the size of the data loaded in memory. - #[cfg(feature = "proto-alpha")] pub fn reveal( payload_addr: *const u8, payload_len: usize, @@ -324,7 +323,6 @@ pub unsafe trait SmartRollupCore { /// - `payload_len` must be the length of the slice. /// - `destination_addr `must point to a mutable slice of bytes with /// `capacity >= max_bytes`. - #[cfg(feature = "proto-alpha")] unsafe fn reveal( &self, payload_addr: *const u8, @@ -497,7 +495,6 @@ mod riscv64_hermit { unimplemented!() } - #[cfg(feature = "proto-alpha")] pub unsafe fn reveal( _payload_addr: *const u8, _payload_len: usize, diff --git a/src/kernel_sdk/entrypoint/src/host.rs b/src/kernel_sdk/entrypoint/src/host.rs index 7228cc2718dc..29dd0d7f4eeb 100644 --- a/src/kernel_sdk/entrypoint/src/host.rs +++ b/src/kernel_sdk/entrypoint/src/host.rs @@ -123,7 +123,6 @@ unsafe impl SmartRollupCore for RollupHostWithInMemoryStorage { .reveal_preimage(hash_addr, hash_len, destination_addr, max_bytes) } - #[cfg(feature = "proto-alpha")] unsafe fn reveal( &self, payload_addr: *const u8, diff --git a/src/kernel_sdk/host/src/runtime.rs b/src/kernel_sdk/host/src/runtime.rs index 615afc8b4fb9..dc18b80e7857 100644 --- a/src/kernel_sdk/host/src/runtime.rs +++ b/src/kernel_sdk/host/src/runtime.rs @@ -12,7 +12,6 @@ use alloc::vec::Vec; use tezos_smart_rollup_core::{SmartRollupCore, PREIMAGE_HASH_SIZE}; -#[cfg(feature = "proto-alpha")] use crate::dal_parameters::RollupDalParameters; #[cfg(feature = "alloc")] use crate::input::Message; @@ -21,7 +20,6 @@ use crate::metadata::RollupMetadata; use crate::path::{Path, RefPath}; #[cfg(not(feature = "alloc"))] use crate::path::{Path, RefPath}; -#[cfg(feature = "proto-alpha")] use crate::DAL_PARAMETERS_SIZE; use crate::{Error, METADATA_SIZE}; #[cfg(feature = "alloc")] @@ -191,7 +189,7 @@ pub trait Runtime { ) -> Result; /// Reveal a DAL page. - #[cfg(all(feature = "alloc", feature = "proto-alpha"))] + #[cfg(feature = "alloc")] fn reveal_dal_page( &self, published_level: i32, @@ -201,7 +199,6 @@ pub trait Runtime { ) -> Result; /// Reveal the DAL parameters. - #[cfg(feature = "proto-alpha")] fn reveal_dal_parameters(&self) -> RollupDalParameters; /// Return the size of value stored at `path` @@ -598,7 +595,7 @@ where RollupMetadata::from(destination) } - #[cfg(all(feature = "alloc", feature = "proto-alpha"))] + #[cfg(feature = "alloc")] fn reveal_dal_page( &self, published_level: i32, @@ -631,7 +628,6 @@ where } } - #[cfg(feature = "proto-alpha")] fn reveal_dal_parameters(&self) -> RollupDalParameters { let mut destination = [0u8; DAL_PARAMETERS_SIZE]; // This will match the encoding declared for revealing DAL parameters in the Tezos protocol. @@ -754,7 +750,6 @@ fn check_path_exists( #[cfg(test)] mod tests { use super::{Runtime, RuntimeError, PREIMAGE_HASH_SIZE}; - #[cfg(feature = "proto-alpha")] use crate::{dal_parameters::RollupDalParameters, DAL_PARAMETERS_SIZE}; use crate::{ input::Message, @@ -1345,7 +1340,6 @@ mod tests { } #[test] - #[cfg(feature = "proto-alpha")] fn reveal_dal_parameters_ok() { // Arrange let expected_dal_parameters = RollupDalParameters { diff --git a/src/kernel_sdk/mock/src/host.rs b/src/kernel_sdk/mock/src/host.rs index b57684ededc0..9ac2bab83169 100644 --- a/src/kernel_sdk/mock/src/host.rs +++ b/src/kernel_sdk/mock/src/host.rs @@ -193,7 +193,6 @@ unsafe impl SmartRollupCore for MockHost { metadata.len().try_into().unwrap() } - #[cfg(feature = "proto-alpha")] unsafe fn reveal( &self, _payload_addr: *const u8, diff --git a/src/kernel_sdk/sdk/src/entrypoint/internal/static_input_host.rs b/src/kernel_sdk/sdk/src/entrypoint/internal/static_input_host.rs index 7b9fe5096c58..c71c17013183 100644 --- a/src/kernel_sdk/sdk/src/entrypoint/internal/static_input_host.rs +++ b/src/kernel_sdk/sdk/src/entrypoint/internal/static_input_host.rs @@ -12,7 +12,6 @@ use crate::core_unsafe::PREIMAGE_HASH_SIZE; use crate::host::{Runtime, RuntimeError, ValueType}; use crate::storage::path::Path; -#[cfg(feature = "proto-alpha")] use crate::types::RollupDalParameters; use crate::types::{Message, RollupMetadata}; use crate::utils::inbox::{file::InboxFile, Inbox, InboxBuilder}; @@ -205,7 +204,6 @@ impl<'runtime, R: Runtime> Runtime for StaticInputHost<'runtime, R> { self.host.runtime_version() } - #[cfg(feature = "proto-alpha")] #[inline(always)] fn reveal_dal_page( &self, @@ -218,7 +216,6 @@ impl<'runtime, R: Runtime> Runtime for StaticInputHost<'runtime, R> { .reveal_dal_page(published_level, slot_index, page_index, destination) } - #[cfg(feature = "proto-alpha")] #[inline(always)] fn reveal_dal_parameters(&self) -> RollupDalParameters { self.host.reveal_dal_parameters() diff --git a/src/kernel_sdk/sdk/src/lib.rs b/src/kernel_sdk/sdk/src/lib.rs index 27ab0e41af7a..e3ed495f0923 100644 --- a/src/kernel_sdk/sdk/src/lib.rs +++ b/src/kernel_sdk/sdk/src/lib.rs @@ -86,7 +86,6 @@ pub mod types { pub use tezos_smart_rollup_host::input::Message; pub use tezos_smart_rollup_host::metadata::RollupMetadata; - #[cfg(feature = "proto-alpha")] pub use tezos_smart_rollup_host::dal_parameters::RollupDalParameters; } -- GitLab From e29b2f1450e97e2467e7d9e007cd329f21e71a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Thu, 13 Jun 2024 16:01:28 +0200 Subject: [PATCH 2/2] Changes/Kernel SDK: mention !13762 --- src/kernel_sdk/CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kernel_sdk/CHANGES.md b/src/kernel_sdk/CHANGES.md index 35e98a269adb..39a3d3a5fdaa 100644 --- a/src/kernel_sdk/CHANGES.md +++ b/src/kernel_sdk/CHANGES.md @@ -17,6 +17,7 @@ - Add `tezos_smart_rollup::entrypoint` module for kernel entrypoint configuration & macros. - Add `entrypoint::main` procedural macro to mark the kernel entrypoint function. - Add `extra` feature flag, for functionalility not-expected to be used by kernels directly. +- Remove the `proto-alpha` flag restriction on DAL host functions. ### Installer client/kernel -- GitLab