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. ## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier 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: rpcsrv.rpc("waku_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists. ## 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. ## Returns key identifier on success and an error on failure.
result = generateRandomID().Identifier result = generateRandomID().Identifier
keys.asymKeys.add(result.string, KeyPair(seckey: key, keys.asymKeys.add(result.string, key.toKeyPair())
pubkey: key.getPublicKey()))
rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool: rpcsrv.rpc("shh_deleteKeyPair") do(id: Identifier) -> bool:
## Deletes the specifies key if it exists. ## 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. ## Returns array of messages on success and an error on failure.
let messages = node.getFilterMessages(id.string) let messages = node.getFilterMessages(id.string)
for msg in messages: for msg in messages:
var filterMsg: WhisperFilterMessage result.add WhisperFilterMessage(
sig: msg.decoded.src,
filterMsg.sig = msg.decoded.src recipientPublicKey: msg.dst,
filterMsg.recipientPublicKey = msg.dst ttl: msg.ttl,
filterMsg.ttl = msg.ttl topic: msg.topic,
filterMsg.topic = msg.topic timestamp: msg.timestamp,
filterMsg.timestamp = msg.timestamp payload: msg.decoded.payload,
filterMsg.payload = msg.decoded.payload # Note: whisper_protocol padding is an Option as there is the
# Note: whisper_protocol padding is an Option as there is the # possibility of 0 padding in case of custom padding.
# possibility of 0 padding in case of custom padding. padding: msg.decoded.padding.get(@[]),
if msg.decoded.padding.isSome(): pow: msg.pow,
filterMsg.padding = msg.decoded.padding.get() hash: msg.hash)
filterMsg.pow = msg.pow
filterMsg.hash = msg.hash
result.add(filterMsg)
rpcsrv.rpc("shh_post") do(message: WhisperPostMessage) -> bool: rpcsrv.rpc("shh_post") do(message: WhisperPostMessage) -> bool:
## Creates a whisper message and injects it into the network for ## 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, "editable": true,
"gnetId": null, "gnetId": null,
"graphTooltip": 0, "graphTooltip": 0,
"id": 1, "id": 8,
"links": [], "links": [],
"panels": [ "panels": [
{ {
@ -214,15 +214,15 @@
"tableColumn": "", "tableColumn": "",
"targets": [ "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\"}", "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": "dropped envelopes", "legendFormat": "Invalid envelopes",
"refId": "A" "refId": "A"
} }
], ],
"thresholds": "", "thresholds": "",
"timeFrom": null, "timeFrom": null,
"timeShift": null, "timeShift": null,
"title": "Dropped Envelopes #0", "title": "Invalid Envelopes #0",
"type": "singlestat", "type": "singlestat",
"valueFontSize": "80%", "valueFontSize": "80%",
"valueMaps": [ "valueMaps": [
@ -388,9 +388,9 @@
"refId": "B" "refId": "B"
}, },
{ {
"expr": "dropped_malicious_duplicate_envelopes_total{node=\"0\"}", "expr": "dropped_duplicate_envelopes_total{node=\"0\"}",
"hide": false, "hide": false,
"legendFormat": "Malicious duplicate", "legendFormat": "Duplicate",
"refId": "C" "refId": "C"
}, },
{ {
@ -428,6 +428,18 @@
"hide": false, "hide": false,
"legendFormat": "Too Large", "legendFormat": "Too Large",
"refId": "I" "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": [], "thresholds": [],
@ -776,7 +788,7 @@
"list": [] "list": []
}, },
"time": { "time": {
"from": "now-1h", "from": "now-30m",
"to": "now" "to": "now"
}, },
"timepicker": { "timepicker": {
@ -796,5 +808,5 @@
"timezone": "", "timezone": "",
"title": "Waku Node", "title": "Waku Node",
"uid": "K7Z6IoBZk", "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_bloom_filter_mismatch_envelopes.value +
waku_protocol.dropped_topic_mismatch_envelopes.value + waku_protocol.dropped_topic_mismatch_envelopes.value +
waku_protocol.dropped_benign_duplicate_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 info "Node metrics", connectedPeers, validEnvelopes, invalidEnvelopes
addTimer(Moment.fromNow(2.seconds), logMetrics) addTimer(Moment.fromNow(2.seconds), logMetrics)

View File

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