mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 05:44:40 +00:00
Merge pull request #457 from status-im/waku-topics
Check all subscribed topics in quicksim + bump vendor/nim-eth
This commit is contained in:
commit
d3b8833145
@ -271,7 +271,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
||||
if config.topics.isSome():
|
||||
try:
|
||||
# TODO: an addTopics call would probably be more useful
|
||||
let result = await node.setTopics(config.topics.get().concat(filter.topics))
|
||||
let result = await node.setTopicInterest(config.topics.get().concat(filter.topics))
|
||||
if not result:
|
||||
raise newException(ValueError, "Too many topics")
|
||||
except CatchableError:
|
||||
|
2
vendor/nim-eth
vendored
2
vendor/nim-eth
vendored
@ -1 +1 @@
|
||||
Subproject commit b89874f6cc35f2506de5d97c9a50978c77e0048f
|
||||
Subproject commit c679b9d436fa1e5e00690dba443c0c9f31b321b9
|
@ -77,15 +77,15 @@ This dashboard can be found at `./waku/metrics/waku-sim-all-nodes-grafana-dashbo
|
||||
|
||||
*This section last updated February 14, 2020*
|
||||
|
||||
This client of Waku is spec compliant with [Waku spec v0.3](https://specs.vac.dev/waku/waku.html) with the exception of:
|
||||
- Currently nodes with higher version don't automatically disconnect if versions are different
|
||||
This client of Waku is spec compliant with [Waku spec v0.3](https://specs.vac.dev/waku/waku.html).
|
||||
|
||||
It doesn't yet implement the following recommended features:
|
||||
- No support for rate limiting
|
||||
- No support for DNS discovery to find Waku nodes
|
||||
- It doesn't disconnect a peer if it receives a message before a Status message
|
||||
- No support for negotiation with peer supporting multiple version
|
||||
- No support for negotiation with peer supporting multiple versions via Devp2p capabilities in `Hello` packet
|
||||
|
||||
Additionally it makes the following choices:
|
||||
- It doesn't send message confirmations
|
||||
- It has partial support for accounting
|
||||
- It has partial support for accounting:
|
||||
- Accounting of total resource usage and total circulated envelopes is done through metrics But no accounting is done for individual peers.
|
||||
|
@ -11,16 +11,18 @@ template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
||||
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||
|
||||
const topicAmount = 100
|
||||
|
||||
let
|
||||
trafficNode = newRpcHttpClient()
|
||||
lightWakuNode = newRpcHttpClient()
|
||||
lightNode = newRpcHttpClient()
|
||||
lightNode2 = newRpcHttpClient()
|
||||
|
||||
waitFor lightWakuNode.connect("localhost", Port(8545))
|
||||
waitFor lightNode.connect("localhost", Port(8546))
|
||||
waitFor lightNode.connect("localhost", Port(8545))
|
||||
waitFor lightNode2.connect("localhost", Port(8546))
|
||||
waitFor trafficNode.connect("localhost", Port(8548))
|
||||
|
||||
proc generateTopics(amount = 100): seq[waku_protocol.Topic] =
|
||||
proc generateTopics(amount = topicAmount): seq[waku_protocol.Topic] =
|
||||
var topic: waku_protocol.Topic
|
||||
for i in 0..<amount:
|
||||
if randomBytes(topic) != 4:
|
||||
@ -30,15 +32,15 @@ proc generateTopics(amount = 100): seq[waku_protocol.Topic] =
|
||||
let
|
||||
symKey = "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||
topics = generateTopics()
|
||||
symKeyID = waitFor lightWakuNode.waku_addSymKey(symKey)
|
||||
symKeyID = waitFor lightNode.waku_addSymKey(symKey)
|
||||
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
||||
topics: some(topics))
|
||||
filterID = waitFor lightWakuNode.waku_newMessageFilter(options)
|
||||
filterID = waitFor lightNode.waku_newMessageFilter(options)
|
||||
|
||||
symKeyID2 = waitFor lightNode.waku_addSymKey(symKey)
|
||||
symKeyID2 = waitFor lightNode2.waku_addSymKey(symKey)
|
||||
options2 = WhisperFilterOptions(symKeyID: some(symKeyID2),
|
||||
topics: some(topics))
|
||||
filterID2 = waitFor lightNode.waku_newMessageFilter(options2)
|
||||
topics: some(topics))
|
||||
filterID2 = waitFor lightNode2.waku_newMessageFilter(options2)
|
||||
|
||||
symkeyID3 = waitFor trafficNode.waku_addSymKey(symKey)
|
||||
|
||||
@ -48,15 +50,27 @@ var message = WhisperPostMessage(symKeyID: some(symkeyID3),
|
||||
payload: "0x45879632".HexDataStr,
|
||||
powTime: 1.0,
|
||||
powTarget: 0.002)
|
||||
discard waitFor trafficNode.waku_post(message)
|
||||
|
||||
var messages: seq[WhisperFilterMessage]
|
||||
info "Posting envelopes on all subscribed topics"
|
||||
for i in 0..<topicAmount:
|
||||
message.topic = some(topics[i])
|
||||
discard waitFor trafficNode.waku_post(message)
|
||||
|
||||
# Check if the subscription for the topic works
|
||||
while messages.len == 0:
|
||||
messages = waitFor lightWakuNode.waku_getFilterMessages(filterID)
|
||||
waitFor sleepAsync(1000.milliseconds)
|
||||
info "Received test message", payload = messages[0].payload
|
||||
# Check if the subscription for the topics works
|
||||
|
||||
waitFor sleepAsync(1000.milliseconds) # This is a bit brittle
|
||||
|
||||
let
|
||||
messages = waitFor lightNode.waku_getFilterMessages(filterID)
|
||||
messages2 = waitFor lightNode2.waku_getFilterMessages(filterID2)
|
||||
|
||||
if messages.len != topicAmount or messages2.len != topicAmount:
|
||||
error "Light node did not receive envelopes on all subscribed topics",
|
||||
lightnode1=messages.len, lightnode2=messages2.len
|
||||
quit 1
|
||||
|
||||
info "Received envelopes on all subscribed topics"
|
||||
|
||||
# Generate test traffic on node
|
||||
discard waitFor trafficNode.wakusim_generateRandomTraffic(10_000)
|
||||
info "Started random traffic generation"
|
||||
|
Loading…
x
Reference in New Issue
Block a user