Check all subscribed topics in quicksim + bump vendor/nim-eth
This commit is contained in:
parent
b37457343d
commit
55fb1294ed
|
@ -271,7 +271,7 @@ proc setupWakuRPC*(node: EthereumNode, keys: KeyStorage, rpcsrv: RpcServer) =
|
||||||
if config.topics.isSome():
|
if config.topics.isSome():
|
||||||
try:
|
try:
|
||||||
# TODO: an addTopics call would probably be more useful
|
# 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:
|
if not result:
|
||||||
raise newException(ValueError, "Too many topics")
|
raise newException(ValueError, "Too many topics")
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
|
|
|
@ -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 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:
|
This client of Waku is spec compliant with [Waku spec v0.3](https://specs.vac.dev/waku/waku.html).
|
||||||
- Currently nodes with higher version don't automatically disconnect if versions are different
|
|
||||||
|
|
||||||
It doesn't yet implement the following recommended features:
|
It doesn't yet implement the following recommended features:
|
||||||
- No support for rate limiting
|
- No support for rate limiting
|
||||||
- No support for DNS discovery to find Waku nodes
|
- No support for DNS discovery to find Waku nodes
|
||||||
- It doesn't disconnect a peer if it receives a message before a Status message
|
- 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:
|
Additionally it makes the following choices:
|
||||||
- It doesn't send message confirmations
|
- 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"
|
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
||||||
createRpcSigs(RpcHttpClient, sigWakuPath)
|
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||||
|
|
||||||
|
const topicAmount = 100
|
||||||
|
|
||||||
let
|
let
|
||||||
trafficNode = newRpcHttpClient()
|
trafficNode = newRpcHttpClient()
|
||||||
lightWakuNode = newRpcHttpClient()
|
|
||||||
lightNode = newRpcHttpClient()
|
lightNode = newRpcHttpClient()
|
||||||
|
lightNode2 = newRpcHttpClient()
|
||||||
|
|
||||||
waitFor lightWakuNode.connect("localhost", Port(8545))
|
waitFor lightNode.connect("localhost", Port(8545))
|
||||||
waitFor lightNode.connect("localhost", Port(8546))
|
waitFor lightNode2.connect("localhost", Port(8546))
|
||||||
waitFor trafficNode.connect("localhost", Port(8548))
|
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
|
var topic: waku_protocol.Topic
|
||||||
for i in 0..<amount:
|
for i in 0..<amount:
|
||||||
if randomBytes(topic) != 4:
|
if randomBytes(topic) != 4:
|
||||||
|
@ -30,15 +32,15 @@ proc generateTopics(amount = 100): seq[waku_protocol.Topic] =
|
||||||
let
|
let
|
||||||
symKey = "0x0000000000000000000000000000000000000000000000000000000000000001"
|
symKey = "0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||||
topics = generateTopics()
|
topics = generateTopics()
|
||||||
symKeyID = waitFor lightWakuNode.waku_addSymKey(symKey)
|
symKeyID = waitFor lightNode.waku_addSymKey(symKey)
|
||||||
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
options = WhisperFilterOptions(symKeyID: some(symKeyID),
|
||||||
topics: some(topics))
|
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),
|
options2 = WhisperFilterOptions(symKeyID: some(symKeyID2),
|
||||||
topics: some(topics))
|
topics: some(topics))
|
||||||
filterID2 = waitFor lightNode.waku_newMessageFilter(options2)
|
filterID2 = waitFor lightNode2.waku_newMessageFilter(options2)
|
||||||
|
|
||||||
symkeyID3 = waitFor trafficNode.waku_addSymKey(symKey)
|
symkeyID3 = waitFor trafficNode.waku_addSymKey(symKey)
|
||||||
|
|
||||||
|
@ -48,15 +50,27 @@ var message = WhisperPostMessage(symKeyID: some(symkeyID3),
|
||||||
payload: "0x45879632".HexDataStr,
|
payload: "0x45879632".HexDataStr,
|
||||||
powTime: 1.0,
|
powTime: 1.0,
|
||||||
powTarget: 0.002)
|
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
|
# Check if the subscription for the topics works
|
||||||
while messages.len == 0:
|
|
||||||
messages = waitFor lightWakuNode.waku_getFilterMessages(filterID)
|
waitFor sleepAsync(1000.milliseconds) # This is a bit brittle
|
||||||
waitFor sleepAsync(1000.milliseconds)
|
|
||||||
info "Received test message", payload = messages[0].payload
|
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
|
# Generate test traffic on node
|
||||||
discard waitFor trafficNode.wakusim_generateRandomTraffic(10_000)
|
discard waitFor trafficNode.wakusim_generateRandomTraffic(10_000)
|
||||||
|
info "Started random traffic generation"
|
||||||
|
|
Loading…
Reference in New Issue