diff --git a/bin/strata-client/src/rpc_server.rs b/bin/strata-client/src/rpc_server.rs index 691511107..f8846ce05 100644 --- a/bin/strata-client/src/rpc_server.rs +++ b/bin/strata-client/src/rpc_server.rs @@ -371,7 +371,10 @@ impl StrataApiServer for StrataRpcImpl { async fn sync_status(&self) -> RpcResult { let sync_state = self.status_channel.get_sync_state(); - let cur_epoch = self.status_channel.get_cur_l2_epoch().unwrap_or(0); + let cur_epoch = self.status_channel.get_cur_l2_epoch().unwrap_or_else(|| { + warn!("cur_epoch unset, using default 0"); + 0 + }); Ok(sync_state .map(|sync| RpcSyncStatus { tip_height: sync.tip_height(), diff --git a/crates/chaintsn/src/epoch.rs b/crates/chaintsn/src/epoch.rs index 11ab34e54..4235ae1f1 100644 --- a/crates/chaintsn/src/epoch.rs +++ b/crates/chaintsn/src/epoch.rs @@ -12,7 +12,7 @@ use strata_state::{ tx::ProtocolOperation, }; -use crate::{errors::TsnError, slot_rng::SlotRng}; +use crate::{errors::TsnError, macros::*, slot_rng::SlotRng}; /// Rollup epoch-level input. pub struct EpochData<'b> { @@ -56,7 +56,9 @@ pub fn process_epoch( // Increment the epoch counter. let cur_epoch = state.state().cur_epoch(); - state.set_cur_epoch(cur_epoch + 1); + let new_epoch = cur_epoch + 1; + state.set_cur_epoch(new_epoch); + info!(%new_epoch, "internally advanced epoch"); Ok(()) } diff --git a/crates/state/src/state_op.rs b/crates/state/src/state_op.rs index 20379ee71..5986d0c14 100644 --- a/crates/state/src/state_op.rs +++ b/crates/state/src/state_op.rs @@ -93,6 +93,8 @@ pub struct StateCache { original_epoch_state: EpochState, new_ch_state: Chainstate, new_epoch_state: Option, + + // Unused right now, will likely use later. write_ops: Vec, }