mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-17 05:13:09 +00:00
chore: debug
This commit is contained in:
parent
c26fe4bdc4
commit
f5c67a5b68
@ -76,7 +76,17 @@ proc serialize*(
|
||||
return output
|
||||
|
||||
proc serialize*(witness: RLNWitnessInput): seq[byte] =
|
||||
## Serializes the witness into a byte array according to the RLN protocol format
|
||||
## Serializes the RLN witness into a byte array following zerokit's expected format.
|
||||
## The serialized format includes:
|
||||
## - identity_secret (32 bytes, little-endian with zero padding)
|
||||
## - user_message_limit (32 bytes, little-endian with zero padding)
|
||||
## - message_id (32 bytes, little-endian with zero padding)
|
||||
## - merkle tree depth (8 bytes, little-endian) = path_elements.len / 32
|
||||
## - path_elements (each 32 bytes, ordered bottom-to-top)
|
||||
## - merkle tree depth again (8 bytes, little-endian)
|
||||
## - identity_path_index (sequence of bits as bytes, 0 = left, 1 = right)
|
||||
## - x (32 bytes, little-endian with zero padding)
|
||||
## - external_nullifier (32 bytes, little-endian with zero padding)
|
||||
var buffer: seq[byte]
|
||||
buffer.add(@(witness.identity_secret))
|
||||
buffer.add(@(witness.user_message_limit))
|
||||
|
||||
@ -4,7 +4,7 @@ import
|
||||
../protocol_metrics,
|
||||
../constants,
|
||||
../rln
|
||||
import options, chronos, results, std/[deques, sequtils], chronicles
|
||||
import options, chronos, results, std/[deques, sequtils]
|
||||
|
||||
export options, chronos, results, protocol_types, protocol_metrics, deques
|
||||
|
||||
|
||||
@ -27,9 +27,6 @@ export group_manager_base
|
||||
logScope:
|
||||
topics = "waku rln_relay onchain_group_manager"
|
||||
|
||||
type UInt40* = StUint[40]
|
||||
type UInt32* = StUint[32]
|
||||
|
||||
# using the when predicate does not work within the contract macro, hence need to dupe
|
||||
contract(WakuRlnContract):
|
||||
# this serves as an entrypoint into the rln membership set
|
||||
|
||||
@ -52,17 +52,19 @@ type RateLimitProof* = object
|
||||
## the external nullifier used for the generation of the `proof` (derived from poseidon([epoch, rln_identifier]))
|
||||
externalNullifier*: ExternalNullifier
|
||||
|
||||
type
|
||||
Fr = array[32, byte] # Field element representation (256 bits)
|
||||
type UInt40* = StUint[40]
|
||||
type UInt32* = StUint[32]
|
||||
|
||||
type
|
||||
Field = array[32, byte] # Field element representation (256 bits)
|
||||
RLNWitnessInput* = object
|
||||
identity_secret*: Fr
|
||||
user_message_limit*: Fr
|
||||
message_id*: Fr
|
||||
identity_secret*: Field
|
||||
user_message_limit*: Field
|
||||
message_id*: Field
|
||||
path_elements*: seq[byte]
|
||||
identity_path_index*: seq[byte]
|
||||
x*: Fr
|
||||
external_nullifier*: Fr
|
||||
x*: Field
|
||||
external_nullifier*: Field
|
||||
|
||||
type ProofMetadata* = object
|
||||
nullifier*: Nullifier
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user