diff --git a/nimbus/rpc/waku.nim b/nimbus/rpc/waku.nim index 5ae44258f..c21b32517 100644 --- a/nimbus/rpc/waku.nim +++ b/nimbus/rpc/waku.nim @@ -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. diff --git a/nimbus/rpc/whisper.nim b/nimbus/rpc/whisper.nim index 13d882d1b..c76d36cd5 100644 --- a/nimbus/rpc/whisper.nim +++ b/nimbus/rpc/whisper.nim @@ -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 diff --git a/vendor/nim-eth b/vendor/nim-eth index fc327718f..3ee5651b7 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit fc327718fbbbdf9a96827b6702d70f3a6e756425 +Subproject commit 3ee5651b7c1b967e9aa115d99125ed35ac3ab2f1 diff --git a/waku/examples/waku-grafana-dashboard.json b/waku/examples/waku-grafana-dashboard.json index 258813bdf..e7df1dff4 100644 --- a/waku/examples/waku-grafana-dashboard.json +++ b/waku/examples/waku-grafana-dashboard.json @@ -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 } \ No newline at end of file diff --git a/waku/wakunode.nim b/waku/wakunode.nim index 05d33c56d..2729e97c5 100644 --- a/waku/wakunode.nim +++ b/waku/wakunode.nim @@ -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) diff --git a/wrappers/libnimbus.nim b/wrappers/libnimbus.nim index 67a4a711f..14e2bdd79 100644 --- a/wrappers/libnimbus.nim +++ b/wrappers/libnimbus.nim @@ -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