Commit Graph

1049 Commits

Author SHA1 Message Date
Aaryamann Challani 1274b15d75
fix(rln-relay): handle empty metadata returned by getMetadata proc (#2516)
* fix(rln-relay): silence error on startup when metadata is not found

* chore: fix fetching value from option

* fix: clarity of returned opt
2024-03-08 19:36:22 +05:30
Ivan FB 161a10ecb0
feat: Postgres partition implementation (#2506)
* postgres: first step to implement partition management
* postgres_driver: use of times.now().toTime().toUnix() instead of Moment.now()
* postgres migrations: set new version to 2
* test_driver_postgres: use of assert instead of require and avoid using times.now()
* postgres_driver: better implementation of the reset method with partitions
* Remove createMessageTable, init, and deleteMessageTable procs
* postgres: ensure we use the version 15.4 in tests
* postgres_driver.nim: enhance debug logs partition addition
* ci.yml: ensure logs are printed without colors
* postgres_driver: starting the loop factory in an asynchronous task
* postgres_driver: log partition name and size when removing a partition
2024-03-06 20:50:22 +01:00
Aaryamann Challani beba14dcaa
fix(rln-relay): make nullifier log abide by epoch ordering (#2508)
* fix(rln-relay): nullifier log abide by epoch ordering

* fix: cleaner hasKey method, test

* chore: idiomatic usage of results, error handling

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-03-06 23:59:07 +05:30
Aaryamann Challani a9d0e48164
chore(rln_db_inspector): include in wakunode2 binary (#2292) 2024-03-06 19:38:43 +05:30
Aaryamann Challani e692edf6c1
fix(postgres): import under feature flag (#2500) 2024-03-06 17:39:02 +05:30
NagyZoltanPeter b151672143
Removed json-rpc leftovers (#2503) 2024-03-05 15:51:43 +01:00
Benjamin Arntzen 9ef2eccb8a
docs: Update link to DNS discovery tutorial (#2496) 2024-03-04 18:08:39 +01:00
Ivan FB a2e28a04f7
Tiny cleanup and more encapsulation in protocol.nim files (#2488) 2024-03-04 15:31:37 +01:00
Aaryamann Challani 5b174fb392
chore(rln-relay-v2): added tests for static rln-relay-v2 (#2484)
* chore(rln-relay-v2): added tests for onchain rln-relay-v2

* chore(rln-relay): added tests for static rln-relay-v2

* Update waku/waku_rln_relay/group_manager/static/group_manager.nim

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

* fix: split lines

* fix: remove redundant require

* fix: remove redundant require

* fix: bad await

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-03-04 17:41:33 +05:30
gabrielmer 361fe2cdc7
chore: moving node initialization code to node_factory.nim (#2479) 2024-03-02 18:59:53 -06:00
Simon-Pierre Vivier 91e3f8cde6
fix: notify Waku Metadata when Waku Filter subscribe to a topic (#2493) 2024-03-01 08:01:37 -05:00
Simon-Pierre Vivier 0a75122828
fix: time on 32 bits architecture (#2492)
authored-by: Emil Ivanichkov <emil.ivanichkov@gmail.com>
2024-03-01 07:58:45 -05:00
Ivan FB 560f949a8b
chore: Postgres migrations (#2477)
* Add postgres_driver/migrations.nim
* Postgres and archive logic adaptation to the migration implementation
* libwaku: adapt node_lifecycle_request.nim to migration refactoring
* test_app.nim: add more detail for test that only fails in CI
* postgres migrations: store the migration scripts inside the resulting wakunode binary instead of external .sql files.
2024-03-01 12:05:27 +01:00
Aaryamann Challani 88ff928213
chore(rln-relay-v2): added tests for onchain rln-relay-v2 (#2482)
* chore(rln-relay-v2): added tests for onchain rln-relay-v2

* Update tests/waku_rln_relay/test_rln_group_manager_onchain.nim

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-03-01 14:15:40 +05:30
Alvaro Revuelta c994ee049b
chore: remove json rpc (#2416) 2024-02-29 23:35:27 +01:00
NagyZoltanPeter d832f92a43
chore: Implemented CORS handling for nwaku REST server (#2470)
* Add allowOrigin configuration for wakunode and WakuRestServer
Update nim-presto to the latest master that contains middleware support
Rework Rest Server in waku to utilize chronos' and presto's new middleware design and added proper CORS handling.
Added cors tests and fixes

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-02-29 09:48:14 +01:00
Alvaro Revuelta 3f4f6d7e5b
chore: remove rln epoch hardcoding (#2483) 2024-02-28 17:19:20 +01:00
Ivan FB d530528259
refactor: new proc to foster different size retention policy implementations (#2463)
* new proc to foster different size retention policy implementations
  The new proc, decreaseDatabaseSize, will have different implementations
  per each driver. For example, in future commits we will implement a size
  retention policy thanks to partitions management, in Postgres.
* RetentionPolicy: use of new instead of init for ref object types
* waku_archive: fix signatures in decreaseDatabaseSize methods
* retention_policy_size: minor cleanup of comments and imports
2024-02-22 16:55:37 +01:00
Ivan FB 501c92e2c3
waku_metrics: change log interval from 30'' to 10' (#2428) 2024-02-19 22:25:20 +01:00
Hanno Cornelius ce151efc36
feat: prioritise yamux above mplex (#2417)
* update libp2p submodule

* feat: prefer yamux to mplex
2024-02-17 19:46:01 +00:00
Aaryamann Challani 2060cfab67
chore(rln-relay): remove wss support from node config (#2442)
* chore(rln-relay): remove wss support from node config

* fix: incl regex pattern examples

* docs: update rln docs
2024-02-16 18:36:31 +05:30
gabrielmer 8f487a2179
fix: checking for keystore file existence (#2427) 2024-02-15 17:33:15 +02:00
Aaryamann Challani 22026b7e89
fix(rln-relay): graceful shutdown with non-zero exit code (#2429)
* fix(rln-relay): graceful shutdown with non-zero exit code

* fix: missed args

* fix: exception str

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

* fix: remove old comment

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-02-15 16:55:08 +05:30
gabrielmer 3903f130cb
feat: supporting meta field in WakuMessage (#2384) 2024-02-14 17:29:59 +02:00
gabrielmer 731dfcbdf6
fix: check max message size in validator according to configured value (#2424) 2024-02-14 17:29:10 +02:00
Aaryamann Challani d0377056ca
chore(rln-relay-v2): add tests for serde (#2421)
* chore(rln-relay-v2): add tests for serde

* fix: call isOk fn instead of prop access

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

* fix: make cast more explicit

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-02-14 13:24:05 +05:30
Aaryamann Challani 50308eda0d
feat(rln-relay-v2): nonce/messageId manager (#2413)
* feat(rln-relay-v2): nonce/messageId manager

* fix: simplify
2024-02-13 10:18:02 +05:30
Aaryamann Challani 2d46c35117
feat(rln-relay-v2): rln-keystore-generator updates (#2392)
* chore: init rln-v2 in OnchainGroupManager

* chore: update wrappers

* fix: units for userMessageLimit

* valueOr for error handling

* fix: len usage
2024-02-09 16:31:45 +05:30
richΛrd 1b4026673a
feat: add yamux support (#2397) 2024-02-06 16:33:13 -04:00
Álex Cabeza Romero 817b2e067a
test(lightpush): Lightpush functional tests (#2269)
* Add ligthpush payload tests.
* Add end to end lightpush tests.
* updating vendor/nim-unittest2 to protect against core dump issue
* Enable "Valid Payload Sizes" test again
---------
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2024-02-06 17:37:42 +01:00
gabrielmer e4e147bcbb
feat: running validators in /relay/v1/auto/messages/{topic} (#2394) 2024-02-05 10:24:54 +02:00
Álex Cabeza Romero f86baa01a7
test(rln): Implement some rln unit tests (#2356)
* Fix sanity check location.
* Implement some rln tests.
2024-02-02 09:56:41 +01:00
Aaryamann Challani b88facd0b7
feat(rln-relay-v2): update C FFI api's and serde (#2385)
* feat(rln-relay-v2): integrate new ffi bindings, serde

* chore: remove ExtendedRateLimitProof, add comments

* fix: typo
2024-02-02 00:26:47 +05:30
gabrielmer 59d8b6204f
feat: running validators in /relay/v1/messages/{pubsubTopic} (#2373) 2024-02-01 18:16:10 +01:00
Ivan FB 3e65cc18f6
REST store: get msgs from self node when store is mounted and no peerAddr is passed (#2387)
A node that handles REST-Store requests normally acts as a 
Store-client and therefore it retrieved the messages from another
Store-node.
With these changes, we allow a node with Store mounted, to retrieve
its messages. In other words, the node can act as a Store-server of
its messages.

* test_rest_store.nim: add a new test to validate that the self-node can
retrieve its messages to the REST client.

* rest/store/client.nim: add new proc to allow making a GET store
request without peerAddr.

* rest/store/handle.nim: add logic to handle requests that don't
provide peerAddr but the self/local node has Store mounted. In this case,
the self/local node will retrieve its locally stored messages.

* waku_store/self_req_handler.nim: logic to handle "store" requests
allowing the REST-store node to act as a Store-server node. The
'self_req_handler.nim' helps to bypass the store protocol and directly
retrieve the messages from the local/self node. I added this logic in
a separate file from 'protocol.nim' because it doesn't participate in
any libp2p communication.

* waku_store/protocol.nim: make 'queryHandler' attribute public so that
it can be used from the 'self_req_handler.nim' module.
2024-01-31 17:43:59 +01:00
Aaryamann Challani c55ca06756
chore(rln-relay-v2): use rln-v2 contract code (#2381)
* chore(rln-relay-v2): use rln-v2 contract code

* fix: reduced duped code
2024-01-30 23:28:30 +05:30
Simon-Pierre Vivier 761ce7b10a
chore: v0.25 vendor bump and associated fixes (#2352) 2024-01-30 10:57:03 -05:00
Simon-Pierre Vivier edca1df1a8
feat: shard aware relay peer management (#2332)
note that this feature is behind a config flag. `--relay-shard-manager`
2024-01-30 07:28:21 -05:00
Simon-Pierre Vivier e04e35e229
chore: handle errors w.r.t. configured cluster-id and pubsub topics (#2368) 2024-01-30 07:15:23 -05:00
gabrielmer bb58a63aa1
fix: adding rln validator as default (#2367) 2024-01-29 16:11:26 +01:00
gabrielmer 025c6ec92a
chore: changing digest and hash log format from bytes to hex (#2363) 2024-01-25 16:03:48 +01:00
Prem Chaitanya Prathi 42204115c7
chore: log messageHash for lightpush request that helps in debugging (#2366) 2024-01-24 19:20:21 +05:30
Aaryamann Challani efdc5244f6
chore(rln-relay): remove websocket from OnchainGroupManager (#2364)
* chore(rln-relay): remove websocket from OnchainGroupManager

* fix: swap ws for http
2024-01-23 23:22:45 +05:30
gabrielmer f841454edc
chore: improve POST /relay/v1/auto/messages/{topic} error handling (#2339) 2024-01-18 13:49:13 +01:00
NagyZoltanPeter c3358409bb
chore: Refactor of FilterV2 subscription management with Time-to-live maintenance (#2341)
* Refactor of FilterV2 subscription handling and maintenance with addition subscription time-to-live support.
Fixed all tests and reworked where subscription handling changes needed it.
Adapted REST API /admin filter subscription retrieve to new filter subscription structure.

* Fix tests and PR comments

* Added filter v2 subscription timeout tests and fixed

* Fix review comments and suggestions. No functional change.

* Remove leftover echoes from test_rest_admin

* Fix failed legacy filter tests due to separation of mounting the filters.

* Small fixes, fix naming typo, removed duplicated checks in test
2024-01-16 17:27:40 +01:00
gabrielmer 3d816c0814
chore: Bump `nim-dnsdisc` (#2354)
* chore: bump `vendor/nim-dnsdisc`

* chore: Update import path of dnsdisc

---------

Co-authored-by: Emil Ivanichkov <emil.ivanichkov@gmail.com>
2024-01-15 16:54:02 +02:00
gabrielmer bcab9d55da
feat: adding filter data admin endpoint (REST) (#2314) 2024-01-09 11:42:29 +01:00
joao 3553fb4fc1
docs: Fix Typos Across Various Documentation Files (#2310) 2024-01-08 13:13:34 +01:00
Simon-Pierre Vivier 7b4f4bb18c
fix(discv5): add bootnode filter exception (#2267) 2024-01-04 16:39:03 -05:00
Ivan FB bd7570faa3
bump vendors for 0.24.0 (#2333)
The following vendors have changes but are not being updated for
the reason explained.

nim-web3: not updated because unit tests started to fail and no
straightforward solution found.

nim-toml-serialization: not updated because it introduced a breaking
change on how the --config-file attribute is parsed. The array
attributes now need a comma. For example, the following attribute
from within the config file:

pubsub-topic = [ "/waku/2/default-waku/proto" "/waku/2/testing-store" ]

... should be converted to:

pubsub-topic = [ "/waku/2/default-waku/proto", "/waku/2/testing-store" ]

and we cannot accept that breaking change
2024-01-04 17:35:00 +01:00
Álex Cabeza Romero 3bbe234962
test(autosharding): Functional Tests (#2318)
* Implement autosharding tests.
2024-01-04 16:26:27 +01:00
Ivan FB ed09074cc3
chore: message.nim - set max message size to 150KiB according to spec (#2298)
* message.nim: set max message size to 150KiB according to spec

Using KiB instead of KB because that seems more aligned with
the actual default defined in nim-libp2p (1024 * 1024)

Spec details: https://rfc.vac.dev/spec/64/#message-size

* test_protocol.nim: align test to current WakuMessage limit
* test_waku_client.nim: adapt test to MaxWakuMessageSize change
* make maxMessageSize configurable for wakunode2
* wakunode2 app now accepts max-num-bytes-msg-size with KiB, KB, or B units
* testlib/wakunode.nim: set maxMessageSize: "1024 KiB"
* test_waku_client.nim: remove duplicate check in "Valid Payload Sizes"
* set DefaultMaxWakuMessageSizeStr as the only source of truth
* external_config.nim: rename max-num-bytes-msg-size -> max-msg-size
2024-01-03 13:11:50 +01:00
Ivan FB ebad0385ef
ip colocation is parameterizable. If set to 0, it is disabled (#2323)
The "ip colocation" concept refers to the maximum allowed peers
from the same IP address. For example, we allow disabling this limit when the
node works behind a reverse proxy.
2024-01-02 14:01:18 +01:00
Ivan FB 32668f43f5
fix: Revert "feat: shard aware peer management (#2151)" (#2312)
This reverts commit dba9820c1f.

We need to revert this commit because
the waku-simulator stopped working. i.e. the nodes couldn't establish
connections among them: 054ba9e33f

Also, the following js-waku test fails due to this commit:
"same cluster, different shard: nodes connect"

* waku_lightpush/protocol.nim: minor changes to make it compile after revert
2023-12-20 15:23:41 +01:00
gabrielmer a1b27edf80
fix: setting connectivity loop interval to 15 seconds (#2307) 2023-12-20 09:38:14 +01:00
Álex Cabeza Romero fae20bff20
refactor(store): HistoryQuery.direction (#2263)
* Fix issue with default history query ascending value in serde operations: Should use the same value.
* Update direction types to PagingDirection.
2023-12-19 15:10:27 +01:00
Ivan FB 574cdf555a
chore: archive - move error to trace level when insert row fails (#2283)
* archive: move error to trace level when insert row fails

That is helpful to prevent the node to spam the logs when it shares
connection to the same Postgres database with other nodes, in
which case the following log appears too much:

topics="waku archive" tid=1 file=archive.nim:113 err="error in
runStmt: error in dbConnQueryPrepared calling waitQueryToFinish: error
in query: ERROR: duplicate key value violates unique constraint
"messageindex" DETAIL: Key
(messagehash)=(88f4ee115eef6f233a7dceaf975f03946e18666adda877e38d61be98add934e8)
already exists. "
2023-12-15 18:58:35 +01:00
gabrielmer 306c8a6259
chore: including content topics on FilterSubscribeRequest logs (#2295) 2023-12-15 14:18:12 +01:00
Ivan FB c9d558f878
relay: add trace logs in case of msg validation rejection (#2285) 2023-12-15 13:34:30 +01:00
Alvaro Revuelta 5847f49d3d
fix: make rln rate limit spec compliant (#2294) 2023-12-15 10:26:17 +01:00
Ivan FB 0fc617ff69
bug fix: update num-msgs archive metrics every minute and not only at the beginning (#2287) 2023-12-14 17:00:13 +01:00
Ivan FB a0ee3d78fe
postgres_driver.nim: restrict getMessages prepared stmt to query with 1 content topic (#2296)
Before this commit, the following execution of a prepared statement
returned nothing even though the database had 2 rows to be returned:

nwaku-db-1  | 2023-12-14 12:55:17.575 UTC [73] LOG:  execute SelectWithoutCursorAsc: SELECT storedAt, contentTopic, payload, pubsubTopic, version, timestamp, id FROM messages
nwaku-db-1  | 	    WHERE contentTopic IN ($1) AND
nwaku-db-1  | 	          pubsubTopic = $2 AND
nwaku-db-1  | 	          storedAt >= $3 AND
nwaku-db-1  | 	          storedAt <= $4
nwaku-db-1  | 	    ORDER BY storedAt ASC LIMIT $5;
nwaku-db-1  | 2023-12-14 12:55:17.575 UTC [73] DETAIL:  parameters: $1 =
'my/ctopic/1,my/ctopic/2', $2 = '/waku/2/default-waku/proto', $3 = '1702552968570786800', $4 = '1702552968585347557', $5 = '101'

The reason why it is not returning anything is that the 'IN' statement doesn't work when using prepared statements with multiple items. It only works when the 'IN' content, i.e. $1, contains one single item.
2023-12-14 15:37:12 +01:00
Ivan FB 385daf16be
chore: vendor bump for 0.23.0 (#2274)
* on_chain/group_manager: use .async: (raises:[Exception]).
* bump nim-dnsdisc
* update nim-chronos to the latest state
* chat2.nim: catch any possible exception when stopping
* chat2bridge.nim: make it to compile after vendor bump
* ValidIpAddress (deprecated) -> IpAddress
* vendor/nim-libp2p additional bump
* libwaku: adapt to vendor bump
* testlib/wakunode.nim: adapt to vendor bump (ValidIpAddress -> IpAddress)
* waku_node: avoid throwing any exception from stop*(node: WakuNode)
* test_confutils_envvar.nim: ValidIpAddress -> IpAddress
* test_jsonrpc_store: capture exception
* test_rln*: handling exceptions
* adaptation to make test_rln_* to work properly
* signature enhancement of group_manager methods
2023-12-14 07:16:39 +01:00
Ivan FB 0cc0c80563
chore: peer_manager.nim - reduce logs from debug to trace (#2279) 2023-12-12 16:00:18 +01:00
Aaryamann Challani 15c1f974df
fix(rln-relay): graceful retries on rpc calls (#2250)
* fix(rln-relay): graceful retries on rpc calls

* fix: missing file
2023-12-11 14:59:16 +05:30
Ivan FB 77c5ba7669
archive: simplify and enhance async retention policy application (#2278)
* Avoid using timer and just use an infinite async loop that can be
cancelled at any time.
2023-12-11 08:50:40 +01:00
Simon-Pierre Vivier 281c13a429
added sharded peer store pruning (#2167) 2023-12-07 07:21:18 -05:00
Simon-Pierre Vivier dba9820c1f
feat: shard aware peer management (#2151) 2023-12-07 06:48:28 -05:00
Ivan FB 42f1957920
fix: add protection in rest service to always publish with timestamp if user doesn't provide it (#2261) 2023-12-06 14:02:21 +01:00
Sasha 103d3981ad
fix: remove trailing commas from keystore json (#2200)
* fix: remove trailing commas from keystore json

* keyfile.nim: try a different Json formatting approach

* build keystore

* address comment

---------

Co-authored-by: Ivan Folgueira Bande <ivansete@status.im>
2023-12-01 12:57:19 +01:00
Ivan FB 89dbbd2048
waku_store/common.nim: correct ret code in PEER_DIAL_FAILURE (#2260) 2023-11-30 16:42:58 +01:00
Ivan FB 72a1f8c724
chore: Better feedback invalid content topic (#2254)
* typo correction appplication -> application
* content_topic.nim: better feedback to user when wrong topic is passed
* test_namespaced_topics.nim: updating tests accordingly
2023-11-30 11:11:33 +01:00
omahs 958b9bd712
chore: fix typos (#2239) 2023-11-30 11:08:08 +01:00
Ivan FB 6301bec05d
fix: waku_filter_v2/common: PEER_DIAL_FAILURE ret code change: 200 -> 504 (#2236) 2023-11-30 10:47:45 +01:00
Simon-Pierre Vivier bebaa59c3b
chore(rest): refactor message cache (#2221) 2023-11-28 07:21:41 -05:00
Simon-Pierre Vivier c301e880c8
chore: refactoring peer storage (#2243) 2023-11-27 08:08:58 -05:00
Ivan FB b31c182325
chore: postres driver allow setting the max number of connection from a parameter (#2246)
* postres driver: allow setting the max number of connections from a parameter
2023-11-24 16:21:22 +01:00
Abhimanyu a1ed517f9c
fix: extended Postgres code to support retention policy + refactoring (#2244)
* updated Postgres retention policy code + refactoring

* Update waku/waku_archive/driver/postgres_driver/postgres_driver.nim

Co-authored-by: Simon-Pierre Vivier <simvivier@status.im>

* updated code review changes

* data unit fixed, processing everything in bytes now

---------

Co-authored-by: Simon-Pierre Vivier <simvivier@status.im>
2023-11-24 15:43:47 +01:00
Abhimanyu aeb77a3e75
feat: Add new DB column `messageHash` (#2202)
* feat: added DB column messageHash

* feat: minor change

* feat: minor merge conflict fix

* Update test_resume.nim

* Update test_resume.nim

* randomblob() func used to populate attribute

* PRIMARY key updated - SQLite and Postgres
2023-11-22 17:32:56 +01:00
Abhimanyu a22ee60494
chore: deterministic message hash algorithm updated (#2233)
* deterministic hash algorithm updated + testcases

* updated code review
2023-11-22 15:23:43 +01:00
gabrielmer 59ee3c69c8
chore(REST): returning lightpush support and updated filter protocol (#2219) 2023-11-22 10:56:23 +02:00
Ivan FB c48accb513
waku_store: better response when the store is requested with wrong cursor (#2231) 2023-11-22 09:32:39 +01:00
Simon-Pierre Vivier 897f487978
chore: mics. improvements to cluster id and shards setup (#2187) 2023-11-21 15:15:39 -05:00
Alvaro Revuelta 51f36099d5
fix(rln): error in api when rate limit (#2212) 2023-11-21 19:24:31 +01:00
Ivan FB c973b85069
peer_manager.nim: better feedback if can't dial peer with WakuMetadataCodec (#2230) 2023-11-21 14:54:45 +01:00
Abhimanyu 9ff441ab47
chore: removing automatic vacuuming from retention policy code (#2228)
* retention policy and testcase updated

* removing dead code

* review updated code
2023-11-21 11:27:50 +01:00
Ivan FB 13fb7c2f74
group_manager.nim more except detail when cant connect eth client (#2195) 2023-11-20 23:25:55 +01:00
gabrielmer ef8ffbdbd0
chore: decoupling announced and listen addresses (#2203) 2023-11-16 18:15:27 +02:00
Álex Cabeza Romero f5f431382b
test(waku-relay): Relay (#2101)
* Implement message id tests.
* Implement relay tests.
* Update import paths to use test_all.
2023-11-15 16:11:36 +01:00
Álex Cabeza Romero 85265e6c61
test(waku-filter): Unsubscribe tests (#2085)
* Implement unsubscribe waku filter tests.
* test(waku-filter): Unsubscribe all, payloads and security tests (#2095)
* Implement waku node filter Security and Privacy tests (#2096)
2023-11-15 10:26:01 +01:00
NagyZoltanPeter 6d81e3841a
chore: Allow text/plain content type descriptor for json formatted content body (#2209)
* Allow text/plain content type descriptor for json formatted content body. Refactored duplicated encode/decode functions for rest api

* Fix relay endpoint decodings of content bodies to accept text/plain

* Added support for content body decoder for checking media type if additional parameters are present

* Fix wrong usage of ContentTypeData - appeared only for tests
2023-11-14 16:59:53 +01:00
Vaclav Pavlin 2cb0989a28
fix(rest): properly check if rln is used (#2205)
* fix(rest): properly check if rln is used

* fix(apis): fix remaining usage of defined(rln)
2023-11-10 15:25:07 +01:00
Abhimanyu d7ef3ca192
Revert "feat: amending computeDigest func. + related test cases (#2132)" (#2180)
This reverts commit 1669f710ce.
2023-11-08 01:41:23 +01:00
Ivan FB 6da1aeec53
chore: Optimize postgres - prepared statements in select (#2182)
* db_postgres: use prepared statements on most freq select queries
* db_postgres/dbconn.nim adding better feedback in case of query error
* dbconn: use of isOkOr
* pgasyncpool: refactor to reduce code (valueOr, catch:)
2023-11-07 13:38:37 +01:00
Simon-Pierre Vivier 200a11da09
feat(discv5): filter out peers without any listed capability (#2186) 2023-11-06 07:31:36 -05:00
gabrielmer b9563ae0b5
chore: upgrade dependencies v0.22 (#2185) 2023-11-06 13:30:34 +02:00
Ivan FB fa467e2462
fix: lightpush rest (#2176)
* rest/lightpush/handlers.nim: enhance feedback in case of error.
* lightpush/openapi.yaml: fix typo in pubsubTopic field.
2023-11-01 11:30:53 +01:00
Ivan FB 2b4ca4d0ff
chore: Optimize postgres - use of rowCallback approach (#2171)
* db_postgres, postgres_driver: better performance by using callback.
  There were a bunch of milliseconds being lost due to multiple-row
  processing. This commit aims to have the minimum possible row
  process time.
* pgasyncpool: clarifying logic around pool conn management.
* db_postgres: removing duplicate code and more searchable proc names.
2023-10-31 14:46:46 +01:00
Simon-Pierre Vivier bcf8e9630d
feat: metadata protocol shard subscription (#2149) 2023-10-30 16:58:15 -04:00
Alvaro Revuelta 250e8b983c
fix(rest): fix bug in rest api when sending rln message (#2169) 2023-10-30 16:19:49 +01:00
Alvaro Revuelta f0f69b3235
chore(networking): lower dhigh to limit amplification factor (#2168) 2023-10-30 16:17:39 +01:00
Ivan FB 282c2e8107
chore: Minor Postgres optimizations (#2166)
* postgres_healthcheck: validate once per minute instead of 30 sec
* postgres_driver.nim: change MaxNumCons from 5 to 50
* postgres_driver.nim: split connPool into writeConPool and readConPool
  This aims to avoid clashes in insert and select queries
  because the inserts and selects can happen concurrently
  in relay and store events, respectively.
2023-10-30 15:16:49 +01:00
Simon-Pierre Vivier 7ca516a5f8
feat: REST APIs discovery handlers (#2109) 2023-10-27 15:43:54 -04:00
NagyZoltanPeter b8bcb1e74b
Pull new version of nim-presto that implements RestServer' new error handler callback (#2144)
Added rest request error handler to capture calls on not installed endpoints
better, more descriptive error message returned.
2023-10-27 16:31:57 +02:00
gabrielmer f7b9afc26f
feat: implementing port 0 support (#2125) 2023-10-27 10:11:47 +03:00
gabrielmer 944dfdaa99
chore: adding ext-multiaddr-only CLI flag (#2141) 2023-10-24 18:39:25 +03:00
Abhimanyu 13aeebe46f
Revert "feat: messageHash attribute added in SQLite + testcase (#2142)" (#2154)
This reverts commit 9cd8c73d27.
2023-10-24 16:05:39 +02:00
Abhimanyu 9cd8c73d27
feat: messageHash attribute added in SQLite + testcase (#2142)
* feat: messageHash attaribute added in SQLite + testcase

* Update tests/waku_archive/test_driver_sqlite_query.nim

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>

---------

Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
2023-10-24 12:19:52 +02:00
Abhimanyu 1669f710ce
feat: amending computeDigest func. + related test cases (#2132)
* feat: amending computeDigest func. + related test cases

* minor fixes

* minor fixes v1: testcase saga continues

---------

Co-authored-by: Vaclav Pavlin <vaclav@status.im>
2023-10-19 11:59:17 +02:00
gabrielmer a5b1cfd024
fix: consider WS extMultiAddrs before publishing host address (#2122) 2023-10-17 12:53:41 +03:00
Álex Cabeza Romero 1bba183492
test(waku-filter): Subscribe tests batch (1/4) (#2034)
* Implement waku filter client subscribe tests.
* Remove legacy filter tests.
* Fix constant for max criteria per subscription limit.
2023-10-12 20:59:21 +02:00
Alvaro Revuelta d5c3ade5e2
feat: add new metadata protocol (#2062) 2023-10-11 08:58:45 +02:00
Abhimanyu 25d6e52e38
chore: added size based retention policy (#2098)
* chore: added size based retention policy

* chore: post review code - size based retention policy

* chore: review integrated, size retention updated, vacuuming in capacity retention

* chore: typo fixed

* chore: review integrated

* chore: external config updated to support newly added retention policy
2023-10-10 15:29:09 +05:30
Sergei Tikhomirov 2c5eb427d7
fix: return erring response if lightpush request is invalid (#2083)
fixes #1641
2023-10-09 16:38:23 +02:00
Abhimanyu 06bc433a80
fix: sqlite limited delete query bug (#2111) 2023-10-09 16:36:40 +05:30
Alvaro Revuelta a0033dff52
Revert "postgres_driver.nim: rename table's name from "messages" to "message" (#2110)" (#2115)
This reverts commit 71cfbbca6f.
2023-10-06 10:36:00 +02:00
Ivan FB 71cfbbca6f
postgres_driver.nim: rename table's name from "messages" to "message" (#2110) 2023-10-05 18:23:19 +02:00
Simon-Pierre Vivier a47dc9e663
fix: cluster id & sharding terminology (#2104) 2023-10-05 08:37:05 -04:00
NagyZoltanPeter 7b5c36b1c6
feat: /admin rest api endpoint (#2094)
/admin rest api implementation and tests
* open api doc
* Add rest admin test to all tests
* Enrich /admin get peers interface, group protocols by peers in response
2023-10-05 14:00:09 +02:00
Alvaro Revuelta 1042cacd3f
chore(rln): add more hardcoded memberhips to static group (#2108) 2023-10-05 13:25:24 +02:00
Ivan FB c74abe131d
postgres_driver: remove duplicated const MaxNumConns. (#2106) 2023-10-04 15:28:07 +02:00
NagyZoltanPeter f05528d4be
chore: Revert lightpush error handling to allow zero peer publish again succeed (#2099)
* This reverts former change on lighpush error handling, now zero peer publish still succeed. This will allow js-waku use case to succeed.

* Adjust lightpush rest-api test
2023-10-02 15:38:40 +02:00
Hanno Cornelius c019016545
Revert "chore: add size retention policy (#2093)" (#2097)
This reverts commit 8897ae1a2f.

(cherry picked from commit b213b2c385b0534481448cd6e30af18e183d0504)
2023-10-02 11:07:13 +02:00
Abhimanyu 8897ae1a2f
chore: add size retention policy (#2093)
* chore: add retention policy with GB or MB limitation #1885

* chore: add retention policy with GB or MB limitation

* chore: updated code post review- retention policy

* ci: extract discordNotify to separate file

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* ci: push images to new wakuorg/nwaku repo

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* ci: enforce default Docker image tags strictly

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* ci: push GIT_REF if it looks like a version

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* fix: update wakuv2 fleet DNS discovery enrtree

https://github.com/status-im/infra-misc/issues/171

* chore: resolving DNS IP and publishing it when no extIp is provided (#2030)

* feat(coverage): Add simple coverage (#2067)

* Add test aggregator to all directories.
* Implement coverage script.

* fix(ci): fix name of discord notify method

Also use absolute path to load Groovy script.

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* chore(networkmonitor): refactor setConnectedPeersMetrics, make it partially concurrent, add version (#2080)

* chore(networkmonitor): refactor setConnectedPeersMetrics, make it partially concurrent, add version

* add more metrics, refactor how most metrics are calculated

* rework metrics table fillup

* reset connErr to make sure we honour successful reconnection

* chore(cbindings): Adding cpp example that integrates the 'libwaku' (#2079)

* Adding cpp example that integrates the `libwaku`

---------

Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com>

* fix(ci): update the dependency list in pre-release WF (#2088)

* chore: adding NetConfig test suite (#2091)

---------

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Co-authored-by: Jakub Sokołowski <jakub@status.im>
Co-authored-by: Anton Iakimov <yakimant@gmail.com>
Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com>
Co-authored-by: Álex Cabeza Romero <alex93cabeza@gmail.com>
Co-authored-by: Vaclav Pavlin <vaclav@status.im>
Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com>
2023-09-30 11:10:52 +05:30
Anton Iakimov 89854a96f6
fix: update wakuv2 fleet DNS discovery enrtree
https://github.com/status-im/infra-misc/issues/171
2023-09-27 13:39:10 +02:00
Simon-Pierre Vivier 56dbe2a7e1
feat: added RELAY openapi definitions (#2081) 2023-09-26 15:53:46 -04:00
Ivan Folgueira Bande a27d005ffc
fix(archive): dburl check (#2071)
* dburl.nim: simpler regex that can support db_urls with . and - in hostname
* dbrul.nim: accepting any non-empty sequence for user and password
* dburl.nim: skipping validation for 'sqlite' db paths
2023-09-26 13:59:54 +02:00
Simon-Pierre Vivier 1763b1efa1
feat: Autosharding API for RELAY subscriptions (#1983) 2023-09-26 07:33:52 -04:00
Simon-Pierre Vivier d178105d9f
fix: filter discv5 bootstrap nodes by shards (#2073) 2023-09-26 07:30:55 -04:00
Aaryamann Challani 45fe2d3bee
fix(rln-relay): segfault when no params except rln-relay is passed in (#2047) 2023-09-25 13:26:16 +05:30
Ivan Folgueira Bande 292de5a6c1
bumping web3 (#2066) 2023-09-25 08:13:40 +02:00
Simon-Pierre Vivier 0d9e9fbdd2
feat: peer manager can filter select peer by shard (#2063) 2023-09-22 15:13:50 -04:00
Simon-Pierre Vivier 3e72e83067
refactor: Moved external APIs out of node (#2069) 2023-09-22 09:36:46 -04:00
NagyZoltanPeter 02a814bd35
feat: lightpush rest api (#2052)
RestApi Lightpush endpoint implemented
* Openapi definition for lightpush rest api
* Update waku/node/rest/lightpush/handlers.nim
* Fix install handler naming, added negative test cases and fixes for restapi lightpush
* Fix error handling in lightpush rest handler
* Fix main success case - relay message that comes with pushRequest
* Fix rest relay serdes test with RelayWakuMessage validation changes
* Checking response message tests
2023-09-22 13:46:55 +02:00
Ivan Folgueira Bande dc25057a26
chore: bump nim-libp2p, nim-toml-serialization, nim-unicodedb, nim-unittest2, nim-websock, nim-zlib, & nimbus-build-system (#2065) 2023-09-22 12:54:23 +02:00
Ivan Folgueira Bande 1c4533a27a
Bumping vendor/nim-confutils and vendor/nim-serialization (#2056) 2023-09-21 13:12:14 +02:00
Ivan Folgueira Bande 11e7394e0d
Adding 'librln' to `libwaku` and cleaning waku_example.c (#2044)
* When adding the dependency with 'librln' to 'libwaku', it is required
  to remove the dependency with 'confutils' because the 'nim-confutils'
  module prevents the creation of a dynamic library (libwaku.so.)

* waku_example.c: less code is needed because the Waku Thread attends
  any Waku event whereas the main thread can have a blocking scanf
  to retrieve user inputs.
2023-09-19 17:01:32 +02:00
Ivan Folgueira Bande f617cd9750
chore: Updating nim-chronicles, nim-chronos, nim-presto, nimcrypto, nim-libp2p, and nim-nat-transversal (#2043) 2023-09-18 18:51:49 +02:00
Aaryamann Challani 2e515a06ed
chore(rln-relay): logs, updated submodule, leaves_set metric (#2024)
* chore(rln-relay): logs, updated submodule, leaves_set metric

* chore(rln-relay): update build script, fix makefile
2023-09-18 10:56:58 +05:30
NagyZoltanPeter dac072f843
feat: HTTP REST API: Filter support v2 (#1890)
Filter v2 rest api support implemented 
Filter rest api documentation updated with v1 and v2 interface support.
Separated legacy filter rest interface
Fix code and tests of v2 Filter rest api
Filter v2 message push test added
Applied autoshard to Filter V2
Redesigned FilterPushHandling, code style, catch up apps and tests with filter v2 interface changes
Rename of FilterV1SubscriptionsRequest to FilterLegacySubscribeRequest, fix broken chat2 app, fix tests
Changed Filter v2 push handler subscription to simple register
Separate node's filterUnsubscribe and filterUnsubscribeAll
2023-09-14 21:28:57 +02:00
Ivan Folgueira Bande aa3e1a66d5
fix(sqlite): Properly set user_version to 7 so that the migration procedure is not started (#2031) 2023-09-14 14:12:37 +02:00
Ivan Folgueira Bande e8602021b6
chore(postgres): not loading the libpq library by default & better user feedback (#2028)
* removing implicit dependency with libpq if postgres is not being used.
* We only run the postgres tests when explicitly willing to, i.e. make
POSTGRES=1 test. The reason is that the postgres tests expect a
database instance to be running locally.
2023-09-13 12:45:55 +02:00
NagyZoltanPeter 563b2b20a5
chore: move SubscriptionManager under waku_core (#2025)
* chore: cherry-pick from Filter V2 RestApi PR: move FilterPushHandler and SubscriptionManager from Filter V1 to under waku_core
2023-09-12 17:08:40 +02:00
Aaryamann Challani a4e783303c
fix(rln-relay): waku_rln_number_registered_memberships metrics appropriately handled (#2018) 2023-09-11 19:21:45 +05:30
gabrielmer 47ae19c104
fix: prevent IP 0.0.0.0 from being published and update peers with empty ENR data (#1982) 2023-09-11 11:30:12 +03:00
Aaryamann Challani 645b034367
feat(rln-relay): removed rln from experimental 🚀 (#2001)
* feat(rln-relay): removed rln from experimental 🚀

* fix(waku_node): if rln-relay is nil, return true

* chore(tests): mark rest health as skipped
2023-09-11 12:02:31 +05:30
Aaryamann Challani 21604e6bfd
fix(rln-relay): missed roots during sync (#2015) 2023-09-08 18:24:27 +05:30
Alvaro Revuelta 7d9d8a3fb4
fix(p2p): fix possible connectivity issue (#1996) 2023-09-08 13:36:26 +02:00
NagyZoltanPeter fc6194bb6b
feat: Rest endoint /health for rln (#2011)
* Rest endoint /health added

* Remove dev-debug echo

* Changed not ready message

* Update waku/node/rest/health/handlers.nim

Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>

* Various fixes on PR foundings, added comments

---------

Co-authored-by: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com>
2023-09-08 11:19:47 +02:00
Ivan Folgueira Bande 1fb13b0967
Adding healtcheck and reconnection mechanism to the postgres archive driver (#1997)
It starts an asynchronous infinite task that checks the connectivity
with the database. In case of error, the postgres_healthcheck task
tries to reconnect for a while, and if it determines that the connection
cannot be resumed, then it invokes a callback indicating that
situation. For the case of the `wakunode2` app, this callback
quits the application itself and adds a log trace indicating
the connectivity issue with the database.
2023-09-06 19:16:37 +02:00