Make subgraph URI a parameter

This commit is contained in:
Marco van Dijk 2024-11-29 19:06:27 +01:00
parent f7f7aa8769
commit 9787af6174
2 changed files with 50 additions and 56 deletions

View File

@ -2,23 +2,22 @@ Requires a Broadcaster with some reserve amount set. TODO
### Config variables ### Config variables
``` ```
{ exports.CONF_MASTER_PORT: Port to upload results to
CONF_MASTER_PORT: Port to upload results to exports.CONF_MASTER_DOMAIN: Domain to upload results to
CONF_MASTER_DOMAIN: Domain to upload results to exports.CONF_MASTER_PATH: Path to the upload endpoint in case there's a reverse proxy
CONF_MASTER_PATH: Path to the upload endpoint in case there's a reverse proxy exports.CONF_FRIENDLY_NAME: Name to attach to the prober, the city name usually works
CONF_FRIENDLY_NAME: Name to attach to the prober, the city name usually works exports.CONF_REGION: Continent the prober is located in
CONF_REGION: Continent the prober is located in exports.CONF_LP_REGIONS: Livepeer leaderboard regions which map to locally resolved orchestrators
CONF_LP_REGIONS: Livepeer leaderboard regions which map to locally resolved orchestrators exports.CONF_CONCURRENCY: Amount of orchestrators to test at the same time
CONF_CONCURRENCY: Amount of orchestrators to test at the same time exports.CONF_SLEEPTIME: Time to sleep in the main loop
CONF_SLEEPTIME: Time to sleep in the main loop exports.CONF_MAX_LATENCY: Max GetOrch discovery time before we set it to 0
CONF_MAX_LATENCY: Max GetOrch discovery time before we set it to 0 exports.CONF_ROUNDTIME: Minimum amount of time between batch-checks
CONF_ROUNDTIME: Minimum amount of time between batch-checks exports.CONF_ORCHINFO_TIMEOUT: Timeout between refreshing the active O list
CONF_ORCHINFO_TIMEOUT: Timeout between refreshing the active O list exports.CONF_BROADCASTER: Public address of the broadcaster to mimic
CONF_BROADCASTER: Public address of the broadcaster to mimic exports.CONF_DNS_TIMEOUT: Timeout between DNS & GEO resolving for orchestrator instances
CONF_DNS_TIMEOUT: Timeout between DNS & GEO resolving for orchestrator instances exports.CONF_PRESHARED_MASTER_KEY: password for uploading to the hodler
CONF_PRESHARED_MASTER_KEY: password for uploading to the hodler exports.CONF_SIGNATURE: Broadcaster signature over a message containing it's own public address
CONF_SIGNATURE: Broadcaster signature over a message containing it's own public address exports.CONF_GRAPH_URI: Full URL including API key to the Livepeer subgraph;
}
``` ```
Obtaining the `CONF_SIGNATURE` is unfortunately a pain in the ass. The only way for now it add a print statement to the `livepeer/server/rpc.go/genOrchestratorReq` function in `go-livepeer` and then run the Broadcaster. All web3 libraries prepend a prefix to any message they sign for security purposes, so a script which can generate the signature from the private key would be nice to have here... Obtaining the `CONF_SIGNATURE` is unfortunately a pain in the ass. The only way for now it add a print statement to the `livepeer/server/rpc.go/genOrchestratorReq` function in `go-livepeer` and then run the Broadcaster. All web3 libraries prepend a prefix to any message they sign for security purposes, so a script which can generate the signature from the private key would be nice to have here...
@ -31,24 +30,22 @@ Note: this folder has to be placed in `/orchTest/client`, or edit `ecosystem.con
example `config.js`: example `config.js`:
``` ```
export const { exports.CONF_MASTER_PORT = 443;
CONF_MASTER_PORT = 443, exports.CONF_MASTER_DOMAIN = "stronk.rocks";
CONF_MASTER_DOMAIN = "stronk.rocks", exports.CONF_MASTER_PATH = "/orch/collectStats";
CONF_MASTER_PATH = "/orch/collectStats", exports.CONF_FRIENDLY_NAME = "Michigan";
CONF_FRIENDLY_NAME = "Michigan", exports.CONF_REGION = "Europe";
CONF_REGION = "Europe", exports.CONF_LP_REGIONS = ["FRA", "LON", "PRA"];
CONF_LP_REGIONS = ["FRA", "LON", "PRA"], exports.CONF_CONCURRENCY = 6;
CONF_CONCURRENCY = 6, exports.CONF_SLEEPTIME = 2000; //< 2 seconds
CONF_SLEEPTIME = 2000, //< 2 seconds exports.CONF_MAX_LATENCY = 2000; //< 2 seconds
CONF_MAX_LATENCY = 2000, //< 2 seconds exports.CONF_ROUNDTIME = 60000; //< 1 minute
CONF_ROUNDTIME = 60000, //< 1 minute exports.CONF_ORCHINFO_TIMEOUT = 14400000; //< 4 hours
CONF_ORCHINFO_TIMEOUT = 14400000, //< 4 hours exports.CONF_BROADCASTER = "847791cBF03be716A7fe9Dc8c9Affe17Bd49Ae5e";
CONF_BROADCASTER = "847791cBF03be716A7fe9Dc8c9Affe17Bd49Ae5e", exports.CONF_DNS_TIMEOUT = 600000; //< 10 minutes
CONF_DNS_TIMEOUT = 600000, //< 10 minutes exports.CONF_PRESHARED_MASTER_KEY = "koekjes";
CONF_PRESHARED_MASTER_KEY = "koekjes", exports.CONF_SIGNATURE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
CONF_SIGNATURE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], exports.CONF_GRAPH_URI = "https://gateway-arbitrum.network.thegraph.com/api/REDACTED/subgraphs/id/REDACTED";
} = process.env;
``` ```
pm2 start ecosystem.config.cjs pm2 start ecosystem.config.cjs
@ -60,23 +57,22 @@ export const {
example `config.js`: example `config.js`:
``` ```
export const { exports.CONF_MASTER_PORT = 42069;
CONF_MASTER_PORT = 42069, exports.CONF_MASTER_DOMAIN = "127.0.0.1";
CONF_MASTER_DOMAIN = "127.0.0.1", exports.CONF_MASTER_PATH = "/api/master/collectStats";
CONF_MASTER_PATH = "/api/master/collectStats", exports.CONF_FRIENDLY_NAME = "Leiden";
CONF_FRIENDLY_NAME = "Leiden", exports.CONF_REGION = "Europe";
CONF_REGION = "Europe", exports.CONF_LP_REGIONS = ["FRA", "LON", "PRA"];
CONF_LP_REGIONS = ["FRA", "LON", "PRA"], exports.CONF_CONCURRENCY = 6;
CONF_CONCURRENCY = 6, exports.CONF_SLEEPTIME = 2000; //< 2 seconds
CONF_SLEEPTIME = 2000, //< 2 seconds exports.CONF_MAX_LATENCY = 2000; //< 2 seconds
CONF_MAX_LATENCY = 2000, //< 2 seconds exports.CONF_ROUNDTIME = 60000; //< 1 minute
CONF_ROUNDTIME = 60000, //< 1 minute exports.CONF_ORCHINFO_TIMEOUT = 14400000; //< 4 hours
CONF_ORCHINFO_TIMEOUT = 14400000, //< 4 hours exports.CONF_BROADCASTER = "847791cBF03be716A7fe9Dc8c9Affe17Bd49Ae5e";
CONF_BROADCASTER = "847791cBF03be716A7fe9Dc8c9Affe17Bd49Ae5e", exports.CONF_DNS_TIMEOUT = 600000; //< 10 minutes
CONF_DNS_TIMEOUT = 600000, //< 10 minutes exports.CONF_PRESHARED_MASTER_KEY = "koekjes";
CONF_PRESHARED_MASTER_KEY = "koekjes", exports.CONF_SIGNATURE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
CONF_SIGNATURE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], exports.CONF_GRAPH_URI = "https://gateway-arbitrum.network.thegraph.com/api/REDACTED/subgraphs/id/REDACTED"
} = process.env;
``` ```
npm run dev npm run dev

View File

@ -22,6 +22,7 @@ const {
CONF_DNS_TIMEOUT, CONF_DNS_TIMEOUT,
CONF_PRESHARED_MASTER_KEY, CONF_PRESHARED_MASTER_KEY,
CONF_SIGNATURE, CONF_SIGNATURE,
CONF_GRAPH_URI,
} = require("../config.js"); } = require("../config.js");
/* /*
@ -311,10 +312,7 @@ const getOrchestrators = async function () {
} }
} }
`; `;
let orchData = await request( let orchData = await request(CONF_GRAPH_URI, orchQuery);
"https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-one",
orchQuery
);
orchData = orchData.transcoders; orchData = orchData.transcoders;
if (!orchData) { if (!orchData) {
console.log("Thegraph is probably acting up..."); console.log("Thegraph is probably acting up...");