Skip to content

test(factory): fix deploy signature in tests and add Soroban unit tests#103

Merged
Miracle656 merged 1 commit intoMiracle656:mainfrom
Depo-dev:test/factory-contract-soroban-tests
Apr 25, 2026
Merged

test(factory): fix deploy signature in tests and add Soroban unit tests#103
Miracle656 merged 1 commit intoMiracle656:mainfrom
Depo-dev:test/factory-contract-soroban-tests

Conversation

@Depo-dev
Copy link
Copy Markdown
Contributor

Summary

The factory contract deploy function signature was updated to accept rp_id and origin (matching the real invisible_wallet.init), but the test module still called client.deploy with only the public key. This PR fixes that mismatch and adds two new test cases.

What was changed

  • mock-wallet/src/lib.rs: Updated init to accept rp_id: Bytes and origin: Bytes, matching the args the factory passes when it calls init on a freshly deployed wallet.
  • factory/src/lib.rs (tests): Every client.deploy and client.try_deploy call now passes (&pub_key, &rp_id, &origin). Added make_rp_id and make_origin helper functions for test setup.
  • New test — test_duplicate_deploy_prevented: Verifies the duplicate guard is keyed on SHA-256(public_key), not on the domain values; deploying the same key with a different rp_id/origin still returns AlreadyDeployed.
  • New test — test_deploy_full_integration: End-to-end check that the returned address is distinct from the factory, the public key is registered as a signer in the deployed wallet, and a repeat deploy is blocked.
  • Deleted stale test snapshots (regenerate automatically on next cargo test run).
  • Added rust-toolchain.toml pinning Rust 1.85.0.

Known limitation

cargo test is currently blocked by the stellar-xdr 20.1.0 / arbitrary crate incompatibility tracked in issue #79. The test code is logically correct and will pass once that upstream issue is resolved.

Closes #85

- Update mock-wallet init to accept rp_id and origin (matching factory's call)
- Fix all client.deploy/try_deploy calls to pass rp_id and origin
- Add make_rp_id and make_origin helpers to test module
- Add test_duplicate_deploy_prevented (same key, different domain blocked)
- Add test_deploy_full_integration (address distinct, signer registered, duplicate blocked)
- Delete stale snapshots (will regenerate on next cargo test run)
- Add rust-toolchain.toml pinning 1.85.0

Note: cargo test is temporarily blocked by the stellar-xdr/arbitrary
incompatibility tracked in issue Miracle656#79 on the upstream repo.

Closes Miracle656#85
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

@Depo-dev is attempting to deploy a commit to the miracle656's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@Depo-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Miracle656 Miracle656 merged commit 0301673 into Miracle656:main Apr 25, 2026
1 of 4 checks passed
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.

Add Soroban tests for factory contract

2 participants