mirror of
https://github.com/logos-messaging/go-zerokit-rln.git
synced 2026-01-02 13:13:11 +00:00
chore: add json marshalling annotations
This commit is contained in:
parent
310a9442c4
commit
d338ed9d40
27
rln/types.go
27
rln/types.go
@ -26,32 +26,32 @@ type ZKSNARK = [128]byte
|
||||
type MembershipKeyPair = struct {
|
||||
// user's identity key (a secret key) which is selected randomly
|
||||
// see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
|
||||
IDKey IDKey
|
||||
IDKey IDKey `json:"idKey"`
|
||||
// hash of user's identity key generated by
|
||||
// Poseidon hash function implemented in rln lib
|
||||
// more details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
|
||||
IDCommitment IDCommitment
|
||||
IDCommitment IDCommitment `json:"idCommitment"`
|
||||
}
|
||||
|
||||
type RateLimitProof struct {
|
||||
// RateLimitProof holds the public inputs to rln circuit as
|
||||
// defined in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Public-Inputs
|
||||
// the `proof` field carries the actual zkSNARK proof
|
||||
Proof ZKSNARK
|
||||
Proof ZKSNARK `json:"proof"`
|
||||
// the root of Merkle tree used for the generation of the `proof`
|
||||
MerkleRoot MerkleNode
|
||||
MerkleRoot MerkleNode `json:"root"`
|
||||
// the epoch used for the generation of the `proof`
|
||||
Epoch Epoch
|
||||
Epoch Epoch `json:"epoch"`
|
||||
// shareX and shareY are shares of user's identity key
|
||||
// these shares are created using Shamir secret sharing scheme
|
||||
// see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Linear-Equation-amp-SSS
|
||||
ShareX MerkleNode
|
||||
ShareY MerkleNode
|
||||
ShareX MerkleNode `json:"share_x"`
|
||||
ShareY MerkleNode `json:"share_y"`
|
||||
// nullifier enables linking two messages published during the same epoch
|
||||
// see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Nullifiers
|
||||
Nullifier Nullifier
|
||||
Nullifier Nullifier `json:"nullifier"`
|
||||
// Application specific RLN Identifier
|
||||
RLNIdentifier RLNIdentifier
|
||||
RLNIdentifier RLNIdentifier `json:"rlnIdentifier"`
|
||||
}
|
||||
|
||||
type MembershipIndex = uint
|
||||
@ -66,7 +66,7 @@ func (p ProofMetadata) Equals(p2 ProofMetadata) bool {
|
||||
return bytes.Equal(p.Nullifier[:], p2.Nullifier[:]) && bytes.Equal(p.ShareX[:], p2.ShareX[:]) && bytes.Equal(p.ShareY[:], p2.ShareY[:])
|
||||
}
|
||||
|
||||
// the current implementation of the rln lib only supports a circuit for Merkle tree with depth 32
|
||||
// the current implementation of the rln lib only supports a circuit for Merkle tree with depth 32
|
||||
const MERKLE_TREE_DEPTH int = 20
|
||||
|
||||
// HASH_BIT_SIZE is the size of poseidon hash output in bits
|
||||
@ -80,9 +80,10 @@ const HASH_HEX_SIZE = int(HASH_BIT_SIZE / 8)
|
||||
const STATIC_GROUP_SIZE = 100
|
||||
|
||||
// STATIC_GROUP_KEYS is a static list of 100 membership keys in the form of (identity key, identity commitment)
|
||||
// keys are created locally, using createMembershipList proc from waku_rln_relay_utils module, and the results are hardcoded in here
|
||||
// this list is temporary and is created to test the performance of waku-rln-relay for the static groups
|
||||
// in the later versions, this static hardcoded group will be replaced with a dynamic one
|
||||
//
|
||||
// keys are created locally, using createMembershipList proc from waku_rln_relay_utils module, and the results are hardcoded in here
|
||||
// this list is temporary and is created to test the performance of waku-rln-relay for the static groups
|
||||
// in the later versions, this static hardcoded group will be replaced with a dynamic one
|
||||
var STATIC_GROUP_KEYS [][]string
|
||||
|
||||
func init() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user