Skip to content

feat: add will finalization, witness verification, and update restrictions#358

Merged
ONEONUORA merged 2 commits intoFracverse:masterfrom
dinahmaccodes:issue-complex
Mar 27, 2026
Merged

feat: add will finalization, witness verification, and update restrictions#358
ONEONUORA merged 2 commits intoFracverse:masterfrom
dinahmaccodes:issue-complex

Conversation

@dinahmaccodes
Copy link
Copy Markdown
Contributor

Description

Will Finalization, Witness Verification & Update Restrictions

Closes #319
Closes #320
Closes #321

This PR implements the final layer of legal enforceability for wills in the InheritX inheritance contract — finalization locking, witness attestation, and immutability enforcement.

What's changed

finalize_will(owner, vault_id, version) permanently locks a will version. It requires the owner to have signed the will and all assigned witnesses to have signed before finalization is allowed. Once finalized, the version is immutable and no new versions can be created. A WillFinalized event is emitted on success.

add_witness lets the plan owner assign one or more third-party witness addresses to a vault. sign_as_witness allows each registered witness to attest to the will using their wallet. Both actions emit events (WitnessAdded, WitnessSigned). Duplicate witness registration and double-signing are rejected.

create_will_version now checks whether the currently active version is finalized before allowing a new version to be created, enforcing the update restriction from issue #321.

New query functions: is_will_finalized, get_will_finalized_at, get_witnesses, get_witness_signature.

Error codes WillAlreadyFinalized = 49 and WillNotVerified = 50 replace the previous SignatureAlreadyUsed and InvalidSignature to stay within Soroban's 50-variant XDR limit for #[contracterror] enums.

24 new tests cover all happy paths, failure cases, event emissions, and edge cases across all three issues.

Checklist

  • finalize_will only callable after owner signature is present
  • Finalization fails if any assigned witness has not signed
  • Finalized will version cannot be modified
  • New version creation blocked when active version is finalized
  • Finalization timestamp recorded correctly
  • Event emitted: WillFinalized(vault_id, version)
  • Witnesses assignable by plan owner only
  • Witness signatures stored and verifiable on-chain
  • Duplicate witness and double-sign rejected
  • Event emitted: WitnessSigned(vault_id, witness)
  • All 154 tests pass (130 existing + 24 new)

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@dinahmaccodes 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

@dinahmaccodes
Copy link
Copy Markdown
Contributor Author

@ONEONUORA
Please review|
CI Is all passing

@ONEONUORA
Copy link
Copy Markdown
Contributor

@dinahmaccodes Pls fix conflict

@dinahmaccodes
Copy link
Copy Markdown
Contributor Author

Fixed Conflicts @ONEONUORA

Copy link
Copy Markdown
Contributor

@ONEONUORA ONEONUORA left a comment

Choose a reason for hiding this comment

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

Great job @dinahmaccodes

@ONEONUORA ONEONUORA merged commit df5033b into Fracverse:master Mar 27, 2026
2 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.

[Soroban] Legal Witness Verification [Soroban] Will Update Restrictions [Soroban] Will Finalization Function

2 participants