fix(rln-relay): feature guard

This commit is contained in:
rymnc 2022-11-11 16:28:24 +05:30
parent 07833ce313
commit 9344f41a34
No known key found for this signature in database
GPG Key ID: C740033EE3F41EBD
5 changed files with 1610 additions and 1602 deletions

View File

@ -86,7 +86,8 @@ type
wakuFilter*: WakuFilter
wakuFilterClient*: WakuFilterClient
wakuSwap*: WakuSwap
wakuRlnRelay*: WakuRLNRelay
when defined(rln):
wakuRlnRelay*: WakuRLNRelay
wakuLightPush*: WakuLightPush
wakuLightpushClient*: WakuLightPushClient
wakuPeerExchange*: WakuPeerExchange

View File

@ -40,7 +40,8 @@ type WakuMessage* = object
# the proof field indicates that the message is not a spam
# this field will be used in the rln-relay protocol
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec and not yet part of WakuMessage spec
proof*: RateLimitProof
when defined(rln):
proof*: RateLimitProof
# The ephemeral field indicates if the message should
# be stored. bools and uints are
# equivalent in serialization of the protobuf
@ -56,7 +57,8 @@ proc encode*(message: WakuMessage): ProtoBuffer =
buf.write3(2, message.contentTopic)
buf.write3(3, message.version)
buf.write3(10, zint64(message.timestamp))
buf.write3(21, message.proof.encode())
when defined(rln):
buf.write3(21, message.proof.encode())
buf.write3(31, uint64(message.ephemeral))
buf.finish3()
@ -75,9 +77,10 @@ proc decode*(T: type WakuMessage, buffer: seq[byte]): ProtoResult[T] =
msg.timestamp = Timestamp(timestamp)
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec
var proofBytes: seq[byte]
discard ?pb.getField(21, proofBytes)
msg.proof = ?RateLimitProof.init(proofBytes)
when defined(rln):
var proofBytes: seq[byte]
discard ?pb.getField(21, proofBytes)
msg.proof = ?RateLimitProof.init(proofBytes)
var ephemeral: uint
if ?pb.getField(31, ephemeral):

View File

