File tree Expand file tree Collapse file tree 5 files changed +32
-13
lines changed
batcher/aligned-sdk/src/sdk/aggregation Expand file tree Collapse file tree 5 files changed +32
-13
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,13 @@ impl IsMerkleTreeBackend for Risc0ImageIdAndPubInputs {
4242
4343 fn hash_new_parent ( child_1 : & Self :: Node , child_2 : & Self :: Node ) -> Self :: Node {
4444 let mut hasher = Keccak :: v256 ( ) ;
45- hasher. update ( child_1) ;
46- hasher. update ( child_2) ;
47-
45+ if child_1 < child_2 {
46+ hasher. update ( child_1) ;
47+ hasher. update ( child_2) ;
48+ } else {
49+ hasher. update ( child_2) ;
50+ hasher. update ( child_1) ;
51+ }
4852 let mut hash = [ 0u8 ; 32 ] ;
4953 hasher. finalize ( & mut hash) ;
5054 hash
Original file line number Diff line number Diff line change @@ -39,8 +39,13 @@ impl IsMerkleTreeBackend for SP1VkAndPubInputs {
3939
4040 fn hash_new_parent ( child_1 : & Self :: Node , child_2 : & Self :: Node ) -> Self :: Node {
4141 let mut hasher = Keccak256 :: new ( ) ;
42- hasher. update ( child_1) ;
43- hasher. update ( child_2) ;
42+ if child_1 < child_2 {
43+ hasher. update ( child_1) ;
44+ hasher. update ( child_2) ;
45+ } else {
46+ hasher. update ( child_2) ;
47+ hasher. update ( child_1) ;
48+ }
4449 hasher. finalize ( ) . into ( )
4550 }
4651}
Original file line number Diff line number Diff line change 11{
2- "risc0_image_id" : " 0xb0ce0665805c4219d134845b74be6f1f97ab74dbbc1b341b73af4068d33bc1b0 " ,
3- "sp1_vk_hash" : " 0x0035279b39b0a20aac302dd3c569f3a6324a00acc1b8e864af9e3a5fbf453b69 "
4- }
2+ "risc0_image_id" : " 0x8bb4145379d717fd7e3921751a2060246445ef290cdad782884180861cf0a3e8 " ,
3+ "sp1_vk_hash" : " 0x008ad92d4c564c912ad93d8660bf67a8d2e9088aa942da4e605a5e8c4383c384 "
4+ }
Original file line number Diff line number Diff line change @@ -152,8 +152,13 @@ impl IsMerkleTreeBackend for AlignedProof {
152152
153153 fn hash_new_parent ( child_1 : & Self :: Node , child_2 : & Self :: Node ) -> Self :: Node {
154154 let mut hasher = Keccak256 :: new ( ) ;
155- hasher. update ( child_1) ;
156- hasher. update ( child_2) ;
155+ if child_1 < child_2 {
156+ hasher. update ( child_1) ;
157+ hasher. update ( child_2) ;
158+ } else {
159+ hasher. update ( child_2) ;
160+ hasher. update ( child_1) ;
161+ }
157162 hasher. finalize ( ) . into ( )
158163 }
159164}
Original file line number Diff line number Diff line change @@ -73,11 +73,16 @@ impl IsMerkleTreeBackend for Hash32 {
7373 fn hash_data ( leaf : & Self :: Data ) -> Self :: Node {
7474 leaf. 0
7575 }
76-
76+
7777 fn hash_new_parent ( child_1 : & Self :: Node , child_2 : & Self :: Node ) -> Self :: Node {
7878 let mut hasher = Keccak256 :: new ( ) ;
79- hasher. update ( child_1) ;
80- hasher. update ( child_2) ;
79+ if child_1 < child_2 {
80+ hasher. update ( child_1) ;
81+ hasher. update ( child_2) ;
82+ } else {
83+ hasher. update ( child_2) ;
84+ hasher. update ( child_1) ;
85+ }
8186 hasher. finalize ( ) . into ( )
8287 }
8388}
You can’t perform that action at this time.
0 commit comments