Skip to content

test: multi-contract state isolation integration test (#169) - #308

Merged
N-thnI merged 4 commits into
Vero-protocol:mainfrom
IfyJustin91:wave-1/multi-contract-state-isolation
Aug 30, 2026
Merged

test: multi-contract state isolation integration test (#169)#308
N-thnI merged 4 commits into
Vero-protocol:mainfrom
IfyJustin91:wave-1/multi-contract-state-isolation

Conversation

@IfyJustin91

Copy link
Copy Markdown
Contributor

Summary

Adds tests/multi_contract_isolation.rs — an integration test that deploys two independent VeroContract instances in the same Soroban test environment and asserts that instance storage is fully isolated between them.

Tests added

Test What is verified
test_guardian_state_does_not_leak_between_instances Guardian registered in A is is_guardian=false and get_reputation=None in B; task in A is get_task=None in B
test_state_registered_in_b_does_not_appear_in_a Bidirectional mirror of the above
test_admin_state_is_isolated_per_instance Each instance stores its own admin independently
test_overlapping_task_ids_are_isolated_per_instance Same task ID and guardian address registered in both instances hold independent state
test_pause_state_is_isolated_per_instance Pausing instance A does not affect instance B's pause state

All five tests pass:

test test_guardian_state_does_not_leak_between_instances ... ok
test test_state_registered_in_b_does_not_appear_in_a ... ok
test test_admin_state_is_isolated_per_instance ... ok
test test_overlapping_task_ids_are_isolated_per_instance ... ok
test test_pause_state_is_isolated_per_instance ... ok

test result: ok. 5 passed; 0 failed; 0 ignored

Acceptance criteria

  • Test deploys two instances and asserts complete state isolation across guardians, tasks, and reputation

Closes #169

…col#169)

Deploy two VeroContract instances in the same test environment and assert
that instance storage is fully isolated across all state dimensions.

Five tests added to tests/multi_contract_isolation.rs:

- test_guardian_state_does_not_leak_between_instances: guardian added
  to instance A is invisible to instance B (is_guardian, get_reputation)
- test_state_registered_in_b_does_not_appear_in_a: bidirectional check
- test_admin_state_is_isolated_per_instance: each instance stores its
  own admin independently
- test_overlapping_task_ids_are_isolated_per_instance: same task ID and
  guardian address in both instances hold independent state
- test_pause_state_is_isolated_per_instance: pausing A does not affect B

All five tests pass (cargo test --test multi_contract_isolation).

Closes Vero-protocol#169
@N-i-xx

N-i-xx commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This needs a Closes #<issue-number> line in the description before it can merge — GrantFox links the payout to that reference. Which issue does this resolve? CI is green otherwise.

N-thnI and others added 3 commits August 26, 2026 10:42
deploy_instance was passing lock_threshold=0, which is rejected by
validate_lock_threshold (ContractError::InvalidAmount, Vero-protocol#19) since
commit 186c349 wired that validation into initialize().

Change all 10 call sites across the 5 test functions from 0 to 1,
the minimum positive value accepted by the protocol.

Fixes CI failure on PR Vero-protocol#308.
@N-thnI
N-thnI merged commit c09d717 into Vero-protocol:main Aug 30, 2026
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.

No multi-contract integration test verifying state isolation between two deployed instances

3 participants