Merge pull request #446 from status-im/waku-queue-fixes

Bump vendor/nim-eth for waku/whisper queue fixes
This commit is contained in:
Kim De Mey 2020-01-23 22:50:12 +01:00 committed by GitHub
commit a2478baeff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 32 deletions

View File

@ -80,7 +80,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier
keys.asymKeys.add(result.string, key.toKeyPair)
keys.asymKeys.add(result.string, key.toKeyPair())
rpcsrv.rpc("waku_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists.

View File

@ -81,8 +81,7 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier
keys.asymKeys.add(result.string, KeyPair(seckey: key,
pubkey: key.getPublicKey()))
keys.asymKeys.add(result.string, key.toKeyPair())
rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists.
@ -283,22 +282,18 @@ proc setupWhisperRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
## Returns array of messages on success and an error on failure.
let messages = node.getFilterMessages(id.string)
for msg in messages:
var filterMsg: WhisperFilterMessage
filterMsg.sig = msg.decoded.src
filterMsg.recipientPublicKey = msg.dst
filterMsg.ttl = msg.ttl
filterMsg.topic = msg.topic
filterMsg.timestamp = msg.timestamp
filterMsg.payload = msg.decoded.payload
# Note: whisper_protocol padding is an Option as there is the
# possibility of 0 padding in case of custom padding.
if msg.decoded.padding.isSome():
filterMsg.padding = msg.decoded.padding.get()
filterMsg.pow = msg.pow
filterMsg.hash = msg.hash
result.add(filterMsg)
result.add WhisperFilterMessage(
sig: msg.decoded.src,
recipientPublicKey: msg.dst,
ttl: msg.ttl,
topic: msg.topic,
timestamp: msg.timestamp,
payload: msg.decoded.payload,
# Note: whisper_protocol padding is an Option as there is the
# possibility of 0 padding in case of custom padding.
padding: msg.decoded.padding.get(@[]),
pow: msg.pow,
hash: msg.hash)
rpcsrv.rpc("shh_post") do(message: WhisperPostMessage) -> bool:
## Creates a whisper message and injects it into the network for

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit fc327718fbbbdf9a96827b6702d70f3a6e756425
Subproject commit 3ee5651b7c1b967e9aa115d99125ed35ac3ab2f1

View File

@ -15,7 +15,7 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"id": 8,
"links": [],
"panels": [
{
@ -214,15 +214,15 @@
"tableColumn": "",
"targets": [
{
"expr": "dropped_expired_envelopes_total{node=\"0\"} + dropped_from_future_envelopes_total{node=\"0\"} + dropped_low_pow_envelopes_total{node=\"0\"} + dropped_too_large_envelopes_total{node=\"0\"} + dropped_bloom_filter_mismatch_envelopes_total{node=\"0\"} + dropped_topic_mismatch_envelopes_total{node=\"0\"} +dropped_benign_duplicate_envelopes_total{node=\"0\"} + dropped_malicious_duplicate_envelopes_total{node=\"0\"}",
"legendFormat": "dropped envelopes",
"expr": "dropped_expired_envelopes_total{node=\"0\"} + dropped_from_future_envelopes_total{node=\"0\"} + dropped_low_pow_envelopes_total{node=\"0\"} + dropped_too_large_envelopes_total{node=\"0\"} + dropped_bloom_filter_mismatch_envelopes_total{node=\"0\"} + dropped_topic_mismatch_envelopes_total{node=\"0\"} +dropped_benign_duplicate_envelopes_total{node=\"0\"} + dropped_duplicate_envelopes_total{node=\"0\"}",
"legendFormat": "Invalid envelopes",
"refId": "A"
}
],
"thresholds": "",
"timeFrom": null,
"timeShift": null,
"title": "Dropped Envelopes #0",
"title": "Invalid Envelopes #0",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
@ -388,9 +388,9 @@
"refId": "B"
},
{
"expr": "dropped_malicious_duplicate_envelopes_total{node=\"0\"}",
"expr": "dropped_duplicate_envelopes_total{node=\"0\"}",
"hide": false,
"legendFormat": "Malicious duplicate",
"legendFormat": "Duplicate",
"refId": "C"
},
{
@ -428,6 +428,18 @@
"hide": false,
"legendFormat": "Too Large",
"refId": "I"
},
{
"expr": "dropped_full_queue_new_envelopes_total{node=\"0\"}",
"hide": false,
"legendFormat": "Full queue new",
"refId": "J"
},
{
"expr": "dropped_full_queue_old_envelopes_total{node=\"0\"}",
"hide": false,
"legendFormat": "Full queue old",
"refId": "K"
}
],
"thresholds": [],
@ -776,7 +788,7 @@
"list": []
},
"time": {
"from": "now-1h",
"from": "now-30m",
"to": "now"
},
"timepicker": {
@ -796,5 +808,5 @@
"timezone": "",
"title": "Waku Node",
"uid": "K7Z6IoBZk",
"version": 5
"version": 2
}

View File

@ -134,7 +134,7 @@ proc run(config: WakuNodeConf) =
waku_protocol.dropped_bloom_filter_mismatch_envelopes.value +
waku_protocol.dropped_topic_mismatch_envelopes.value +
waku_protocol.dropped_benign_duplicate_envelopes.value +
waku_protocol.dropped_malicious_duplicate_envelopes.value
waku_protocol.dropped_duplicate_envelopes.value
info "Node metrics", connectedPeers, validEnvelopes, invalidEnvelopes
addTimer(Moment.fromNow(2.seconds), logMetrics)

View File

@ -99,7 +99,8 @@ proc nimbus_start(port: uint16, startListening: bool, enableDiscovery: bool,
else:
try:
let privKey = initPrivateKey(makeOpenArray(privateKey, 32))
keypair = KeyPair(seckey: privKey, pubkey: privKey.getPublicKey())
keypair = privKey.toKeyPair()
except EthKeysException:
error "Passed an invalid private key."
return false
@ -176,8 +177,8 @@ proc nimbus_add_keypair(privateKey: ptr byte, id: var Identifier):
var keypair: KeyPair
try:
keypair.seckey = initPrivateKey(makeOpenArray(privateKey, 32))
keypair.pubkey = keypair.seckey.getPublicKey()
let privKey = initPrivateKey(makeOpenArray(privateKey, 32))
keypair = privKey.toKeyPair()
except EthKeysException, Secp256k1Exception:
error "Passed an invalid private key."
return false