NethermindEth / juno

Starknet client implementation.
https://juno.nethermind.io
Apache License 2.0
393 stars 170 forks source link

Add readiness endpoint for synced node #2052

Closed kirugan closed 2 months ago

kirugan commented 2 months ago

This feature was requested from tg channel. We need to add /ready/synced (we can discuss actual endpoint path later) endpoint that will return 200 http code if node is fully synced (withing N blocks maybe?) otherwise it should return 503 http code. Similar to what pathfinder does

obasekiosa commented 2 months ago

Why have a dedicated enpoint when we can use the HEAD/OPTIONS method for all rpc endpoints to check if they are ready (like a pre-flight check). Use status code or header value that says "how synced the node is"?

kirugan commented 2 months ago

Use status code or header value that says "how synced the node is"?

How is this different from /ready/synced endpoint? instead of sending the header from all endpoints we can have dedicated endpoint for that.

obasekiosa commented 2 months ago

Use status code or header value that says "how synced the node is"?

How is this different from /ready/synced endpoint? instead of sending the header from all endpoints we can have dedicated endpoint for that.

it would reduce the number of calls to just one and eliminate an extra endpoint.

but then again, it might depend on how this is going to be used and typical usage patterns with other end points.

kirugan commented 2 months ago

We decided to keep /ready/sync only (see https://t.me/StarknetJuno/1224)