diff --git a/cartesi-rollups/node/state-manager/src/rollups_machine.rs b/cartesi-rollups/node/state-manager/src/rollups_machine.rs index 8f013741..46ac8d89 100644 --- a/cartesi-rollups/node/state-manager/src/rollups_machine.rs +++ b/cartesi-rollups/node/state-manager/src/rollups_machine.rs @@ -10,7 +10,10 @@ use cartesi_prt_core::machine::constants::{ use crate::{CommitmentLeaf, Proof}; use cartesi_machine::{ config::runtime::{HTIFRuntimeConfig, RuntimeConfig}, - constants::{break_reason, pma::TX_START}, + constants::{ + break_reason, + pma::{SHADOW_REVERT_ROOT_HASH_START, TX_START}, + }, error::{MachineError, MachineResult}, machine::Machine, types::{ @@ -45,8 +48,6 @@ pub const STRIDE_COUNT_IN_EPOCH: u64 = 1 << (LOG2_INPUT_SPAN_TO_EPOCH + LOG2_BARCH_SPAN_TO_INPUT + LOG2_UARCH_SPAN_TO_BARCH - LOG2_STRIDE); -pub const CHECKPOINT_ADDRESS: u64 = 0x7ffff000; - pub struct RollupsMachine { machine: Machine, epoch_number: u64, @@ -110,8 +111,8 @@ impl RollupsMachine { CmioRequest::Manual(ManualReason::RxAccepted { .. }) )); - let checkpoint_hash = self.machine.root_hash()?; - self.feed_input(data, &checkpoint_hash)?; + let revert_root_hash = self.machine.root_hash()?; + self.feed_input(data, &revert_root_hash)?; self.run_machine(BIG_STEPS_IN_STRIDE)?; let mut state_hashes = Vec::with_capacity(1 << 20); @@ -143,7 +144,7 @@ impl RollupsMachine { CmioRequest::Manual(reason) => { state_hashes.push(CommitmentLeaf { - hash: checkpoint_hash, + hash: revert_root_hash, repetitions: STRIDE_COUNT_IN_INPUT - i, }); @@ -155,9 +156,9 @@ impl RollupsMachine { } } - fn feed_input(&mut self, input: &[u8], checkpoint_hash: &Hash) -> MachineResult<()> { + fn feed_input(&mut self, input: &[u8], revert_root_hash: &Hash) -> MachineResult<()> { self.machine - .write_memory(CHECKPOINT_ADDRESS, checkpoint_hash)?; + .write_memory(SHADOW_REVERT_ROOT_HASH_START, revert_root_hash)?; self.machine .send_cmio_response(CmioResponseReason::Advance, input) } diff --git a/machine/rust-bindings/cartesi-machine/src/constants.rs b/machine/rust-bindings/cartesi-machine/src/constants.rs index fef0a375..3e7998e5 100644 --- a/machine/rust-bindings/cartesi-machine/src/constants.rs +++ b/machine/rust-bindings/cartesi-machine/src/constants.rs @@ -19,6 +19,7 @@ pub mod pma { pub const TX_START: u64 = CM_AR_CMIO_TX_BUFFER_START as u64; pub const TX_LOG2_SIZE: u64 = CM_AR_CMIO_TX_BUFFER_LOG2_SIZE as u64; pub const RAM_START: u64 = CM_AR_RAM_START as u64; + pub const SHADOW_REVERT_ROOT_HASH_START: u64 = CM_AR_SHADOW_REVERT_ROOT_HASH_START as u64; } pub mod break_reason { diff --git a/prt/client-rs/core/src/machine/instance.rs b/prt/client-rs/core/src/machine/instance.rs index 74801ed6..b49e0e6e 100644 --- a/prt/client-rs/core/src/machine/instance.rs +++ b/prt/client-rs/core/src/machine/instance.rs @@ -63,7 +63,7 @@ pub struct MachineInstance { pub snapshot_path: PathBuf, } -const CHECKPOINT_ADDRESS: u64 = 0x7ffff000; +const CHECKPOINT_ADDRESS: u64 = 0xfe0; impl MachineInstance { pub fn new_from_path(path: &str) -> Result { let runtime_config = RuntimeConfig {