fix: replace hardcoded Koios URLs with public endpoints + koios.url config override#94
fix: replace hardcoded Koios URLs with public endpoints + koios.url config override#94
Conversation
…onfig override
Previously:
- Production code defaulted to koios.tosidrop.me (private mainnet mirror)
for all REST calls (epoch_params, pool_history, pool_blocks, etc.)
- Go client used koios.MainnetHost (api.koios.rest) creating inconsistency
between the two Koios call paths
- Tests hardcoded api.koios.rest regardless of config
Now:
- koiosRESTBase(networkMagic) defaults to public koios.rest endpoints:
mainnet -> https://api.koios.rest/api/v1
preprod -> https://preprod.koios.rest/api/v1
preview -> https://preview.koios.rest/api/v1
- koiosClientHost(networkMagic) mirrors the same logic for the Go client,
extracting just the hostname (koios.PreProdHost / PreviewHost / MainnetHost)
- Both functions check koios.url config key first, so operators running a
private Koios mirror can override with a single config line
- cli.go Go client init collapsed from 3-branch switch to one line using
koiosClientHost(cc.networkMagic)
- Tests use koiosRESTBase(MainnetNetworkMagic) instead of hardcoded URLs so
they stay consistent with whatever endpoint the config resolves to
- config.yaml.example documents koios.url (commented out, optional)
- All tosidrop references removed from code, docs, and agent skill files
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Two separate bugs:
Private endpoint in production code — all REST-based Koios calls (nonce fetch, pool history, epoch info, pool blocks, pool registration) hardcoded
koios.tosidrop.meas the mainnet base URL. That's a private mirror, not a public default.Inconsistency between code paths — the Go client (
i.koios) usedapi.koios.rest(public), while the raw REST helpers used tosidrop (private). Same logical operation, different backends.Tests hardcoded
api.koios.restdirectly, bypassing any config logic.Fix
koiosRESTBase(networkMagic int): defaults to public koios.rest per network; readskoios.urlconfig override firstkoiosClientHost(networkMagic int): same logic for the Go client (returns just the hostname)cli.goGo client init simplified from 3-branch switch to one linekoiosRESTBase(MainnetNetworkMagic)instead of hardcoded stringsconfig.yaml.example: documentskoios.urloptional overridetosidropreferences removed from code, docs, and agent skill filesDefault endpoints (no config override)
https://api.koios.rest/api/v1https://preprod.koios.rest/api/v1https://preview.koios.rest/api/v1Config override (optional)