Skip to content

Conversation

@heemankv
Copy link
Contributor

@heemankv heemankv commented Dec 5, 2025

Pull Request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Testing
  • Other (please describe):

What is the current behavior?

Currently, the orchestrator fetches chain configuration (chain_id, fee token addresses) during SNOS job processing. This means:

  1. Every SNOS job makes an RPC call to fetch chain_id
  2. Fee token addresses (strk_fee_token_address, eth_fee_token_address) must be manually configured via environment variables
  3. If the RPC is temporarily unavailable during job processing, the job fails immediately without retry

Resolves: #NA

What is the new behavior?

  • Chain details fetched once at startup: A new ChainDetails struct is fetched at orchestrator startup with retry logic (5s interval, 5min timeout)

    • chain_id fetched from RPC (starknet_chainId)
    • Fee token addresses fetched from feeder gateway (/feeder_gateway/get_contract_addresses)
  • No more env vars for fee tokens: Fee token addresses are now dynamically fetched from the node, removing the need for MADARA_ORCHESTRATOR_STRK_NATIVE_FEE_TOKEN_ADDRESS and MADARA_ORCHESTRATOR_ETH_NATIVE_FEE_TOKEN_ADDRESS environment variables

  • Fail-fast at startup: If the node is unreachable, the orchestrator fails at startup rather than mid-job processing

Does this introduce a breaking change?

Yes - The following environment variables are no longer used and can be removed:

  • MADARA_ORCHESTRATOR_STRK_NATIVE_FEE_TOKEN_ADDRESS
  • MADARA_ORCHESTRATOR_ETH_NATIVE_FEE_TOKEN_ADDRESS

Migration: Simply remove these environment variables from your configuration. The orchestrator will now fetch these values automatically from the node's feeder gateway.

Other information

Architecture

Startup Flow:
┌─────────────────┐     ┌──────────────┐     ┌─────────────────────┐
│  Orchestrator   │────▶│ ChainDetails │────▶│  RPC: chain_id      │
│    Startup      │     │   ::fetch()  │     │  FG: fee tokens     │
└─────────────────┘     └──────────────┘     └─────────────────────┘
                              │ retry (5s interval, 5min timeout)
                              ▼
                        ┌──────────────┐
                        │   Config     │
                        │ (cached)     │
                        └──────────────┘

SNOS Job Flow:
┌─────────────────┐     ┌──────────────────────────────┐
│   SNOS Job      │────▶│ config.chain_details()       │ (instant, no RPC)
│  process_job()  │     │   .to_chain_config()         │
└─────────────────┘     └──────────────────────────────┘
image

@heemankv heemankv self-assigned this Dec 5, 2025
@heemankv heemankv changed the title Orchestrator/better chain dets fetch feat(orchestrator): fetch chain details at startup with retry Dec 5, 2025
@heemankv heemankv marked this pull request as ready for review December 8, 2025 19:41
Copy link
Contributor Author

@heemankv heemankv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self Review done, lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants