Selaa lähdekoodia

Revert "chore: updated blake3 init usage"

This reverts commit d8f4529c726955fccf90031caf71fd66b93c61d9.
x 8 kuukautta sitten
vanhempi
sitoutus
a8ead9e5ea

+ 1 - 1
bin/explorer/explorerd/src/service/blocks.rs

@@ -91,7 +91,7 @@ impl From<&BlockInfo> for BlockRecord {
             timestamp: block.header.timestamp,
             nonce: block.header.nonce,
             transactions_root: block.header.transactions_root.to_string(),
-            state_root: blake3::hash(&block.header.state_root).to_string(),
+            state_root: blake3::Hash::from_bytes(block.header.state_root).to_string(),
             pow_data: format!("{:?}", block.header.pow_data),
             signature: block.signature,
         }

+ 2 - 2
src/blockchain/header_store.rs

@@ -60,7 +60,7 @@ impl HeaderHash {
     }
 
     pub fn as_string(&self) -> String {
-        blake3::hash(&self.0).to_string()
+        blake3::Hash::from_bytes(self.0).to_string()
     }
 
     pub fn as_slice(&self) -> &[u8] {
@@ -186,7 +186,7 @@ impl fmt::Display for Header {
             "Transactions Root",
             self.transactions_root,
             "State Root",
-            blake3::hash(&self.state_root),
+            blake3::Hash::from_bytes(self.state_root),
             "Proof of Work data",
             self.pow_data,
         );

+ 1 - 1
src/sdk/src/tx.rs

@@ -47,7 +47,7 @@ impl TransactionHash {
     }
 
     pub fn as_string(&self) -> String {
-        blake3::hash(&self.0).to_string()
+        blake3::Hash::from_bytes(self.0).to_string()
     }
 }
 

+ 6 - 6
src/validator/consensus.rs

@@ -660,8 +660,8 @@ impl Consensus {
         let last_block_state_root = self.blockchain.last_header()?.state_root;
         if state_root != last_block_state_root {
             return Err(Error::ContractsStatesRootError(
-                blake3::hash(&state_root).to_string(),
-                blake3::hash(&last_block_state_root).to_string(),
+                blake3::Hash::from_bytes(state_root).to_string(),
+                blake3::Hash::from_bytes(last_block_state_root).to_string(),
             ));
         }
 
@@ -952,8 +952,8 @@ impl Fork {
         };
         if state_root != fork_state_root {
             return Err(Error::ContractsStatesRootError(
-                blake3::hash(&state_root).to_string(),
-                blake3::hash(&fork_state_root).to_string(),
+                blake3::Hash::from_bytes(state_root).to_string(),
+                blake3::Hash::from_bytes(fork_state_root).to_string(),
             ));
         }
 
@@ -961,8 +961,8 @@ impl Fork {
         let last_block_state_root = self.last_proposal()?.block.header.state_root;
         if state_root != last_block_state_root {
             return Err(Error::ContractsStatesRootError(
-                blake3::hash(&state_root).to_string(),
-                blake3::hash(&last_block_state_root).to_string(),
+                blake3::Hash::from_bytes(state_root).to_string(),
+                blake3::Hash::from_bytes(last_block_state_root).to_string(),
             ));
         }
 

+ 6 - 6
src/validator/verification.rs

@@ -122,8 +122,8 @@ pub async fn verify_genesis_block(
     };
     if state_root != block.header.state_root {
         return Err(Error::ContractsStatesRootError(
-            blake3::hash(&state_root).to_string(),
-            blake3::hash(&block.header.state_root).to_string(),
+            blake3::Hash::from_bytes(state_root).to_string(),
+            blake3::Hash::from_bytes(block.header.state_root).to_string(),
         ));
     }
 
@@ -269,8 +269,8 @@ pub async fn verify_block(
     };
     if state_root != block.header.state_root {
         return Err(Error::ContractsStatesRootError(
-            blake3::hash(&state_root).to_string(),
-            blake3::hash(&block.header.state_root).to_string(),
+            blake3::Hash::from_bytes(state_root).to_string(),
+            blake3::Hash::from_bytes(block.header.state_root).to_string(),
         ));
     }
 
@@ -347,8 +347,8 @@ pub async fn verify_checkpoint_block(
     };
     if state_root != block.header.state_root {
         return Err(Error::ContractsStatesRootError(
-            blake3::hash(&state_root).to_string(),
-            blake3::hash(&block.header.state_root).to_string(),
+            blake3::Hash::from_bytes(state_root).to_string(),
+            blake3::Hash::from_bytes(block.header.state_root).to_string(),
         ));
     }