@ -1,246 +1,248 @@
import
stint
# Acceptable roots for merkle root validation of incoming messages
const AcceptableRootWindowSize* = 5
when defined(rln):
# RLN membership key and index files path
const
RlnCredentialsFilename* = "rlnCredentials.txt"
# inputs of the membership contract constructor
# TODO may be able to make these constants private and put them inside the waku_rln_relay_utils
const
MembershipFee* = 1000000000000000.u256
# the current implementation of the rln lib supports a circuit for Merkle tree with depth 20
MerkleTreeDepth* = 20
EthClient* = "ws://127.0.0.1:8540"
# Acceptable roots for merkle root validation of incoming messages
const AcceptableRootWindowSize* = 5
const
# the size of poseidon hash output in bits
HashBitSize* = 256
# the size of poseidon hash output as the number hex digits
HashHexSize* = int(HashBitSize/4)
# RLN membership key and index files path
const
RlnCredentialsFilename* = "rlnCredentials.txt"
# inputs of the membership contract constructor
# TODO may be able to make these constants private and put them inside the waku_rln_relay_utils
const
MembershipFee* = 1000000000000000.u256
# the current implementation of the rln lib supports a circuit for Merkle tree with depth 20
MerkleTreeDepth* = 20
EthClient* = "ws://127.0.0.1:8540"
const
# The relative folder where the circuit, proving and verification key for RLN can be found
# Note that resources has to be compiled with respect to the above MerkleTreeDepth
RlnResourceFolder* = "vendor/zerokit/rln/resources/tree_height_" & $MerkleTreeDepth & "/"
# temporary variables to test waku-rln-relay performance in the static group mode
const
StaticGroupSize* = 100
# StaticGroupKeys 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
const
StaticGroupKeys* = @[("2c0198101a2828a0ac6c9e58fc131e1bd83326a4f748ef592588eeb8c3112dc1",
"1ca742a54641e2de14c5cb87ad707fd869693f682cedb901e47b8138918aecb3"), (
"095177fd334629dbc29c5fc9e32addecfcb6a42f9673268810fa9f70d1a8191a",
"0e30810a60f53fcbd60b312d9d65ccefe4e9d0b0d2220d7350fdf881469e59eb"), (
"131c6d4dbfb3feafc7fdd69aa62cd05d7b6be0cd7b7777ce9513ad742be71763",
"110ca13b7fa2ed72ccc4659a4fdaea3a2e28443617a29bbe977e92c83b531a15"), (
"2f45043d0efabffadcc0db24d238a8bc4a30ce7394ee2a70b4f9c91ff675d3d5",
"23a76dd96b527d12f7d5cda1000cba8e4926b072a795d3a2bc13c479956038f5"), (
"0ca272f013725eb1cfed07780a0ea6122e67d0c29717b26eb12c71dfd2367bf4",
"082663318217ad470c42f66cc66a888b296f92353d35151c31d8c611ce2cd1d4"), (
"0d08566358b2af4b38c0ce7d92840d1bc71930a7591470ad8cabf457de60833a",
"28c6909a697e160d69ffda94e0f9acc9cca6d61c05b8bd78b864620313b7a808"), (
"22b64925e839c488ef606d99d463f7af963b5634bfbc81a1e8c93597b65e1b66",
"2c1e7bf4af57bdadebb36ee840db5cfe88bb722d05ba24eb788b6dbcc2faffc1"), (
"1c102745fffa271dbc1e6ba9d1e4d4cf03f0537e1c0937d7126453eec61afe79",
"2e57378468e7d3612379047dc0580a48eb75afacd827324b4c16cb18ed331bae"), (
"2ef1ca7b105b932c78ae2b03b152a07dcf2ceb9459a718d417447c870559f388",
"05b7e60a719029aad98713ed5a0bcba3982e16a0befafe0d4763c8e2fef83c0e"), (
"1aceda8f46cd198b7abbb79e45f6508af8999ca31332133d042dfc4a19201b77",
"2f3d259b8aabe16f645d4a6e66ba890d55e7f0cf594935ea852a0e2624868f40"), (
"202de1595bc8e35e502a46124a067453d1e9c1b9f406acbac37c93be4bc1401e",
"1f5666cf374886ca7558658a7e9b5af5004f2bef9b65c5ff19394cd57082eac5"), (
"162cf23e68b513465c1c392879ad7a3ce51fb98687777873c145cf32b0e2da23",
"1f3f115f1ecf136d740fa0927d2525beaa2fc965b7cbab4ce6f96d9fcc206e9f"), (
"1c45d7e1421ae4df9a32bd2ea6f2bff70a4ed56762ef1358ee73bd8ee13e21f3",
"2417003e9c27c4fbc14c77e877074eceeaae6ace98f2b881c1c4eca2583c9c83"), (
"0b0b3d09d843d911b283299bbcd8965e8e4534c66ef9752be1eb01dff69669f9",
"115b7c70b9a1f468295afdca9dba3b67ccc3123e5be74d5a8da73a029fa2e68c"), (
"1b1b4f1fbc8804762e3e7ccb53c50921a5642431169cb49cb220eed33e40d5c9",
"2b7821ead551ba2a9a55450da9b21d6aaa4c382c50d9fcc9115b48a89f06a496"), (
"067b456b971b40477a97b66672fbf259f5dc46669218272ed517d36716f0e43d",
"0f4cbafe9afbee252db6dbaf23a5975e24bf2d360b907f5c88bdd3e3be6bff6e"), (
"18ee822f7abe8ac80aba210116b438d661a97dba2c0602456582a767e33e4589",
"02f812ffd5b9859fd202ad21c303b6352bda53af97dd944e9ae4161508191f55"), (
"14c41f2ee56279e7bca332679c4ed5c865b83b4e7aa1be0415d4e5ef12a5c532",
"122f3326f332d5ff387bf8e3f4a2ac647636a2dbc69be9590664107f87ab8d3b"), (
"29b1fe377ff7295120756108959ee7d6c8dc314c078086fd52743e81d3134ca7",
"1e47ec0b7957e911a9c3591a9df514413e437eb8549a61a2d13f9aa9f38559c5"), (
"17d5b6d345b4ee67418a29ee18a6bed4976c1321ba0b299f2e25dca30a421c9b",
"233ef113d1b1c6659b1c964eba8a8b2336e9f71db3daa251f8a69968aeeff066"), (
"14e40d11000392066c5624737ad96faed0e126cccec8eb4f8f7b5eed141c82d4",
"1d8bb23790d6105666913eb9bdb4ad06584e12bf428e46f034b546b9cbe05396"), (
"0498600cbfb3fff26656fb8ecf7f5fc1212003d5391e6998330bae8b3453c426",
"2944f71c79f223b47d0ded89fea53ecd362d64314c39aa632046fd7c9bc366a3"), (
"19137c8e6c8249e4897b260d387aea6afb82d0f36f9eef5018ea786dc6a8504a",
"2dbd8b02cbb6d5a8fc2a91ae5175019af9c9c003bcdcbb5d56590ba48ec353e3"), (
"176f27c080beeb31b4d4726846185b41b0ed480b589645d18609759afe8847d0",
"1030d697176631bba1ac4179f6a1640a4d7b99b68484a4808f750fd58bcb4e23"), (
"0383a55e14226eff828d4a3f6df6e3374d6a9e6538d9a36ba2161b5e88e4a3c5",
"25e4b8ccb1fe4f9cf90e60dbd9714902e3c76e95e39ebaadac0dc36b3b632129"), (
"0c57de13726bee0b6fc5f04c45d4bc3fdc1f884eaf8ece07ac85b87d23875848",
"22f4ceb33f1a84d0d263aebc1d0850347bc126e9981dbcc4593aaa53e3861106"), (
"06d159ec59bc4b0e9ec25e63fe3e29368059999e3c304b565789c776f89f0fca",
"144789e2e129d2282ecf5dd3b23286ab475a8eec7e066182f28ef71be14ce048"), (
"242b10778fa6e753bb08f186b2e07c1c87c263057e09d9ce88333033f465799d",
"2feb99f0a004f1ee48046d72969eaa73ec5945fed1b8e41704d38fdee2b6afb6"), (
"1359ff7f691d03c867ed1e10e7bffec09ffda9d9254565d5da8b3d472ef91edb",
"016f4071d37b38572bb3b4f07b86d47b1813bcb64caaf0fcf4c49388bbb8d534"), (
"14263ca40720663eaa4e78cd9bc6336aaed42f83c30a20b4b62c5a5a9b053ed4",
"121d1ac2a73279e3b1ed99c044a5b240cd4345c6e944233b8850f85f91830656"), (
"017e31163b233f56fa999c1433dbe6bf9f4e6c248d83f6a6f496866ea407cfa1",
"27e00d68571fb1b20f32ad2090125d39a781f3a80133d267a520c09e3e000439"), (
"2668502cb436958df8b6036340c9cbfcd6f6cb4304a46d50621fa612869c8c17",
"0577e480c19501a7e1b03acc9e456c79af9b7c2405a005fa288340196290812c"), (
"1cbe3144b594879735c43002b480bd83e83c4fe6cd430fc447c11ef862934bf8",
"0ff3b7fdb22a138cd90beec386f5cac06c3167dd2f25169199004472394f52ca"), (
"221edbd101eb5300d45f30c5102b9cf61a4668de7b96c2428e726fbb2eccfba2",
"1ee78ea001663058670233fa4bd3f5eca125d2ee27166a3c270cc9ff828ef44e"), (
"09f4c1a0a0acb6fd0bdbad6fa15fec36a053b04924f71c50158d386393dea791",
"0af261879fe9f9dc428d2d3ed1e2951e0b8ea45d2dd9452ae9657197ebc25bfa"), (
"1c797777a6175c021f776a177617ff78c691075e61c5ab78a575696abf98256e",
"14acf51f86ed0f2cc202599a7b2c7d836036e80374a27ba4d1a015577ac0af22"), (
"11b022742928eea62ef72d64b6156c7bc1a3df355e57d5c1edf29887b7d788e7",
"15aa67cf3c4bfcc267b5267c33b026cd8d7b19e2a6b3f8abef610da276419aba"), (
"00323a544e19221877fa41066cc0f400f73b4d788e05192f9ba4c33559c113bd",
"1afab12d34efab0b919c5fcf9aa4250a13e48bf97c112f0451c8ab687cc93515"), (
"0ff6ec8f949bc2c540fc661911215818212f37f37d1b041517bee13f01d01877",
"099ac3a4ae91b8aaaedb701d53c284931bdd4e1acf248cc435a2121b44d876e4"), (
"03200d6a35588a4cae7342c9cb2160a596072f17e51b0071eec3eeef44df7a85",
"21785df67a48d487e7267175ceb1398d871fcf204d3507389c08fd818eae8e35"), (
"22f6ffa9d3607ae5eb10610dc9198d1e836b5b67fdebe0e875f59ee41c49d28d",
"285af8a70a34a6d34e6d715d28b18869c74fa8c0a97cd5035c39b4ad9c9bef88"), (
"131373e532a4c0e6730d023c8cc00a300ded84f0ff38ae8ef26b869ffd21a495",
"2617021b27ccb848203efb158e222e727929239acebc1bcfcfdab441ca2267d8"), (
"2deaa385e5ac88d90c9ac88f4dd1390b570da7e3368820baddee878c1c920985",
"0775d7a6e69b2fc8d887ac4d8ba5f45a5d70ff1593d44ec7d68f125241a27019"), (
"13a55e79d5843dd86599461865d3e41895ae7414778b5d6d7b3122f8a21b59f0",
"0023467c1f7de5335e1f25ae8a854dcd9afae22f8a8ebda13725827ad0b5781d"), (
"0b6b34fa4f045993221dddc35b1a7d39b900bc74d6da3e75d85dbf3f6a9002a3",
"204d8b8dbc6fe2300c2a7998c6334aa772e8e31f9aa0521f074cebfca09076de"), (
"07bf2bd503c4c08950b74961eae6b22c1dfa9866e1d9566561665ffd3c5f426b",
"0049bade3018d28f8c40a47c71f1415811dc6528f0bf6982abd09f4df6d45432"), (
"2a2243a0405c0d40af17245e02e1c1f5aea007143fd17fe2fd93a2b49b3f0a57",
"112aab67ed0bacf225f87ff6591fc8d219a73b4dbfe36b21892a5795d481d4f3"), (
"22a1fd33e4b83d1cbac4a92160ac8b41ef86774bd7885f69a8fa79fe6c33a4d2",
"2de16b061df3b291a664ef1e1eb285538d18b80aea7014ebf2b3e50d22888861"), (
"284e390e5be08da632b0155b6ee23941b3275fd23682590c7efd1dcd78b69d5e",
"0a282a3b2e4462ea48c82933c2ed03d046058d24c39d02b7d012126adc79234f"), (
"216ef8f66b9d3cab3ad9f95e041677ced8d59cfa987cc898d0db31ec17bc2d04",
"08cbcb81beaa2113b5710e5441032a7d7144121372ef9d2d903b8e76c44108d3"), (
"1f5fe5d1a7eba65373f8c23b02b330e24677fd8fecc8142f4af2df2de6a9cdc5",
"18818a95dc1a2dceeaf5484b2324b6f2977ba0a8120d4d19b9a1bac7482a25d6"), (
"02f4a10357e1b8fcd3c8d6fa3cbe498a4451cc0d3c29075addc853c7e0b851b7",
"23f50656c54f84cbce760335ca09d50f27ab160f7fcea39ceb49d9d5aef67a29"), (
"1ae88ec49df2fa49d2f1d3170a15b2c5a80fc950ab0b50d28a6caa20aca6722c",
"08f18be90156d957e2328367d7fd661d6c5bcb167193961c7f9b7d7bb82855c0"), (
"152b2f54041f1a615225bc96723dae89fd0d17352b0d37b37f419e49332f3a84",
"087ea7a796503b43cd723344004d4a6c869f9c779ef5c96b4f385c1b6a16f585"), (
"0ce422373db69ea5f19ad22480b6b5052c8e2d66e3bde5cf9a3a43998e699f32",
"3034885d053bdcb7074ff7bd67f5b6d3dfc27be07986ae27ae65f99f95670b91"), (
"0ea472ec17bba7b8d9e7c522d9d5b0b8404ae1da0f6998c7e1acbc5433f3002e",
"1eb8eb2cf399ceed4b9c4894d1cba611d78f2aea9ec3bb04e4f4502c6e72504b"), (
"20769b227bb7d3cd8f08a7c3a58e557d87a645601dda0a89b322cdc4a29dc073",
"13b601dea1b88605d1479331596128fcff755118259802a2ef28e7aa3a7900f5"), (
"207c117d42d91e6b6d4c0451aa96f38d7d86a0dda678440f4a1b79ffe9efc825",
"064790db9a228621e867ba894c0e7f3a0b178c0eae72892dc743ee62d5c557eb"), (
"2ed78374a4b336bcb8fd8603610059ff51dac1cc7c6dd3549c072101e0443f86",
"2c1d57b17d1f0fd9cf00fa9409ecb47624c8685bd632f447a3c15ab0b1d90fc3"), (
"073fee805a6121d1cac9f68ab6b5759313a82100e9b59e70a84589f1e311736a",
"1c61cc79a8a9c061385ea2f7899171f5d870b0f5de27b6acd5387d7caa8f3d1a"), (
"2fe95c45a1c3ed3f81a9713762c8f15edd783207a2343f866466474be47cd297",
"137d8a12344f774e17c852313526c982927a08050b8add27ad8fe8feea29c49f"), (
"10c3634849afe5a64bb5325770dc2ab1045bead339fa995397cda85e5bb48aa8",
"1cc853ceab6fe0a2e0396f5e58ff96ffd7280907c44c77d2327e34018bcf2924"), (
"26853b411ff5829880b6305740a15c245b4246e84ffc6d61722966f466a4eb51",
"1d3a27beef286cb47d716de1b6b93b1c090e759a9538395a38bb804cdb2d11f9"), (
"2b4ea98233ee2eac4df809f2620bbc6b183b956561e1eb25c8b4a84a28ffe945",
"1c82f94e2e952156c1d759d3f93fc97bf8f8a444183e578cb62001e1bbaf32d9"), (
"1c047970753dda8c20b8cc4a40721847d26dff8634b72d02e8d28e3b407c80d1",
"195e38c09efa924609232323395867ccd8f913dd7a4fe4322a043f6eeb51ed7a"), (
"01c2cd45a421cb629b5d4752380f296f98ba923a6ee9b28c3f427f236138c9b9",
"160875e6eceeb3e3abfbaea572d16e7a4c1df16a906f18805d1db031bbe25ae2"), (
"1ac75381eb5d3bb34dbf46b3e8deaf88822bf59880cd206f2b88a7cb0cd78a55",
"2198af5533f0829ee6a02cd9f7f9d50de57e15f08d86fc8d18eb9d6f7b3751c6"), (
"254c281c6a72e0fadfe88280dcf1353b1880db14634863cab2fc18fc38ffe4b6",
"1ba0e9722e2f2911610966004407991a8c7f41c5c4bb78f15b9809aa45b6ed2e"), (
"2786cdfc7446c95c3f3a83d851d0c50cd3ee96bb91bec1bb9a3308907dab64c2",
"2bfe013073d942cfb1793c0aa8d14a5e09f7d5ac7c8f6dd5119ef730c232d78f"), (
"1a809572677c00af2d52023bc2aaa3d43d8b6f16f7576a357f82471081b2298b",
"13ff785c5a8ec7ab13291759c37499d32ab95edededf2e7c08eb3e5d0dd0b4e4"), (
"2ef26ceeca603bacaae271072909a22cea69fce5f299865c66f5ae63b45dbe30",
"0ed774428015317b7d299500c5e4d01e49039bcfebe5db3ab1034c664d975e3c"), (
"2d5d5b1d825b27f2345976f3d43e47017c1efc41e8e62f93b0e12c1037b316db",
"2343a52d8a37d986fdd52c31d5742a84f51088c002f4dd4e4b039960a504cbdb"), (
"172e2144b6ded94be4b9642c7c6f9afed81aecb5485aeef5b3d054f53aa2756f",
"2406c9401b7cbd9494f429616ffc85a489bfbdb6f914bd84640b28528dbfce68"), (
"285af6cd43a017bec5394152e13a2ca4df2131b32c28cc9df9b45c24aa0bd0e3",
"0f79493ffde795d083b097734356107f41f33137b6bc7118f2768c924cf31057"), (
"00117742394adf01ad59a127f0a0bec58f8d4e593c589266ed15041422f382f3",
"0fb47c14a31f6be53718284a8f35f3a7be7445acb7685893b007a22da26dfb4b"), (
"041d9eed43c71e705a9a4ab0f3d20d27e27cc86f494db2579c20166fde4fe733",
"1f37f81316470689a67a8f6fc22a8000870affa7f69a53c0538240bae147e8e1"), (
"2c43ad22585ba0e1c836782ce619ae0579ac376efe2c433c3d29257fc65d4b3e",
"0303d6adea59b2538c8c625761396228fbd552e36d93af02d177c1219ba778c9"), (
"2931a506675b34076d279296b1fb36d8d2161568210754bc0ada09206b956814",
"2a650ed20b09a37b6c99f4ed99e352069979306db538c9e85d8e4f24990df7ee"), (
"0199bb1cb7798516759aecedc974db39f8ecc9befbf97265b224c17b66b241c6",
"18ba142aaa522112b47c2ebab08a483e01e75b7931024b1accca5e7ba557b983"), (
"2fc6e58b52fb6bdcde370f5849c990c542dc112c42100323dd199a3a90c3c55b",
"1be44b8c0fbc328fe46ed9ad8d62d85c6058df7a5a1eadd3d88d018dfdca2d5e"), (
"0e5928b37cd899cd186c0b5ed2d2b9034b82fa542420903c25aab9d835e16697",
"0db6cc4f93d7c62a819ff05218e7f97deed2899ff87e9316048afa3d5f88f8d3"), (
"1c4ad5b10dc591d28b111f17bdf06c4d52fca3f598a16918f0c22adb1046b6fe",
"0fdbbf0beb5a7e9fe36eb5950a8a42886c985c35a753193dfb88b2289bcd273e"), (
"254cc2e093b44b9817d6e63b200e901719ee2c71cf08122845ae17c83df11b57",
"0ce7d93826ead805dccb2db908df05af4b8eb253ffba9f7e12f5b65c790e2f13"), (
"082d33c58b7ef35450b6e0f04228af71cb62c24b65facdca8a786448939a64fb",
"1eca9298aee68fec2c3485fe7b46b154b2d28dac651d4692143da495e1a6a567"), (
"135441db7e663906d2a3fe179541475c568dfe5100a7bb0d711bb8fca34d6dbd",
"2832f9e2f973d3c679905fc1c173b71384c54d0c86be08ca053052a1e516fc07"), (
"1d979375e1e725d394b017452863a2375a349072add1a1f4e8a62783e29997e4",
"16d4c4d52996d207d2f5111e6be2a333f575cd63a5d71df24e413ec239441a64"), (
"241e5996499e43372a4e86c30a1f141d6157eb175b939da7b08a19522a52bac0",
"129341569c322516d77c426ebcfef6d7f40e5338d15c31a5aa3bcd056008fe78"), (
"2269de57ca36264ec72dde1c8ebacee471960cc2fad7c0ee3a9118ba40e41e87",
"2aae3a1043157c1bf2c79e6111cdc46c7e1a2bc960596eb023b7b8c6227c2e9d"), (
"120cb3d07e7560d2146397bdf872004fa29eefc5a5113595be164ecd72125aab",
"1e21ba2aec2eaaae2595695d5b638a27433bd883b8e17f6f8fe1fd1b3421fceb"), (
"1bc45135b0cffa828ee41ce1c65b64d9f3f65390684401e903c9964099919e2c",
"0083742467cf09853010726529661bac06864c91da35300f630e8cc78c61cbf9"), (
"233135b00df8453eaebcd34d338014d01efbabebb3ddfe6219dd7f5db7a341ba",
"07fd4cd97e761f7391eb9718baddef0acc9a6dba3dedaef40612754a2dcdee39"), (
"02fe17ec7b1ccc29368b8f654442db237d8cd8221edaff653220ca0beffef1cc",
"0cf8adbfd9140830b15670269f6c9e7a39b6172e2b0e059998403ee609323c09"), (
"11221c9f08070d40f1368e0818d2f31c93312b98954bdd1f0f820d68be592f7c",
"16de82ddd15ed3809e392ae92a0d67dbde6abeede876c7cdf8e6fa106721eb67"), (
"12c0d0c606aa1cc11896de752de3b071793b0d40bc1c76224bf709a73f3e0694",
"184d0476ead3701a7ffb62d0ae2b43e3ebc41cb27d4d558c09e9092f50fceec2"), (
"260904e50145e0dab40c86488a48f1a857915058f3b263b2d7d4325e71788abd",
"14c9bf7f4c25a6a69a83652a57853462149761ec82954678345c8811abc2daf9"), (
"2a1ceaa3461f3e3e6539c1d5f58823753c2bab300fc7b995be94f510f4d842c7",
"05a4f98932e76eb1a8b4714c6b3bf079aa022750d4d8a6c9761b34b0578ba239"), (
"0d344bf806ab8566bea729eea160fee2e0f685416b577ca8bee0b4346be74cb7",
"0b55b69e6183e03e3ff83e9397e6c4fd7a530a17d77687e98da9346f436fbefa"), (
"2fbc760addd5f584378b071acb9f8ecb4aa9d40bd640d352db3f56a0d0b3f389",
"2cd8a28452aead0fe6860fc152a8d15568d2a7fd41bb3d907a93ee8bdce2e554"), (
"0d0b7216902409e7a4c2588c59b002bdd3f739954deb6869fea6424c26212b6a",
"1d2a5e216d4e4cfced68bf71e68721fdd9297bd0c3c790432156f029d63820a0"), (
"0ab175fa60fe331351385be1eca5174511d284f674b6ba4cf58acb47c018f5a7",
"03aeb24c83f1a5d343d9cfb6c124f6cea32113a4d02c063bbeaa937ff1a492e0")]
const
# the size of poseidon hash output in bits
HashBitSize* = 256
# the size of poseidon hash output as the number hex digits
HashHexSize* = int(HashBitSize/4)
# StaticGroupMerkleRoot is the root of the Merkle tree constructed from the StaticGroupKeys above
# only identity commitments are used for the Merkle tree construction
# the root is created locally, using createMembershipList proc from waku_rln_relay_utils module, and the result is hardcoded in here
StaticGroupMerkleRoot* = "2b5c4a3a12d98026e2f55a5cbfc74e8a5a05a8f5403409bf218bbc92ace25b80"
const
# The relative folder where the circuit, proving and verification key for RLN can be found
# Note that resources has to be compiled with respect to the above MerkleTreeDepth
RlnResourceFolder* = "vendor/zerokit/rln/resources/tree_height_" & $MerkleTreeDepth & "/"
# temporary variables to test waku-rln-relay performance in the static group mode
const
StaticGroupSize* = 100
# StaticGroupKeys 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
const
StaticGroupKeys* = @[("2c0198101a2828a0ac6c9e58fc131e1bd83326a4f748ef592588eeb8c3112dc1",
"1ca742a54641e2de14c5cb87ad707fd869693f682cedb901e47b8138918aecb3"), (
"095177fd334629dbc29c5fc9e32addecfcb6a42f9673268810fa9f70d1a8191a",
"0e30810a60f53fcbd60b312d9d65ccefe4e9d0b0d2220d7350fdf881469e59eb"), (
"131c6d4dbfb3feafc7fdd69aa62cd05d7b6be0cd7b7777ce9513ad742be71763",
"110ca13b7fa2ed72ccc4659a4fdaea3a2e28443617a29bbe977e92c83b531a15"), (
"2f45043d0efabffadcc0db24d238a8bc4a30ce7394ee2a70b4f9c91ff675d3d5",
"23a76dd96b527d12f7d5cda1000cba8e4926b072a795d3a2bc13c479956038f5"), (
"0ca272f013725eb1cfed07780a0ea6122e67d0c29717b26eb12c71dfd2367bf4",
"082663318217ad470c42f66cc66a888b296f92353d35151c31d8c611ce2cd1d4"), (
"0d08566358b2af4b38c0ce7d92840d1bc71930a7591470ad8cabf457de60833a",
"28c6909a697e160d69ffda94e0f9acc9cca6d61c05b8bd78b864620313b7a808"), (
"22b64925e839c488ef606d99d463f7af963b5634bfbc81a1e8c93597b65e1b66",
"2c1e7bf4af57bdadebb36ee840db5cfe88bb722d05ba24eb788b6dbcc2faffc1"), (
"1c102745fffa271dbc1e6ba9d1e4d4cf03f0537e1c0937d7126453eec61afe79",
"2e57378468e7d3612379047dc0580a48eb75afacd827324b4c16cb18ed331bae"), (
"2ef1ca7b105b932c78ae2b03b152a07dcf2ceb9459a718d417447c870559f388",
"05b7e60a719029aad98713ed5a0bcba3982e16a0befafe0d4763c8e2fef83c0e"), (
"1aceda8f46cd198b7abbb79e45f6508af8999ca31332133d042dfc4a19201b77",
"2f3d259b8aabe16f645d4a6e66ba890d55e7f0cf594935ea852a0e2624868f40"), (
"202de1595bc8e35e502a46124a067453d1e9c1b9f406acbac37c93be4bc1401e",
"1f5666cf374886ca7558658a7e9b5af5004f2bef9b65c5ff19394cd57082eac5"), (
"162cf23e68b513465c1c392879ad7a3ce51fb98687777873c145cf32b0e2da23",
"1f3f115f1ecf136d740fa0927d2525beaa2fc965b7cbab4ce6f96d9fcc206e9f"), (
"1c45d7e1421ae4df9a32bd2ea6f2bff70a4ed56762ef1358ee73bd8ee13e21f3",
"2417003e9c27c4fbc14c77e877074eceeaae6ace98f2b881c1c4eca2583c9c83"), (
"0b0b3d09d843d911b283299bbcd8965e8e4534c66ef9752be1eb01dff69669f9",
"115b7c70b9a1f468295afdca9dba3b67ccc3123e5be74d5a8da73a029fa2e68c"), (
"1b1b4f1fbc8804762e3e7ccb53c50921a5642431169cb49cb220eed33e40d5c9",
"2b7821ead551ba2a9a55450da9b21d6aaa4c382c50d9fcc9115b48a89f06a496"), (
"067b456b971b40477a97b66672fbf259f5dc46669218272ed517d36716f0e43d",
"0f4cbafe9afbee252db6dbaf23a5975e24bf2d360b907f5c88bdd3e3be6bff6e"), (
"18ee822f7abe8ac80aba210116b438d661a97dba2c0602456582a767e33e4589",
"02f812ffd5b9859fd202ad21c303b6352bda53af97dd944e9ae4161508191f55"), (
"14c41f2ee56279e7bca332679c4ed5c865b83b4e7aa1be0415d4e5ef12a5c532",
"122f3326f332d5ff387bf8e3f4a2ac647636a2dbc69be9590664107f87ab8d3b"), (
"29b1fe377ff7295120756108959ee7d6c8dc314c078086fd52743e81d3134ca7",
"1e47ec0b7957e911a9c3591a9df514413e437eb8549a61a2d13f9aa9f38559c5"), (
"17d5b6d345b4ee67418a29ee18a6bed4976c1321ba0b299f2e25dca30a421c9b",
"233ef113d1b1c6659b1c964eba8a8b2336e9f71db3daa251f8a69968aeeff066"), (
"14e40d11000392066c5624737ad96faed0e126cccec8eb4f8f7b5eed141c82d4",
"1d8bb23790d6105666913eb9bdb4ad06584e12bf428e46f034b546b9cbe05396"), (
"0498600cbfb3fff26656fb8ecf7f5fc1212003d5391e6998330bae8b3453c426",
"2944f71c79f223b47d0ded89fea53ecd362d64314c39aa632046fd7c9bc366a3"), (
"19137c8e6c8249e4897b260d387aea6afb82d0f36f9eef5018ea786dc6a8504a",
"2dbd8b02cbb6d5a8fc2a91ae5175019af9c9c003bcdcbb5d56590ba48ec353e3"), (
"176f27c080beeb31b4d4726846185b41b0ed480b589645d18609759afe8847d0",
"1030d697176631bba1ac4179f6a1640a4d7b99b68484a4808f750fd58bcb4e23"), (
"0383a55e14226eff828d4a3f6df6e3374d6a9e6538d9a36ba2161b5e88e4a3c5",
"25e4b8ccb1fe4f9cf90e60dbd9714902e3c76e95e39ebaadac0dc36b3b632129"), (
"0c57de13726bee0b6fc5f04c45d4bc3fdc1f884eaf8ece07ac85b87d23875848",
"22f4ceb33f1a84d0d263aebc1d0850347bc126e9981dbcc4593aaa53e3861106"), (
"06d159ec59bc4b0e9ec25e63fe3e29368059999e3c304b565789c776f89f0fca",
"144789e2e129d2282ecf5dd3b23286ab475a8eec7e066182f28ef71be14ce048"), (
"242b10778fa6e753bb08f186b2e07c1c87c263057e09d9ce88333033f465799d",
"2feb99f0a004f1ee48046d72969eaa73ec5945fed1b8e41704d38fdee2b6afb6"), (
"1359ff7f691d03c867ed1e10e7bffec09ffda9d9254565d5da8b3d472ef91edb",
"016f4071d37b38572bb3b4f07b86d47b1813bcb64caaf0fcf4c49388bbb8d534"), (
"14263ca40720663eaa4e78cd9bc6336aaed42f83c30a20b4b62c5a5a9b053ed4",
"121d1ac2a73279e3b1ed99c044a5b240cd4345c6e944233b8850f85f91830656"), (
"017e31163b233f56fa999c1433dbe6bf9f4e6c248d83f6a6f496866ea407cfa1",
"27e00d68571fb1b20f32ad2090125d39a781f3a80133d267a520c09e3e000439"), (
"2668502cb436958df8b6036340c9cbfcd6f6cb4304a46d50621fa612869c8c17",
"0577e480c19501a7e1b03acc9e456c79af9b7c2405a005fa288340196290812c"), (
"1cbe3144b594879735c43002b480bd83e83c4fe6cd430fc447c11ef862934bf8",
"0ff3b7fdb22a138cd90beec386f5cac06c3167dd2f25169199004472394f52ca"), (
"221edbd101eb5300d45f30c5102b9cf61a4668de7b96c2428e726fbb2eccfba2",
"1ee78ea001663058670233fa4bd3f5eca125d2ee27166a3c270cc9ff828ef44e"), (
"09f4c1a0a0acb6fd0bdbad6fa15fec36a053b04924f71c50158d386393dea791",
"0af261879fe9f9dc428d2d3ed1e2951e0b8ea45d2dd9452ae9657197ebc25bfa"), (
"1c797777a6175c021f776a177617ff78c691075e61c5ab78a575696abf98256e",
"14acf51f86ed0f2cc202599a7b2c7d836036e80374a27ba4d1a015577ac0af22"), (
"11b022742928eea62ef72d64b6156c7bc1a3df355e57d5c1edf29887b7d788e7",
"15aa67cf3c4bfcc267b5267c33b026cd8d7b19e2a6b3f8abef610da276419aba"), (
"00323a544e19221877fa41066cc0f400f73b4d788e05192f9ba4c33559c113bd",
"1afab12d34efab0b919c5fcf9aa4250a13e48bf97c112f0451c8ab687cc93515"), (
"0ff6ec8f949bc2c540fc661911215818212f37f37d1b041517bee13f01d01877",
"099ac3a4ae91b8aaaedb701d53c284931bdd4e1acf248cc435a2121b44d876e4"), (
"03200d6a35588a4cae7342c9cb2160a596072f17e51b0071eec3eeef44df7a85",
"21785df67a48d487e7267175ceb1398d871fcf204d3507389c08fd818eae8e35"), (
"22f6ffa9d3607ae5eb10610dc9198d1e836b5b67fdebe0e875f59ee41c49d28d",
"285af8a70a34a6d34e6d715d28b18869c74fa8c0a97cd5035c39b4ad9c9bef88"), (
"131373e532a4c0e6730d023c8cc00a300ded84f0ff38ae8ef26b869ffd21a495",
"2617021b27ccb848203efb158e222e727929239acebc1bcfcfdab441ca2267d8"), (
"2deaa385e5ac88d90c9ac88f4dd1390b570da7e3368820baddee878c1c920985",
"0775d7a6e69b2fc8d887ac4d8ba5f45a5d70ff1593d44ec7d68f125241a27019"), (
"13a55e79d5843dd86599461865d3e41895ae7414778b5d6d7b3122f8a21b59f0",
"0023467c1f7de5335e1f25ae8a854dcd9afae22f8a8ebda13725827ad0b5781d"), (
"0b6b34fa4f045993221dddc35b1a7d39b900bc74d6da3e75d85dbf3f6a9002a3",
"204d8b8dbc6fe2300c2a7998c6334aa772e8e31f9aa0521f074cebfca09076de"), (
"07bf2bd503c4c08950b74961eae6b22c1dfa9866e1d9566561665ffd3c5f426b",
"0049bade3018d28f8c40a47c71f1415811dc6528f0bf6982abd09f4df6d45432"), (
"2a2243a0405c0d40af17245e02e1c1f5aea007143fd17fe2fd93a2b49b3f0a57",
"112aab67ed0bacf225f87ff6591fc8d219a73b4dbfe36b21892a5795d481d4f3"), (
"22a1fd33e4b83d1cbac4a92160ac8b41ef86774bd7885f69a8fa79fe6c33a4d2",
"2de16b061df3b291a664ef1e1eb285538d18b80aea7014ebf2b3e50d22888861"), (
"284e390e5be08da632b0155b6ee23941b3275fd23682590c7efd1dcd78b69d5e",
"0a282a3b2e4462ea48c82933c2ed03d046058d24c39d02b7d012126adc79234f"), (
"216ef8f66b9d3cab3ad9f95e041677ced8d59cfa987cc898d0db31ec17bc2d04",
"08cbcb81beaa2113b5710e5441032a7d7144121372ef9d2d903b8e76c44108d3"), (
"1f5fe5d1a7eba65373f8c23b02b330e24677fd8fecc8142f4af2df2de6a9cdc5",
"18818a95dc1a2dceeaf5484b2324b6f2977ba0a8120d4d19b9a1bac7482a25d6"), (
"02f4a10357e1b8fcd3c8d6fa3cbe498a4451cc0d3c29075addc853c7e0b851b7",
"23f50656c54f84cbce760335ca09d50f27ab160f7fcea39ceb49d9d5aef67a29"), (
"1ae88ec49df2fa49d2f1d3170a15b2c5a80fc950ab0b50d28a6caa20aca6722c",
"08f18be90156d957e2328367d7fd661d6c5bcb167193961c7f9b7d7bb82855c0"), (
"152b2f54041f1a615225bc96723dae89fd0d17352b0d37b37f419e49332f3a84",
"087ea7a796503b43cd723344004d4a6c869f9c779ef5c96b4f385c1b6a16f585"), (
"0ce422373db69ea5f19ad22480b6b5052c8e2d66e3bde5cf9a3a43998e699f32",
"3034885d053bdcb7074ff7bd67f5b6d3dfc27be07986ae27ae65f99f95670b91"), (
"0ea472ec17bba7b8d9e7c522d9d5b0b8404ae1da0f6998c7e1acbc5433f3002e",
"1eb8eb2cf399ceed4b9c4894d1cba611d78f2aea9ec3bb04e4f4502c6e72504b"), (
"20769b227bb7d3cd8f08a7c3a58e557d87a645601dda0a89b322cdc4a29dc073",
"13b601dea1b88605d1479331596128fcff755118259802a2ef28e7aa3a7900f5"), (
"207c117d42d91e6b6d4c0451aa96f38d7d86a0dda678440f4a1b79ffe9efc825",
"064790db9a228621e867ba894c0e7f3a0b178c0eae72892dc743ee62d5c557eb"), (
"2ed78374a4b336bcb8fd8603610059ff51dac1cc7c6dd3549c072101e0443f86",
"2c1d57b17d1f0fd9cf00fa9409ecb47624c8685bd632f447a3c15ab0b1d90fc3"), (
"073fee805a6121d1cac9f68ab6b5759313a82100e9b59e70a84589f1e311736a",
"1c61cc79a8a9c061385ea2f7899171f5d870b0f5de27b6acd5387d7caa8f3d1a"), (
"2fe95c45a1c3ed3f81a9713762c8f15edd783207a2343f866466474be47cd297",
"137d8a12344f774e17c852313526c982927a08050b8add27ad8fe8feea29c49f"), (
"10c3634849afe5a64bb5325770dc2ab1045bead339fa995397cda85e5bb48aa8",
"1cc853ceab6fe0a2e0396f5e58ff96ffd7280907c44c77d2327e34018bcf2924"), (
"26853b411ff5829880b6305740a15c245b4246e84ffc6d61722966f466a4eb51",
"1d3a27beef286cb47d716de1b6b93b1c090e759a9538395a38bb804cdb2d11f9"), (
"2b4ea98233ee2eac4df809f2620bbc6b183b956561e1eb25c8b4a84a28ffe945",
"1c82f94e2e952156c1d759d3f93fc97bf8f8a444183e578cb62001e1bbaf32d9"), (
"1c047970753dda8c20b8cc4a40721847d26dff8634b72d02e8d28e3b407c80d1",
"195e38c09efa924609232323395867ccd8f913dd7a4fe4322a043f6eeb51ed7a"), (
"01c2cd45a421cb629b5d4752380f296f98ba923a6ee9b28c3f427f236138c9b9",
"160875e6eceeb3e3abfbaea572d16e7a4c1df16a906f18805d1db031bbe25ae2"), (
"1ac75381eb5d3bb34dbf46b3e8deaf88822bf59880cd206f2b88a7cb0cd78a55",
"2198af5533f0829ee6a02cd9f7f9d50de57e15f08d86fc8d18eb9d6f7b3751c6"), (
"254c281c6a72e0fadfe88280dcf1353b1880db14634863cab2fc18fc38ffe4b6",
"1ba0e9722e2f2911610966004407991a8c7f41c5c4bb78f15b9809aa45b6ed2e"), (
"2786cdfc7446c95c3f3a83d851d0c50cd3ee96bb91bec1bb9a3308907dab64c2",
"2bfe013073d942cfb1793c0aa8d14a5e09f7d5ac7c8f6dd5119ef730c232d78f"), (
"1a809572677c00af2d52023bc2aaa3d43d8b6f16f7576a357f82471081b2298b",
"13ff785c5a8ec7ab13291759c37499d32ab95edededf2e7c08eb3e5d0dd0b4e4"), (
"2ef26ceeca603bacaae271072909a22cea69fce5f299865c66f5ae63b45dbe30",
"0ed774428015317b7d299500c5e4d01e49039bcfebe5db3ab1034c664d975e3c"), (
"2d5d5b1d825b27f2345976f3d43e47017c1efc41e8e62f93b0e12c1037b316db",
"2343a52d8a37d986fdd52c31d5742a84f51088c002f4dd4e4b039960a504cbdb"), (
"172e2144b6ded94be4b9642c7c6f9afed81aecb5485aeef5b3d054f53aa2756f",
"2406c9401b7cbd9494f429616ffc85a489bfbdb6f914bd84640b28528dbfce68"), (
"285af6cd43a017bec5394152e13a2ca4df2131b32c28cc9df9b45c24aa0bd0e3",
"0f79493ffde795d083b097734356107f41f33137b6bc7118f2768c924cf31057"), (
"00117742394adf01ad59a127f0a0bec58f8d4e593c589266ed15041422f382f3",
"0fb47c14a31f6be53718284a8f35f3a7be7445acb7685893b007a22da26dfb4b"), (
"041d9eed43c71e705a9a4ab0f3d20d27e27cc86f494db2579c20166fde4fe733",
"1f37f81316470689a67a8f6fc22a8000870affa7f69a53c0538240bae147e8e1"), (
"2c43ad22585ba0e1c836782ce619ae0579ac376efe2c433c3d29257fc65d4b3e",
"0303d6adea59b2538c8c625761396228fbd552e36d93af02d177c1219ba778c9"), (
"2931a506675b34076d279296b1fb36d8d2161568210754bc0ada09206b956814",
"2a650ed20b09a37b6c99f4ed99e352069979306db538c9e85d8e4f24990df7ee"), (
"0199bb1cb7798516759aecedc974db39f8ecc9befbf97265b224c17b66b241c6",
"18ba142aaa522112b47c2ebab08a483e01e75b7931024b1accca5e7ba557b983"), (
"2fc6e58b52fb6bdcde370f5849c990c542dc112c42100323dd199a3a90c3c55b",
"1be44b8c0fbc328fe46ed9ad8d62d85c6058df7a5a1eadd3d88d018dfdca2d5e"), (
"0e5928b37cd899cd186c0b5ed2d2b9034b82fa542420903c25aab9d835e16697",
"0db6cc4f93d7c62a819ff05218e7f97deed2899ff87e9316048afa3d5f88f8d3"), (
"1c4ad5b10dc591d28b111f17bdf06c4d52fca3f598a16918f0c22adb1046b6fe",
"0fdbbf0beb5a7e9fe36eb5950a8a42886c985c35a753193dfb88b2289bcd273e"), (
"254cc2e093b44b9817d6e63b200e901719ee2c71cf08122845ae17c83df11b57",
"0ce7d93826ead805dccb2db908df05af4b8eb253ffba9f7e12f5b65c790e2f13"), (
"082d33c58b7ef35450b6e0f04228af71cb62c24b65facdca8a786448939a64fb",
"1eca9298aee68fec2c3485fe7b46b154b2d28dac651d4692143da495e1a6a567"), (
"135441db7e663906d2a3fe179541475c568dfe5100a7bb0d711bb8fca34d6dbd",
"2832f9e2f973d3c679905fc1c173b71384c54d0c86be08ca053052a1e516fc07"), (
"1d979375e1e725d394b017452863a2375a349072add1a1f4e8a62783e29997e4",
"16d4c4d52996d207d2f5111e6be2a333f575cd63a5d71df24e413ec239441a64"), (
"241e5996499e43372a4e86c30a1f141d6157eb175b939da7b08a19522a52bac0",
"129341569c322516d77c426ebcfef6d7f40e5338d15c31a5aa3bcd056008fe78"), (
"2269de57ca36264ec72dde1c8ebacee471960cc2fad7c0ee3a9118ba40e41e87",
"2aae3a1043157c1bf2c79e6111cdc46c7e1a2bc960596eb023b7b8c6227c2e9d"), (
"120cb3d07e7560d2146397bdf872004fa29eefc5a5113595be164ecd72125aab",
"1e21ba2aec2eaaae2595695d5b638a27433bd883b8e17f6f8fe1fd1b3421fceb"), (
"1bc45135b0cffa828ee41ce1c65b64d9f3f65390684401e903c9964099919e2c",
"0083742467cf09853010726529661bac06864c91da35300f630e8cc78c61cbf9"), (
"233135b00df8453eaebcd34d338014d01efbabebb3ddfe6219dd7f5db7a341ba",
"07fd4cd97e761f7391eb9718baddef0acc9a6dba3dedaef40612754a2dcdee39"), (
"02fe17ec7b1ccc29368b8f654442db237d8cd8221edaff653220ca0beffef1cc",
"0cf8adbfd9140830b15670269f6c9e7a39b6172e2b0e059998403ee609323c09"), (
"11221c9f08070d40f1368e0818d2f31c93312b98954bdd1f0f820d68be592f7c",
"16de82ddd15ed3809e392ae92a0d67dbde6abeede876c7cdf8e6fa106721eb67"), (
"12c0d0c606aa1cc11896de752de3b071793b0d40bc1c76224bf709a73f3e0694",
"184d0476ead3701a7ffb62d0ae2b43e3ebc41cb27d4d558c09e9092f50fceec2"), (
"260904e50145e0dab40c86488a48f1a857915058f3b263b2d7d4325e71788abd",
"14c9bf7f4c25a6a69a83652a57853462149761ec82954678345c8811abc2daf9"), (
"2a1ceaa3461f3e3e6539c1d5f58823753c2bab300fc7b995be94f510f4d842c7",
"05a4f98932e76eb1a8b4714c6b3bf079aa022750d4d8a6c9761b34b0578ba239"), (
"0d344bf806ab8566bea729eea160fee2e0f685416b577ca8bee0b4346be74cb7",
"0b55b69e6183e03e3ff83e9397e6c4fd7a530a17d77687e98da9346f436fbefa"), (
"2fbc760addd5f584378b071acb9f8ecb4aa9d40bd640d352db3f56a0d0b3f389",
"2cd8a28452aead0fe6860fc152a8d15568d2a7fd41bb3d907a93ee8bdce2e554"), (
"0d0b7216902409e7a4c2588c59b002bdd3f739954deb6869fea6424c26212b6a",
"1d2a5e216d4e4cfced68bf71e68721fdd9297bd0c3c790432156f029d63820a0"), (
"0ab175fa60fe331351385be1eca5174511d284f674b6ba4cf58acb47c018f5a7",
"03aeb24c83f1a5d343d9cfb6c124f6cea32113a4d02c063bbeaa937ff1a492e0")]
# StaticGroupMerkleRoot is the root of the Merkle tree constructed from the StaticGroupKeys above
# only identity commitments are used for the Merkle tree construction
# the root is created locally, using createMembershipList proc from waku_rln_relay_utils module, and the result is hardcoded in here
StaticGroupMerkleRoot* = "2b5c4a3a12d98026e2f55a5cbfc74e8a5a05a8f5403409bf218bbc92ace25b80"
const EpochUnitSeconds* = float64(10) # the rln-relay epoch length in seconds
const MaxClockGapSeconds* = 20.0 # the maximum clock difference between peers in seconds

