Skip to content

fix: support comma-separated NEW_CHAIN without duplicating cross-new-chain edges#538

Merged
ravinagill15 merged 3 commits intomainfrom
ravina/fix-dupe-txs
Apr 29, 2026
Merged

fix: support comma-separated NEW_CHAIN without duplicating cross-new-chain edges#538
ravinagill15 merged 3 commits intomainfrom
ravina/fix-dupe-txs

Conversation

@ravinagill15
Copy link
Copy Markdown
Collaborator

@ravinagill15 ravinagill15 commented Apr 20, 2026

Summary

Fixes a bug introduced alongside #514 where configuring more than one new chain at a time (e.g. NEW_CHAIN='subtensorevm-mainnet,ault-mainnet') produced 58 duplicate transactions in the OneSig bundle between the two new chains.

What was happening

  • getNewChain() returned the raw comma-separated string.
  • getNewChainEid() tried to resolve the whole string as a single chain name → threw (or, in the iterate-per-chain variant, emitted each cross-new-chain edge once per run).
  • filterConnections filtered on a single newChainEid, so edges between two new chains could be kept under both chains' filter passes when callers iterated manually.

What this PR does

  • getNewChaingetNewChains(): string[] (splits on ,, trims, drops empties).
  • getNewChainEidgetNewChainEids(): Set<EndpointId> — a Set, so edges get kept at most once.
  • filterConnections now uses set-membership filtering. Each directed edge A→B is emitted exactly once if either endpoint is a new chain, whether or not both endpoints are new.
  • All config builders (messaging, asset, feelib, rewarder, staking, treasurer, oft-wrapper) accept the list.
  • Added multi-chain test cases to every relevant test suite.

Single-chain behavior is unchanged.

Test plan

  • pnpm test:hardhat — 300 passing (up from 295, including 5 new multi-chain tests)
  • Dry-run NEW_CHAIN='subtensorevm-mainnet,ault-mainnet' make configure-mainnet and confirm the OneSig bundle no longer flags duplicate transactions

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

🦋 Changeset detected

Latest commit: a538843

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stargatefinance/stg-evm-v2 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/stg-evm-v2/devtools/config/utils/utils.config.ts
Comment thread packages/stg-evm-v2/devtools/config/mainnet/01/oft-wrapper.config.ts Outdated
Comment thread packages/stg-evm-v2/devtools/config/utils/asset.config.utils.ts
@clauBv23
Copy link
Copy Markdown
Contributor

clauBv23 commented Apr 28, 2026

fixed the comments in #544, let me know it you agree and feel free to adjust anything @ravinagill15

skipped the new tests since they use rpcs, tested them locally, and all green

@ravinagill15 ravinagill15 requested a review from clauBv23 April 28, 2026 20:39
ravinagill15 and others added 3 commits April 28, 2026 13:40
…chain edges

NEW_CHAIN now accepts a comma-separated list. When multiple new chains are
specified, each directed edge (A→B) is kept exactly once if either endpoint
is a new chain — including edges between new chains, which previously could
be emitted twice by callers iterating per-chain.

- getNewChain/getNewChainEid → getNewChains/getNewChainEids (array/Set)
- filterConnections uses set-membership filtering
- All builders (messaging, asset, feelib, rewarder, staking, treasurer,
  oft-wrapper) accept a list of new chains
- Added multi-chain test coverage across all config test suites

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ravinagill15 ravinagill15 merged commit 8556e53 into main Apr 29, 2026
11 of 15 checks passed
@ravinagill15 ravinagill15 deleted the ravina/fix-dupe-txs branch April 29, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants