From 627a8dace28dd0010d54d52325379a0969dc0814 Mon Sep 17 00:00:00 2001 From: Marcin Czenko Date: Sat, 15 Nov 2025 13:28:06 +0100 Subject: [PATCH] final round of docs --- 10 Notes/Running Unit Tests for status-go.md | 2 +- ...ng status-backend to test status-go API.md | 74 ++++++++++++++++++- 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/10 Notes/Running Unit Tests for status-go.md b/10 Notes/Running Unit Tests for status-go.md index 70041a8..2a8caa1 100644 --- a/10 Notes/Running Unit Tests for status-go.md +++ b/10 Notes/Running Unit Tests for status-go.md @@ -575,4 +575,4 @@ DONE 2 tests in 1.453s DONE 3 runs, 6 tests, 4 failures in 27.876s ``` -Thus, being able to run all the tests successfully a number of time, we should be allowed to conclude that our setup is correct. \ No newline at end of file +Thus, being able to run all the tests successfully a number of times, we should be allowed to conclude that our setup is correct. \ No newline at end of file diff --git a/10 Notes/Using status-backend to test status-go API.md b/10 Notes/Using status-backend to test status-go API.md index b9582d0..95c2909 100644 --- a/10 Notes/Using status-backend to test status-go API.md +++ b/10 Notes/Using status-backend to test status-go API.md @@ -1,5 +1,23 @@ +--- +related-to: + - "[[Running Unit Tests for status-go]]" + - "[[Running functional tests in status-go]]" + - "[[testing codex-status-go integration]]" +--- Here are some basic steps to follow: +Build status-backend: + +```bash +make status-backend +``` + +Start status-backend (I am using port `45453` for all examples below): + +```bash +./build/bin/status-backend -address localhost:45453 +``` + ### Step 1: Initialize the application ```bash @@ -93,7 +111,7 @@ I initially thought this is necessary - but it turns out that logging in is suff ```bash curl -sS http://127.0.0.1:45453/statusgo/CallRPC \ -H 'Content-Type: application/json' \ - -d '{"jsonrpc":"2.0","id":1,"method":"wakuext_startMessenger","params":[]}' + -d '{"jsonrpc":"2.0","id":1,"method":"wakuext_startMessenger","params":[]}' | jq ``` ### Step 4: Now you can call your method! @@ -118,4 +136,56 @@ Some examples: curl -sS http://127.0.0.1:12345/statusgo/CallRPC -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":2,"method":"wakuext_updateMessageArchiveInterval","params":[60480]}' {"jsonrpc":"2.0","id":1,"result":604800000000000} ``` -Notice that value to be set is provided in seconds but the value returned in the result is in nanoseconds (to avoid potential problems with division). \ No newline at end of file +Notice that value to be set is provided in seconds but the value returned in the result is in nanoseconds (to avoid potential problems with division). + +### Enabling History Archives + +You use `EnableCodexCommunityHistoryArchiveProtocol` method to enable history archives for Codex. The method also accepts optional overrides to the default codex node config. +#### without overrides + +```bash +curl -sS http://127.0.0.1:45453/statusgo/CallRPC \ + -H 'Content-Type: application/json' \ + -d '{"jsonrpc":"2.0","id":1,"method":"wakuext_enableCodexCommunityHistoryArchiveProtocol","params":[{}]}' + +# returns +{"jsonrpc":"2.0","id":1,"result":null} +``` +#### with overrides (example DiscoveryPort + one bootstrap SPR) + +```bash +curl -sS http://127.0.0.1:45453/statusgo/CallRPC \ + -H 'Content-Type: application/json' \ + -d '{ + "jsonrpc":"2.0", + "id":1, + "method":"wakuext_enableCodexCommunityHistoryArchiveProtocol", + "params":[ + { + "CodexNodeConfig.DiscoveryPort":"8091", + "CodexNodeConfig.BootstrapNodes":"[\"spr:CiUIAhIhAjOc4w87PAfj0XGMnqtYSgO8rwfPOxF7d8Y4-BXGVUJTEgIDARpJCicAJQgCEiECM5zjDzs8B-PRcYyeq1hKA7yvB887EXt3xjj4FcZVQlMQkfncyAYaCwoJBH8AAAGRAh-bGgsKCQSsEgAGkQIfmypGMEQCID4B7M6G5bEPQ_D_Z7YdPG6LHpXq3ghY2gkXtBxTExDeAiAFSOjwAem1PmbAIZlOq2hvT_LGQMwiEOEaVaoIJ1g-FQ\"]" + } + ] + }' + +# returns +{"jsonrpc":"2.0","id":1,"result":null} +``` + +To stop: + +```bash +curl -sS http://127.0.0.1:45453/statusgo/CallRPC -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"wakuext_disableCommunityHistoryArchiveProtocol","params":[]}' + +# returns +{"jsonrpc":"2.0","id":1,"result":null} +``` + + +And to verify the current node configuration: + +```bash +curl -sS http://127.0.0.1:45453/statusgo/GetNodeConfig \ + -H 'Content-Type: application/json' \ + -d '{}' | jq +```