Skip to content

Commit e2cdef9

Browse files
committed
remove rewind depth
doc
1 parent ab79239 commit e2cdef9

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

src/block_range_scanner.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//! // Configuration
2121
//! let block_range_scanner = BlockRangeScanner::new()
2222
//! .with_blocks_read_per_epoch(1000)
23-
//! .with_reorg_rewind_depth(5)
2423
//! .with_block_confirmations(5)
2524
//! .connect_ws::<Ethereum>(Url::parse("ws://localhost:8546").unwrap())
2625
//! .await?;
@@ -97,8 +96,6 @@ pub const DEFAULT_BLOCK_CONFIRMATIONS: u64 = 0;
9796

9897
pub const MAX_BUFFERED_MESSAGES: usize = 50000;
9998

100-
pub const DEFAULT_REORG_REWIND_DEPTH: u64 = 0;
101-
10299
// // State sync aware retry settings
103100
// const STATE_SYNC_RETRY_INTERVAL: Duration = Duration::from_secs(30);
104101
// const STATE_SYNC_MAX_RETRIES: u64 = 12;
@@ -186,18 +183,11 @@ pub enum Command {
186183
#[derive(Clone)]
187184
struct Config {
188185
blocks_read_per_epoch: usize,
189-
#[allow(dead_code, reason = "Will be removed")]
190-
reorg_rewind_depth: u64,
191-
#[allow(
192-
dead_code,
193-
reason = "Will be used in reorg mechanism: https://github.com/OpenZeppelin/Event-Scanner/issues/5"
194-
)]
195186
block_confirmations: u64,
196187
}
197188

198189
pub struct BlockRangeScanner {
199190
blocks_read_per_epoch: usize,
200-
reorg_rewind_depth: u64,
201191
block_confirmations: u64,
202192
}
203193

@@ -212,7 +202,6 @@ impl BlockRangeScanner {
212202
pub fn new() -> Self {
213203
Self {
214204
blocks_read_per_epoch: DEFAULT_BLOCKS_READ_PER_EPOCH,
215-
reorg_rewind_depth: DEFAULT_REORG_REWIND_DEPTH,
216205
block_confirmations: DEFAULT_BLOCK_CONFIRMATIONS,
217206
}
218207
}
@@ -223,12 +212,6 @@ impl BlockRangeScanner {
223212
self
224213
}
225214

226-
#[must_use]
227-
pub fn with_reorg_rewind_depth(mut self, reorg_rewind_depth: u64) -> Self {
228-
self.reorg_rewind_depth = reorg_rewind_depth;
229-
self
230-
}
231-
232215
#[must_use]
233216
pub fn with_block_confirmations(mut self, block_confirmations: u64) -> Self {
234217
self.block_confirmations = block_confirmations;
@@ -275,7 +258,6 @@ impl BlockRangeScanner {
275258
provider,
276259
config: Config {
277260
blocks_read_per_epoch: self.blocks_read_per_epoch,
278-
reorg_rewind_depth: self.reorg_rewind_depth,
279261
block_confirmations: self.block_confirmations,
280262
},
281263
})
@@ -1064,7 +1046,7 @@ mod tests {
10641046
}
10651047

10661048
fn test_config() -> Config {
1067-
Config { blocks_read_per_epoch: 5, reorg_rewind_depth: 5, block_confirmations: 0 }
1049+
Config { blocks_read_per_epoch: 5, block_confirmations: 0 }
10681050
}
10691051

10701052
fn mocked_provider(asserter: Asserter) -> RootProvider<Ethereum> {
@@ -1076,19 +1058,16 @@ mod tests {
10761058
let scanner = BlockRangeScanner::new();
10771059

10781060
assert_eq!(scanner.blocks_read_per_epoch, DEFAULT_BLOCKS_READ_PER_EPOCH);
1079-
assert_eq!(scanner.reorg_rewind_depth, DEFAULT_REORG_REWIND_DEPTH);
10801061
assert_eq!(scanner.block_confirmations, DEFAULT_BLOCK_CONFIRMATIONS);
10811062
}
10821063

10831064
#[test]
10841065
fn builder_methods_update_configuration() {
10851066
let blocks_read_per_epoch = 42;
1086-
let reorg_rewind_depth = 12;
10871067
let block_confirmations = 7;
10881068

10891069
let scanner = BlockRangeScanner::new()
10901070
.with_blocks_read_per_epoch(blocks_read_per_epoch)
1091-
.with_reorg_rewind_depth(reorg_rewind_depth)
10921071
.with_block_confirmations(block_confirmations);
10931072

10941073
assert_eq!(scanner.blocks_read_per_epoch, blocks_read_per_epoch);

src/event_scanner.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ impl EventScanner {
6565
self
6666
}
6767

68-
/// Sets the depth to rewind when a reorg is detected.
69-
#[must_use]
70-
pub fn with_reorg_rewind_depth(mut self, reorg_rewind_depth: u64) -> Self {
71-
self.block_range_scanner =
72-
self.block_range_scanner.with_reorg_rewind_depth(reorg_rewind_depth);
73-
self
74-
}
75-
7668
/// Configures how many confirmations are required before processing a block (used for reorgs).
7769
#[must_use]
7870
pub fn with_block_confirmations(mut self, block_confirmations: u64) -> Self {

0 commit comments

Comments
 (0)