Skip to content

Commit 7dea740

Browse files
committed
fix: typos, clippy
1 parent 5dea87c commit 7dea740

File tree

34 files changed

+94
-124
lines changed

34 files changed

+94
-124
lines changed

src/payload/ext/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub trait BlockExt<P: Platform>: super::sealed::Sealed {
3535
/// Address of the fees recipient for the block.
3636
fn coinbase(&self) -> Address;
3737

38-
/// Returns the balance of the given address at the begining of the block
38+
/// Returns the balance of the given address at the beginning of the block
3939
/// before any transactions are executed.
4040
fn balance_of(&self, address: Address) -> ProviderResult<U256>;
4141
}
@@ -101,7 +101,7 @@ impl<P: Platform> BlockExt<P> for BlockContext<P> {
101101
self.attributes().suggested_fee_recipient()
102102
}
103103

104-
/// Returns the balance of the given address at the begining of the block
104+
/// Returns the balance of the given address at the beginning of the block
105105
/// before any transactions are executed.
106106
fn balance_of(&self, address: Address) -> ProviderResult<U256> {
107107
self

src/payload/ext/checkpoint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub trait CheckpointExt<P: Platform>: super::sealed::Sealed {
7777
history.take(immutable_prefix + 1)
7878
}
7979

80-
/// Creates a new span that includes this checkpoints and all other
80+
/// Creates a new span that includes this checkpoint and all other
8181
/// checkpoints that are between this checkpoint and the given checkpoint.
8282
///
8383
/// The two checkpoints must be part of the same linear history, meaning that
@@ -185,7 +185,7 @@ impl<P: Platform> CheckpointExt<P> for Checkpoint<P> {
185185
.expect("history is always linear between self and root")
186186
}
187187

188-
/// Creates a new span that includes this checkpoints and all other
188+
/// Creates a new span that includes this checkpoint and all other
189189
/// checkpoints that are between this checkpoint and the given checkpoint.
190190
///
191191
/// The two checkpoints must be part of the same linear history, meaning that

src/payload/ext/span.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait SpanExt<P: Platform>: super::sealed::Sealed {
1717

1818
/// Checks if this span contains a checkpoint with a transaction with a given
1919
/// hash.
20-
fn contains(&self, txhash: impl Into<TxHash>) -> bool;
20+
fn contains(&self, tx_hash: impl Into<TxHash>) -> bool;
2121

2222
/// Iterates of all transactions in the span in chronological order as they
2323
/// appear in the payload under construction.
@@ -56,8 +56,8 @@ pub trait SpanExt<P: Platform>: super::sealed::Sealed {
5656
impl<P: Platform> SpanExt<P> for Span<P> {
5757
/// Checks if this span contains a checkpoint with a transaction with a given
5858
/// hash.
59-
fn contains(&self, txhash: impl Into<TxHash>) -> bool {
60-
let hash = txhash.into();
59+
fn contains(&self, tx_hash: impl Into<TxHash>) -> bool {
60+
let hash = tx_hash.into();
6161
self.iter().any(|checkpoint| {
6262
checkpoint
6363
.transactions()

src/payload/span.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub enum Error {
2222
///
2323
/// A span can be used as a database reference for an evm instance. When a span
2424
/// is used as a database, only new state that was created or modified by
25-
/// checkpoints in the span are visible, any state from checkpoints outside of
25+
/// checkpoints in the span are visible, any state from checkpoints outside
2626
/// the span or the base state of the block is not available.
2727
#[derive(Clone)]
2828
pub struct Span<P: Platform> {
@@ -78,9 +78,9 @@ impl<P: Platform> Span<P> {
7878
checkpoints.push(prev.clone());
7979

8080
if prev == ancestor {
81-
// we've reached the ancestor checkpoint and we have linear history. The
82-
// collected checkpoints are in reverse order, so we need to reverse
83-
// them before returning.
81+
// we've reached the ancestor checkpoint, and we have linear history.
82+
// The collected checkpoints are in reverse order, so we need to
83+
// reverse them before returning.
8484
return Ok(Self {
8585
checkpoints: checkpoints.into_iter().rev().collect(),
8686
});

src/pipelines/events.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ use {
1010
/// pipeline.
1111
///
1212
/// Notes:
13-
/// - In a pipeline with nested pipelines, the top-level pipline's event bus is
14-
/// responsible for handling all events of all contained pipelines and steps.
13+
/// - In a pipeline with nested pipelines, the top-level pipeline's event bus
14+
/// is responsible for handling all events of all contained pipelines and
15+
/// steps.
1516
#[derive(Default, Debug)]
1617
pub(super) struct EventsBus<P: Platform> {
1718
publishers: DashMap<TypeId, Sender<Arc<dyn Any + Send + Sync>>>,

src/pipelines/exec/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type PipelineOutput<P: Platform> =
3333

3434
/// This type is responsible for executing a single run of a pipeline.
3535
///
36-
/// It's execution is driven by the future poll that it implements. Each call to
36+
/// The execution is driven by the future poll that it implements. Each call to
3737
/// `poll` will run one step of the pipeline at a time, or parts of a step if
3838
/// the step is async and needs many polls before it completes. The executor
3939
/// future will resolve when the whole pipeline has been executed, or when an
@@ -123,7 +123,7 @@ impl<P: Platform, Provider: traits::ProviderBounds<P>>
123123
impl<P: Platform, Provider: traits::ProviderBounds<P>>
124124
PipelineExecutor<P, Provider>
125125
{
126-
/// This method creates a future that encapsulates the execution an an async
126+
/// This method creates a future that encapsulates the execution as an async
127127
/// step. The created future will be held inside `Cursor::StepInProgress` and
128128
/// polled until it resolves.
129129
///
@@ -243,7 +243,7 @@ impl<P: Platform, Provider: traits::ProviderBounds<P>>
243243

244244
async move {
245245
// invoke the `after_job` method of each step in the pipeline
246-
// if any of them failes we fail the pipeline execution, othwerwise
246+
// if any of them fails, we fail the pipeline execution, otherwise
247247
// we return the output of the pipeline.
248248
for step in pipeline.iter_steps() {
249249
let navi = step.navigator(&pipeline).expect(
@@ -279,7 +279,7 @@ where
279279
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
280280
let executor = self.get_mut();
281281

282-
// The executor has not ran any steps yet, it is invoking the `before_job`
282+
// The executor has not run any steps yet, it is invoking the `before_job`
283283
// method of each step in the pipeline.
284284
if let Cursor::Initializing(ref mut future) = executor.cursor {
285285
if let Poll::Ready(output) = future.as_mut().poll_unpin(cx) {
@@ -404,7 +404,7 @@ enum Cursor<P: Platform> {
404404

405405
/// The pipeline is currently initializing all steps for a new payload job.
406406
///
407-
/// This happens once before any step is executed and it calls the
407+
/// This happens once before any step is executed, and it calls the
408408
/// `before_job` method of each step in the pipeline.
409409
Initializing(
410410
Pin<
@@ -419,8 +419,8 @@ enum Cursor<P: Platform> {
419419
Finalizing(Pin<Box<dyn Future<Output = PipelineOutput<P>> + Send>>),
420420

421421
/// The pipeline is currently preparing to execute the next step.
422-
/// We are in this state only for a brief moment inside the `poll` method
423-
/// and it will never be seen by the `run_step` method.
422+
/// We are in this state only for a brief moment inside the `poll` method, and
423+
/// it will never be seen by the `run_step` method.
424424
PreparingStep,
425425
}
426426

src/pipelines/exec/navi.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl StepPath {
7979
self.depth() == 1
8080
}
8181

82-
/// Returns `true` the the path is pointing to a prologue of a pipeline.
82+
/// Returns `true` if the path is pointing to a prologue of a pipeline.
8383
pub(crate) fn is_prologue(&self) -> bool {
8484
self.leaf() == PROLOGUE_INDEX
8585
}
@@ -426,11 +426,11 @@ impl<'a, P: Platform> StepNavigator<'a, P> {
426426
let is_last = position + 1 >= enclosing_pipeline.steps().len();
427427

428428
match (self.behavior(), is_last) {
429-
(Behavior::Loop, true) => {
429+
(Loop, true) => {
430430
// we are the last step in a loop pipeline, go to first step.
431431
Self(self.0.replace_leaf(STEP0_INDEX), self.1.clone()).enter()
432432
}
433-
(Behavior::Once, true) => {
433+
(Once, true) => {
434434
// we are last step in a non-loop pipeline, this is the end of a
435435
// single iteration loop.
436436
self.after_loop()
@@ -469,7 +469,7 @@ impl<P: Platform> StepNavigator<'_, P> {
469469
fn behavior(&self) -> Behavior {
470470
// top-level pipelines are always `Once`.
471471
if self.0.is_toplevel() {
472-
return Behavior::Once;
472+
return Once;
473473
}
474474

475475
// to identify the behavior of the pipeline that contains the current step
@@ -560,7 +560,7 @@ impl<P: Platform> StepNavigator<'_, P> {
560560
}
561561
}
562562

563-
/// Finds the next step to run afer the prologue of the current pipeline.
563+
/// Finds the next step to run after the prologue of the current pipeline.
564564
fn after_prologue(self) -> Option<Self> {
565565
if self.pipeline().steps().is_empty() {
566566
// no steps, go to epilogue.
@@ -583,8 +583,8 @@ impl<P: Platform> StepNavigator<'_, P> {
583583
// is last step in the enclosing pipeline?
584584
if step_index + 1 >= enclosing_pipeline.steps().len() {
585585
match ancestor.behavior() {
586-
Behavior::Loop => ancestor.after_prologue(),
587-
Behavior::Once => ancestor.after_loop(),
586+
Loop => ancestor.after_prologue(),
587+
Once => ancestor.after_loop(),
588588
}
589589
} else {
590590
// there are more items in the enclosing pipeline, so we can just
@@ -681,7 +681,7 @@ mod test {
681681
Pipeline::<Ethereum>::default().with_step(Step1),
682682
StepPath::step0(),
683683
// name autogenerated from source location
684-
vec![format!("navi_{}", (line!() - 3))]
684+
vec![format!("navi_{}", line!() - 3)]
685685
);
686686

687687
// one step with prologue
@@ -773,17 +773,17 @@ mod test {
773773
.with_step(Step2)
774774
.with_step(Step3);
775775
let navigator = StepNavigator::entrypoint(&pipeline).unwrap();
776-
assert_eq!(navigator.behavior(), Behavior::Once);
776+
assert_eq!(navigator.behavior(), Once);
777777

778778
let pipeline =
779779
Pipeline::<Ethereum>::default().with_pipeline(Loop, (Step1,));
780780
let navigator = StepNavigator::entrypoint(&pipeline).unwrap();
781-
assert_eq!(navigator.behavior(), Behavior::Loop);
781+
assert_eq!(navigator.behavior(), Loop);
782782

783783
let pipeline =
784784
Pipeline::<Ethereum>::default().with_pipeline(Once, (Step1,));
785785
let navigator = StepNavigator::entrypoint(&pipeline).unwrap();
786-
assert_eq!(navigator.behavior(), Behavior::Once);
786+
assert_eq!(navigator.behavior(), Once);
787787
}
788788

789789
#[test]

src/pipelines/exec/scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use {
6161
/// `PipelineExecutor::advance_cursor`.
6262
///
6363
/// Scopes manage:
64-
/// - The metrics name for each pipeline and its nested pipelines
64+
/// - The metrics name for each pipeline and its nested pipelines
6565
/// - Limits calculation and renewal for pipeline steps.
6666
pub(crate) struct RootScope<P: Platform> {
6767
root: RwLock<Scope<P>>,

src/pipelines/job.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use {
3030
///
3131
/// This is a long-running job that will be polled by the CL node until it is
3232
/// resolved. The job future must resolve within 1 second from the moment
33-
/// [`PayloadJob::resolve_kind`] is called with [`PaylodKind::Earliest`].
33+
/// [`PayloadJob::resolve_kind`] is called with [`PayloadKind::Earliest`].
3434
pub(super) struct PayloadJob<P, Provider>
3535
where
3636
P: Platform,
@@ -96,7 +96,7 @@ where
9696
// protocol.
9797
PayloadKind::Earliest => {
9898
debug!(
99-
"Resolving earliest payload for job {}",
99+
"Resolving the earliest payload for job {}",
100100
self.block.attributes().payload_id()
101101
);
102102
(self.fut.clone(), KeepPayloadJobAlive::No)
@@ -120,7 +120,7 @@ where
120120

121121
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
122122
// When the payload job future is polled, we begin executing the pipeline
123-
// production future immediatelly as well, so that the time between the
123+
// production future immediately as well, so that the time between the
124124
// creation of the job and the call to `resolve_kind` is utilized for the
125125
// pipeline execution.
126126
//
@@ -134,15 +134,15 @@ where
134134
return Poll::Ready(Err(e));
135135
}
136136

137-
// On happy paths or in-progress pipielines, keep the future alive. Reth
137+
// On happy paths or in-progress pipelines, keep the future alive. Reth
138138
// will drop it when a payload is resolved.
139139
Poll::Pending
140140
}
141141
}
142142

143143
/// This future wraps the `PipelineExecutor` and is used to poll the
144144
/// internal executor of the pipeline. Once this future is resolved, it
145-
/// can be polled again and will return copie of the resolved payload.
145+
/// can be polled again and will return copy of the resolved payload.
146146
pub(super) struct ExecutorFuture<P, Provider>
147147
where
148148
P: Platform,
@@ -154,7 +154,7 @@ where
154154
}
155155

156156
/// This enum allows us to wrap the `PipelineExecutor` future
157-
/// and cache the result of the execution. Also it makes the executor future
157+
/// and cache the result of the execution. Also, it makes the executor future
158158
/// clonable, so that many copies of the future could be returned from
159159
/// `resolve_kind`.
160160
///

src/pipelines/limits.rs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub trait ScopedLimits<P: Platform>: Send + Sync + 'static {
2121
fn create(&self, payload: &Checkpoint<P>, enclosing: &Limits) -> Limits;
2222
}
2323

24-
/// Convinience trait that allows API users to either use a `ScopedLimits` type
24+
/// Convenience trait that allows API users to either use a `ScopedLimits` type
2525
/// or a concrete limits value in [`Pipeline::with_limits`].
2626
pub trait IntoScopedLimits<P: Platform, Marker = ()> {
2727
/// Convert the type into a limits factory.
@@ -105,35 +105,7 @@ impl<T> From<Zero> for ScaleOp<T> {
105105

106106
impl<P: Platform> ScopedLimits<P> for Scaled {
107107
fn create(&self, _: &Checkpoint<P>, enclosing: &Limits) -> Limits {
108-
let mut limits = *enclosing;
109-
110-
if let Some(ref op) = self.gas {
111-
limits.gas_limit = op.apply(limits.gas_limit);
112-
}
113-
114-
if let Some(ref op) = self.deadline {
115-
limits.deadline = op.apply(limits.deadline);
116-
}
117-
118-
if let Some(ref op) = self.max_txs {
119-
limits.max_transactions = op.apply(limits.max_transactions);
120-
}
121-
122-
if let Some(ref op) = self.max_blob_count {
123-
limits.blob_params = limits.blob_params.map(|params| BlobParams {
124-
max_blob_count: op.apply(params.max_blob_count),
125-
..params
126-
});
127-
}
128-
129-
if let Some(ref op) = self.max_blobs_per_tx {
130-
limits.blob_params = limits.blob_params.map(|params| BlobParams {
131-
max_blobs_per_tx: op.apply(params.max_blobs_per_tx),
132-
..params
133-
});
134-
}
135-
136-
limits
108+
self.from(enclosing)
137109
}
138110
}
139111

0 commit comments

Comments
 (0)