diff --git a/cairo-contracts/packages/core/src/commitment/types.cairo b/cairo-contracts/packages/core/src/commitment/types.cairo index c1b8efd49..4d40448d7 100644 --- a/cairo-contracts/packages/core/src/commitment/types.cairo +++ b/cairo-contracts/packages/core/src/commitment/types.cairo @@ -52,7 +52,9 @@ pub fn compute_packet_commitment( json_packet_data: @ByteArray, timeout_height: Height, timeout_timestamp: Timestamp ) -> Commitment { let mut coll = U32CollectorImpl::init(); - coll.extend(timeout_timestamp); + // ibc-go uses nanosecs + // https://github.com/cosmos/ibc-go/blob/98d7e7550a23ecf8d96ce042ab11ef857b184f2a/proto/ibc/core/channel/v1/channel.proto#L179-L180 + coll.extend(timeout_timestamp.timestamp * 1_000_000_000); coll.extend(timeout_height); coll.extend_from_chunk(compute_sha256_byte_array(json_packet_data)); compute_sha256_u32_array(coll.value(), 0, 0).into() diff --git a/cairo-contracts/packages/core/src/tests/commitment.cairo b/cairo-contracts/packages/core/src/tests/commitment.cairo index d785731f4..c7b3fc8b7 100644 --- a/cairo-contracts/packages/core/src/tests/commitment.cairo +++ b/cairo-contracts/packages/core/src/tests/commitment.cairo @@ -52,7 +52,7 @@ fn test_array_u8_into_array_u32() { fn test_compute_packet_commitment() { let commitment = PACKET_COMMITMENT_ON_SN(ERC20()); let expected: [u32; 8] = [ - 3458244073, 1576048754, 4210798310, 1002247062, 2365181318, 2763927782, 545147151, 944653547 + 1561496803, 591083406, 1958596266, 2480824962, 846563094, 2634790765, 145282158, 2139799705 ]; assert_eq!(commitment, expected.into()); }