diff --git a/tests/incentivization/test_poc.nim b/tests/incentivization/test_poc.nim index 280a8d17c..03fb833da 100644 --- a/tests/incentivization/test_poc.nim +++ b/tests/incentivization/test_poc.nim @@ -18,7 +18,8 @@ import rpc, rpc_codec, common, - txid_proof + txid_proof, + eligibility ] @@ -33,20 +34,17 @@ const TxHashNonExisting* = TxHash.fromHex( const EthClient = "https://sepolia.infura.io/v3/470c2e9a16f24057aee6660081729fb9" -#suite "Waku Incentivization PoC Eligibility Proofs": +suite "Waku Incentivization PoC Eligibility Proofs": - # TODO: test eligibility without dummy protocol - - #[ asyncTest "incentivization PoC: dummy protocol with a valid txid eligibility proof": - let request = genDummyRequestWithTxIdEligibilityProof(@(TxHashExisting.bytes())) - let response = await client.sendRequest(request, serverRemotePeerInfo) + let eligibilityProof = EligibilityProof(proofOfPayment: some(@(TxHashExisting.bytes()))) + let txIdExists = await isEligible(eligibilityProof, EthClient) check: - response.isOk() + txIdExists asyncTest "incentivization PoC: dummy protocol client with an invalid txid eligibility proof": - let request = genDummyRequestWithTxIdEligibilityProof(@(TxHashNonExisting.bytes())) - let response = await client.sendRequest(request, serverRemotePeerInfo) + let eligibilityProof = EligibilityProof(proofOfPayment: some(@(TxHashNonExisting.bytes()))) + let txIdExists = await isEligible(eligibilityProof, EthClient) check: - response.isErr() - ]# + not txIdExists + diff --git a/tests/incentivization/test_rpc_codec.nim b/tests/incentivization/test_rpc_codec.nim index 58b9b09b1..c622a7793 100644 --- a/tests/incentivization/test_rpc_codec.nim +++ b/tests/incentivization/test_rpc_codec.nim @@ -14,13 +14,17 @@ import eligibility ] +#[ let txHash = TxHash.fromHex( "0x0000000000000000000000000000000000000000000000000000000000000000" ) let txHashAsBytes = @(txHash.bytes()) +]# suite "Waku Incentivization Eligibility Codec": - asyncTest "encode eligibility proof": + + asyncTest "encode eligibility proof from bytes": + # FIXME: remove this test? var byteSequence: seq[byte] = @[1, 2, 3, 4, 5, 6, 7, 8] let epRpc = EligibilityProof(proofOfPayment: some(byteSequence)) let encoded = encode(epRpc) @@ -28,7 +32,7 @@ suite "Waku Incentivization Eligibility Codec": check: epRpc == decoded - asyncTest "encode eligibility proof": + asyncTest "encode eligibility proof from txid": let txHash = TxHash.fromHex( "0x0000000000000000000000000000000000000000000000000000000000000000") let txHashAsBytes = @(txHash.bytes())