Merge branch 'master' into deprecate_sync_strategy

This commit is contained in:
Darshan K 2025-03-28 14:49:33 +05:30 committed by GitHub
commit 8e9cbb53e8
8 changed files with 30 additions and 18 deletions

View File

@ -79,7 +79,7 @@ jobs:
- name: Build binaries
run: make V=1 QUICK_AND_DIRTY_COMPILER=1 all tools
trigger-windows-build:
build-windows:
uses: ./.github/workflows/windows-build.yml
with:
branch: ${{ github.ref }}

View File

@ -27,7 +27,7 @@ RUN make -j$(nproc) ${NIM_COMMIT} $MAKE_TARGET LOG_LEVEL=${LOG_LEVEL} NIMFLAGS="
# PRODUCTION IMAGE -------------------------------------------------------------
FROM alpine:3.18 as prod
FROM alpine:3.18 AS prod
ARG MAKE_TARGET=wakunode2

View File

@ -1,5 +1,5 @@
# Dockerfile to build a distributable container image from pre-existing binaries
FROM debian:stable-slim as prod
FROM debian:stable-slim AS prod
ARG MAKE_TARGET=wakunode2

View File

@ -33,7 +33,7 @@ proc testWakuNode(): WakuNode =
newTestWakuNode(privkey, bindIp, port, some(extIp), some(port))
suite "Waku v2 REST API - Debug":
asyncTest "Get node info - GET /debug/v1/info":
asyncTest "Get node info - GET /info":
# Given
let node = testWakuNode()
await node.start()
@ -62,7 +62,7 @@ suite "Waku v2 REST API - Debug":
await restServer.closeWait()
await node.stop()
asyncTest "Get node version - GET /debug/v1/version":
asyncTest "Get node version - GET /version":
# Given
let node = testWakuNode()
await node.start()

View File

@ -148,7 +148,7 @@ proc startRestServerProtocolSupport*(
"/relay endpoints are not available. Please check your configuration: --relay"
## Filter REST API
if conf.filternode != "" and node.wakuFilterClient != nil:
if node.wakuFilterClient != nil:
let filterCache = MessageCache.init()
let filterDiscoHandler =
@ -161,8 +161,7 @@ proc startRestServerProtocolSupport*(
router, node, filterCache, filterDiscoHandler
)
else:
restServerNotInstalledTab["filter"] =
"/filter endpoints are not available. Please check your configuration: --filternode"
restServerNotInstalledTab["filter"] = "/filter endpoints are not available."
## Store REST API
let storeDiscoHandler =
@ -175,9 +174,10 @@ proc startRestServerProtocolSupport*(
rest_store_legacy_api.installStoreApiHandlers(router, node, storeDiscoHandler)
## Light push API
## Install it either if lightpushnode (lightpush service node) is configured and client is mounted)
## Install it either if client is mounted)
## or install it to be used with self-hosted lightpush service
if (conf.lightpushnode != "" and node.wakuLegacyLightpushClient != nil) or
## We either get lightpushnode (lightpush service node) from config or discovered or self served
if (node.wakuLegacyLightpushClient != nil) or
(conf.lightpush and node.wakuLegacyLightPush != nil and node.wakuRelay != nil):
let lightDiscoHandler =
if not wakuDiscv5.isNil():
@ -190,8 +190,7 @@ proc startRestServerProtocolSupport*(
)
rest_lightpush_api.installLightPushRequestHandler(router, node, lightDiscoHandler)
else:
restServerNotInstalledTab["lightpush"] =
"/lightpush endpoints are not available. Please check your configuration: --lightpushnode"
restServerNotInstalledTab["lightpush"] = "/lightpush endpoints are not available."
info "REST services are installed"
return ok()

View File

@ -11,10 +11,10 @@ logScope:
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
proc debugInfoV1*(): RestResponse[DebugWakuInfo] {.
rest, endpoint: "/debug/v1/info", meth: HttpMethod.MethodGet
rest, endpoint: "/info", meth: HttpMethod.MethodGet
.}
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
proc debugVersionV1*(): RestResponse[string] {.
rest, endpoint: "/debug/v1/version", meth: HttpMethod.MethodGet
rest, endpoint: "/version", meth: HttpMethod.MethodGet
.}

View File

@ -8,10 +8,12 @@ export types
logScope:
topics = "waku node rest debug_api"
const ROUTE_DEBUG_INFOV1* = "/debug/v1/info"
const ROUTE_INFOV1* = "/info"
# /debug route is deprecated, will be removed
const ROUTE_DEBUG_INFOV1 = "/debug/v1/info"
proc installDebugInfoV1Handler(router: var RestRouter, node: WakuNode) =
router.api(MethodGet, ROUTE_DEBUG_INFOV1) do() -> RestApiResponse:
let getInfo = proc(): RestApiResponse =
let info = node.info().toDebugWakuInfo()
let resp = RestApiResponse.jsonResponse(info, status = Http200)
if resp.isErr():
@ -20,11 +22,22 @@ proc installDebugInfoV1Handler(router: var RestRouter, node: WakuNode) =
return resp.get()
const ROUTE_DEBUG_VERSIONV1* = "/debug/v1/version"
# /debug route is deprecated, will be removed
router.api(MethodGet, ROUTE_DEBUG_INFOV1) do() -> RestApiResponse:
return getInfo()
router.api(MethodGet, ROUTE_INFOV1) do() -> RestApiResponse:
return getInfo()
const ROUTE_VERSIONV1* = "/version"
# /debug route is deprecated, will be removed
const ROUTE_DEBUG_VERSIONV1 = "/debug/v1/version"
proc installDebugVersionV1Handler(router: var RestRouter, node: WakuNode) =
# /debug route is deprecated, will be removed
router.api(MethodGet, ROUTE_DEBUG_VERSIONV1) do() -> RestApiResponse:
return RestApiResponse.textResponse(git_version, status = Http200)
router.api(MethodGet, ROUTE_VERSIONV1) do() -> RestApiResponse:
return RestApiResponse.textResponse(git_version, status = Http200)
proc installDebugApiHandlers*(router: var RestRouter, node: WakuNode) =
installDebugInfoV1Handler(router, node)

View File

@ -229,7 +229,7 @@ proc populateEnrCache(wpx: WakuPeerExchange) =
# swap cache for new
wpx.enrCache = newEnrCache
debug "ENR cache populated"
trace "ENR cache populated"
proc updatePxEnrCache(wpx: WakuPeerExchange) {.async.} =
# try more aggressively to fill the cache at startup