View File

@ -16,141 +16,142 @@ import
type RlnRelayResult*[T] = Result[T, string]
## RLN is a Nim wrapper for the data types used in zerokit RLN
type RLN* {.incompleteStruct.} = object
type RLNResult* = RlnRelayResult[ptr RLN]
when defined(rln):
## RLN is a Nim wrapper for the data types used in zerokit RLN
type RLN* {.incompleteStruct.} = object
type RLNResult* = RlnRelayResult[ptr RLN]
type
# identity key as defined in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
IDKey* = array[32, byte]
# hash of identity key as defined ed in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
IDCommitment* = array[32, byte]
MerkleNode* = array[32, byte] # Each node of the Merkle tee is a Poseidon hash which is a 32 byte value
Nullifier* = array[32, byte]
Epoch* = array[32, byte]
RlnIdentifier* = array[32, byte]
ZKSNARK* = array[128, byte]
type
# identity key as defined in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
IDKey* = array[32, byte]
# hash of identity key as defined ed in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
IDCommitment* = array[32, byte]
MerkleNode* = array[32, byte] # Each node of the Merkle tee is a Poseidon hash which is a 32 byte value
Nullifier* = array[32, byte]
Epoch* = array[32, byte]
RlnIdentifier* = array[32, byte]
ZKSNARK* = array[128, byte]
# Custom data types defined for waku rln relay -------------------------
type MembershipKeyPair* = object
## user's identity key (a secret key) which is selected randomly
## see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
idKey*: 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
# Custom data types defined for waku rln relay -------------------------
type MembershipKeyPair* = object
## user's identity key (a secret key) which is selected randomly
## see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Membership
idKey*: 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
type RateLimitProof* = object
## 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
## the root of Merkle tree used for the generation of the `proof`
merkleRoot*: MerkleNode
## the epoch used for the generation of the `proof`
epoch*: 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
## nullifier enables linking two messages published during the same epoch
## see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Nullifiers
nullifier*: Nullifier
## Application specific RLN Identifier
rlnIdentifier*: RlnIdentifier
type RateLimitProof* = object
## 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
## the root of Merkle tree used for the generation of the `proof`
merkleRoot*: MerkleNode
## the epoch used for the generation of the `proof`
epoch*: 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
## nullifier enables linking two messages published during the same epoch
## see details in https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view#Nullifiers
nullifier*: Nullifier
## Application specific RLN Identifier
rlnIdentifier*: RlnIdentifier
type MembershipIndex* = uint
type MembershipIndex* = uint
type RlnMembershipCredentials* = object
membershipKeyPair*: MembershipKeyPair
rlnIndex*: MembershipIndex
type RlnMembershipCredentials* = object
membershipKeyPair*: MembershipKeyPair
rlnIndex*: MembershipIndex
type ProofMetadata* = object
nullifier*: Nullifier
shareX*: MerkleNode
shareY*: MerkleNode
type ProofMetadata* = object
nullifier*: Nullifier
shareX*: MerkleNode
shareY*: MerkleNode
type WakuRLNRelay* = ref object
membershipKeyPair*: MembershipKeyPair
# membershipIndex denotes the index of a leaf in the Merkle tree
# that contains the pk of the current peer
# this index is used to retrieve the peer's authentication path
membershipIndex*: MembershipIndex
membershipContractAddress*: Address
ethClientAddress*: string
ethAccountAddress*: Option[Address]
# this field is required for signing transactions
# TODO may need to erase this ethAccountPrivateKey when is not used
# TODO may need to make ethAccountPrivateKey mandatory
ethAccountPrivateKey*: Option[PrivateKey]
rlnInstance*: ptr RLN
pubsubTopic*: string # the pubsub topic for which rln relay is mounted
# contentTopic should be of type waku_message.ContentTopic, however, due to recursive module dependency, the underlying type of ContentTopic is used instead
# TODO a long-term solution is to place types with recursive dependency inside one file
contentTopic*: string
# the log of nullifiers and Shamir shares of the past messages grouped per epoch
nullifierLog*: Table[Epoch, seq[ProofMetadata]]
lastEpoch*: Epoch # the epoch of the last published rln message
validMerkleRoots*: Deque[MerkleNode] # An array of valid merkle roots, which are updated in a FIFO fashion
lastSeenMembershipIndex*: MembershipIndex # the last seen membership index
lastProcessedBlock*: BlockNumber # the last processed block number
type WakuRLNRelay* = ref object
membershipKeyPair*: MembershipKeyPair
# membershipIndex denotes the index of a leaf in the Merkle tree
# that contains the pk of the current peer
# this index is used to retrieve the peer's authentication path
membershipIndex*: MembershipIndex
membershipContractAddress*: Address
ethClientAddress*: string
ethAccountAddress*: Option[Address]
# this field is required for signing transactions
# TODO may need to erase this ethAccountPrivateKey when is not used
# TODO may need to make ethAccountPrivateKey mandatory
ethAccountPrivateKey*: Option[PrivateKey]
rlnInstance*: ptr RLN
pubsubTopic*: string # the pubsub topic for which rln relay is mounted
# contentTopic should be of type waku_message.ContentTopic, however, due to recursive module dependency, the underlying type of ContentTopic is used instead
# TODO a long-term solution is to place types with recursive dependency inside one file
contentTopic*: string
# the log of nullifiers and Shamir shares of the past messages grouped per epoch
nullifierLog*: Table[Epoch, seq[ProofMetadata]]
lastEpoch*: Epoch # the epoch of the last published rln message
validMerkleRoots*: Deque[MerkleNode] # An array of valid merkle roots, which are updated in a FIFO fashion
lastSeenMembershipIndex*: MembershipIndex # the last seen membership index
lastProcessedBlock*: BlockNumber # the last processed block number
type
MessageValidationResult* {.pure.} = enum
Valid,
Invalid,
Spam
MerkleNodeResult* = RlnRelayResult[MerkleNode]
RateLimitProofResult* = RlnRelayResult[RateLimitProof]
# Protobufs enc and init
proc init*(T: type RateLimitProof, buffer: seq[byte]): ProtoResult[T] =
var nsp: RateLimitProof
let pb = initProtoBuffer(buffer)
type
MessageValidationResult* {.pure.} = enum
Valid,
Invalid,
Spam
MerkleNodeResult* = RlnRelayResult[MerkleNode]
RateLimitProofResult* = RlnRelayResult[RateLimitProof]
# Protobufs enc and init
proc init*(T: type RateLimitProof, buffer: seq[byte]): ProtoResult[T] =
var nsp: RateLimitProof
let pb = initProtoBuffer(buffer)
var proof: seq[byte]
discard ? pb.getField(1, proof)
discard nsp.proof.copyFrom(proof)
var proof: seq[byte]
discard ? pb.getField(1, proof)
discard nsp.proof.copyFrom(proof)
var merkleRoot: seq[byte]
discard ? pb.getField(2, merkleRoot)
discard nsp.merkleRoot.copyFrom(merkleRoot)
var merkleRoot: seq[byte]
discard ? pb.getField(2, merkleRoot)
discard nsp.merkleRoot.copyFrom(merkleRoot)
var epoch: seq[byte]
discard ? pb.getField(3, epoch)
discard nsp.epoch.copyFrom(epoch)
var epoch: seq[byte]
discard ? pb.getField(3, epoch)
discard nsp.epoch.copyFrom(epoch)
var shareX: seq[byte]
discard ? pb.getField(4, shareX)
discard nsp.shareX.copyFrom(shareX)
var shareX: seq[byte]
discard ? pb.getField(4, shareX)
discard nsp.shareX.copyFrom(shareX)
var shareY: seq[byte]
discard ? pb.getField(5, shareY)
discard nsp.shareY.copyFrom(shareY)
var shareY: seq[byte]
discard ? pb.getField(5, shareY)
discard nsp.shareY.copyFrom(shareY)
var nullifier: seq[byte]
discard ? pb.getField(6, nullifier)
discard nsp.nullifier.copyFrom(nullifier)
var rlnIdentifier: seq[byte]
discard ? pb.getField(7, rlnIdentifier)
discard nsp.rlnIdentifier.copyFrom(rlnIdentifier)
var nullifier: seq[byte]
discard ? pb.getField(6, nullifier)
discard nsp.nullifier.copyFrom(nullifier)
var rlnIdentifier: seq[byte]
discard ? pb.getField(7, rlnIdentifier)
discard nsp.rlnIdentifier.copyFrom(rlnIdentifier)
return ok(nsp)
return ok(nsp)
proc encode*(nsp: RateLimitProof): ProtoBuffer =
var output = initProtoBuffer()
proc encode*(nsp: RateLimitProof): ProtoBuffer =
var output = initProtoBuffer()
output.write3(1, nsp.proof)
output.write3(2, nsp.merkleRoot)
output.write3(3, nsp.epoch)
output.write3(4, nsp.shareX)
output.write3(5, nsp.shareY)
output.write3(6, nsp.nullifier)
output.write3(7, nsp.rlnIdentifier)
output.write3(1, nsp.proof)
output.write3(2, nsp.merkleRoot)
output.write3(3, nsp.epoch)
output.write3(4, nsp.shareX)
output.write3(5, nsp.shareY)
output.write3(6, nsp.nullifier)
output.write3(7, nsp.rlnIdentifier)
output.finish3()
output.finish3()
return output
return output

File diff suppressed because it is too large Load Diff