22use anyhow:: anyhow;
33use hex;
44use sp_core:: { Hasher , H256 } ;
5+ use subxt:: backend:: legacy:: rpc_methods:: Bytes ;
56use wormhole_circuit:: storage_proof:: ProcessedStorageProof ;
67
7- // Assuming PoseidonHasher is brought into scope from main.rs or lib.rs
8- use crate :: PoseidonHasher ;
8+ use qp_poseidon:: PoseidonHasher ;
99
1010/// Prepares the storage proof for circuit consumption.
1111/// This function attempts to order the proof nodes based on finding child hashes
1212/// within parent nodes using a string search.
1313pub fn prepare_proof_for_circuit (
14- proof : Vec < Vec < u8 > > ,
14+ proof : Vec < Bytes > ,
1515 state_root : H256 ,
1616 last_idx : usize ,
1717) -> anyhow:: Result < ProcessedStorageProof > {
@@ -20,12 +20,12 @@ pub fn prepare_proof_for_circuit(
2020 let mut storage_proof_hex = vec ! [ ] ;
2121
2222 for node_data in proof. iter ( ) {
23- let hash = <PoseidonHasher as Hasher >:: hash ( node_data) ;
23+ let hash = <PoseidonHasher as Hasher >:: hash ( & node_data. 0 ) ;
2424 if hash == state_root {
25- storage_proof_hex. push ( hex:: encode ( node_data) ) ;
25+ storage_proof_hex. push ( hex:: encode ( & node_data. 0 ) ) ;
2626 } else {
2727 hashes. push ( hash) ;
28- bytes_hex. push ( hex:: encode ( node_data) ) ;
28+ bytes_hex. push ( hex:: encode ( & node_data. 0 ) ) ;
2929 }
3030 }
3131
@@ -66,5 +66,5 @@ pub fn prepare_proof_for_circuit(
6666 . map ( hex:: decode)
6767 . collect :: < Result < _ , _ > > ( ) ?;
6868
69- Ok ( ProcessedStorageProof :: new ( final_storage_proof, indices) )
69+ ProcessedStorageProof :: new ( final_storage_proof, indices)
7070}
0 commit comments