Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
preston-evans98 committed Jun 20, 2023
1 parent d1b095b commit f6e514e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions examples/demo-rollup/src/test_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ fn test_get_events() {
}

fn batch_receipt_without_hasher() -> impl Strategy<Value = BatchReceipt<u32, u32>> {
let mut args: BatchReceiptStrategyArgs = Default::default();
args.hasher = None;
let mut args = BatchReceiptStrategyArgs {
hasher: None,
..Default::default()
};
args.transaction_strategy_args.hasher = None;
any_with::<BatchReceipt<u32, u32>>(args)
}
Expand Down
6 changes: 3 additions & 3 deletions rollup-interface/src/state_machine/crypto/simple_merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ pub trait MerkleHasher {
/// domain-separated RC6962-style merkle trees.
macro_rules! impl_merkle_hasher(
($name:ty) => {
impl crate::crypto::simple_merkle::MerkleHasher for $name {
impl $crate::crypto::simple_merkle::MerkleHasher for $name {
fn empty_root(&mut self) -> [u8; 32] {
<$name as SimpleHasher>::new().finalize()
}

fn leaf_hash(&mut self, bytes: impl AsRef<[u8]>) -> [u8; 32] {
let mut hasher = <$name as SimpleHasher>::new();
hasher.update(&crate::crypto::simple_merkle::DEFAULT_LEAF_DOMAIN_SEPARATOR);
hasher.update(& $crate::crypto::simple_merkle::DEFAULT_LEAF_DOMAIN_SEPARATOR);
hasher.update(bytes.as_ref());
hasher.finalize()
}

fn inner_hash(&mut self, left: &[u8; 32], right: &[u8; 32]) -> [u8; 32] {
let mut hasher = <$name as SimpleHasher>::new();
hasher.update(&crate::crypto::simple_merkle::DEFAULT_INTERNAL_DOMAIN_SEPARATOR);
hasher.update(& $crate::crypto::simple_merkle::DEFAULT_INTERNAL_DOMAIN_SEPARATOR);
hasher.update(left);
hasher.update(right);
hasher.finalize()
Expand Down
4 changes: 2 additions & 2 deletions rollup-interface/src/state_machine/stf/fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait FuzzHasher {

/// The default hasher to use for fuzzing
fn default_fuzz_hasher() -> Box<dyn FuzzHasher> {
Box::new(sha2::Sha256::new())
Box::new(::sha2::Sha256::new())
}

impl<T: SimpleHasher + Clone> FuzzHasher for T {
Expand All @@ -32,7 +32,7 @@ impl<T: SimpleHasher + Clone> FuzzHasher for T {
/// A special merkle hasher used only for fuzz tests. This hasher sacrifices some
/// efficiency for object safety.
struct FuzzMerkleHasher<'a> {
hasher: &'a Box<dyn FuzzHasher>,
hasher: &'a dyn FuzzHasher,
}

impl<'a> MerkleHasher for FuzzMerkleHasher<'a> {
Expand Down

0 comments on commit f6e514e

Please sign in to comment.