mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-25 10:25:32 +00:00
bump modules, merge master
This commit is contained in:
commit
a243634aca
@ -25,6 +25,7 @@ PersistBlockTests
|
||||
+ block2675002.json OK
|
||||
+ block299804.json OK
|
||||
+ block420301.json OK
|
||||
+ block4370000.json OK
|
||||
+ block46147.json OK
|
||||
+ block46400.json OK
|
||||
+ block46402.json OK
|
||||
@ -46,7 +47,7 @@ PersistBlockTests
|
||||
+ block97.json OK
|
||||
+ block98.json OK
|
||||
```
|
||||
OK: 43/43 Fail: 0/43 Skip: 0/43
|
||||
OK: 44/44 Fail: 0/44 Skip: 0/44
|
||||
|
||||
---TOTAL---
|
||||
OK: 43/43 Fail: 0/43 Skip: 0/43
|
||||
OK: 44/44 Fail: 0/44 Skip: 0/44
|
||||
|
@ -155,7 +155,12 @@ proc process*(nimbus: NimbusObject) =
|
||||
|
||||
# Main loop
|
||||
while nimbus.state == Running:
|
||||
poll()
|
||||
try:
|
||||
poll()
|
||||
except CatchableError:
|
||||
debug "Exception in poll()",
|
||||
exc = getCurrentException().name,
|
||||
err = getCurrentExceptionMsg()
|
||||
|
||||
# Stop loop
|
||||
waitFor nimbus.stop()
|
||||
|
9353
tests/fixtures/PersistBlockTests/block4370000.json
vendored
Normal file
9353
tests/fixtures/PersistBlockTests/block4370000.json
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -100,6 +100,7 @@ proc main() =
|
||||
chainDB.dumpTest(2_463_413) # tangerine call* gas cost bug
|
||||
chainDB.dumpTest(2_675_000) # spurious dragon first block
|
||||
chainDB.dumpTest(2_675_002) # EIP155 tx.getSender
|
||||
chainDB.dumpTest(4_370_000) # Byzantium first block
|
||||
|
||||
when isMainModule:
|
||||
var message: string
|
||||
|
@ -32,7 +32,7 @@ createRpcSigs(RpcSocketClient, sigPath)
|
||||
proc toEthAddressStr(address: EthAddress): EthAddressStr =
|
||||
result = ("0x" & address.toHex).ethAddressStr
|
||||
|
||||
proc doTests =
|
||||
proc doTests {.async.} =
|
||||
# TODO: Include other transports such as Http
|
||||
var ethNode = setupEthNode(eth)
|
||||
let
|
||||
@ -62,7 +62,7 @@ proc doTests =
|
||||
|
||||
# Begin tests
|
||||
rpcServer.start()
|
||||
waitFor client.connect("localhost", Port(RPC_PORT))
|
||||
await client.connect("localhost", Port(RPC_PORT))
|
||||
|
||||
# TODO: add more tests here
|
||||
suite "Remote Procedure Calls":
|
||||
@ -70,23 +70,23 @@ proc doTests =
|
||||
let
|
||||
blockNum = state.blockheader.blockNumber
|
||||
callParams = EthCall(value: some(100.u256))
|
||||
r1 = waitFor client.eth_call(callParams, "0x" & blockNum.toHex)
|
||||
r1 = await client.eth_call(callParams, "0x" & blockNum.toHex)
|
||||
check r1 == "0x"
|
||||
test "eth_getBalance":
|
||||
let r2 = waitFor client.eth_getBalance(ZERO_ADDRESS.toEthAddressStr, "0x0")
|
||||
let r2 = await client.eth_getBalance(ZERO_ADDRESS.toEthAddressStr, "0x0")
|
||||
check r2 == 0
|
||||
|
||||
let blockNum = state.blockheader.blockNumber
|
||||
let r3 = waitFor client.eth_getBalance(address.toEthAddressStr, "0x" & blockNum.toHex)
|
||||
let r3 = await client.eth_getBalance(address.toEthAddressStr, "0x" & blockNum.toHex)
|
||||
check r3 == 0
|
||||
test "eth_estimateGas":
|
||||
let
|
||||
call = EthCall()
|
||||
blockNum = state.blockheader.blockNumber
|
||||
r4 = waitFor client.eth_estimateGas(call, "0x" & blockNum.toHex)
|
||||
r4 = await client.eth_estimateGas(call, "0x" & blockNum.toHex)
|
||||
check r4 == 21_000
|
||||
|
||||
rpcServer.stop()
|
||||
rpcServer.close()
|
||||
|
||||
doTests()
|
||||
waitFor doTests()
|
||||
|
@ -12,7 +12,7 @@ template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||
const sigPath = &"{sourceDir}{DirSep}rpcclient{DirSep}ethcallsigs.nim"
|
||||
createRpcSigs(RpcSocketClient, sigPath)
|
||||
|
||||
proc doTests =
|
||||
proc doTests {.async.} =
|
||||
var ethNode = setupEthNode(Whisper)
|
||||
|
||||
# Create Ethereum RPCs
|
||||
@ -25,82 +25,82 @@ proc doTests =
|
||||
|
||||
# Begin tests
|
||||
rpcServer.start()
|
||||
waitFor client.connect("localhost", Port(RPC_PORT))
|
||||
await client.connect("localhost", Port(RPC_PORT))
|
||||
|
||||
suite "Whisper Remote Procedure Calls":
|
||||
test "shh_version":
|
||||
check waitFor(client.shh_version()) == whisperVersionStr
|
||||
check await(client.shh_version()) == whisperVersionStr
|
||||
test "shh_info":
|
||||
let info = waitFor client.shh_info()
|
||||
let info = await client.shh_info()
|
||||
check info.maxMessageSize == defaultMaxMsgSize
|
||||
test "shh_setMaxMessageSize":
|
||||
let testValue = 1024'u64
|
||||
check waitFor(client.shh_setMaxMessageSize(testValue)) == true
|
||||
var info = waitFor client.shh_info()
|
||||
check await(client.shh_setMaxMessageSize(testValue)) == true
|
||||
var info = await client.shh_info()
|
||||
check info.maxMessageSize == testValue
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_setMaxMessageSize(defaultMaxMsgSize + 1))
|
||||
info = waitFor client.shh_info()
|
||||
expect ValueError:
|
||||
discard await(client.shh_setMaxMessageSize(defaultMaxMsgSize + 1))
|
||||
info = await client.shh_info()
|
||||
check info.maxMessageSize == testValue
|
||||
test "shh_setMinPoW":
|
||||
let testValue = 0.0001
|
||||
check waitFor(client.shh_setMinPoW(testValue)) == true
|
||||
let info = waitFor client.shh_info()
|
||||
check await(client.shh_setMinPoW(testValue)) == true
|
||||
let info = await client.shh_info()
|
||||
check info.minPow == testValue
|
||||
# test "shh_markTrustedPeer":
|
||||
# TODO: need to connect a peer to test
|
||||
test "shh asymKey tests":
|
||||
let keyID = waitFor client.shh_newKeyPair()
|
||||
let keyID = await client.shh_newKeyPair()
|
||||
check:
|
||||
waitFor(client.shh_hasKeyPair(keyID)) == true
|
||||
waitFor(client.shh_deleteKeyPair(keyID)) == true
|
||||
waitFor(client.shh_hasKeyPair(keyID)) == false
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteKeyPair(keyID))
|
||||
await(client.shh_hasKeyPair(keyID)) == true
|
||||
await(client.shh_deleteKeyPair(keyID)) == true
|
||||
await(client.shh_hasKeyPair(keyID)) == false
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteKeyPair(keyID))
|
||||
|
||||
let privkey = "0x5dc5381cae54ba3174dc0d46040fe11614d0cc94d41185922585198b4fcef9d3"
|
||||
let pubkey = "0x04e5fd642a0f630bbb1e4cd7df629d7b8b019457a9a74f983c0484a045cebb176def86a54185b50bbba6bbf97779173695e92835d63109c23471e6da382f922fdb"
|
||||
let keyID2 = waitFor client.shh_addPrivateKey(privkey)
|
||||
let keyID2 = await client.shh_addPrivateKey(privkey)
|
||||
check:
|
||||
waitFor(client.shh_getPublicKey(keyID2)) == pubkey.toPublicKey
|
||||
waitFor(client.shh_getPrivateKey(keyID2)) == privkey.toPrivateKey
|
||||
waitFor(client.shh_hasKeyPair(keyID2)) == true
|
||||
waitFor(client.shh_deleteKeyPair(keyID2)) == true
|
||||
waitFor(client.shh_hasKeyPair(keyID2)) == false
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteKeyPair(keyID2))
|
||||
await(client.shh_getPublicKey(keyID2)) == pubkey.toPublicKey
|
||||
await(client.shh_getPrivateKey(keyID2)) == privkey.toPrivateKey
|
||||
await(client.shh_hasKeyPair(keyID2)) == true
|
||||
await(client.shh_deleteKeyPair(keyID2)) == true
|
||||
await(client.shh_hasKeyPair(keyID2)) == false
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteKeyPair(keyID2))
|
||||
test "shh symKey tests":
|
||||
let keyID = waitFor client.shh_newSymKey()
|
||||
let keyID = await client.shh_newSymKey()
|
||||
check:
|
||||
waitFor(client.shh_hasSymKey(keyID)) == true
|
||||
waitFor(client.shh_deleteSymKey(keyID)) == true
|
||||
waitFor(client.shh_hasSymKey(keyID)) == false
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteSymKey(keyID))
|
||||
await(client.shh_hasSymKey(keyID)) == true
|
||||
await(client.shh_deleteSymKey(keyID)) == true
|
||||
await(client.shh_hasSymKey(keyID)) == false
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteSymKey(keyID))
|
||||
|
||||
let symKey = "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
let keyID2 = waitFor client.shh_addSymKey(symKey)
|
||||
let keyID2 = await client.shh_addSymKey(symKey)
|
||||
check:
|
||||
waitFor(client.shh_getSymKey(keyID2)) == symKey.toSymKey
|
||||
waitFor(client.shh_hasSymKey(keyID2)) == true
|
||||
waitFor(client.shh_deleteSymKey(keyID2)) == true
|
||||
waitFor(client.shh_hasSymKey(keyID2)) == false
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteSymKey(keyID2))
|
||||
await(client.shh_getSymKey(keyID2)) == symKey.toSymKey
|
||||
await(client.shh_hasSymKey(keyID2)) == true
|
||||
await(client.shh_deleteSymKey(keyID2)) == true
|
||||
await(client.shh_hasSymKey(keyID2)) == false
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteSymKey(keyID2))
|
||||
|
||||
let keyID3 = waitFor client.shh_generateSymKeyFromPassword("password")
|
||||
let keyID4 = waitFor client.shh_generateSymKeyFromPassword("password")
|
||||
let keyID5 = waitFor client.shh_generateSymKeyFromPassword("nimbus!")
|
||||
let keyID3 = await client.shh_generateSymKeyFromPassword("password")
|
||||
let keyID4 = await client.shh_generateSymKeyFromPassword("password")
|
||||
let keyID5 = await client.shh_generateSymKeyFromPassword("nimbus!")
|
||||
check:
|
||||
waitFor(client.shh_getSymKey(keyID3)) ==
|
||||
waitFor(client.shh_getSymKey(keyID4))
|
||||
waitFor(client.shh_getSymKey(keyID3)) !=
|
||||
waitFor(client.shh_getSymKey(keyID5))
|
||||
waitFor(client.shh_hasSymKey(keyID3)) == true
|
||||
waitFor(client.shh_deleteSymKey(keyID3)) == true
|
||||
waitFor(client.shh_hasSymKey(keyID3)) == false
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteSymKey(keyID3))
|
||||
await(client.shh_getSymKey(keyID3)) ==
|
||||
await(client.shh_getSymKey(keyID4))
|
||||
await(client.shh_getSymKey(keyID3)) !=
|
||||
await(client.shh_getSymKey(keyID5))
|
||||
await(client.shh_hasSymKey(keyID3)) == true
|
||||
await(client.shh_deleteSymKey(keyID3)) == true
|
||||
await(client.shh_hasSymKey(keyID3)) == false
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteSymKey(keyID3))
|
||||
|
||||
# Some defaults for the filter & post tests
|
||||
let
|
||||
@ -115,24 +115,24 @@ proc doTests =
|
||||
test "shh filter create and delete":
|
||||
let
|
||||
topic = topicStr.toTopic()
|
||||
symKeyID = waitFor client.shh_newSymKey()
|
||||
symKeyID = await client.shh_newSymKey()
|
||||
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
||||
topics: some(@[topic]))
|
||||
filterID = waitFor client.shh_newMessageFilter(options)
|
||||
filterID = await client.shh_newMessageFilter(options)
|
||||
|
||||
check:
|
||||
filterID.string.isValidIdentifier
|
||||
waitFor(client.shh_deleteMessageFilter(filterID))
|
||||
expect Exception:
|
||||
discard waitFor(client.shh_deleteMessageFilter(filterID))
|
||||
await(client.shh_deleteMessageFilter(filterID)) == true
|
||||
expect ValueError:
|
||||
discard await(client.shh_deleteMessageFilter(filterID))
|
||||
|
||||
test "shh symKey post and filter loop":
|
||||
let
|
||||
topic = topicStr.toTopic()
|
||||
symKeyID = waitFor client.shh_newSymKey()
|
||||
symKeyID = await client.shh_newSymKey()
|
||||
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
||||
topics: some(@[topic]))
|
||||
filterID = waitFor client.shh_newMessageFilter(options)
|
||||
filterID = await client.shh_newMessageFilter(options)
|
||||
message = WhisperPostMessage(symKeyID: some(symKeyID),
|
||||
ttl: ttl,
|
||||
topic: some(topic),
|
||||
@ -140,10 +140,10 @@ proc doTests =
|
||||
powTime: powTime,
|
||||
powTarget: powTarget)
|
||||
check:
|
||||
waitFor(client.shh_setMinPoW(powTarget)) == true
|
||||
waitFor(client.shh_post(message)) == true
|
||||
await(client.shh_setMinPoW(powTarget)) == true
|
||||
await(client.shh_post(message)) == true
|
||||
|
||||
let messages = waitFor client.shh_getFilterMessages(filterID)
|
||||
let messages = await client.shh_getFilterMessages(filterID)
|
||||
check:
|
||||
messages.len == 1
|
||||
messages[0].sig.isNone()
|
||||
@ -154,15 +154,15 @@ proc doTests =
|
||||
messages[0].padding.len > 0
|
||||
messages[0].pow >= powTarget
|
||||
|
||||
waitFor(client.shh_deleteMessageFilter(filterID))
|
||||
await(client.shh_deleteMessageFilter(filterID)) == true
|
||||
|
||||
test "shh asymKey post and filter loop":
|
||||
let
|
||||
topic = topicStr.toTopic()
|
||||
privateKeyID = waitFor client.shh_newKeyPair()
|
||||
privateKeyID = await client.shh_newKeyPair()
|
||||
options = WhisperFilterOptions(privateKeyID: some(privateKeyID))
|
||||
filterID = waitFor client.shh_newMessageFilter(options)
|
||||
pubKey = waitFor client.shh_getPublicKey(privateKeyID)
|
||||
filterID = await client.shh_newMessageFilter(options)
|
||||
pubKey = await client.shh_getPublicKey(privateKeyID)
|
||||
message = WhisperPostMessage(pubKey: some(pubKey),
|
||||
ttl: ttl,
|
||||
topic: some(topic),
|
||||
@ -170,10 +170,10 @@ proc doTests =
|
||||
powTime: powTime,
|
||||
powTarget: powTarget)
|
||||
check:
|
||||
waitFor(client.shh_setMinPoW(powTarget)) == true
|
||||
waitFor(client.shh_post(message)) == true
|
||||
await(client.shh_setMinPoW(powTarget)) == true
|
||||
await(client.shh_post(message)) == true
|
||||
|
||||
let messages = waitFor client.shh_getFilterMessages(filterID)
|
||||
let messages = await client.shh_getFilterMessages(filterID)
|
||||
check:
|
||||
messages.len == 1
|
||||
messages[0].sig.isNone()
|
||||
@ -184,18 +184,18 @@ proc doTests =
|
||||
messages[0].padding.len > 0
|
||||
messages[0].pow >= powTarget
|
||||
|
||||
waitFor(client.shh_deleteMessageFilter(filterID))
|
||||
await(client.shh_deleteMessageFilter(filterID)) == true
|
||||
|
||||
test "shh signature in post and filter loop":
|
||||
let
|
||||
topic = topicStr.toTopic()
|
||||
symKeyID = waitFor client.shh_newSymKey()
|
||||
privateKeyID = waitFor client.shh_newKeyPair()
|
||||
pubKey = waitFor client.shh_getPublicKey(privateKeyID)
|
||||
symKeyID = await client.shh_newSymKey()
|
||||
privateKeyID = await client.shh_newKeyPair()
|
||||
pubKey = await client.shh_getPublicKey(privateKeyID)
|
||||
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
||||
topics: some(@[topic]),
|
||||
sig: some(pubKey))
|
||||
filterID = waitFor client.shh_newMessageFilter(options)
|
||||
filterID = await client.shh_newMessageFilter(options)
|
||||
message = WhisperPostMessage(symKeyID: some(symKeyID),
|
||||
sig: some(privateKeyID),
|
||||
ttl: ttl,
|
||||
@ -204,10 +204,10 @@ proc doTests =
|
||||
powTime: powTime,
|
||||
powTarget: powTarget)
|
||||
check:
|
||||
waitFor(client.shh_setMinPoW(powTarget)) == true
|
||||
waitFor(client.shh_post(message)) == true
|
||||
await(client.shh_setMinPoW(powTarget)) == true
|
||||
await(client.shh_post(message)) == true
|
||||
|
||||
let messages = waitFor client.shh_getFilterMessages(filterID)
|
||||
let messages = await client.shh_getFilterMessages(filterID)
|
||||
check:
|
||||
messages.len == 1
|
||||
messages[0].sig.get() == pubKey
|
||||
@ -218,9 +218,9 @@ proc doTests =
|
||||
messages[0].padding.len > 0
|
||||
messages[0].pow >= powTarget
|
||||
|
||||
waitFor(client.shh_deleteMessageFilter(filterID))
|
||||
await(client.shh_deleteMessageFilter(filterID)) == true
|
||||
|
||||
rpcServer.stop()
|
||||
rpcServer.close()
|
||||
|
||||
doTests()
|
||||
waitFor doTests()
|
||||
|
2
vendor/Nim
vendored
2
vendor/Nim
vendored
@ -1 +1 @@
|
||||
Subproject commit b6d96cafc8bcad1f3d32f2910b25cd11a93f7751
|
||||
Subproject commit c6f601d48ec81e0d6e052ba0d19a195b55cc68f2
|
2
vendor/nim-beacon-chain
vendored
2
vendor/nim-beacon-chain
vendored
@ -1 +1 @@
|
||||
Subproject commit 8da71715eb7951bca996162d3b8407792b970934
|
||||
Subproject commit 6a47ca3c4639f97bc176eeb83ab551d400761295
|
2
vendor/nim-blscurve
vendored
2
vendor/nim-blscurve
vendored
@ -1 +1 @@
|
||||
Subproject commit 7c18d7c5eb509803be7739ffb1028b4650215c07
|
||||
Subproject commit e6dd2739c05bf21880e93efd7e76369544316905
|
2
vendor/nim-chronos
vendored
2
vendor/nim-chronos
vendored
@ -1 +1 @@
|
||||
Subproject commit 6e7a753793bccae95889f6e46510098a7934400b
|
||||
Subproject commit 738a9e7b724dd89572b39c5fd66aa6cbb8e907e2
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
||||
Subproject commit 55e1eff4a95c1ed889fbf74b6069766538aa6ef7
|
||||
Subproject commit d2d6d7fc166efa26a8815ed9eee8c0fcbabb39d8
|
2
vendor/nim-json-rpc
vendored
2
vendor/nim-json-rpc
vendored
@ -1 +1 @@
|
||||
Subproject commit 493583b7f45e59e371fbc067d74629ad84c99801
|
||||
Subproject commit 707567c7ab775107a6e7eb47ff728e3596079d62
|
2
vendor/nim-json-serialization
vendored
2
vendor/nim-json-serialization
vendored
@ -1 +1 @@
|
||||
Subproject commit 4ffd0b3af3fa5b49c5b44071e8f4d3aa56cae92f
|
||||
Subproject commit f3d8f822bddf1135233b82bd0f9b0f6495ce64ea
|
2
vendor/nim-result
vendored
2
vendor/nim-result
vendored
@ -1 +1 @@
|
||||
Subproject commit ca56ea36b8dd7f644305c383dbebd28c1e44399b
|
||||
Subproject commit 1ca2401f3b5b239b54e09aece3a29480f1ef3958
|
2
vendor/nim-std-shims
vendored
2
vendor/nim-std-shims
vendored
@ -1 +1 @@
|
||||
Subproject commit b909465eb876b6ceaa3da861a65fe2f1248c3d77
|
||||
Subproject commit 5e03d90ad3b0b5864b542a2c46405f112841091c
|
Loading…
x
Reference in New Issue
Block a user