From 312169999e717a67b6872d46b83feb6ffb522190 Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Wed, 11 Jun 2025 16:19:55 +0530 Subject: [PATCH] chore: use BE --- tests/waku_rln_relay/test_waku_rln_relay.nim | 11 ++--------- waku/waku_keystore/protocol_types.nim | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/waku_rln_relay/test_waku_rln_relay.nim b/tests/waku_rln_relay/test_waku_rln_relay.nim index d09764ca2..020939d9e 100644 --- a/tests/waku_rln_relay/test_waku_rln_relay.nim +++ b/tests/waku_rln_relay/test_waku_rln_relay.nim @@ -837,26 +837,19 @@ suite "Waku rln relay": msgValidate2 == MessageValidationResult.Valid test "toIDCommitment and toUInt256": - # create an instance of rln - let rlnInstance = createRLNInstanceWrapper() - require: - rlnInstance.isOk() - - let rln = rlnInstance.get() - - # create an idendity credential let idCredentialRes = rln.membershipKeyGen() require: idCredentialRes.isOk() let idCredential = idCredentialRes.get() - # convert the idCommitment to UInt256 + # convert the idCommitment to UInt256 (now using big-endian) let idCUInt = idCredential.idCommitment.toUInt256() # convert the UInt256 back to ICommitment let idCommitment = toIDCommitment(idCUInt) # check that the conversion has not distorted the original value + # This test now expects big-endian round-trip check: idCredential.idCommitment == idCommitment diff --git a/waku/waku_keystore/protocol_types.nim b/waku/waku_keystore/protocol_types.nim index 6cfc2f183..96c19f50e 100644 --- a/waku/waku_keystore/protocol_types.nim +++ b/waku/waku_keystore/protocol_types.nim @@ -26,7 +26,7 @@ type IdentityCredential* = object idCommitment*: IDCommitment proc toUInt256*(idCommitment: IDCommitment): UInt256 = - let pk = UInt256.fromBytesLE(idCommitment) + let pk = UInt256.fromBytesBE(idCommitment) return pk proc toIDCommitment*(idCommitmentUint: UInt256): IDCommitment =