Skip to content

Commit 065a6a8

Browse files
apollo_batcher: remove revert config (#11278)
1 parent 3f238d4 commit 065a6a8

File tree

8 files changed

+5
-53
lines changed

8 files changed

+5
-53
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_batcher/src/batcher.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ impl Batcher {
251251
&mut self,
252252
propose_block_input: ProposeBlockInput,
253253
) -> BatcherResult<()> {
254-
self.assert_not_in_revert_mode();
255254
let block_number = propose_block_input.block_info.block_number;
256255
let proposal_metrics_handle = ProposalMetricsHandle::new();
257256
let active_height = self.active_height.ok_or(BatcherError::NoActiveHeight)?;
@@ -378,7 +377,6 @@ impl Batcher {
378377
&mut self,
379378
validate_block_input: ValidateBlockInput,
380379
) -> BatcherResult<()> {
381-
self.assert_not_in_revert_mode();
382380
let proposal_metrics_handle = ProposalMetricsHandle::new();
383381
let active_height = self.active_height.ok_or(BatcherError::NoActiveHeight)?;
384382
verify_block_input(
@@ -617,7 +615,6 @@ impl Batcher {
617615

618616
#[instrument(skip(self, sync_block), err)]
619617
pub async fn add_sync_block(&mut self, sync_block: SyncBlock) -> BatcherResult<()> {
620-
self.assert_not_in_revert_mode();
621618
trace!("Received sync block: {:?}", sync_block);
622619
// TODO(AlonH): Use additional data from the sync block.
623620
let SyncBlock {
@@ -1069,7 +1066,6 @@ impl Batcher {
10691066
#[instrument(skip(self), err)]
10701067
// This function will panic if there is a storage failure to revert the block.
10711068
pub async fn revert_block(&mut self, input: RevertBlockInput) -> BatcherResult<()> {
1072-
self.assert_in_revert_mode();
10731069
info!("Reverting block at height {}.", input.height);
10741070
let height = self.get_height_from_storage()?.prev().ok_or(
10751071
BatcherError::StorageHeightMarkerMismatch {
@@ -1203,24 +1199,6 @@ impl Batcher {
12031199

12041200
Ok(())
12051201
}
1206-
1207-
#[track_caller]
1208-
fn assert_not_in_revert_mode(&self) {
1209-
assert!(
1210-
!self.config.revert_config.should_revert,
1211-
"Batcher can't perform this operation when in revert mode. Turn OFF revert mode in \
1212-
config and restart the Batcher."
1213-
);
1214-
}
1215-
1216-
#[track_caller]
1217-
fn assert_in_revert_mode(&self) {
1218-
assert!(
1219-
self.config.revert_config.should_revert,
1220-
"Batcher can only perform this operation when in revert mode. Turn ON revert mode in \
1221-
config and restart the Batcher."
1222-
);
1223-
}
12241202
}
12251203

12261204
/// Logs the result of the transactions execution in the proposal.

crates/apollo_batcher/src/batcher_test.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,6 @@ async fn multiple_proposals_with_l1_every_n_proposals() {
853853
batcher.config.propose_l1_txs_every = PROPOSALS_L1_MODULATOR.try_into().unwrap();
854854

855855
for i in 0..N_PROPOSALS {
856-
// The revert config shouldn't be toggled without restarting the Batcher. But in the context
857-
// of the test it should be ok.
858-
batcher.config.revert_config.should_revert = false;
859856
batcher.start_height(StartHeightInput { height: INITIAL_HEIGHT }).await.unwrap();
860857
batcher.propose_block(propose_block_input(PROPOSAL_ID)).await.unwrap();
861858
let content = batcher
@@ -872,7 +869,6 @@ async fn multiple_proposals_with_l1_every_n_proposals() {
872869
}
873870

874871
batcher.await_active_proposal(DUMMY_FINAL_N_EXECUTED_TXS).await.unwrap();
875-
batcher.config.revert_config.should_revert = true;
876872
batcher
877873
.revert_block(RevertBlockInput { height: INITIAL_HEIGHT.prev().unwrap() })
878874
.await
@@ -1356,8 +1352,7 @@ async fn revert_block() {
13561352
.with(eq(LATEST_BLOCK_IN_STORAGE))
13571353
.returning(|_| ());
13581354

1359-
let mut mock_dependencies = MockDependencies { storage_writer, ..Default::default() };
1360-
mock_dependencies.batcher_config.revert_config.should_revert = true;
1355+
let mock_dependencies = MockDependencies { storage_writer, ..Default::default() };
13611356

13621357
let mut batcher = create_batcher(mock_dependencies).await;
13631358

@@ -1374,9 +1369,7 @@ async fn revert_block() {
13741369

13751370
#[tokio::test]
13761371
async fn revert_block_mismatch_block_number() {
1377-
let mut mock_dependencies = MockDependencies::default();
1378-
mock_dependencies.batcher_config.revert_config.should_revert = true;
1379-
let mut batcher = create_batcher(mock_dependencies).await;
1372+
let mut batcher = create_batcher(MockDependencies::default()).await;
13801373

13811374
let revert_input = RevertBlockInput { height: INITIAL_HEIGHT };
13821375
let result = batcher.revert_block(revert_input).await;
@@ -1394,8 +1387,7 @@ async fn revert_block_empty_storage() {
13941387
let mut storage_reader = MockBatcherStorageReader::new();
13951388
storage_reader.expect_height().returning(|| Ok(BlockNumber(0)));
13961389
storage_reader.expect_global_root_height().returning(|| Ok(BlockNumber(0)));
1397-
let mut mock_dependencies = MockDependencies { storage_reader, ..Default::default() };
1398-
mock_dependencies.batcher_config.revert_config.should_revert = true;
1390+
let mock_dependencies = MockDependencies { storage_reader, ..Default::default() };
13991391
let mut batcher = create_batcher(mock_dependencies).await;
14001392

14011393
let revert_input = RevertBlockInput { height: BlockNumber(0) };

crates/apollo_batcher/src/commitment_manager/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ impl CommitmentManager {
299299
.expect("Failed to get block hash height from storage.");
300300
let mut commitment_manager = Self::new_or_none(
301301
commitment_manager_config,
302-
&batcher_config.revert_config,
302+
// TODO(Amos): Always return commitment manager.
303+
&RevertConfig::default(),
303304
global_root_height,
304305
committer_client,
305306
);

crates/apollo_batcher_config/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ description = "Configuration for Apollo batcher"
88

99
[dependencies]
1010
apollo_config.workspace = true
11-
apollo_reverts.workspace = true
1211
apollo_storage.workspace = true
1312
blockifier.workspace = true
1413
serde = { workspace = true, features = ["derive"] }

crates/apollo_batcher_config/src/config.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use apollo_config::dumping::{
1010
};
1111
use apollo_config::secrets::Sensitive;
1212
use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
13-
use apollo_reverts::RevertConfig;
1413
use apollo_storage::db::DbConfig;
1514
use apollo_storage::storage_reader_server::ServerConfig;
1615
use apollo_storage::{StorageConfig, StorageScope};
@@ -196,8 +195,6 @@ pub struct BatcherConfig {
196195
pub propose_l1_txs_every: u64,
197196
pub first_block_with_partial_block_hash: Option<FirstBlockWithPartialBlockHash>,
198197
pub storage_reader_server_config: ServerConfig,
199-
// Used to verify the Batcher is restarted before switching to / from revert mode.
200-
pub revert_config: RevertConfig,
201198
}
202199

203200
impl SerializeConfig for BatcherConfig {
@@ -255,8 +252,6 @@ impl SerializeConfig for BatcherConfig {
255252
&self.first_block_with_partial_block_hash,
256253
"first_block_with_partial_block_hash",
257254
));
258-
259-
dump.append(&mut prepend_sub_config_name(self.revert_config.dump(), "revert_config"));
260255
dump
261256
}
262257
}
@@ -284,7 +279,6 @@ impl Default for BatcherConfig {
284279
propose_l1_txs_every: 1, // Default is to propose L1 transactions every proposal.
285280
first_block_with_partial_block_hash: None,
286281
storage_reader_server_config: ServerConfig::default(),
287-
revert_config: RevertConfig::default(),
288282
}
289283
}
290284
}

crates/apollo_node/resources/config_schema.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,6 @@
324324
"privacy": "Public",
325325
"value": 1
326326
},
327-
"batcher_config.revert_config.revert_up_to_and_including": {
328-
"description": "The component will revert blocks up to this block number (including).",
329-
"pointer_target": "revert_config.revert_up_to_and_including",
330-
"privacy": "Public"
331-
},
332-
"batcher_config.revert_config.should_revert": {
333-
"description": "If set true, the component would revert blocks and do nothing else.",
334-
"pointer_target": "revert_config.should_revert",
335-
"privacy": "Public"
336-
},
337327
"batcher_config.storage.db_config.chain_id": {
338328
"description": "The chain to follow. For more details see https://docs.starknet.io/documentation/architecture_and_concepts/Blocks/transactions/#chain-id.",
339329
"pointer_target": "chain_id",

crates/apollo_node_config/src/node_config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ pub static CONFIG_POINTERS: LazyLock<ConfigPointers> = LazyLock::new(|| {
169169
&RevertConfig::default(),
170170
set_pointing_param_paths(&[
171171
"state_sync_config.revert_config",
172-
"batcher_config.revert_config",
173172
"consensus_manager_config.revert_config",
174173
]),
175174
);

0 commit comments

Comments
 (0)