Skip to content

Commit

Permalink
Fix trailing semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
acerone85 committed Sep 13, 2024
1 parent 87efdde commit 17a7144
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
50 changes: 25 additions & 25 deletions crates/services/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ where
.ok_or(ExecutorError::PreviousBlockIsNotFound)?;
let previous_da_height = prev_block_header.header().da_height;
let Some(next_unprocessed_da_height) = previous_da_height.0.checked_add(1) else {
return Err(ExecutorError::DaHeightExceededItsLimit);
return Err(ExecutorError::DaHeightExceededItsLimit)
};

let mut root_calculator = MerkleRootCalculator::new();
Expand All @@ -851,14 +851,14 @@ where
match event {
Event::Message(message) => {
if message.da_height() != da_height {
return Err(ExecutorError::RelayerGivesIncorrectMessages);
return Err(ExecutorError::RelayerGivesIncorrectMessages)
}
block_storage_tx
.storage_as_mut::<Messages>()
.insert(message.nonce(), &message)?;
execution_data
.events
.push(ExecutorEvent::MessageImported(message));
.push(ExecutorEvent::MessageImported(message))
}
Event::Transaction(relayed_tx) => {
let id = relayed_tx.id();
Expand Down Expand Up @@ -956,7 +956,7 @@ where
return Err(ForcedTransactionFailure::InsufficientMaxGas {
claimed_max_gas,
actual_max_gas,
});
})
}
Ok(())
}
Expand Down Expand Up @@ -1039,7 +1039,7 @@ where

fn check_mint_is_not_found(execution_data: &ExecutionData) -> ExecutorResult<()> {
if execution_data.found_mint {
return Err(ExecutorError::MintIsNotLastTransaction);
return Err(ExecutorError::MintIsNotLastTransaction)
}
Ok(())
}
Expand All @@ -1055,7 +1055,7 @@ where
.storage::<ProcessedTransactions>()
.contains_key(tx_id)?
{
return Err(ExecutorError::TransactionIdCollision(*tx_id));
return Err(ExecutorError::TransactionIdCollision(*tx_id))
}
Ok(())
}
Expand Down Expand Up @@ -1202,14 +1202,14 @@ where

fn check_mint_amount(mint: &Mint, expected_amount: u64) -> ExecutorResult<()> {
if *mint.mint_amount() != expected_amount {
return Err(ExecutorError::CoinbaseAmountMismatch);
return Err(ExecutorError::CoinbaseAmountMismatch)
}
Ok(())
}

fn check_gas_price(mint: &Mint, expected_gas_price: Word) -> ExecutorResult<()> {
if *mint.gas_price() != expected_gas_price {
return Err(ExecutorError::CoinbaseGasPriceMismatch);
return Err(ExecutorError::CoinbaseGasPriceMismatch)
}
Ok(())
}
Expand All @@ -1219,14 +1219,14 @@ where
execution_data: &ExecutionData,
) -> ExecutorResult<()> {
if checked_mint.transaction().tx_pointer().tx_index() != execution_data.tx_count {
return Err(ExecutorError::MintHasUnexpectedIndex);
return Err(ExecutorError::MintHasUnexpectedIndex)
}
Ok(())
}

