fix(infra): use agent-only overrides only for generating config#7254
fix(infra): use agent-only overrides only for generating config#7254paulbalaji merged 4 commits intomainfrom
Conversation
|
📝 WalkthroughWalkthroughMoved per-chain transaction overrides for select chains into a new exported Changes
Sequence Diagram(s)sequenceDiagram
participant Script as update-agent-config.ts
participant Registry as registry (env)
participant Config as chains.ts (agentSpecificChainMetadataOverrides)
participant Result as per-chain overrides
Script->>Config: import agentSpecificChainMetadataOverrides
alt registry available
Script->>Registry: registry.getChainMetadata(chain)
Registry-->>Script: ChainMetadata (blocks, tx fields, maybe gasPrice)
Script->>Script: extract blocks, transactionOverrides, gasPrice
else registry not available
Script->>Script: fallback to env gas-price JSON & local metadata
end
Script->>Config: merge agent-specific transactionOverrides (if exist)
Script->>Result: assemble final object (gasPrice, blocks, transactionOverrides)
Note over Result: returned per-chain consolidated override object
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
typescript/infra/scripts/agents/update-agent-config.ts (1)
82-96: Right then, let me dig a bit deeper into this. The first script didn't turn up much, so I'll need to get me hands dirty and find where these chains are actually defined in the codebase, yeah?Good, so now I understand Hyperlane uses metadata.yaml files to define chains with protocol types. Let me search the codebase more thoroughly for these specific chains and their metadata.Based on my investigation, the review comment's concern is valid and critical. I've confirmed that:
- Ronin is an EVM-compatible gaming-centric Ethereum sidechain designed to handle transactions (NOT Cosmos)
- Incentiv is a Layer 1 blockchain that combines Advanced Account Abstraction (AAA) with a Proof-of-Work (PoW) consensus mechanism with EVM compatibility (NOT Cosmos)
- Ink is a Stage 1 Optimistic Rollup (NOT Cosmos)
The code at lines 82-86 filters exclusively for
ProtocolType.CosmosorProtocolType.CosmosNativechains. Since all three chains (incentiv, ronin, ink) are EVM-compatible and not Cosmos-based chains, their agent-specific overrides defined earlier will be silently skipped during the map operation—they'll never be applied.
Agent-specific overrides for incentiv, ronin, and ink will never be applied because these chains are not Cosmos-protocol chains.
The code filters only for Cosmos/CosmosNative chains (lines 83-86), but all three chains defined in
agentSpecificChainMetadataOverridesare EVM chains. Their overrides will be silently ignored.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
typescript/infra/config/environments/mainnet3/chains.ts(1 hunks)typescript/infra/scripts/agents/update-agent-config.ts(5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-21T14:26:22.163Z
Learnt from: paulbalaji
PR: hyperlane-xyz/hyperlane-monorepo#7223
File: typescript/infra/src/config/chain.ts:56-58
Timestamp: 2025-10-21T14:26:22.163Z
Learning: When adding chains to chainsToSkip in typescript/infra/src/config/chain.ts, it's the expected pattern to keep the chain's configurations in other files like supportedChainNames.ts, agent.ts, validators.ts, and owners.ts. The chainsToSkip array is used selectively by specific scripts (e.g., check-owner-ica.ts) to exclude chains from certain operations, not as a signal to remove all configurations.
Applied to files:
typescript/infra/config/environments/mainnet3/chains.ts
🧬 Code graph analysis (1)
typescript/infra/scripts/agents/update-agent-config.ts (5)
typescript/infra/scripts/core-utils.ts (1)
getEnvironmentConfig(13-15)typescript/infra/config/environments/mainnet3/chains.ts (2)
environment(9-9)agentSpecificChainMetadataOverrides(17-41)typescript/infra/config/environments/mainnet3/index.ts (1)
environment(23-58)typescript/infra/scripts/agent-utils.ts (1)
getAgentConfig(496-510)typescript/sdk/src/gas/utils.ts (1)
getCosmosChainGasPrice(74-129)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (50)
- GitHub Check: infra-test
- GitHub Check: cli-evm-e2e-matrix (warp-apply-1)
- GitHub Check: cli-evm-e2e-matrix (warp-send)
- GitHub Check: cli-evm-e2e-matrix (warp-init)
- GitHub Check: cli-evm-e2e-matrix (core-check)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-config)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-basic)
- GitHub Check: cli-evm-e2e-matrix (core-read)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-2)
- GitHub Check: cli-evm-e2e-matrix (warp-check-2)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-recovery)
- GitHub Check: cli-evm-e2e-matrix (warp-rebalancer)
- GitHub Check: cli-evm-e2e-matrix (warp-check-1)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-ism-updates)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-1)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-2)
- GitHub Check: cli-evm-e2e-matrix (warp-deploy)
- GitHub Check: cli-evm-e2e-matrix (warp-check-3)
- GitHub Check: cli-evm-e2e-matrix (relay)
- GitHub Check: cli-evm-e2e-matrix (warp-read)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-submitters)
- GitHub Check: env-test-matrix (mainnet3, inevm, core)
- GitHub Check: cli-evm-e2e-matrix (core-deploy)
- GitHub Check: cli-evm-e2e-matrix (core-apply)
- GitHub Check: cli-evm-e2e-matrix (core-init)
- GitHub Check: env-test-matrix (testnet4, sepolia, core)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, igp)
- GitHub Check: env-test-matrix (mainnet3, inevm, igp)
- GitHub Check: cli-cosmos-e2e-matrix (warp-read)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, core)
- GitHub Check: cosmos-sdk-e2e-run
- GitHub Check: cli-cosmos-e2e-matrix (core-check)
- GitHub Check: env-test-matrix (mainnet3, ethereum, core)
- GitHub Check: env-test-matrix (mainnet3, optimism, igp)
- GitHub Check: env-test-matrix (mainnet3, optimism, core)
- GitHub Check: env-test-matrix (mainnet3, ethereum, igp)
- GitHub Check: cli-cosmos-e2e-matrix (core-read)
- GitHub Check: cli-cosmos-e2e-matrix (core-deploy)
- GitHub Check: cli-cosmos-e2e-matrix (warp-deploy)
- GitHub Check: cli-cross-chain-e2e-matrix (warp-apply)
- GitHub Check: cli-cross-chain-e2e-matrix (warp-deploy)
- GitHub Check: cli-cosmos-e2e-matrix (core-apply)
- GitHub Check: coverage-run
- GitHub Check: cli-install-test-run
- GitHub Check: yarn-test-run
- GitHub Check: build-and-push-to-gcr
- GitHub Check: lint-rs
- GitHub Check: e2e-matrix (evm)
- GitHub Check: test-rs
- GitHub Check: lander-coverage
🔇 Additional comments (4)
typescript/infra/config/environments/mainnet3/chains.ts (1)
15-41: Good separation of agent-specific overrides.The new constant clearly isolates agent-only configuration (minGasPrice, minFeePerGas, minPriorityFeePerGas) from general chain metadata. The structure is clean and the values look reasonable.
typescript/infra/scripts/agents/update-agent-config.ts (3)
8-8: Imports look good.The new imports support the agent-specific override merging logic introduced below.
Also applies to: 29-29
98-113: Gas price handling with fallback looks solid.The try-catch pattern properly handles both the happy path (fetching live gas price) and the fallback (using environment-specific JSON). The denom extraction and amount lookup are correct.
116-116: Return structure is correct once the spread issue is fixed.Returning the full overrides object (with both transactionOverrides and gasPrice) properly consolidates the configuration for each Cosmos chain.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7254 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 1 1
Lines 14 14
=====================================
Misses 14 14
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
typescript/infra/scripts/agents/update-agent-config.ts (1)
117-117: Minor: comment could be clearer.The comment says "from the agent-specific overrides" but line 118 destructures from the merged result of both
chainMetadataandagentSpecificOverrides. Might be worth saying "from the merged metadata" to avoid confusion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
typescript/infra/scripts/agents/update-agent-config.ts(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
typescript/infra/scripts/agents/update-agent-config.ts (6)
typescript/infra/scripts/core-utils.ts (1)
getEnvironmentConfig(13-15)typescript/infra/config/environments/mainnet3/chains.ts (2)
environment(9-9)agentSpecificChainMetadataOverrides(17-41)typescript/infra/scripts/agent-utils.ts (1)
getAgentConfig(496-510)typescript/infra/src/utils/utils.ts (1)
chainIsProtocol(336-339)typescript/sdk/src/gas/utils.ts (1)
getCosmosChainGasPrice(74-129)typescript/utils/src/objects.ts (1)
objMerge(116-151)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (50)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-config)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-1)
- GitHub Check: cli-evm-e2e-matrix (warp-send)
- GitHub Check: cli-evm-e2e-matrix (warp-read)
- GitHub Check: cli-evm-e2e-matrix (warp-rebalancer)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-basic)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-ism-updates)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-1)
- GitHub Check: cli-evm-e2e-matrix (warp-init)
- GitHub Check: cli-evm-e2e-matrix (warp-deploy)
- GitHub Check: cli-evm-e2e-matrix (warp-check-1)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-recovery)
- GitHub Check: cli-evm-e2e-matrix (warp-check-3)
- GitHub Check: cli-cosmos-e2e-matrix (core-read)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-2)
- GitHub Check: cli-evm-e2e-matrix (core-init)
- GitHub Check: cli-evm-e2e-matrix (relay)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-2)
- GitHub Check: cli-evm-e2e-matrix (core-read)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-submitters)
- GitHub Check: cli-evm-e2e-matrix (warp-check-2)
- GitHub Check: cli-evm-e2e-matrix (core-apply)
- GitHub Check: cli-evm-e2e-matrix (core-deploy)
- GitHub Check: cli-evm-e2e-matrix (core-check)
- GitHub Check: cli-cosmos-e2e-matrix (warp-read)
- GitHub Check: cli-cosmos-e2e-matrix (core-check)
- GitHub Check: cli-cosmos-e2e-matrix (core-deploy)
- GitHub Check: env-test-matrix (mainnet3, inevm, core)
- GitHub Check: env-test-matrix (testnet4, sepolia, core)
- GitHub Check: env-test-matrix (mainnet3, inevm, igp)
- GitHub Check: cli-cosmos-e2e-matrix (warp-deploy)
- GitHub Check: env-test-matrix (mainnet3, optimism, core)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, igp)
- GitHub Check: cli-cosmos-e2e-matrix (core-apply)
- GitHub Check: env-test-matrix (mainnet3, ethereum, igp)
- GitHub Check: env-test-matrix (mainnet3, optimism, igp)
- GitHub Check: cli-cross-chain-e2e-matrix (warp-apply)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, core)
- GitHub Check: cosmos-sdk-e2e-run
- GitHub Check: env-test-matrix (mainnet3, ethereum, core)
- GitHub Check: coverage-run
- GitHub Check: cli-cross-chain-e2e-matrix (warp-deploy)
- GitHub Check: cli-install-test-run
- GitHub Check: yarn-test-run
- GitHub Check: e2e-matrix (evm)
- GitHub Check: yarn-install
- GitHub Check: lander-coverage
- GitHub Check: lint-rs
- GitHub Check: test-rs
- GitHub Check: build-and-push-to-gcr
🔇 Additional comments (3)
typescript/infra/scripts/agents/update-agent-config.ts (3)
8-8: New imports look good.Both imports are properly used in the refactored logic - ChainMetadata for typing the config object, and agentSpecificChainMetadataOverrides for merging agent-specific settings.
Also applies to: 29-29
74-82: Good setup and clear documentation.The registry is fetched once and reused efficiently within the loop, and the comments properly explain what the additional config handles.
83-128: Solid refactor that properly separates concerns.The logic correctly handles different scenarios - Cosmos chains get their gasPrice set, chains with agent-specific overrides get their blocks and transactionOverrides merged from both registry and overrides. The past issue with the spread operator has been properly addressed here.
One thing: the TODO on line 111 mentions testnet4 support. If that environment ever needs similar overrides, you'll want a conditional import or a mapping rather than the hardcoded mainnet3 path.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
typescript/infra/scripts/agents/update-agent-config.ts (1)
101-107: Add error handling for missing gas prices in JSON.If the chain isn't in the gas prices JSON file, this'll blow up at runtime. Consider adding a fallback or at least a more helpful error message.
+ if ( + (environment === 'mainnet3' && + !(chain in mainnet3GasPrices)) || + (environment !== 'mainnet3' && !(chain in testnet4GasPrices)) + ) { + throw new Error( + `No gas price found for Cosmos chain ${chain} in ${environment} gas prices JSON`, + ); + } const amount = environment === 'mainnet3' ? mainnet3GasPrices[chain as keyof typeof mainnet3GasPrices] .amount : testnet4GasPrices[chain as keyof typeof testnet4GasPrices] .amount;
🧹 Nitpick comments (1)
typescript/infra/scripts/agents/update-agent-config.ts (1)
118-118: Comment's a bit off.The comment says "only care about blocks and transactionOverrides from the agent-specific overrides", but you're actually extracting from the MERGED result of chainMetadata + agentSpecificOverrides. So you're getting blocks from registry metadata too (if it exists), not just from agent overrides.
- // Only care about blocks and transactionOverrides from the agent-specific overrides + // Extract blocks and transactionOverrides from the merged metadata
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
typescript/infra/scripts/agents/update-agent-config.ts(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-21T14:26:22.163Z
Learnt from: paulbalaji
PR: hyperlane-xyz/hyperlane-monorepo#7223
File: typescript/infra/src/config/chain.ts:56-58
Timestamp: 2025-10-21T14:26:22.163Z
Learning: When adding chains to chainsToSkip in typescript/infra/src/config/chain.ts, it's the expected pattern to keep the chain's configurations in other files like supportedChainNames.ts, agent.ts, validators.ts, and owners.ts. The chainsToSkip array is used selectively by specific scripts (e.g., check-owner-ica.ts) to exclude chains from certain operations, not as a signal to remove all configurations.
Applied to files:
typescript/infra/scripts/agents/update-agent-config.ts
🧬 Code graph analysis (1)
typescript/infra/scripts/agents/update-agent-config.ts (7)
typescript/infra/scripts/core-utils.ts (1)
getEnvironmentConfig(13-15)typescript/infra/config/environments/mainnet3/chains.ts (2)
environment(9-9)agentSpecificChainMetadataOverrides(17-41)typescript/infra/config/environments/mainnet3/index.ts (1)
environment(23-58)typescript/infra/scripts/agent-utils.ts (1)
getAgentConfig(496-510)typescript/infra/src/utils/utils.ts (1)
chainIsProtocol(336-339)typescript/sdk/src/gas/utils.ts (1)
getCosmosChainGasPrice(74-129)typescript/utils/src/objects.ts (1)
objMerge(116-151)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (50)
- GitHub Check: infra-test
- GitHub Check: coverage
- GitHub Check: cli-evm-e2e-matrix (warp-send)
- GitHub Check: cli-evm-e2e-matrix (warp-read)
- GitHub Check: cli-evm-e2e-matrix (warp-rebalancer)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-recovery)
- GitHub Check: cli-evm-e2e-matrix (warp-init)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-2)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-config)
- GitHub Check: cli-evm-e2e-matrix (warp-extend-basic)
- GitHub Check: cli-evm-e2e-matrix (warp-check-2)
- GitHub Check: cli-evm-e2e-matrix (warp-check-1)
- GitHub Check: cli-evm-e2e-matrix (warp-check-3)
- GitHub Check: cli-evm-e2e-matrix (warp-bridge-1)
- GitHub Check: cli-evm-e2e-matrix (relay)
- GitHub Check: cli-evm-e2e-matrix (warp-deploy)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-submitters)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-1)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-2)
- GitHub Check: cli-cosmos-e2e-matrix (core-check)
- GitHub Check: cli-evm-e2e-matrix (core-apply)
- GitHub Check: cli-evm-e2e-matrix (core-read)
- GitHub Check: cli-evm-e2e-matrix (core-init)
- GitHub Check: cli-evm-e2e-matrix (core-deploy)
- GitHub Check: cli-evm-e2e-matrix (warp-apply-ism-updates)
- GitHub Check: cli-evm-e2e-matrix (core-check)
- GitHub Check: env-test-matrix (testnet4, sepolia, core)
- GitHub Check: cli-cosmos-e2e-matrix (core-deploy)
- GitHub Check: cli-cosmos-e2e-matrix (core-apply)
- GitHub Check: cli-cosmos-e2e-matrix (warp-deploy)
- GitHub Check: env-test-matrix (mainnet3, inevm, igp)
- GitHub Check: cli-cosmos-e2e-matrix (warp-read)
- GitHub Check: env-test-matrix (mainnet3, optimism, igp)
- GitHub Check: cli-cosmos-e2e-matrix (core-read)
- GitHub Check: env-test-matrix (mainnet3, inevm, core)
- GitHub Check: env-test-matrix (mainnet3, optimism, core)
- GitHub Check: env-test-matrix (mainnet3, ethereum, core)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, igp)
- GitHub Check: env-test-matrix (mainnet3, arbitrum, core)
- GitHub Check: env-test-matrix (mainnet3, ethereum, igp)
- GitHub Check: yarn-test-run
- GitHub Check: cli-install-test-run
- GitHub Check: cli-cross-chain-e2e-matrix (warp-deploy)
- GitHub Check: cli-cross-chain-e2e-matrix (warp-apply)
- GitHub Check: cosmos-sdk-e2e-run
- GitHub Check: build-and-push-to-gcr
- GitHub Check: e2e-matrix (evm)
- GitHub Check: test-rs
- GitHub Check: lander-coverage
- GitHub Check: lint-rs
🔇 Additional comments (4)
typescript/infra/scripts/agents/update-agent-config.ts (4)
8-8: Nice work on the imports.The new imports for
ChainMetadataandagentSpecificChainMetadataOverridesare spot on for what you're doing here.Also applies to: 29-29
115-117: Agent overrides get skipped without a registry.The condition here means if there's no registry (like in test environment per line 79), any agent-specific overrides won't be applied. That might be what you want, but worth being aware of.
If this is intentional because you only want overrides in non-test environments, all good. Otherwise, you might want to apply the overrides even without registry metadata as a fallback.
119-123: The objMerge approach works well here.Using
objMergeto combine chainMetadata with agentSpecificOverrides properly handles the nested transactionOverrides merging, with agent overrides taking priority. Then extracting just the bits you need keeps things clean.
86-127: Good refactoring of the per-chain config building.The map over environmentChains with the async handling for Cosmos gas prices and the merge logic for agent overrides is well structured. The past issue about the spread operator has been properly addressed by using
objMerge.
Description
fix(infra): use agent-only overrides only for generating config
Drive-by changes
Related issues
Backward compatibility
Testing
locally + ensuring CI doesn't fail https://github.com/hyperlane-xyz/hyperlane-monorepo/actions/runs/18785685986/job/53603270700?pr=7254
Summary by CodeRabbit
Release Notes