Skip to content

feat(node): chain-compatible presignature selection for verifying foreign transactions - #4054

Merged
anodar merged 31 commits into
mainfrom
anodar/3569-6-chain-aware-presigs
Aug 24, 2026
Merged

feat(node): chain-compatible presignature selection for verifying foreign transactions#4054
anodar merged 31 commits into
mainfrom
anodar/3569-6-chain-aware-presigs

Conversation

@anodar

@anodar anodar commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Extends queue with take_first_matching and ingest

Unlike take, take_first_matching does full scan (accepted degradation risk when nodes drop support for given chain).

Closes: #3959

anodar added 13 commits July 22, 2026 11:53
…channel

The per-request view-client call (chain_is_supported) is gone: request
execution now checks a channel-backed supporters map on both the leader
and follower paths. foreign_chain_policy::spawn_supporters_by_foreign_chain
resolves the indexer's TLS-key channel against the running job's
participant set and threshold-filters it (TODO(#3640): switch to the
domain threshold); the coordinator spawns it per running job since it
needs the current participants. The ReadSupportedForeignChain trait,
its real/fake readers, the legacy view-client read, and the reader
generic on IndexerAPI/Coordinator/MpcClient/VerifyForeignTxProvider are
all removed.
@anodar
anodar force-pushed the anodar/3569-6-chain-aware-presigs branch from 6475bb8 to bec2c49 Compare August 4, 2026 20:30
@anodar
anodar marked this pull request as ready for review August 4, 2026 21:07
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/assets.rs Outdated

@haiyuechen-nearone haiyuechen-nearone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feel free to dismiss the suggestions if I misunderstood

@netrome netrome left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the well-sliced PR. I find it difficult to navigate and understand the asset queue, so I'm happy I don't have to consider anything else here. I still don't understand everything going on here but the intention is clear, and most of the code looks reasonable.

One blocker though: The .expect() on the rocksdb commit error is giving me a bit of a pause - couldn't we handle this error instead.

Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/assets.rs Outdated
Comment thread crates/node/src/assets.rs Outdated
Comment thread crates/node/src/assets.rs
netrome
netrome previously approved these changes Aug 7, 2026

@netrome netrome left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the updates, and creating the follow-up 🙏

Base automatically changed from anodar/3569-5-node-available-chains-switch to main August 17, 2026 11:49

@kevindeforth kevindeforth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We had a little attestation expiration emergency which interrupted me mid-review. Will pick this up tomorrow.

Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs

@kevindeforth kevindeforth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unfortunately, we are running into limitations of our existing asset queue implementation.
The currently proposed solution may lead to delayed signature responses in case the network does not have a uniform foreign chain tx support (#4054 (comment)).

A proper solution will probably require a refactor of the asset queue, so it's a trade-off:

  1. We ship it and gain more robust foregin-chain tx requests, at the risk of delayed signature responses and possibly at the cost of future refactors.
  2. We take time to refactor the queue now and solve other existing problems with it (such as offline participants), at the cost of more stringent requirements wrt to foreign chain configs in the MPC network.

I think I have a preference for 2 here, as we now have much better tooling for the foreign chain configs and I think the asset queue has been a thorn in our eye for a long time.

But I don't have full visibility on the demands of the community / business.
In any case, I think his is @netrome's call, as it's essentially a choice between shipping a feature now at the cost of increased tech-debt, or addressing tech-debt at the cost of delaying the feature.

Remark: the required refactor might be smaller than it might seem here. I haven't thought too much about possible designs yet, but I can if that is desired.

Comment thread crates/node/src/assets.rs Outdated
Comment thread crates/node/src/assets.rs
Comment thread crates/node/src/assets.rs Outdated
Comment thread crates/node/src/assets.rs Outdated
@anodar

anodar commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

As per our offline discussion, adding notifies to mitigate front-running problem.

@kevindeforth kevindeforth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!
A few remaining comments to polish and clarifying questions, the most significant about the take_owned_matching method.
But looks good otherwise. Please make sure to address the existing open threads.

Comment thread crates/node/src/assets.rs
Comment thread crates/node/src/assets.rs
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs Outdated
Comment thread crates/node/src/providers/verify_foreign_tx/sign.rs
Comment thread crates/node/src/assets.rs Outdated
Comment thread crates/node/src/assets.rs Outdated
Comment thread docs/asset-generation.md Outdated
Comment thread docs/asset-generation.md Outdated
Comment thread docs/design/calculating-supported-foreign-chains.md Outdated
Comment thread docs/design/calculating-supported-foreign-chains.md Outdated
@kevindeforth
kevindeforth dismissed their stale review August 21, 2026 08:51

main concern has been addressed

@near near deleted a comment from claude Bot Aug 23, 2026
@near near deleted a comment from claude Bot Aug 23, 2026
@near near deleted a comment from claude Bot Aug 23, 2026

@kevindeforth kevindeforth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

Comment thread crates/node/src/assets.rs
};

if ingested {
self.cold_queue_new_elements.notify_waiters();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that we are waking ourselves here. Not ideal, but it's okay.

@anodar
anodar requested a review from netrome August 24, 2026 08:41
@anodar
anodar added this pull request to the merge queue Aug 24, 2026
Merged via the queue into main with commit 060191b Aug 24, 2026
15 checks passed
@anodar
anodar deleted the anodar/3569-6-chain-aware-presigs branch August 24, 2026 10:44
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.

Chain-compatible presignature selection for verify-foreign-tx

5 participants