From 40fa4547c1dcc63e558d64fa749b6d15da9be884 Mon Sep 17 00:00:00 2001 From: jangko Date: Sun, 21 Jan 2024 07:34:46 +0700 Subject: [PATCH] Reduce compiler warnings in testethcalls --- tests/testethcalls.nim | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/testethcalls.nim b/tests/testethcalls.nim index 3621217..04ccf0f 100644 --- a/tests/testethcalls.nim +++ b/tests/testethcalls.nim @@ -43,27 +43,42 @@ server.rpc(rpcDynamicName "testReturnUint256") do() -> UInt256: let r: UInt256 = "0x1234567890abcdef".parse(UInt256, 16) return r -proc testLocalCalls: Future[seq[JsonString]] = +proc testLocalCalls: Future[seq[JsonString]] {.async.} = ## Call RPCs created with `rpc` locally. ## This simply demonstrates async calls of the procs generated by the `rpc` macro. let uint256Param = server.executeMethod("rpc.uint256Param", %[%"0x1234567890"]) returnUint256 = server.executeMethod("rpc.testReturnUint256", %[]) - return all(uint256Param, returnUint256) -proc testRemoteUInt256: Future[seq[JsonString]] = + await noCancel(allFutures(uint256Param, returnUint256)) + var pending: seq[JsonString] + pending.add uint256Param.read() + pending.add returnUint256.read() + return pending + +proc testRemoteUInt256: Future[seq[JsonString]] {.async.} = ## Call function remotely on server, testing `stint` types let uint256Param = client.call("rpc.uint256Param", %[%"0x1234567890"]) returnUint256 = client.call("rpc.testReturnUint256", %[]) - return all(uint256Param, returnUint256) -proc testSigCalls: Future[seq[string]] = + await noCancel(allFutures(uint256Param, returnUint256)) + var pending: seq[JsonString] + pending.add uint256Param.read() + pending.add returnUint256.read() + return pending + +proc testSigCalls: Future[seq[string]] {.async.} = ## Remote call using proc generated from signatures in `ethcallsigs.nim` let version = client.web3_clientVersion() sha3 = client.web3_sha3("0x68656c6c6f20776f726c64") - return all(version, sha3) + + await noCancel(allFutures(version, sha3)) + var pending: seq[string] + pending.add version.read() + pending.add sha3.read() + return pending server.start() waitFor client.connect(server.localAddress()[0])