feat: accept foreign tx validation requests on contract#3106
Conversation
Code ReviewMinor issue found:
Otherwise the change is straightforward — adding an ✅ Approved (with nit above) |
| #[case::starknet(starknet_request(), starknet_extracted_values())] | ||
| #[case::bnb(bnb_evm_request(), evm_block_hash_extracted_values())] | ||
| #[case::base(base_evm_request(), evm_block_hash_extracted_values())] | ||
| #[case::arbitrum(arbitrum_evm_request(), evm_block_hash_extracted_values())] | ||
| #[tokio::test] | ||
| async fn verify_foreign_transaction__should_succeed( |
There was a problem hiding this comment.
side comment: I wonder if we need to test each chain separately here. These tests are unfortunately getting a noticeable time inside the sandbox tests (just my experience running them locally sometimes). If the behavior in the contract is actually the same for all chains, maybe we could just test one, or use some mechanism (trait?) to ensure that testing one is enough
There was a problem hiding this comment.
I wouldn't want to lose test coverage. But we could instead collapse them all to one test case, and run requests against all of them in one test similar to what @anodar did with the e2e tests
mpc/crates/e2e-tests/tests/foreign_chain_tx_validation.rs
Lines 369 to 389 in 9c8acca
There was a problem hiding this comment.
yeah that would also fix the problem indeed
There was a problem hiding this comment.
Pull request overview
Adds Arbitrum support to the NEAR MPC contract “foreign tx validation request” surface by extending the contract interface DTOs and updating sandbox/ABI tests accordingly (closes #2801).
Changes:
- Extend
ForeignChainRpcRequestwith a newArbitrum(EvmRpcRequest)variant and map it toForeignChain::Arbitrum. - Update the ABI snapshot to reflect the new request variant shape.
- Add Arbitrum coverage to sandbox tests (including a new
arbitrum_evm_request()helper) and to the DTO unit test cases.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/near-mpc-contract-interface/src/types/foreign_chain.rs | Adds Arbitrum to ForeignChainRpcRequest and updates chain() + tests. |
| crates/contract/tests/snapshots/abi__abi_has_not_changed.snap | Updates ABI snapshot to include the new Arbitrum request variant schema. |
| crates/contract/tests/sandbox/foreign_chain_request.rs | Expands sandbox foreign-tx request tests to include an Arbitrum case. |
| crates/contract/tests/sandbox/common.rs | Adds arbitrum_evm_request() test helper for Arbitrum requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
closes #2801