From 4e4cb3680f74d0429f7604c59a22559aed82bfa9 Mon Sep 17 00:00:00 2001 From: Darien Hernandez Date: Wed, 11 Mar 2026 20:30:36 +0100 Subject: [PATCH] feat: add support for Asimov and Bradbury network configurations in setup guide and action files --- .github/actions/sync-files/action.yml | 6 +- .github/workflows/sync-docs-from-node.yml | 22 ++++- content/validators/asimov.yaml | 4 + content/validators/bradbury.yaml | 4 + pages/validators/monitoring.mdx | 14 ++- pages/validators/setup-guide.mdx | 26 +++++- scripts/update-config-in-setup-guide.js | 103 ++++++++++++---------- 7 files changed, 120 insertions(+), 59 deletions(-) create mode 100644 content/validators/asimov.yaml create mode 100644 content/validators/bradbury.yaml diff --git a/.github/actions/sync-files/action.yml b/.github/actions/sync-files/action.yml index d8eade87..6bcd1c0b 100644 --- a/.github/actions/sync-files/action.yml +++ b/.github/actions/sync-files/action.yml @@ -38,7 +38,7 @@ runs: using: 'composite' steps: - name: Prepare config file - if: inputs.type == 'config' + if: inputs.type == 'config' || inputs.type == 'config_asimov' || inputs.type == 'config_bradbury' shell: bash run: | # For config type, handle special case: @@ -92,7 +92,7 @@ runs: shell: bash run: | # Use prepared source for config/docker_compose types, otherwise use original source - if [[ "${{ inputs.type }}" == "config" ]] && [[ -n "$CONFIG_SOURCE" ]]; then + if [[ "${{ inputs.type }}" == "config" || "${{ inputs.type }}" == "config_asimov" || "${{ inputs.type }}" == "config_bradbury" ]] && [[ -n "$CONFIG_SOURCE" ]]; then SOURCE_PATH="$CONFIG_SOURCE" elif [[ "${{ inputs.type }}" == "docker_compose" ]] && [[ -n "$DOCKER_COMPOSE_SOURCE" ]]; then SOURCE_PATH="$DOCKER_COMPOSE_SOURCE" @@ -109,7 +109,7 @@ runs: "${{ inputs.exclude_files }}" - name: Cleanup config temp directory - if: inputs.type == 'config' && always() + if: (inputs.type == 'config' || inputs.type == 'config_asimov' || inputs.type == 'config_bradbury') && always() shell: bash run: | if [[ -n "$TEMP_CONFIG_DIR" ]] && [[ -d "$TEMP_CONFIG_DIR" ]]; then diff --git a/.github/workflows/sync-docs-from-node.yml b/.github/workflows/sync-docs-from-node.yml index 33b7a3da..c2ec7bf5 100644 --- a/.github/workflows/sync-docs-from-node.yml +++ b/.github/workflows/sync-docs-from-node.yml @@ -92,7 +92,7 @@ jobs: needs: prepare strategy: matrix: - sync_type: [changelog, config, docker_compose, api_gen, api_debug, api_ops] + sync_type: [changelog, config, config_asimov, config_bradbury, docker_compose, api_gen, api_debug, api_ops] fail-fast: false steps: - name: Checkout documentation repository @@ -101,7 +101,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Install yq for YAML sanitization - if: matrix.sync_type == 'config' || matrix.sync_type == 'docker_compose' + if: matrix.sync_type == 'config' || matrix.sync_type == 'config_asimov' || matrix.sync_type == 'config_bradbury' || matrix.sync_type == 'docker_compose' run: | sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 sudo chmod +x /usr/local/bin/yq @@ -115,6 +115,8 @@ jobs: sparse-checkout: | docs configs/node/config.yaml.example + configs/node/asimov.yaml.example + configs/node/bradbury.yaml.example release/docker-compose.yaml sparse-checkout-cone-mode: true path: source-repo @@ -136,6 +138,18 @@ jobs: echo "target_path=content/validators/config.yaml" >> $GITHUB_OUTPUT echo "filter_pattern=.*" >> $GITHUB_OUTPUT ;; + "config_asimov") + echo "title=Config File (Asimov)" >> $GITHUB_OUTPUT + echo "source_path=source-repo/configs/node/asimov.yaml.example" >> $GITHUB_OUTPUT + echo "target_path=content/validators/asimov.yaml" >> $GITHUB_OUTPUT + echo "filter_pattern=.*" >> $GITHUB_OUTPUT + ;; + "config_bradbury") + echo "title=Config File (Bradbury)" >> $GITHUB_OUTPUT + echo "source_path=source-repo/configs/node/bradbury.yaml.example" >> $GITHUB_OUTPUT + echo "target_path=content/validators/bradbury.yaml" >> $GITHUB_OUTPUT + echo "filter_pattern=.*" >> $GITHUB_OUTPUT + ;; "docker_compose") echo "title=Docker Compose File" >> $GITHUB_OUTPUT echo "source_path=source-repo/release/docker-compose.yaml" >> $GITHUB_OUTPUT @@ -474,11 +488,13 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY # Process each sync type report - for sync_type in changelog config docker_compose api_gen api_debug api_ops; do + for sync_type in changelog config config_asimov config_bradbury docker_compose api_gen api_debug api_ops; do # Get proper title case "$sync_type" in "changelog") title="📝 Changelog Sync" ;; "config") title="⚙️ Config File Sync" ;; + "config_asimov") title="⚙️ Config File Sync (Asimov)" ;; + "config_bradbury") title="⚙️ Config File Sync (Bradbury)" ;; "docker_compose") title="🐳 Docker Compose Sync" ;; "api_gen") title="🔧 API Gen Methods Sync" ;; "api_debug") title="🐛 API Debug Methods Sync" ;; diff --git a/content/validators/asimov.yaml b/content/validators/asimov.yaml new file mode 100644 index 00000000..6aa49ab3 --- /dev/null +++ b/content/validators/asimov.yaml @@ -0,0 +1,4 @@ +# Asimov Phase 5 network consensus configuration +consensus: + consensusaddress: "0xe66B434bc83805f380509642429eC8e43AE9874a" + genesis: 17326 diff --git a/content/validators/bradbury.yaml b/content/validators/bradbury.yaml new file mode 100644 index 00000000..7655a3c8 --- /dev/null +++ b/content/validators/bradbury.yaml @@ -0,0 +1,4 @@ +# Bradbury Phase 1 network consensus configuration +consensus: + consensusaddress: "0x8aCE036C8C3C5D603dB546b031302FCf149648E8" + genesis: 501711 diff --git a/pages/validators/monitoring.mdx b/pages/validators/monitoring.mdx index 60376383..2fd2d6af 100644 --- a/pages/validators/monitoring.mdx +++ b/pages/validators/monitoring.mdx @@ -117,6 +117,7 @@ CENTRAL_LOKI_PASSWORD=your-logs-password # Node identification NODE_ID=validator-001 VALIDATOR_NAME=MyValidator +NETWORK_NAME=asimov-phase5 # Usually defaults are fine NODE_METRICS_ENDPOINT=host.docker.internal:9153 @@ -165,6 +166,7 @@ alloy: # Single node configuration - NODE_ID=${NODE_ID:-local} - VALIDATOR_NAME=${VALIDATOR_NAME:-default} + - NETWORK_NAME=${NETWORK_NAME:-asimov-phase5} - NODE_METRICS_ENDPOINT=${NODE_METRICS_ENDPOINT:-host.docker.internal:9153} # Multi-node configuration @@ -237,6 +239,12 @@ discovery.relabel "add_labels" { replacement = "alloy" } + // Add network label from environment variable + rule { + target_label = "network" + replacement = coalesce(sys.env("NETWORK_NAME"), "asimov-phase5") + } + // Add job label rule { target_label = "job" @@ -278,16 +286,16 @@ loki.write "central" { // Supports both single node and multi-node configurations // // Single Node Mode: -// Set NODE_METRICS_ENDPOINT, NODE_ID, VALIDATOR_NAME +// Set NODE_METRICS_ENDPOINT, NODE_ID, VALIDATOR_NAME, NETWORK_NAME // // Multi-Node Mode: // Set SCRAPE_TARGETS_JSON with JSON array of target objects -// Example: [{"__address__":"host.docker.internal:9250","instance":"0x...","validator_name":"node-1"}] +// Example: [{"__address__":"host.docker.internal:9250","instance":"0x...","validator_name":"node-1","network":"testnet-asimov"}] prometheus.scrape "genlayer_node" { // Dynamic targets based on environment variable // If SCRAPE_TARGETS_JSON is set, use it (multi-node mode) // Otherwise, build single target from individual env vars (single node mode) - targets = encoding.from_json(coalesce(sys.env("SCRAPE_TARGETS_JSON"), string.format("[{\"__address__\":\"%s\",\"instance\":\"%s\",\"validator_name\":\"%s\"}]", coalesce(sys.env("NODE_METRICS_ENDPOINT"), "host.docker.internal:9153"), coalesce(sys.env("NODE_ID"), "local"), coalesce(sys.env("VALIDATOR_NAME"), "default")))) + targets = encoding.from_json(coalesce(sys.env("SCRAPE_TARGETS_JSON"), string.format("[{\"__address__\":\"%s\",\"instance\":\"%s\",\"validator_name\":\"%s\",\"network\":\"%s\"}]", coalesce(sys.env("NODE_METRICS_ENDPOINT"), "host.docker.internal:9153"), coalesce(sys.env("NODE_ID"), "local"), coalesce(sys.env("VALIDATOR_NAME"), "default"), coalesce(sys.env("NETWORK_NAME"), "asimov-phase5")))) forward_to = [prometheus.relabel.metrics.receiver] diff --git a/pages/validators/setup-guide.mdx b/pages/validators/setup-guide.mdx index 9293f2c2..420cc4b8 100644 --- a/pages/validators/setup-guide.mdx +++ b/pages/validators/setup-guide.mdx @@ -255,7 +255,7 @@ This is the main configuration file of your node. Without it, your node won't st The file needs to be located at `configs/node/config.yaml` -You can use the following example configuration. **Note:** For most users, you will only need to modify the `genlayerchainrpcurl` and `genlayerchainwebsocketurl` values below. +You can use the following example configuration. **Note:** For most users, you will only need to modify the `genlayerchainrpcurl`, `genlayerchainwebsocketurl`, and the `consensus` section for your target network (see [Network-Specific Consensus Configuration](#network-specific-consensus-configuration) below). ```yaml copy # rollup configuration @@ -366,6 +366,30 @@ metrics: ``` +#### Network-Specific Consensus Configuration + +Set the `consensus` section in your `config.yaml` according to the network you want to join: + +##### Testnet Asimov + +```yaml copy +# Asimov Phase 5 network consensus configuration +consensus: + consensusaddress: "0xe66B434bc83805f380509642429eC8e43AE9874a" + genesis: 17326 + +``` + +##### Testnet Bradbury + +```yaml copy +# Bradbury Phase 1 network consensus configuration +consensus: + consensusaddress: "0x8aCE036C8C3C5D603dB546b031302FCf149648E8" + genesis: 501711 + +``` + #### Overriding Configuration with Environment Variables Any configuration value in `config.yaml` can be overridden using environment variables with the prefix `GENLAYERNODE_`. diff --git a/scripts/update-config-in-setup-guide.js b/scripts/update-config-in-setup-guide.js index 44519ea5..c10e458e 100755 --- a/scripts/update-config-in-setup-guide.js +++ b/scripts/update-config-in-setup-guide.js @@ -5,66 +5,71 @@ const path = require('path'); /** * Update the setup guide with the latest config from content/validators/config.yaml + * and network-specific consensus configs from content/validators/asimov.yaml and bradbury.yaml */ function updateConfigInSetupGuide() { const configPath = path.join(process.cwd(), 'content/validators/config.yaml'); + const asimovPath = path.join(process.cwd(), 'content/validators/asimov.yaml'); + const bradburyPath = path.join(process.cwd(), 'content/validators/bradbury.yaml'); const setupGuidePath = path.join(process.cwd(), 'pages/validators/setup-guide.mdx'); - - if (!fs.existsSync(configPath)) { - console.error(`Config file ${configPath} does not exist`); - return; - } - + if (!fs.existsSync(setupGuidePath)) { console.error(`Setup guide file ${setupGuidePath} does not exist`); return; } - - // Read the config.yaml content - const configContent = fs.readFileSync(configPath, 'utf8'); - - // Read the setup guide + let setupGuideContent = fs.readFileSync(setupGuidePath, 'utf8'); - - // Pattern to match the YAML config block - // Looks for the text before the yaml block, the yaml block itself, and the text after - // Note: The yaml block may have additional attributes like "copy" (```yaml copy) - // Uses [\s\S]*? to match any characters (including backticks in inline code) until the yaml block - const configPattern = /(You can use the following example configuration[\s\S]*?```yaml[^\n]*\n)([\s\S]*?)(\n```)/; - - if (configPattern.test(setupGuideContent)) { - // Replace the config content while preserving the surrounding text - setupGuideContent = setupGuideContent.replace( - configPattern, - `$1${configContent}$3` - ); - - // Write the updated content back - fs.writeFileSync(setupGuidePath, setupGuideContent); - console.log(`Updated setup guide config at ${new Date().toISOString()}`); - } else { - console.error('Could not find config pattern in setup guide'); - - // Try a more general pattern as fallback - const fallbackPattern = /(```yaml\n)([\s\S]*?)(\n```)/; - const matches = setupGuideContent.match(fallbackPattern); - - if (matches) { - // Check if this looks like the config block by looking for consensus addresses - if (matches[2].includes('contractmanageraddress') || matches[2].includes('consensus:')) { - setupGuideContent = setupGuideContent.replace( - fallbackPattern, - `$1${configContent}$3` - ); - fs.writeFileSync(setupGuidePath, setupGuideContent); - console.log(`Updated setup guide config using fallback pattern at ${new Date().toISOString()}`); - } else { - console.error('Found YAML block but it does not appear to be the config block'); - } + + // Update main config block from config.yaml + if (fs.existsSync(configPath)) { + const configContent = fs.readFileSync(configPath, 'utf8'); + const configPattern = /(You can use the following example configuration[\s\S]*?```yaml[^\n]*\n)([\s\S]*?)(\n```)/; + + if (configPattern.test(setupGuideContent)) { + setupGuideContent = setupGuideContent.replace( + configPattern, + `$1${configContent}$3` + ); + console.log(`Updated main config block at ${new Date().toISOString()}`); } else { - console.error('Could not find any YAML block in setup guide'); + console.error('Could not find main config pattern in setup guide'); } } + + // Update Asimov consensus config + if (fs.existsSync(asimovPath)) { + const asimovContent = fs.readFileSync(asimovPath, 'utf8'); + const asimovPattern = /(##### Testnet Asimov\s*```yaml[^\n]*\n)([\s\S]*?)(\n```)/; + + if (asimovPattern.test(setupGuideContent)) { + setupGuideContent = setupGuideContent.replace( + asimovPattern, + `$1${asimovContent}$3` + ); + console.log(`Updated Asimov config block at ${new Date().toISOString()}`); + } else { + console.error('Could not find Asimov config pattern in setup guide'); + } + } + + // Update Bradbury consensus config + if (fs.existsSync(bradburyPath)) { + const bradburyContent = fs.readFileSync(bradburyPath, 'utf8'); + const bradburyPattern = /(##### Testnet Bradbury\s*```yaml[^\n]*\n)([\s\S]*?)(\n```)/; + + if (bradburyPattern.test(setupGuideContent)) { + setupGuideContent = setupGuideContent.replace( + bradburyPattern, + `$1${bradburyContent}$3` + ); + console.log(`Updated Bradbury config block at ${new Date().toISOString()}`); + } else { + console.error('Could not find Bradbury config pattern in setup guide'); + } + } + + // Write the updated content back + fs.writeFileSync(setupGuidePath, setupGuideContent); } // Run the script @@ -72,4 +77,4 @@ if (require.main === module) { updateConfigInSetupGuide(); } -module.exports = { updateConfigInSetupGuide }; \ No newline at end of file +module.exports = { updateConfigInSetupGuide };