Skip to content

feat: wire available foreign chains API into node and e2e tests#3512

Open
anodar wants to merge 2 commits into
mainfrom
anodar/foreigntx_node
Open

feat: wire available foreign chains API into node and e2e tests#3512
anodar wants to merge 2 commits into
mainfrom
anodar/foreigntx_node

Conversation

@anodar

@anodar anodar commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Node side changes from: #3484

Work towards: #3475

Followup on: #3511

@anodar anodar changed the base branch from main to anodar/foreigntx_contract June 9, 2026 21:53
@anodar anodar marked this pull request as ready for review June 9, 2026 21:53
@anodar anodar changed the title Anodar/foreigntx node feat: wire available foreign chains API into node and e2e tests Jun 9, 2026
@claude

claude Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR title type suggestion: This PR adds new functionality for foreign chain transaction verification and configuration, so it should use the feat: prefix.

Suggested title: feat: add foreign chain transaction verification support

@claude

claude Bot commented Jun 9, 2026

Copy link
Copy Markdown

Pull request overview

Adds the node-side wiring for the new register_foreign_chains_config / get_foreign_chains_configs contract API introduced in #3484, sent alongside the legacy register_foreign_chain_config so a single node binary works on both pre- and post-upgrade contracts. The fake indexer gains an equivalent registration path plus a threshold-based recompute, and a new e2e test asserts the per-node configs surface on the contract after auto-registration.

Changes:

  • coordinator.rs: send both legacy and new registration transactions on startup.
  • indexer/types.rs: new ChainRegisterForeignChainsConfigArgs variant; method/gas wiring.
  • indexer/tx_sender.rs: accept the new variant in observe_tx_result.
  • indexer/fake.rs: handle the new tx; recompute an "available" set with threshold semantics; refactor the legacy registration to share the cross-participant intersection helper.
  • e2e-tests: new cluster view helper and e2e test available_foreign_chain_by_node__should_reflect_auto_registered_configs.

Reviewed changes

Per-file summary
File Description
crates/node/src/coordinator.rs Send both RegisterForeignChainConfig and RegisterForeignChainsConfig on startup.
crates/node/src/indexer/types.rs Add new args type and enum variant; map to REGISTER_FOREIGN_CHAINS_CONFIG method and MAX_GAS.
crates/node/src/indexer/tx_sender.rs Treat new variant as TransactionStatus::Unknown (fire-and-forget).
crates/node/src/indexer/fake.rs Add available_foreign_chains_by_node + available_foreign_chains fields; implement register_foreign_chains_config with threshold-based recompute; refactor legacy path through record_node_chains.
crates/e2e-tests/src/cluster.rs Add view_available_foreign_chain_by_node calling GET_FOREIGN_CHAINS_CONFIGS.
crates/e2e-tests/tests/foreign_chain_configuration.rs New e2e test asserting auto-registered per-node configs.
crates/e2e-tests/tests/common.rs Add AVAILABLE_FOREIGN_CHAINS_BY_NODE_PORT_SEED = 22.

Findings

Non-blocking (nits, follow-ups, suggestions):

  • crates/node/src/indexer/fake.rs:58available_foreign_chains (and by extension the threshold recompute at fake.rs:154-170) is dead code: the field is written but never read, and there is no getter exposing it. Either expose it via a method that a unit test uses to lock in the threshold semantics, or drop the field and the recompute. As written it is untested logic that will silently drift from the real contract (e.g. if the real contract's whitelist intersection rule changes, this stays out of sync with no test surfacing the divergence).
  • crates/node/src/indexer/types.rs:194 — TODO references #3485, while the matching TODOs in coordinator.rs:402 and tx_sender.rs:302 reference #3475. Worth aligning so a future cleanup grep finds all three sites.
  • crates/e2e-tests/src/cluster.rs:842 — method name view_available_foreign_chain_by_node is slightly misleading: it calls GET_FOREIGN_CHAINS_CONFIGS, which returns the per-node registered configs, not the available (threshold-passed) set. Consider view_foreign_chains_configs_by_node to match the contract method's intent and avoid future confusion with GET_AVAILABLE_FOREIGN_CHAINS.
  • crates/e2e-tests/tests/foreign_chain_configuration.rs:158-181 — the test asserts cardinalities only (2 covering Solana, 1 empty) and does not check which nodes are which. Keying the assertion on the per-node TLS public key (which the cluster exposes) would catch a regression where, e.g., node 2's empty registration overwrites the wrong TLS-key slot.

Approved

anodar added 2 commits June 10, 2026 01:13
…gistration

Adds register_foreign_chains_config / get_foreign_chains_configs to the
contract: a new registration path keyed by each node's Ed25519 TLS public key
(rather than AccountId). Introduces ForeignChainsMetadata to hold the
per-node map alongside the existing RPC whitelist and available-chain cache.
Coexists with the legacy register_foreign_chain_support until node and
contract have both migrated.
…2e tests

Connects the new contract registration path to the node: coordinator sends
register_foreign_chains_config on startup (alongside the legacy call),
tx_sender and indexer types carry the new RPC, fake contract mirrors the
real semantics. Adds e2e test coverage and updates docs to reflect the
new TLS-key-keyed API.
@anodar anodar force-pushed the anodar/foreigntx_contract branch from c4ceaac to 5870113 Compare June 9, 2026 23:16
@anodar anodar force-pushed the anodar/foreigntx_node branch from 3a66f1d to 76b5ebd Compare June 9, 2026 23:16
@anodar anodar changed the base branch from anodar/foreigntx_contract to 3475-available-foreign-chains_1 June 9, 2026 23:19
@anodar anodar changed the base branch from 3475-available-foreign-chains_1 to main June 9, 2026 23:21
@anodar anodar changed the base branch from main to 3475-available-foreign-chains_1 June 9, 2026 23:22
@anodar anodar changed the base branch from 3475-available-foreign-chains_1 to anodar/foreigntx_contract June 9, 2026 23:22
Base automatically changed from anodar/foreigntx_contract to main June 18, 2026 07:08
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