fix: update and shift unittest (#2934)

* fix: update and shift location of unit test
This commit is contained in:
Darshan K 2024-07-26 16:57:34 +05:30 committed by GitHub
parent d9ff2ffb8f
commit 08973add7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 21 deletions

View File

@ -16,6 +16,7 @@ import
../waku_store/store_utils,
../waku_archive/archive_utils,
../waku_relay/utils,
../waku_rln_relay/test_rln_group_manager_onchain,
../testlib/[wakucore, wakunode, testasync, futures],
../resources/payloads
@ -136,6 +137,33 @@ suite "Waku RlnRelay - End to End":
check:
not isCompleted2
asyncTest "rln-relay-max-message-limit testing":
let
nodekey = generateSecp256k1Key()
node = newTestWakuNode(nodekey, parseIpAddress("0.0.0.0"), Port(0))
await node.mountRelay(@[DefaultPubsubTopic])
let contractAddress = await uploadRLNContract(EthClient)
let wakuRlnConfig = WakuRlnConfig(
rlnRelayDynamic: true,
rlnRelayCredIndex: some(0.uint),
rlnRelayUserMessageLimit: 111,
rlnRelayTreepath: genTempPath("rln_tree", "wakunode_0"),
rlnRelayEthClientAddress: EthClient,
rlnRelayEthContractAddress: $contractAddress,
rlnRelayChainId: 1337,
onFatalErrorAction: proc(errStr: string) =
raiseAssert errStr
,
)
try:
await node.mountRlnRelay(wakuRlnConfig)
except CatchableError as e:
check e.msg ==
"failed to mount WakuRlnRelay: rln-relay-user-message-limit can't exceed the MAX_MESSAGE_LIMIT in the rln contract"
suite "Analysis of Bandwith Limitations":
asyncTest "Valid Payload Sizes":
# Given the node enables Relay and Rln while subscribing to a pubsub topic

View File

@ -782,26 +782,6 @@ suite "Onchain group manager":
await manager.stop()
asyncTest "rln-relay-max-message-limit testing":
let
nodekey = generateSecp256k1Key()
node = newTestWakuNode(nodekey, parseIpAddress("0.0.0.0"), Port(0))
await node.mountRelay(@[DefaultPubsubTopic])
let wakuRlnConfig = WakuRlnConfig(
rlnRelayDynamic: false,
rlnRelayCredIndex: some(0.uint),
rlnRelayUserMessageLimit: 111,
rlnRelayTreepath: genTempPath("rln_tree", "wakunode_0"),
)
try:
await node.mountRlnRelay(wakuRlnConfig)
except CatchableError as e:
check e.msg ==
"failed to mount WakuRlnRelay: rln-relay-user-message-limit can't be exceed then MAX_MESSAGE_LIMIT set by rln contract"
################################
## Terminating/removing Anvil
################################

View File

@ -1090,7 +1090,7 @@ proc mountRlnRelay*(
newException(CatchableError, "failed to mount WakuRlnRelay: " & rlnRelayRes.error)
let rlnRelay = rlnRelayRes.get()
if (rlnConf.rlnRelayUserMessageLimit > rlnRelay.groupManager.rlnRelayMaxMessageLimit):
error "rln-relay-user-message-limit can't be exceed then MAX_MESSAGE_LIMIT set by rln contract"
error "rln-relay-user-message-limit can't exceed the MAX_MESSAGE_LIMIT in the rln contract"
let validator = generateRlnValidator(rlnRelay, spamHandler)
# register rln validator as default validator