Skip to content

feat(sdk): support hyper_evm and polygon#3154

Merged
DSharifi merged 5 commits into
mainfrom
dsharifi/add-remaining-evm-to-sdk
May 6, 2026
Merged

feat(sdk): support hyper_evm and polygon#3154
DSharifi merged 5 commits into
mainfrom
dsharifi/add-remaining-evm-to-sdk

Conversation

@DSharifi

@DSharifi DSharifi commented May 6, 2026

Copy link
Copy Markdown
Contributor

closes #2815
closes #2816

@claude

claude Bot commented May 6, 2026

Copy link
Copy Markdown

Pull request overview

Adds SDK builders for two new EVM-compatible foreign chains, HyperEvm and Polygon, mirroring the existing pattern used for Arbitrum/Base/Bnb. New variants are appended to ForeignChainRpcRequest and ForeignChain in the contract-interface crate, and exhaustiveness is preserved (matches were updated; downstream callers either use the _ => bail!(…) arm or are wildcard-aware via #[non_exhaustive]).

Changes:

  • New ForeignChainRpcRequest::HyperEvm / Polygon variants and corresponding ForeignChain enum entries, with the chain() mapping updated and rstest cases added.
  • New near_mpc_sdk::foreign_chain::hyper_evm and polygon modules implementing EvmChainVariant plus new_hyper_evm() / new_polygon() builders.
  • Integration tests tests/hyper_evm.rs and tests/polygon.rs mirroring the Bnb/Base/Arbitrum tests.

Reviewed changes

Per-file summary
File Description
crates/near-mpc-contract-interface/src/types/foreign_chain.rs Adds HyperEvm/Polygon variants to ForeignChainRpcRequest and ForeignChain, updates chain() match, and extends rstest cases.
crates/near-mpc-sdk/src/foreign_chain.rs Registers new hyper_evm and polygon submodules.
crates/near-mpc-sdk/src/foreign_chain/hyper_evm.rs New chain variant marker, EvmChainVariant impl, builder constructor, and unit test.
crates/near-mpc-sdk/src/foreign_chain/polygon.rs Same as above for Polygon.
crates/near-mpc-sdk/tests/hyper_evm.rs Integration test asserting the request wraps to the HyperEvm variant with no extractors.
crates/near-mpc-sdk/tests/polygon.rs Same as above for Polygon.

Findings

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

  • crates/node/src/providers/verify_foreign_tx/sign.rs:274 — heads-up that signing requests for HyperEvm/Polygon will hit the _ => bail!(\"unsupported foreign chain request\") arm at runtime, since the node binary has no inspector/config wiring for these chains. This is consistent with the PR title (feat(sdk): …), but it means a client built with this SDK can produce requests the node will reject — worth a follow-up issue (or noting in the PR description) to track the node-side support and config fields in crates/node-config/src/foreign_chains.rs.
  • crates/near-mpc-sdk/tests/hyper_evm.rs:8 and crates/near-mpc-sdk/tests/polygon.rs:8fn no_extractor_added() doesn't follow the <system_under_test>__should_<assertion> convention from docs/engineering-standards.md. Mirrors the existing bnb.rs/arbitrum.rs tests, so not introduced by this PR, but a good opportunity to convert if you're touching them.

✅ Approved

@DSharifi

DSharifi commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented May 6, 2026

Copy link
Copy Markdown

Pull request overview

Adds near_mpc_sdk builder modules and integration tests for two additional EVM-compatible foreign chains (HyperEvm and Polygon), mirroring the existing Bnb/Base/Arbitrum pattern. The corresponding ForeignChainRpcRequest::{HyperEvm,Polygon} variants already landed on main via #3149 (the inspector PR), so this is a pure SDK ergonomics addition — no contract or wire-format changes.

Changes:

  • New near_mpc_sdk::foreign_chain::hyper_evm and polygon modules: marker structs, EvmChainVariant impls, new_hyper_evm() / new_polygon() builder constructors, and one builder unit test each.
  • New tests/hyper_evm.rs and tests/polygon.rs integration tests asserting the built request wraps into the correct variant with no extractors.

Reviewed changes

Per-file summary
File Description
crates/near-mpc-sdk/src/foreign_chain.rs Registers the two new chain submodules.
crates/near-mpc-sdk/src/foreign_chain/hyper_evm.rs New HyperEvm variant marker, EvmChainVariant::wrap impl, new_hyper_evm() builder, and unit test asserting the variant wrap.
crates/near-mpc-sdk/src/foreign_chain/polygon.rs Same as above for Polygon.
crates/near-mpc-sdk/tests/hyper_evm.rs Integration test verifying the HyperEvm variant has empty extractors when none are configured.
crates/near-mpc-sdk/tests/polygon.rs Same as above for Polygon.

Findings

No blocking issues. The two heads-ups raised in the prior @claude review (node-side _ => bail!("unsupported foreign chain request") at crates/node/src/providers/verify_foreign_tx/sign.rs:274 for these new variants, and the no_extractor_added test naming not matching the <sut>__should_<assertion> convention) still stand but are non-blocking and consistent with the existing chain modules.

✅ Approved

@DSharifi DSharifi added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit f369d8e May 6, 2026
13 checks passed
@DSharifi DSharifi deleted the dsharifi/add-remaining-evm-to-sdk branch May 6, 2026 13:07
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.

HyperEvm foreign-chain request support in mpc-SDK Polygon foreign-chain request support in mpc-SDK

3 participants