@@ -34,6 +34,13 @@ pub const CHANNELS: U256 = U256::from_limbs([3, 0, 0, 0]);
3434pub const PACKETS : U256 = U256 :: from_limbs ( [ 4 , 0 , 0 , 0 ] ) ;
3535pub const PACKET_ACKS : U256 = U256 :: from_limbs ( [ 5 , 0 , 0 , 0 ] ) ;
3636
37+ #[ cfg( feature = "ethabi" ) ]
38+ #[ must_use]
39+ pub fn commit_packets ( packets : & [ Packet ] ) -> H256 {
40+ use alloy_sol_types:: SolValue ;
41+ keccak256 ( packets. abi_encode ( ) )
42+ }
43+
3744#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Enumorph ) ]
3845#[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
3946#[ cfg_attr(
@@ -193,9 +200,8 @@ impl BatchReceiptsPath {
193200 #[ cfg( feature = "ethabi" ) ]
194201 #[ must_use]
195202 pub fn from_packets ( packets : & [ Packet ] ) -> Self {
196- use alloy_sol_types:: SolValue ;
197203 Self {
198- batch_hash : keccak256 ( packets. abi_encode ( ) ) ,
204+ batch_hash : commit_packets ( packets) ,
199205 }
200206 }
201207
@@ -261,3 +267,4 @@ fn connection_key() {
261267 dbg ! ( ConnectionPath { connection_id: 4 } . key( ) ) ;
262268 dbg ! ( ConnectionPath { connection_id: 5 } . key( ) ) ;
263269}
270+
0 commit comments