fn verify_mint_for_empty_contract(mint: &Mint) -> ExecutorResult<()> {
if *mint.mint_amount() != 0 {
return Err(ExecutorError::CoinbaseAmountMismatch);
return Err(ExecutorError::CoinbaseAmountMismatch)
}

let input = input::contract::Contract {
Expand All @@ -1242,7 +1242,7 @@ where
state_root: Bytes32::zeroed(),
};
if mint.input_contract() != &input || mint.output_contract() != &output {
return Err(ExecutorError::MintMismatch);
return Err(ExecutorError::MintMismatch)
}
Ok(())
}
Expand Down Expand Up @@ -1273,7 +1273,7 @@ where
.replace(&coinbase_id, &())?
.is_some()
{
return Err(ExecutorError::TransactionIdCollision(coinbase_id));
return Err(ExecutorError::TransactionIdCollision(coinbase_id))
}
Ok(tx)
}
Expand Down Expand Up @@ -1333,12 +1333,12 @@ where
let Input::Contract(input) = core::mem::take(input) else {
return Err(ExecutorError::Other(
"Input of the `Mint` transaction is not a contract".to_string(),
));
))
};
let Output::Contract(output) = outputs[0] else {
return Err(ExecutorError::Other(
"The output of the `Mint` transaction is not a contract".to_string(),
));
))
};
Ok((input, output))
}
Expand Down Expand Up @@ -1447,7 +1447,7 @@ where
or we added a new predicate inputs.");
return Err(ExecutorError::InvalidTransactionOutcome {
transaction_id: tx_id,
});
})
}
}
}
Expand Down Expand Up @@ -1582,12 +1582,12 @@ where
if !coin.matches_input(input).unwrap_or_default() {
return Err(
TransactionValidityError::CoinMismatch(*utxo_id).into()
);
)
}
} else {
return Err(
TransactionValidityError::CoinDoesNotExist(*utxo_id).into()
);
)
}
}
Input::Contract(contract) => {
Expand All @@ -1598,7 +1598,7 @@ where
return Err(TransactionValidityError::ContractDoesNotExist(
contract.contract_id,
)
.into());
.into())
}
}
Input::MessageCoinSigned(MessageCoinSigned { nonce, .. })
Expand All @@ -1610,18 +1610,18 @@ where
return Err(TransactionValidityError::MessageSpendTooEarly(
*nonce,
)
.into());
.into())
}

if !message.matches_input(input).unwrap_or_default() {
return Err(
TransactionValidityError::MessageMismatch(*nonce).into()
);
)
}
} else {
return Err(
TransactionValidityError::MessageDoesNotExist(*nonce).into()
);
)
}
}
}
Expand Down Expand Up @@ -1716,7 +1716,7 @@ where
for r in receipts {
if let Receipt::ScriptResult { gas_used, .. } = r {
used_gas = *gas_used;
break;
break
}
}

Expand Down Expand Up @@ -1818,7 +1818,7 @@ where
} else {
return Err(ExecutorError::InvalidTransactionOutcome {
transaction_id: tx_id,
});
})
};

let contract = ContractRef::new(db, *contract_id);
Expand Down Expand Up @@ -1938,7 +1938,7 @@ where
} else {
return Err(ExecutorError::TransactionValidity(
TransactionValidityError::InvalidContractInputIndex(utxo_id),
));
))
}
}
Output::Change {
Expand Down Expand Up @@ -2004,7 +2004,7 @@ where
.into();

if db.storage::<Coins>().replace(&utxo_id, &coin)?.is_some() {
return Err(ExecutorError::OutputAlreadyExists);
return Err(ExecutorError::OutputAlreadyExists)
}
execution_data
.events
Expand Down
4 changes: 2 additions & 2 deletions crates/services/producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ where
best: highest,
previous_block: previous_da_height,
}
.into());
.into())
}

if highest == previous_da_height {
return Ok(highest);
return Ok(highest)
}

let next_da_height = previous_da_height.saturating_add(1);
Expand Down
6 changes: 3 additions & 3 deletions crates/services/upgradable-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ where

// If one of the transactions fails, return an error.
if let Some((_, err)) = skipped_transactions.into_iter().next() {
return Err(err);
return Err(err)
}

Ok(tx_status)
Expand Down Expand Up @@ -644,7 +644,7 @@ where
let fuel_core_types::fuel_vm::UploadedBytecode::Completed(bytecode) =
uploaded_bytecode.as_ref()
else {
return Err(UpgradableError::IncompleteUploadedBytecode(bytecode_root));
return Err(UpgradableError::IncompleteUploadedBytecode(bytecode_root))
};

wasmtime::Module::new(&self.engine, bytecode)
Expand All @@ -662,7 +662,7 @@ where
) -> ExecutorResult<wasmtime::Module> {
let guard = self.cached_modules.lock();
if let Some(module) = guard.get(&version) {
return Ok(module.clone());
return Ok(module.clone())
}
drop(guard);

Expand Down

0 comments on commit 17a7144

Please sign in to comment.