From c3b4c4fba90456d117070244136e31667b26ffdc Mon Sep 17 00:00:00 2001 From: Trey Del Bonis Date: Thu, 19 Dec 2024 15:57:40 -0500 Subject: [PATCH] misc: changed a few things to try to address broken things --- bin/strata-client/src/rpc_server.rs | 5 ++++- crates/chaintsn/src/epoch.rs | 6 ++++-- crates/state/src/state_op.rs | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/strata-client/src/rpc_server.rs b/bin/strata-client/src/rpc_server.rs index 691511107d..f8846ce05d 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 11ab34e54a..4235ae1f12 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 20379ee71f..5986d0c149 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, }