Skip to content

Commit 6fd7bf4

Browse files
committed
1 parent c694d33 commit 6fd7bf4

File tree

11 files changed

+81
-61
lines changed

11 files changed

+81
-61
lines changed

src/chainspec/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ impl BerachainChainSpec {
119119
// We filter out TTD-based forks w/o a pre-known block since those do not show up in
120120
// the fork filter.
121121
Some(match condition {
122-
ForkCondition::Block(block) |
123-
ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block),
122+
ForkCondition::Block(block)
123+
| ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block),
124124
ForkCondition::Timestamp(time) => ForkFilterKey::Time(time),
125125
_ => return None,
126126
})
@@ -152,8 +152,8 @@ impl BerachainChainSpec {
152152
for (_, cond) in self.inner.hardforks.forks_iter() {
153153
// handle block based forks and the sepolia merge netsplit block edge case (TTD
154154
// ForkCondition with Some(block))
155-
if let ForkCondition::Block(block) |
156-
ForkCondition::TTD { fork_block: Some(block), .. } = cond
155+
if let ForkCondition::Block(block)
156+
| ForkCondition::TTD { fork_block: Some(block), .. } = cond
157157
{
158158
if head.number >= block {
159159
// skip duplicated hardforks: hardforks enabled at genesis block
@@ -550,8 +550,8 @@ impl From<Genesis> for BerachainChainSpec {
550550
}
551551

552552
// Validate Prague3 ordering if configured (Prague3 must come at or after Prague2)
553-
if let Some(prague3_config) = prague3_config_opt.as_ref() &&
554-
prague3_config.time < prague2_config.time
553+
if let Some(prague3_config) = prague3_config_opt.as_ref()
554+
&& prague3_config.time < prague2_config.time
555555
{
556556
panic!(
557557
"Prague3 hardfork must activate at or after Prague2 hardfork. Prague2 time: {}, Prague3 time: {}.",

src/consensus/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ impl FullConsensus<BerachainPrimitives> for BerachainBeaconConsensus {
135135
for receipt in &result.receipts {
136136
for log in &receipt.logs {
137137
// Check if this is a Transfer event (first topic is the event signature)
138-
if log.topics().first() == Some(&TRANSFER_EVENT_SIGNATURE) &&
139-
log.topics().len() >= 3
138+
if log.topics().first() == Some(&TRANSFER_EVENT_SIGNATURE)
139+
&& log.topics().len() >= 3
140140
{
141141
// Transfer event has indexed from (topics[1]) and to (topics[2]) addresses
142142
let from_addr = Address::from_word(log.topics()[1]);
143143
let to_addr = Address::from_word(log.topics()[2]);
144144

145145
// Check if BEX vault is involved in the transfer (block all BEX vault
146146
// transfers)
147-
if let Some(bex_vault) = bex_vault_address &&
148-
(from_addr == bex_vault || to_addr == bex_vault)
147+
if let Some(bex_vault) = bex_vault_address
148+
&& (from_addr == bex_vault || to_addr == bex_vault)
149149
{
150150
return Err(ConsensusError::Other(
151151
BerachainExecutionError::Prague3BexVaultTransfer {
@@ -197,8 +197,8 @@ impl FullConsensus<BerachainPrimitives> for BerachainBeaconConsensus {
197197
for log in &receipt.logs {
198198
// Check if this log is from the BEX vault and is an InternalBalanceChanged
199199
// event
200-
if log.address == bex_vault_address &&
201-
log.topics().first() == Some(&INTERNAL_BALANCE_CHANGED_SIGNATURE)
200+
if log.address == bex_vault_address
201+
&& log.topics().first() == Some(&INTERNAL_BALANCE_CHANGED_SIGNATURE)
202202
{
203203
return Err(ConsensusError::Other(
204204
BerachainExecutionError::Prague3BexVaultEvent {

src/engine/validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ where
162162
payload_or_attrs: PayloadOrAttributes<'_, Types::ExecutionData, Types::PayloadAttributes>,
163163
) -> Result<(), EngineObjectValidationError> {
164164
// Validate execution requests if present in the payload
165-
if let PayloadOrAttributes::ExecutionPayload(payload) = &payload_or_attrs &&
166-
let Some(requests) = payload.sidecar.requests()
165+
if let PayloadOrAttributes::ExecutionPayload(payload) = &payload_or_attrs
166+
&& let Some(requests) = payload.sidecar.requests()
167167
{
168168
validate_execution_requests(requests)?;
169169
}

src/evm/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,14 @@ mod tests {
403403
assert!(result_without_tracer.is_ok());
404404

405405
// Both should have gas_used = 0
406-
if let Ok(result) = &result_with_tracer &&
407-
let ExecutionResult::Success { gas_used, .. } = &result.result
406+
if let Ok(result) = &result_with_tracer
407+
&& let ExecutionResult::Success { gas_used, .. } = &result.result
408408
{
409409
assert_eq!(*gas_used, 0);
410410
}
411411

412-
if let Ok(result) = &result_without_tracer &&
413-
let ExecutionResult::Success { gas_used, .. } = &result.result
412+
if let Ok(result) = &result_without_tracer
413+
&& let ExecutionResult::Success { gas_used, .. } = &result.result
414414
{
415415
assert_eq!(*gas_used, 0);
416416
}

src/genesis/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ impl TryFrom<&OtherFields> for BerachainGenesisConfig {
9898
(Some(prague1_config), Some(prague2_config)) => {
9999
// Both configured - validate Prague2 comes at or after Prague1
100100
if prague2_config.time < prague1_config.time {
101-
return Err(BerachainConfigError::InvalidConfig(serde_json::Error::io(
102-
std::io::Error::new(
101+
return Err(BerachainConfigError::InvalidConfig(
102+
serde_json::Error::io(std::io::Error::new(
103103
std::io::ErrorKind::InvalidData,
104104
"Prague2 hardfork must activate at or after Prague1 hardfork",
105-
),
106-
)));
105+
)),
106+
));
107107
}
108108
}
109109
_ => {

src/hardforks/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub trait BerachainHardforks: EthereumHardforks {
3434
/// Checks if Prague3 hardfork is active at given timestamp
3535
/// Prague3 is active between its activation time and Prague4 activation
3636
fn is_prague3_active_at_timestamp(&self, timestamp: u64) -> bool {
37-
self.berachain_fork_activation(BerachainHardfork::Prague3).active_at_timestamp(timestamp) &&
38-
!self.is_prague4_active_at_timestamp(timestamp)
37+
self.berachain_fork_activation(BerachainHardfork::Prague3).active_at_timestamp(timestamp)
38+
&& !self.is_prague4_active_at_timestamp(timestamp)
3939
}
4040

4141
/// Checks if Prague4 hardfork is active at given timestamp

src/pool/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ where
3939
) -> eyre::Result<Self::Pool> {
4040
let pool_config = ctx.pool_config();
4141

42-
let blobs_disabled = ctx.config().txpool.disable_blobs_support ||
43-
ctx.config().txpool.blobpool_max_count == 0;
42+
let blobs_disabled = ctx.config().txpool.disable_blobs_support
43+
|| ctx.config().txpool.blobpool_max_count == 0;
4444

4545
let blob_cache_size = if let Some(blob_cache_size) = pool_config.blob_cache_size {
4646
Some(blob_cache_size)

src/rpc/api.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ impl TransactionBuilder<BerachainNetwork> for TransactionRequest {
226226
}
227227

228228
fn can_submit(&self) -> bool {
229-
self.from.is_some() &&
230-
self.to.is_some() &&
231-
self.gas.is_some() &&
232-
(self.gas_price.is_some() || self.max_fee_per_gas.is_some())
229+
self.from.is_some()
230+
&& self.to.is_some()
231+
&& self.gas.is_some()
232+
&& (self.gas_price.is_some() || self.max_fee_per_gas.is_some())
233233
}
234234

235235
fn can_build(&self) -> bool {
236-
self.to.is_some() &&
237-
self.gas.is_some() &&
238-
(self.gas_price.is_some() || self.max_fee_per_gas.is_some())
236+
self.to.is_some()
237+
&& self.gas.is_some()
238+
&& (self.gas_price.is_some() || self.max_fee_per_gas.is_some())
239239
}
240240

241241
fn output_tx_type(&self) -> <BerachainNetwork as Network>::TxType {

src/rpc/receipt.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,24 @@ impl BerachainReceiptEnvelope {
7474
/// Returns inner receipt reference
7575
pub const fn as_receipt(&self) -> &Receipt<alloy_rpc_types_eth::Log> {
7676
match self {
77-
Self::Legacy(receipt) |
78-
Self::Eip2930(receipt) |
79-
Self::Eip1559(receipt) |
80-
Self::Eip4844(receipt) |
81-
Self::Eip7702(receipt) |
82-
Self::Berachain(receipt) => &receipt.receipt,
77+
Self::Legacy(receipt)
78+
| Self::Eip2930(receipt)
79+
| Self::Eip1559(receipt)
80+
| Self::Eip4844(receipt)
81+
| Self::Eip7702(receipt)
82+
| Self::Berachain(receipt) => &receipt.receipt,
8383
}
8484
}
8585

8686
/// Returns the bloom filter for this receipt
8787
pub const fn bloom(&self) -> &Bloom {
8888
match self {
89-
Self::Legacy(receipt) |
90-
Self::Eip2930(receipt) |
91-
Self::Eip1559(receipt) |
92-
Self::Eip4844(receipt) |
93-
Self::Eip7702(receipt) |
94-
Self::Berachain(receipt) => &receipt.logs_bloom,
89+
Self::Legacy(receipt)
90+
| Self::Eip2930(receipt)
91+
| Self::Eip1559(receipt)
92+
| Self::Eip4844(receipt)
93+
| Self::Eip7702(receipt)
94+
| Self::Berachain(receipt) => &receipt.logs_bloom,
9595
}
9696
}
9797
}

src/transaction/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ impl PoLTx {
138138
}
139139

140140
fn rlp_payload_length(&self) -> usize {
141-
self.chain_id.length() +
142-
self.from.length() +
143-
self.to.length() +
144-
self.nonce.length() +
145-
self.gas_limit.length() +
146-
self.gas_price.length() +
147-
self.input.length()
141+
self.chain_id.length()
142+
+ self.from.length()
143+
+ self.to.length()
144+
+ self.nonce.length()
145+
+ self.gas_limit.length()
146+
+ self.gas_price.length()
147+
+ self.input.length()
148148
}
149149

150150
fn rlp_encoded_length(&self) -> usize {

0 commit comments

Comments
 (0)