nautechsystems/nautilus_trader · error

Invalid multicall address

Error message

Invalid multicall address

What it means

The multicall contract constructor hardcodes the well-known MULTICALL3 address and validates it with `validate_address`, panicking with "Invalid multicall address" if validation fails. This is a build-time constant, so the panic indicates the compiled-in constant is malformed or the validator rejects it — an internal invariant, not user input.

Source

Thrown at crates/adapters/blockchain/src/contracts/base.rs:116

        multicall_calls_per_rpc_request: u32,
    ) -> Self {
        Self::new_with_multicall_limit_and_timeout(client, multicall_calls_per_rpc_request, None)
    }

    /// Creates a new base contract interface with an explicit Multicall request size and
    /// per-request RPC timeout.
    ///
    /// # Panics
    ///
    /// Panics if the multicall address is invalid (which should never happen with the hardcoded address).
    #[must_use]
    pub fn new_with_multicall_limit_and_timeout(
        client: Arc<BlockchainHttpRpcClient>,
        multicall_calls_per_rpc_request: u32,
        rpc_timeout_secs: Option<u64>,
    ) -> Self {
        let multicall_address =
            validate_address(MULTICALL3_ADDRESS).expect("Invalid multicall address");
        let multicall_calls_per_rpc_request = (multicall_calls_per_rpc_request as usize).max(1);

        Self {
            client,
            multicall_address,
            multicall_calls_per_rpc_request,
            rpc_timeout_secs,
        }
    }

    /// Gets a reference to the RPC client.
    #[must_use]
    pub const fn client(&self) -> &Arc<BlockchainHttpRpcClient> {
        &self.client
    }

    /// Executes a single contract call and returns the raw response bytes.
    ///

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the MULTICALL3_ADDRESS constant in crates/adapters/blockchain/src/contracts/base.rs is a valid 20-byte hex address.
  2. Compare against the official Multicall3 deployment addresses for your chain.
  3. Rebuild from an unmodified upstream version to rule out local edits.
  4. If the validator rejects checksummed vs lowercase forms, fix the constant's EIP-55 checksum.

Example fix

// before
const MULTICALL3_ADDRESS: &str = "0xcA11bde05977b3631167028862bE2a173976CA1"; // truncated/invalid
// after
const MULTICALL3_ADDRESS: &str = "0xcA11bde05977b3631167028862bE2a173976CA11"; // valid Multicall3
Defensive patterns

Strategy: validation

Validate before calling

// Validate the constant at startup or in tests
assert!(Address::from_str(MULTICALL3_ADDRESS).is_ok(), "MULTICALL3_ADDRESS is not a valid address");

Try / catch

// Use the fallible constructor path instead of the panicking one if available,
// or wrap calls in catch_unwind during startup smoke tests.

Prevention

When it happens

Trigger: Calling `BlockchainDataClient::new_with_multicall_limit_and_timeout(...)` when the compiled-in MULTICALL3_ADDRESS constant fails address validation (wrong length, bad hex, or a validator build that rejects it).

Common situations: Custom builds/patches where MULTICALL3_ADDRESS was edited incorrectly; chain builds with a stale or mistyped constant; checksum/EIP-55 validation strictness differences.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/1f9e99117299793b. Report an issue: GitHub.