From 66315e7ffa1c4916f2a8ca62aceb56d6d8f95918 Mon Sep 17 00:00:00 2001 From: ethanoroshiba Date: Thu, 30 Jan 2025 11:36:14 -0600 Subject: [PATCH] base stop height on rollup instead of sequencer --- crates/astria-conductor/src/celestia/mod.rs | 18 ++- .../astria-conductor/src/conductor/inner.rs | 44 +++--- crates/astria-conductor/src/executor/mod.rs | 30 ++-- crates/astria-conductor/src/executor/state.rs | 137 ++++++++---------- crates/astria-conductor/src/sequencer/mod.rs | 22 +-- .../tests/blackbox/firm_only.rs | 43 +++--- .../tests/blackbox/helpers/macros.rs | 68 ++++----- .../tests/blackbox/soft_and_firm.rs | 54 +++---- .../tests/blackbox/soft_only.rs | 42 +++--- crates/astria-core/src/execution/v1/mod.rs | 64 ++++---- .../src/generated/astria.execution.v1.rs | 16 +- .../generated/astria.execution.v1.serde.rs | 91 ++++++------ .../astria/execution/v1/execution.proto | 14 +- 13 files changed, 319 insertions(+), 324 deletions(-) diff --git a/crates/astria-conductor/src/celestia/mod.rs b/crates/astria-conductor/src/celestia/mod.rs index 1d097a4ca..3b76c19c5 100644 --- a/crates/astria-conductor/src/celestia/mod.rs +++ b/crates/astria-conductor/src/celestia/mod.rs @@ -378,7 +378,7 @@ impl RunningReader { }); let reason = loop { - if self.has_reached_stop_height() { + if self.has_reached_stop_height()? { break Ok("stop height reached"); } @@ -449,13 +449,15 @@ impl RunningReader { /// The stop height is reached if a) the next height to be forwarded would be greater /// than the stop height, and b) there is no block currently in flight. - fn has_reached_stop_height(&self) -> bool { - self.rollup_state - .sequencer_stop_block_height() - .map_or(false, |stop_height| { - self.block_cache.next_height_to_pop() > stop_height.get() - }) - && self.enqueued_block.is_terminated() + fn has_reached_stop_height(&self) -> eyre::Result { + Ok(self + .rollup_state + .sequencer_stop_height() + .wrap_err("failed to obtain sequencer stop height")? + .map_or(false, |height| { + self.block_cache.next_height_to_pop() > height.get() + && self.enqueued_block.is_terminated() + })) } #[instrument(skip_all)] diff --git a/crates/astria-conductor/src/conductor/inner.rs b/crates/astria-conductor/src/conductor/inner.rs index c977d05f7..86738c266 100644 --- a/crates/astria-conductor/src/conductor/inner.rs +++ b/crates/astria-conductor/src/conductor/inner.rs @@ -177,7 +177,7 @@ fn should_restart_or_shutdown( config: &Config, status: &crate::executor::State, ) -> eyre::Result { - let Some(sequencer_stop_height) = status.sequencer_stop_block_height() else { + let Some(rollup_stop_block_number) = status.rollup_stop_block_number() else { return Err(eyre!( "executor exited with a success value even though it was not configured to run with a \ stop height and even though it received no shutdown signal; this should not happen" @@ -202,9 +202,9 @@ fn should_restart_or_shutdown( config.execution_commit_level, status.firm_number(), status.firm_block_number_as_sequencer_height(), - status.rollup_start_block_height(), - status.sequencer_start_block_height(), - sequencer_stop_height, + status.rollup_start_block_number(), + status.sequencer_start_height(), + rollup_stop_block_number, )) } } @@ -225,9 +225,9 @@ fn should_restart_or_shutdown( config.execution_commit_level, status.soft_number(), status.soft_block_number_as_sequencer_height(), - status.rollup_start_block_height(), - status.sequencer_start_block_height(), - sequencer_stop_height, + status.rollup_start_block_number(), + status.sequencer_start_height(), + rollup_stop_block_number, )) } } @@ -309,10 +309,10 @@ mod tests { let rollup_id = RollupId::new([24; 32]); GenesisInfo { rollup_id: Some(rollup_id.to_raw()), - sequencer_start_block_height: 10, - sequencer_stop_block_height: 100, + sequencer_start_height: 10, celestia_block_variance: 0, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 90, sequencer_chain_id: "test-sequencer-0".to_string(), celestia_chain_id: "test-celestia-0".to_string(), halt_at_stop_height: false, @@ -358,9 +358,9 @@ mod tests { }, &make_rollup_state( GenesisInfo { - sequencer_start_block_height: 10, - sequencer_stop_block_height: 99, - rollup_start_block_height: 10, + sequencer_start_height: 10, + rollup_start_block_number: 10, + rollup_stop_block_number: 99, halt_at_stop_height: false, ..make_genesis_info() }, @@ -390,9 +390,9 @@ mod tests { }, &make_rollup_state( GenesisInfo { - sequencer_start_block_height: 10, - sequencer_stop_block_height: 99, - rollup_start_block_height: 10, + sequencer_start_height: 10, + rollup_start_block_number: 10, + rollup_stop_block_number: 99, halt_at_stop_height: true, ..make_genesis_info() }, @@ -425,9 +425,9 @@ mod tests { }, &make_rollup_state( GenesisInfo { - sequencer_start_block_height: 10, - sequencer_stop_block_height: 99, - rollup_start_block_height: 10, + sequencer_start_height: 10, + rollup_start_block_number: 10, + rollup_stop_block_number: 99, halt_at_stop_height: false, ..make_genesis_info() }, @@ -457,9 +457,9 @@ mod tests { }, &make_rollup_state( GenesisInfo { - sequencer_start_block_height: 10, - sequencer_stop_block_height: 99, - rollup_start_block_height: 10, + sequencer_start_height: 10, + rollup_start_block_number: 10, + rollup_stop_block_number: 99, halt_at_stop_height: true, ..make_genesis_info() }, diff --git a/crates/astria-conductor/src/executor/mod.rs b/crates/astria-conductor/src/executor/mod.rs index 7b3bd7e7c..d3ac99af5 100644 --- a/crates/astria-conductor/src/executor/mod.rs +++ b/crates/astria-conductor/src/executor/mod.rs @@ -371,20 +371,21 @@ impl Initialized { std::cmp::Ordering::Equal => {} } - let sequencer_start_height = self.state.sequencer_start_block_height(); - let rollup_start_height = self.state.rollup_start_block_height(); + let sequencer_start_height = self.state.sequencer_start_height(); + let rollup_start_block_number = self.state.rollup_start_block_number(); let current_block_height = executable_block.height; let Some(block_number) = state::map_sequencer_height_to_rollup_height( sequencer_start_height, - rollup_start_height, + rollup_start_block_number, current_block_height, ) else { bail!( "failed to map block height rollup number. This means the operation - `sequencer_height - sequencer_start_height + rollup_start_height` underflowed or \ - was not a valid cometbft height. Sequencer height: `{current_block_height}`, + `sequencer_height - sequencer_start_height + rollup_start_block_number` \ + underflowed or was not a valid cometbft height. Sequencer height: \ + `{current_block_height}`, sequencer start height: `{sequencer_start_height}`, - rollup start height: `{rollup_start_height}`" + rollup start height: `{rollup_start_block_number}`" ) }; @@ -428,19 +429,20 @@ impl Initialized { "expected block at sequencer height {expected_height}, but got {block_height}", ); - let sequencer_start_height = self.state.sequencer_start_block_height(); - let rollup_start_height = self.state.rollup_start_block_height(); + let sequencer_start_height = self.state.sequencer_start_height(); + let rollup_start_block_number = self.state.rollup_start_block_number(); let Some(block_number) = state::map_sequencer_height_to_rollup_height( sequencer_start_height, - rollup_start_height, + rollup_start_block_number, block_height, ) else { bail!( "failed to map block height rollup number. This means the operation - `sequencer_height - sequencer_start_height + rollup_start_height` underflowed or \ - was not a valid cometbft height. Sequencer block height: `{block_height}`, + `sequencer_height - sequencer_start_height + rollup_start_block_number` \ + underflowed or was not a valid cometbft height. Sequencer block height: \ + `{block_height}`, sequencer start height: `{sequencer_start_height}`, - rollup start height: `{rollup_start_height}`" + rollup start height: `{rollup_start_block_number}`" ) }; @@ -605,7 +607,7 @@ impl Initialized { match task { ReaderKind::Firm if self.config.is_with_firm() => { match ( - self.state.sequencer_stop_block_height().is_some(), + self.state.rollup_stop_block_number().is_some(), self.state.has_firm_number_reached_stop_height(), ) { (true, true) => { @@ -640,7 +642,7 @@ impl Initialized { ReaderKind::Soft if self.config.is_with_soft() => { match ( - self.state.sequencer_stop_block_height().is_some(), + self.state.rollup_stop_block_number().is_some(), self.state.has_soft_number_reached_stop_height(), ) { (true, true) => { diff --git a/crates/astria-conductor/src/executor/state.rs b/crates/astria-conductor/src/executor/state.rs index a0fdb3d93..818523729 100644 --- a/crates/astria-conductor/src/executor/state.rs +++ b/crates/astria-conductor/src/executor/state.rs @@ -12,6 +12,11 @@ use astria_core::{ }, primitive::v1::RollupId, }; +use astria_eyre::eyre::{ + self, + eyre, + WrapErr as _, +}; use bytes::Bytes; use sequencer_client::tendermint::block::Height as SequencerHeight; use tokio::sync::watch::{ @@ -34,14 +39,14 @@ pub(super) fn channel(state: State) -> (StateSender, StateReceiver) { #[derive(Debug, thiserror::Error)] #[error( "could not map rollup number to sequencer height for commitment type `{commitment_type}`: the \ - operation `{sequencer_start_height} + ({rollup_number} - {rollup_start_height}`) failed \ - because `{issue}`" + operation `{sequencer_start_height} + ({rollup_number} - {rollup_start_block_number}`) \ + failed because `{issue}`" )] pub(crate) struct InvalidState { commitment_type: &'static str, issue: &'static str, sequencer_start_height: u64, - rollup_start_height: u64, + rollup_start_block_number: u64, rollup_number: u64, } @@ -78,6 +83,28 @@ impl StateReceiver { self.inner.changed().await?; Ok(self.next_expected_soft_sequencer_height()) } + + pub(crate) fn sequencer_stop_height(&self) -> eyre::Result> { + let Some(rollup_stop_block_number) = self.inner.borrow().rollup_stop_block_number() else { + return Ok(None); + }; + let sequencer_start_height = self.inner.borrow().sequencer_start_height(); + let rollup_start_block_number = self.inner.borrow().rollup_start_block_number(); + Ok(NonZeroU64::new( + map_rollup_number_to_sequencer_height( + sequencer_start_height, + rollup_start_block_number, + rollup_stop_block_number + .get() + .try_into() + .wrap_err("rollup stop block number overflows u32::MAX")?, + ) + .map_err(|e| { + eyre!(e).wrap_err("failed to map rollup stop block number to sequencer height") + })? + .into(), + )) + } } pub(super) struct StateSender { @@ -95,20 +122,20 @@ fn map_firm_to_sequencer_height( genesis_info: &GenesisInfo, commitment_state: &CommitmentState, ) -> Result { - let sequencer_start_height = genesis_info.sequencer_start_block_height(); - let rollup_start_height = genesis_info.rollup_start_block_height(); + let sequencer_start_height = genesis_info.sequencer_start_height(); + let rollup_start_block_number = genesis_info.rollup_start_block_number(); let rollup_number = commitment_state.firm().number(); map_rollup_number_to_sequencer_height( sequencer_start_height, - rollup_start_height, + rollup_start_block_number, rollup_number, ) .map_err(|issue| InvalidState { commitment_type: "firm", issue, sequencer_start_height, - rollup_start_height, + rollup_start_block_number, rollup_number: rollup_number.into(), }) } @@ -117,20 +144,20 @@ fn map_soft_to_sequencer_height( genesis_info: &GenesisInfo, commitment_state: &CommitmentState, ) -> Result { - let sequencer_start_height = genesis_info.sequencer_start_block_height(); - let rollup_start_height = genesis_info.rollup_start_block_height(); + let sequencer_start_height = genesis_info.sequencer_start_height(); + let rollup_start_block_number = genesis_info.rollup_start_block_number(); let rollup_number = commitment_state.soft().number(); map_rollup_number_to_sequencer_height( sequencer_start_height, - rollup_start_height, + rollup_start_block_number, rollup_number, ) .map_err(|issue| InvalidState { commitment_type: "soft", issue, sequencer_start_height, - rollup_start_height, + rollup_start_block_number, rollup_number: rollup_number.into(), }) } @@ -225,10 +252,10 @@ forward_impls!( [soft_hash -> Bytes], [celestia_block_variance -> u64], [rollup_id -> RollupId], - [sequencer_start_block_height -> u64], + [sequencer_start_height -> u64], [celestia_base_block_height -> u64], - [sequencer_stop_block_height -> Option], - [rollup_start_block_height -> u64], + [rollup_start_block_number -> u64], + [rollup_stop_block_number -> Option], [has_firm_number_reached_stop_height -> bool], [has_soft_number_reached_stop_height -> bool], ); @@ -237,7 +264,6 @@ forward_impls!( StateReceiver: [celestia_base_block_height -> u64], [celestia_block_variance -> u64], - [sequencer_stop_block_height -> Option], [rollup_id -> RollupId], [sequencer_chain_id -> String], [celestia_chain_id -> String], @@ -263,55 +289,20 @@ impl State { }) } - /// Returns if the tracked firm state of the rollup has reached the sequencer stop height. - /// - /// The sequencer stop height being reached is defined as: - /// - /// ```text - /// sequencer_height_of_rollup := - /// sequencer_start_height + (firm_rollup_number - rollup_start_height) - /// - /// has_firm_number_been_reached := - /// sequencer_height_of_rollup >= sequencer_stop_height - /// ```` + /// Returns if the tracked firm state of the rollup has reached the rollup stop block number. pub(crate) fn has_firm_number_reached_stop_height(&self) -> bool { - let Some(sequencer_stop_height) = self.sequencer_stop_block_height() else { + let Some(rollup_stop_block_number) = self.rollup_stop_block_number() else { return false; }; - - let sequencer_height_of_rollup = - map_firm_to_sequencer_height(&self.genesis_info, &self.commitment_state).expect( - "state must only be set through State::try_from_genesis_info_and_commitment_state \ - and/or StateSender::try_update_commitment_state, which ensures that the number \ - can always be mapped to a sequencer height", - ); - - sequencer_height_of_rollup.value() >= sequencer_stop_height.get() + u64::from(self.commitment_state.firm().number()) >= rollup_stop_block_number.get() } - /// Returns if the tracked soft state of the rollup has reached the sequencer stop height. - /// - /// The sequencer stop height being reached is defined as: - /// - /// ```text - /// sequencer_height_of_rollup := - /// sequencer_start_height + (soft_rollup_number - rollup_start_height) - /// - /// has_soft_number_been_reached := - /// sequencer_height_of_rollup >= sequencer_stop_height - /// ```` + /// Returns if the tracked soft state of the rollup has reached the rollup stop block number. pub(crate) fn has_soft_number_reached_stop_height(&self) -> bool { - let Some(sequencer_stop_height) = self.sequencer_stop_block_height() else { + let Some(rollup_stop_block_number) = self.rollup_stop_block_number() else { return false; }; - - let sequencer_height_of_rollup = - map_soft_to_sequencer_height(&self.genesis_info, &self.commitment_state).expect( - "state must only be updated through StateSender::try_update_commitment_state, \ - which ensures that the number can always be mapped to a sequencer height", - ); - - sequencer_height_of_rollup.value() >= sequencer_stop_height.get() + u64::from(self.commitment_state.soft().number()) >= rollup_stop_block_number.get() } /// Sets the inner commitment state. @@ -355,18 +346,14 @@ impl State { self.genesis_info.celestia_block_variance() } - pub(crate) fn sequencer_start_block_height(&self) -> u64 { - self.genesis_info.sequencer_start_block_height() + pub(crate) fn sequencer_start_height(&self) -> u64 { + self.genesis_info.sequencer_start_height() } pub(crate) fn halt_at_stop_height(&self) -> bool { self.genesis_info.halt_at_stop_height() } - pub(crate) fn sequencer_stop_block_height(&self) -> Option { - self.genesis_info.sequencer_stop_block_height() - } - fn sequencer_chain_id(&self) -> String { self.genesis_info.sequencer_chain_id().to_string() } @@ -379,8 +366,12 @@ impl State { self.genesis_info.rollup_id() } - pub(crate) fn rollup_start_block_height(&self) -> u64 { - self.genesis_info.rollup_start_block_height() + pub(crate) fn rollup_start_block_number(&self) -> u64 { + self.genesis_info.rollup_start_block_number() + } + + pub(crate) fn rollup_stop_block_number(&self) -> Option { + self.genesis_info.rollup_stop_block_number() } pub(crate) fn firm_block_number_as_sequencer_height(&self) -> SequencerHeight { @@ -410,15 +401,15 @@ impl State { /// Maps a rollup height to a sequencer height. /// -/// Returns error if `sequencer_start_height + (rollup_number - rollup_start_height)` +/// Returns error if `sequencer_start_height + (rollup_number - rollup_start_block_number)` /// overflows `u32::MAX`. fn map_rollup_number_to_sequencer_height( sequencer_start_height: u64, - rollup_start_height: u64, + rollup_start_block_number: u64, rollup_number: u32, ) -> Result { let delta = u64::from(rollup_number) - .checked_sub(rollup_start_height) + .checked_sub(rollup_start_block_number) .ok_or("rollup start height exceeds rollup number")?; let sequencer_height = sequencer_start_height .checked_add(delta) @@ -430,17 +421,17 @@ fn map_rollup_number_to_sequencer_height( /// Maps a sequencer height to a rollup height. /// -/// Returns `None` if `sequencer_height - sequencer_start_height + rollup_start_height` +/// Returns `None` if `sequencer_height - sequencer_start_height + rollup_start_block_number` /// underflows or if the result does not fit in `u32`. pub(super) fn map_sequencer_height_to_rollup_height( sequencer_start_height: u64, - rollup_start_height: u64, + rollup_start_block_number: u64, sequencer_height: SequencerHeight, ) -> Option { sequencer_height .value() .checked_sub(sequencer_start_height)? - .checked_add(rollup_start_height)? + .checked_add(rollup_start_block_number)? .try_into() .ok() } @@ -488,10 +479,10 @@ mod tests { let rollup_id = RollupId::new([24; 32]); GenesisInfo::try_from_raw(raw::GenesisInfo { rollup_id: Some(rollup_id.to_raw()), - sequencer_start_block_height: 10, - sequencer_stop_block_height: 100, + sequencer_start_height: 10, celestia_block_variance: 0, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 90, sequencer_chain_id: "test-sequencer-0".to_string(), celestia_chain_id: "test-celestia-0".to_string(), halt_at_stop_height: false, diff --git a/crates/astria-conductor/src/sequencer/mod.rs b/crates/astria-conductor/src/sequencer/mod.rs index a3920d5e4..1f08d5813 100644 --- a/crates/astria-conductor/src/sequencer/mod.rs +++ b/crates/astria-conductor/src/sequencer/mod.rs @@ -150,7 +150,9 @@ impl RunningReader { } = reader; let next_expected_height = rollup_state.next_expected_soft_sequencer_height(); - let sequencer_end_height = rollup_state.sequencer_stop_block_height(); + let sequencer_end_height = rollup_state + .sequencer_stop_height() + .wrap_err("failed to obtain sequencer stop height")?; let latest_height_stream = sequencer_cometbft_client.stream_latest_height(sequencer_block_time); @@ -187,7 +189,7 @@ impl RunningReader { async fn run_loop(&mut self) -> eyre::Result<&'static str> { loop { - if self.has_reached_stop_height() { + if self.has_reached_stop_height()? { return Ok("stop height reached"); } @@ -292,13 +294,15 @@ impl RunningReader { /// The stop height is reached if a) the next height to be forwarded would be greater /// than the stop height, and b) there is no block currently in flight. - fn has_reached_stop_height(&self) -> bool { - self.rollup_state - .sequencer_stop_block_height() - .map_or(false, |stop_height| { - self.block_cache.next_height_to_pop() > stop_height.get() - }) - && self.enqueued_block.is_terminated() + fn has_reached_stop_height(&self) -> eyre::Result { + Ok(self + .rollup_state + .sequencer_stop_height() + .wrap_err("failed to obtain sequencer stop height")? + .map_or(false, |height| { + self.block_cache.next_height_to_pop() > height.get() + && self.enqueued_block.is_terminated() + })) } } diff --git a/crates/astria-conductor/tests/blackbox/firm_only.rs b/crates/astria-conductor/tests/blackbox/firm_only.rs index 149fe108d..1fd2cbfa4 100644 --- a/crates/astria-conductor/tests/blackbox/firm_only.rs +++ b/crates/astria-conductor/tests/blackbox/firm_only.rs @@ -57,10 +57,10 @@ async fn simple() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -140,10 +140,10 @@ async fn submits_two_heights_in_succession() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -254,10 +254,10 @@ async fn skips_already_executed_heights() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -340,10 +340,10 @@ async fn fetch_from_later_celestia_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -458,10 +458,11 @@ async fn exits_on_celestia_chain_id_mismatch() { matcher::message_type::(), ) .respond_with(GrpcResponse::constant_response( - genesis_info!(sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + genesis_info!(sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0,), + rollup_start_block_number: 0, + rollup_stop_block_number: 9 + ), )) .expect(0..) .mount(&mock_grpc.mock_server) @@ -550,10 +551,10 @@ async fn conductor_restarts_after_reaching_stop_block_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 3, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 2, up_to_n_times: 1, // Only respond once, since updated information is needed after restart. ); @@ -640,10 +641,10 @@ async fn conductor_restarts_after_reaching_stop_block_height() { // Mount new genesis info and commitment state with updated heights mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 2, - sequencer_stop_block_height: 10, + sequencer_start_height: 2, celestia_block_variance: 10, - rollup_start_block_height: 1, + rollup_start_block_number: 1, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( diff --git a/crates/astria-conductor/tests/blackbox/helpers/macros.rs b/crates/astria-conductor/tests/blackbox/helpers/macros.rs index a10e56438..d41c0498b 100644 --- a/crates/astria-conductor/tests/blackbox/helpers/macros.rs +++ b/crates/astria-conductor/tests/blackbox/helpers/macros.rs @@ -94,34 +94,34 @@ macro_rules! filtered_sequencer_block { #[macro_export] macro_rules! genesis_info { ( - sequencer_start_block_height: - $start_height:expr,sequencer_stop_block_height: - $stop_height:expr,celestia_block_variance: - $variance:expr,rollup_start_block_height: - $rollup_start_block_height:expr, + sequencer_start_height: + $start_height:expr,celestia_block_variance: + $variance:expr,rollup_start_block_number: + $rollup_start_block_number:expr, rollup_stop_block_number: + $rollup_stop_block_number:expr $(,)? ) => { genesis_info!( - sequencer_start_block_height: $start_height, - sequencer_stop_block_height: $stop_height, + sequencer_start_height: $start_height, celestia_block_variance: $variance, - rollup_start_block_height: $rollup_start_block_height, + rollup_start_block_number: $rollup_start_block_number, + rollup_stop_block_number: $rollup_stop_block_number, halt_at_stop_height: false, ) }; ( - sequencer_start_block_height: - $start_height:expr,sequencer_stop_block_height: - $stop_height:expr,celestia_block_variance: - $variance:expr,rollup_start_block_height: - $rollup_start_block_height:expr, + sequencer_start_height: + $start_height:expr,celestia_block_variance: + $variance:expr,rollup_start_block_number: + $rollup_start_block_number:expr, + rollup_stop_block_number: $rollup_stop_block_number:expr, halt_at_stop_height: $halt_at_stop_height:expr $(,)? ) => { ::astria_core::generated::astria::execution::v1::GenesisInfo { rollup_id: Some($crate::ROLLUP_ID.to_raw()), - sequencer_start_block_height: $start_height, - sequencer_stop_block_height: $stop_height, + sequencer_start_height: $start_height, celestia_block_variance: $variance, - rollup_start_block_height: $rollup_start_block_height, + rollup_start_block_number: $rollup_start_block_number, + rollup_stop_block_number: $rollup_stop_block_number, sequencer_chain_id: $crate::SEQUENCER_CHAIN_ID.to_string(), celestia_chain_id: $crate::helpers::CELESTIA_CHAIN_ID.to_string(), halt_at_stop_height: $halt_at_stop_height, @@ -391,36 +391,36 @@ macro_rules! mount_get_filtered_sequencer_block { macro_rules! mount_get_genesis_info { ( $test_env:ident, - sequencer_start_block_height: $start_height:expr, - sequencer_stop_block_height: $stop_height:expr, + sequencer_start_height: $start_height:expr, celestia_block_variance: $variance:expr, - rollup_start_block_height: $rollup_start_block_height:expr + rollup_start_block_number: $rollup_start_block_number:expr, + rollup_stop_block_number: $rollup_stop_block_number:expr $(,)? ) => { mount_get_genesis_info!( $test_env, - sequencer_start_block_height: $start_height, - sequencer_stop_block_height: $stop_height, + sequencer_start_height: $start_height, celestia_block_variance: $variance, - rollup_start_block_height: $rollup_start_block_height, + rollup_start_block_number: $rollup_start_block_number, + rollup_stop_block_number: $rollup_stop_block_number, up_to_n_times: 1, ) }; ( $test_env:ident, - sequencer_start_block_height: $start_height:expr, - sequencer_stop_block_height: $stop_height:expr, + sequencer_start_height: $start_height:expr, celestia_block_variance: $variance:expr, - rollup_start_block_height: $rollup_start_block_height:expr, + rollup_start_block_number: $rollup_start_block_number:expr, + rollup_stop_block_number: $rollup_stop_block_number:expr, up_to_n_times: $up_to_n_times:expr $(,)? ) => { mount_get_genesis_info!( $test_env, - sequencer_start_block_height: $start_height, - sequencer_stop_block_height: $stop_height, + sequencer_start_height: $start_height, celestia_block_variance: $variance, - rollup_start_block_height: $rollup_start_block_height, + rollup_start_block_number: $rollup_start_block_number, + rollup_stop_block_number: $rollup_stop_block_number, up_to_n_times: $up_to_n_times, halt_at_stop_height: false, expected_calls: 1, @@ -428,10 +428,10 @@ macro_rules! mount_get_genesis_info { }; ( $test_env:ident, - sequencer_start_block_height: $start_height:expr, - sequencer_stop_block_height: $stop_height:expr, + sequencer_start_height: $start_height:expr, celestia_block_variance: $variance:expr, - rollup_start_block_height: $rollup_start_block_height:expr, + rollup_start_block_number: $rollup_start_block_number:expr, + rollup_stop_block_number: $rollup_stop_block_number:expr, up_to_n_times: $up_to_n_times:expr, halt_at_stop_height: $halt_at_stop_height:expr, expected_calls: $expected_calls:expr @@ -439,10 +439,10 @@ macro_rules! mount_get_genesis_info { ) => { $test_env.mount_get_genesis_info( $crate::genesis_info!( - sequencer_start_block_height: $start_height, - sequencer_stop_block_height: $stop_height, + sequencer_start_height: $start_height, celestia_block_variance: $variance, - rollup_start_block_height: $rollup_start_block_height, + rollup_start_block_number: $rollup_start_block_number, + rollup_stop_block_number: $rollup_stop_block_number, halt_at_stop_height: $halt_at_stop_height, ), $up_to_n_times, diff --git a/crates/astria-conductor/tests/blackbox/soft_and_firm.rs b/crates/astria-conductor/tests/blackbox/soft_and_firm.rs index e05fab94f..06032934f 100644 --- a/crates/astria-conductor/tests/blackbox/soft_and_firm.rs +++ b/crates/astria-conductor/tests/blackbox/soft_and_firm.rs @@ -43,10 +43,10 @@ async fn executes_soft_first_then_updates_firm() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -179,10 +179,10 @@ async fn executes_firm_then_soft_at_next_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -340,10 +340,10 @@ async fn missing_block_is_fetched_for_updating_firm_commitment() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -471,10 +471,10 @@ async fn conductor_restarts_on_permission_denied() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, up_to_n_times: 2, halt_at_stop_height: false, expected_calls: 2, @@ -624,10 +624,10 @@ async fn conductor_restarts_after_reaching_soft_stop_height_first() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 3, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 2, up_to_n_times: 1, // We only respond once since this needs to be updated after restart ); @@ -744,10 +744,10 @@ async fn conductor_restarts_after_reaching_soft_stop_height_first() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 2, - sequencer_stop_block_height: 10, + sequencer_start_height: 2, celestia_block_variance: 10, - rollup_start_block_height: 1, + rollup_start_block_number: 1, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -854,10 +854,10 @@ async fn conductor_restarts_after_reaching_firm_stop_height_first() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 3, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 2, up_to_n_times: 1, // We only respond once since this needs to be updated after restart ); @@ -974,10 +974,10 @@ async fn conductor_restarts_after_reaching_firm_stop_height_first() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 2, - sequencer_stop_block_height: 10, + sequencer_start_height: 2, celestia_block_variance: 10, - rollup_start_block_height: 1, + rollup_start_block_number: 1, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -1072,10 +1072,10 @@ async fn conductor_stops_at_stop_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 3, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 2, up_to_n_times: 2, // allow for calls after an potential erroneous restart halt_at_stop_height: true, expected_calls: 1, diff --git a/crates/astria-conductor/tests/blackbox/soft_only.rs b/crates/astria-conductor/tests/blackbox/soft_only.rs index d95619dfe..8b08ba53f 100644 --- a/crates/astria-conductor/tests/blackbox/soft_only.rs +++ b/crates/astria-conductor/tests/blackbox/soft_only.rs @@ -44,10 +44,10 @@ async fn simple() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -119,10 +119,10 @@ async fn submits_two_heights_in_succession() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -227,10 +227,10 @@ async fn skips_already_executed_heights() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( @@ -302,10 +302,10 @@ async fn requests_from_later_genesis_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 10, - sequencer_stop_block_height: 20, + sequencer_start_height: 10, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 10, ); mount_get_commitment_state!( @@ -412,10 +412,10 @@ async fn exits_on_sequencer_chain_id_mismatch() { matcher::message_type::(), ) .respond_with(GrpcResponse::constant_response( - genesis_info!(sequencer_start_block_height: 1, - sequencer_stop_block_height: 10, + genesis_info!(sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0,), + rollup_start_block_number: 0, + rollup_stop_block_number: 9), )) .expect(0..) .mount(&mock_grpc.mock_server) @@ -492,10 +492,10 @@ async fn conductor_restarts_after_reaching_stop_block_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 1, - sequencer_stop_block_height: 3, + sequencer_start_height: 1, celestia_block_variance: 10, - rollup_start_block_height: 0, + rollup_start_block_number: 0, + rollup_stop_block_number: 2, up_to_n_times: 1, // We need to mount a new genesis info after restart ); @@ -576,10 +576,10 @@ async fn conductor_restarts_after_reaching_stop_block_height() { mount_get_genesis_info!( test_conductor, - sequencer_start_block_height: 2, - sequencer_stop_block_height: 10, + sequencer_start_height: 2, celestia_block_variance: 10, - rollup_start_block_height: 1, + rollup_start_block_number: 1, + rollup_stop_block_number: 9, ); mount_get_commitment_state!( diff --git a/crates/astria-core/src/execution/v1/mod.rs b/crates/astria-core/src/execution/v1/mod.rs index 367e957ee..df322ac46 100644 --- a/crates/astria-core/src/execution/v1/mod.rs +++ b/crates/astria-core/src/execution/v1/mod.rs @@ -63,13 +63,13 @@ pub struct GenesisInfo { /// The rollup id which is used to identify the rollup txs. rollup_id: RollupId, /// The Sequencer block height which contains the first block of the rollup. - sequencer_start_block_height: tendermint::block::Height, - /// The Sequencer block height to stop at. - sequencer_stop_block_height: tendermint::block::Height, + sequencer_start_height: tendermint::block::Height, /// The allowed variance in the block height of celestia when looking for sequencer blocks. celestia_block_variance: u64, /// The rollup block number to map to the sequencer start block height. - rollup_start_block_height: u64, + rollup_start_block_number: u64, + /// The rollup block number to restart/halt at after executing. + rollup_stop_block_number: Option, /// The chain ID of the sequencer network. sequencer_chain_id: tendermint::chain::Id, /// The chain ID of the celestia network. @@ -85,13 +85,8 @@ impl GenesisInfo { } #[must_use] - pub fn sequencer_start_block_height(&self) -> u64 { - self.sequencer_start_block_height.into() - } - - #[must_use] - pub fn sequencer_stop_block_height(&self) -> Option { - NonZeroU64::new(self.sequencer_stop_block_height.value()) + pub fn sequencer_start_height(&self) -> u64 { + self.sequencer_start_height.into() } #[must_use] @@ -110,8 +105,13 @@ impl GenesisInfo { } #[must_use] - pub fn rollup_start_block_height(&self) -> u64 { - self.rollup_start_block_height + pub fn rollup_start_block_number(&self) -> u64 { + self.rollup_start_block_number + } + + #[must_use] + pub fn rollup_stop_block_number(&self) -> Option { + self.rollup_stop_block_number } #[must_use] @@ -133,10 +133,10 @@ impl Protobuf for GenesisInfo { fn try_from_raw_ref(raw: &Self::Raw) -> Result { let raw::GenesisInfo { rollup_id, - sequencer_start_block_height, - sequencer_stop_block_height, + sequencer_start_height, celestia_block_variance, - rollup_start_block_height, + rollup_start_block_number, + rollup_stop_block_number, sequencer_chain_id, celestia_chain_id, halt_at_stop_height, @@ -157,10 +157,10 @@ impl Protobuf for GenesisInfo { Ok(Self { rollup_id, - sequencer_start_block_height: (*sequencer_start_block_height).into(), - sequencer_stop_block_height: (*sequencer_stop_block_height).into(), + sequencer_start_height: (*sequencer_start_height).into(), celestia_block_variance: *celestia_block_variance, - rollup_start_block_height: *rollup_start_block_height, + rollup_start_block_number: *rollup_start_block_number, + rollup_stop_block_number: NonZeroU64::new(*rollup_stop_block_number), sequencer_chain_id, celestia_chain_id, halt_at_stop_height: *halt_at_stop_height, @@ -170,32 +170,26 @@ impl Protobuf for GenesisInfo { fn to_raw(&self) -> Self::Raw { let Self { rollup_id, - sequencer_start_block_height, - sequencer_stop_block_height, + sequencer_start_height, celestia_block_variance, - rollup_start_block_height, + rollup_start_block_number, + rollup_stop_block_number, sequencer_chain_id, celestia_chain_id, halt_at_stop_height, } = self; - let sequencer_start_block_height: u32 = - (*sequencer_start_block_height).value().try_into().expect( - "block height overflow, this should not happen since tendermint heights are i64 \ - under the hood", - ); - let sequencer_stop_block_height: u32 = - (*sequencer_stop_block_height).value().try_into().expect( - "block height overflow, this should not happen since tendermint heights are i64 \ - under the hood", - ); + let sequencer_start_height: u32 = (*sequencer_start_height).value().try_into().expect( + "block height overflow, this should not happen since tendermint heights are i64 under \ + the hood", + ); Self::Raw { rollup_id: Some(rollup_id.to_raw()), - sequencer_start_block_height, - sequencer_stop_block_height, + sequencer_start_height, celestia_block_variance: *celestia_block_variance, - rollup_start_block_height: *rollup_start_block_height, + rollup_start_block_number: *rollup_start_block_number, + rollup_stop_block_number: rollup_stop_block_number.map(NonZeroU64::get).unwrap_or(0), sequencer_chain_id: sequencer_chain_id.to_string(), celestia_chain_id: celestia_chain_id.to_string(), halt_at_stop_height: *halt_at_stop_height, diff --git a/crates/astria-core/src/generated/astria.execution.v1.rs b/crates/astria-core/src/generated/astria.execution.v1.rs index 3c3538c0c..a3a97d43e 100644 --- a/crates/astria-core/src/generated/astria.execution.v1.rs +++ b/crates/astria-core/src/generated/astria.execution.v1.rs @@ -10,22 +10,22 @@ pub struct GenesisInfo { pub rollup_id: ::core::option::Option, /// The first block height of sequencer chain to use for rollup transactions. #[prost(uint32, tag = "2")] - pub sequencer_start_block_height: u32, - /// The last block height of sequencer chain to use for rollup transactions. - #[prost(uint32, tag = "3")] - pub sequencer_stop_block_height: u32, + pub sequencer_start_height: u32, /// The allowed variance in celestia for sequencer blocks to have been posted. #[prost(uint64, tag = "4")] pub celestia_block_variance: u64, /// The rollup block number to map to the sequencer start block height. #[prost(uint64, tag = "5")] - pub rollup_start_block_height: u64, - #[prost(string, tag = "6")] - pub sequencer_chain_id: ::prost::alloc::string::String, + pub rollup_start_block_number: u64, + /// The rollup block number to restart/halt at after executing. + #[prost(uint64, tag = "6")] + pub rollup_stop_block_number: u64, #[prost(string, tag = "7")] + pub sequencer_chain_id: ::prost::alloc::string::String, + #[prost(string, tag = "8")] pub celestia_chain_id: ::prost::alloc::string::String, /// True if the conductor should halt at the stop height instead of attempting restart. - #[prost(bool, tag = "8")] + #[prost(bool, tag = "9")] pub halt_at_stop_height: bool, } impl ::prost::Name for GenesisInfo { diff --git a/crates/astria-core/src/generated/astria.execution.v1.serde.rs b/crates/astria-core/src/generated/astria.execution.v1.serde.rs index 6e0defa09..818d73177 100644 --- a/crates/astria-core/src/generated/astria.execution.v1.serde.rs +++ b/crates/astria-core/src/generated/astria.execution.v1.serde.rs @@ -710,16 +710,16 @@ impl serde::Serialize for GenesisInfo { if self.rollup_id.is_some() { len += 1; } - if self.sequencer_start_block_height != 0 { + if self.sequencer_start_height != 0 { len += 1; } - if self.sequencer_stop_block_height != 0 { + if self.celestia_block_variance != 0 { len += 1; } - if self.celestia_block_variance != 0 { + if self.rollup_start_block_number != 0 { len += 1; } - if self.rollup_start_block_height != 0 { + if self.rollup_stop_block_number != 0 { len += 1; } if !self.sequencer_chain_id.is_empty() { @@ -735,19 +735,20 @@ impl serde::Serialize for GenesisInfo { if let Some(v) = self.rollup_id.as_ref() { struct_ser.serialize_field("rollupId", v)?; } - if self.sequencer_start_block_height != 0 { - struct_ser.serialize_field("sequencerStartBlockHeight", &self.sequencer_start_block_height)?; - } - if self.sequencer_stop_block_height != 0 { - struct_ser.serialize_field("sequencerStopBlockHeight", &self.sequencer_stop_block_height)?; + if self.sequencer_start_height != 0 { + struct_ser.serialize_field("sequencerStartHeight", &self.sequencer_start_height)?; } if self.celestia_block_variance != 0 { #[allow(clippy::needless_borrow)] struct_ser.serialize_field("celestiaBlockVariance", ToString::to_string(&self.celestia_block_variance).as_str())?; } - if self.rollup_start_block_height != 0 { + if self.rollup_start_block_number != 0 { #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("rollupStartBlockHeight", ToString::to_string(&self.rollup_start_block_height).as_str())?; + struct_ser.serialize_field("rollupStartBlockNumber", ToString::to_string(&self.rollup_start_block_number).as_str())?; + } + if self.rollup_stop_block_number != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("rollupStopBlockNumber", ToString::to_string(&self.rollup_stop_block_number).as_str())?; } if !self.sequencer_chain_id.is_empty() { struct_ser.serialize_field("sequencerChainId", &self.sequencer_chain_id)?; @@ -770,14 +771,14 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { const FIELDS: &[&str] = &[ "rollup_id", "rollupId", - "sequencer_start_block_height", - "sequencerStartBlockHeight", - "sequencer_stop_block_height", - "sequencerStopBlockHeight", + "sequencer_start_height", + "sequencerStartHeight", "celestia_block_variance", "celestiaBlockVariance", - "rollup_start_block_height", - "rollupStartBlockHeight", + "rollup_start_block_number", + "rollupStartBlockNumber", + "rollup_stop_block_number", + "rollupStopBlockNumber", "sequencer_chain_id", "sequencerChainId", "celestia_chain_id", @@ -789,10 +790,10 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { #[allow(clippy::enum_variant_names)] enum GeneratedField { RollupId, - SequencerStartBlockHeight, - SequencerStopBlockHeight, + SequencerStartHeight, CelestiaBlockVariance, - RollupStartBlockHeight, + RollupStartBlockNumber, + RollupStopBlockNumber, SequencerChainId, CelestiaChainId, HaltAtStopHeight, @@ -818,10 +819,10 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { { match value { "rollupId" | "rollup_id" => Ok(GeneratedField::RollupId), - "sequencerStartBlockHeight" | "sequencer_start_block_height" => Ok(GeneratedField::SequencerStartBlockHeight), - "sequencerStopBlockHeight" | "sequencer_stop_block_height" => Ok(GeneratedField::SequencerStopBlockHeight), + "sequencerStartHeight" | "sequencer_start_height" => Ok(GeneratedField::SequencerStartHeight), "celestiaBlockVariance" | "celestia_block_variance" => Ok(GeneratedField::CelestiaBlockVariance), - "rollupStartBlockHeight" | "rollup_start_block_height" => Ok(GeneratedField::RollupStartBlockHeight), + "rollupStartBlockNumber" | "rollup_start_block_number" => Ok(GeneratedField::RollupStartBlockNumber), + "rollupStopBlockNumber" | "rollup_stop_block_number" => Ok(GeneratedField::RollupStopBlockNumber), "sequencerChainId" | "sequencer_chain_id" => Ok(GeneratedField::SequencerChainId), "celestiaChainId" | "celestia_chain_id" => Ok(GeneratedField::CelestiaChainId), "haltAtStopHeight" | "halt_at_stop_height" => Ok(GeneratedField::HaltAtStopHeight), @@ -845,10 +846,10 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { V: serde::de::MapAccess<'de>, { let mut rollup_id__ = None; - let mut sequencer_start_block_height__ = None; - let mut sequencer_stop_block_height__ = None; + let mut sequencer_start_height__ = None; let mut celestia_block_variance__ = None; - let mut rollup_start_block_height__ = None; + let mut rollup_start_block_number__ = None; + let mut rollup_stop_block_number__ = None; let mut sequencer_chain_id__ = None; let mut celestia_chain_id__ = None; let mut halt_at_stop_height__ = None; @@ -860,19 +861,11 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { } rollup_id__ = map_.next_value()?; } - GeneratedField::SequencerStartBlockHeight => { - if sequencer_start_block_height__.is_some() { - return Err(serde::de::Error::duplicate_field("sequencerStartBlockHeight")); + GeneratedField::SequencerStartHeight => { + if sequencer_start_height__.is_some() { + return Err(serde::de::Error::duplicate_field("sequencerStartHeight")); } - sequencer_start_block_height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::SequencerStopBlockHeight => { - if sequencer_stop_block_height__.is_some() { - return Err(serde::de::Error::duplicate_field("sequencerStopBlockHeight")); - } - sequencer_stop_block_height__ = + sequencer_start_height__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } @@ -884,11 +877,19 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::RollupStartBlockHeight => { - if rollup_start_block_height__.is_some() { - return Err(serde::de::Error::duplicate_field("rollupStartBlockHeight")); + GeneratedField::RollupStartBlockNumber => { + if rollup_start_block_number__.is_some() { + return Err(serde::de::Error::duplicate_field("rollupStartBlockNumber")); + } + rollup_start_block_number__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::RollupStopBlockNumber => { + if rollup_stop_block_number__.is_some() { + return Err(serde::de::Error::duplicate_field("rollupStopBlockNumber")); } - rollup_start_block_height__ = + rollup_stop_block_number__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } @@ -914,10 +915,10 @@ impl<'de> serde::Deserialize<'de> for GenesisInfo { } Ok(GenesisInfo { rollup_id: rollup_id__, - sequencer_start_block_height: sequencer_start_block_height__.unwrap_or_default(), - sequencer_stop_block_height: sequencer_stop_block_height__.unwrap_or_default(), + sequencer_start_height: sequencer_start_height__.unwrap_or_default(), celestia_block_variance: celestia_block_variance__.unwrap_or_default(), - rollup_start_block_height: rollup_start_block_height__.unwrap_or_default(), + rollup_start_block_number: rollup_start_block_number__.unwrap_or_default(), + rollup_stop_block_number: rollup_stop_block_number__.unwrap_or_default(), sequencer_chain_id: sequencer_chain_id__.unwrap_or_default(), celestia_chain_id: celestia_chain_id__.unwrap_or_default(), halt_at_stop_height: halt_at_stop_height__.unwrap_or_default(), diff --git a/proto/executionapis/astria/execution/v1/execution.proto b/proto/executionapis/astria/execution/v1/execution.proto index fe7cd7615..2301782be 100644 --- a/proto/executionapis/astria/execution/v1/execution.proto +++ b/proto/executionapis/astria/execution/v1/execution.proto @@ -14,17 +14,17 @@ message GenesisInfo { // The rollup_id is the unique identifier for the rollup chain. astria.primitive.v1.RollupId rollup_id = 1; // The first block height of sequencer chain to use for rollup transactions. - uint32 sequencer_start_block_height = 2; - // The last block height of sequencer chain to use for rollup transactions. - uint32 sequencer_stop_block_height = 3; + uint32 sequencer_start_height = 2; // The allowed variance in celestia for sequencer blocks to have been posted. uint64 celestia_block_variance = 4; // The rollup block number to map to the sequencer start block height. - uint64 rollup_start_block_height = 5; - string sequencer_chain_id = 6; - string celestia_chain_id = 7; + uint64 rollup_start_block_number = 5; + // The rollup block number to restart/halt at after executing. + uint64 rollup_stop_block_number = 6; + string sequencer_chain_id = 7; + string celestia_chain_id = 8; // True if the conductor should halt at the stop height instead of attempting restart. - bool halt_at_stop_height = 8; + bool halt_at_stop_height = 9; } // The set of information which deterministic driver of block production