Enforce issuer adjustment issuer reference#241
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ence-integrity' into codex/ocf-issuer-adjustment-reference-integrity
There was a problem hiding this comment.
Pull request overview
Adds cap-table mutation validation to ensure IssuerAuthorizedSharesAdjustment.issuer_id matches the cap table’s actual Issuer.issuer_data.id, preventing cross-issuer adjustments on both create and edit.
Changes:
- Adds
validateIssuerReferenceand threadsissuerCidthrough generated create/edit handlers so reference checks can fetch the current Issuer contract. - Enforces issuer-id reference validation for
IssuerAuthorizedSharesAdjustmenton create and edit via codegen templates. - Extends DAML tests to cover create-time and edit-time rejection on mismatched
issuer_id.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Test/daml/OpenCapTable/TestIssuerAuthorizedSharesAdjustment.daml | Adds helper constructor + negative tests for mismatched issuer_id on create/edit. |
| scripts/codegen/templates/loops/edit-case.daml | Adds generated edit-time issuer_id reference validation hook. |
| scripts/codegen/templates/loops/create-case.daml | Adds generated create-time issuer_id reference validation hook. |
| scripts/codegen/templates/CapTable.daml.template | Implements validateIssuerReference and passes issuerCid into create/edit processing. |
| scripts/codegen/generate-captable.ts | Adds a type flag to enable issuer-id validation for IssuerAuthorizedSharesAdjustment. |
| dars/OpenCapTable-v34/0.0.2/OpenCapTable-v34.dar | Updates built DAR artifact (Git LFS pointer). |
| dars/dars.lock | Updates DAR hash/size metadata to match rebuilt artifact. |
|
Superseded by #251, which consolidates the reference-integrity work into one PR. Before closing this stack PR, I rechecked the live review comments and folded the actionable improvements into #251: StockPlan create-tier ordering, document related-object error messages, stock-class conversion source IDs, warrant conversion validation across all OcfAnyConversionRight variants, WarrantIssuance same-batch vesting-term edits, and immutable DAR backup versioning. |
Summary
Stacked on #240.
This adds contract-level validation that
IssuerAuthorizedSharesAdjustment.issuer_idmatches the cap table's actualIssuer.id:IssuerAuthorizedSharesAdjustmentcreate/edit fetches the issuer and rejects mismatchedissuer_idvalues;OCF documentation
IssuerAuthorizedSharesAdjustmentincludes anissuer_idfield: https://github.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/blob/main/schema/objects/transactions/adjustment/IssuerAuthorizedSharesAdjustment.schema.json#L22-L28Issueris the cap-table company object: https://github.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/blob/main/schema/objects/Issuer.schema.json#L3-L6Tests
issuer_id.issuer_id.Validation
NODE_PATH=/Users/fairnick/Documents/code/fairmint/open-captable-protocol-daml/node_modules PATH="/Users/fairnick/Documents/code/fairmint/open-captable-protocol-daml/node_modules/.bin:$HOME/.dpm/bin:$PATH" npm run buildTest/:JAVA_HOME=/opt/homebrew/opt/openjdk@17 PATH="/opt/homebrew/opt/openjdk@17/bin:$HOME/.dpm/bin:$PATH" dpm test --show-coverage --color --coverage-ignore-choice 'splice-amulet:.*'Note
Medium Risk
Tightens cap-table integrity for issuer-scoped transactions; behavior change rejects previously accepted bad
issuer_iddata, with limited blast radius toIssuerAuthorizedSharesAdjustmentcreate/edit paths.Overview
Issuer authorized shares adjustments must now reference the cap table’s actual issuer: on create and edit,
UpdateCapTablefetches the issuer contract and rejectsissuer_idvalues that do not matchIssuer.id.Codegen wires this through by adding
validateIssuerReference, passing the issuerContractIdintoprocessCreate/processEdit, and calling validation forIssuerAuthorizedSharesAdjustmentonly. Creates run againstnewIssuerCidafter any issuer edit in the same batch, so validation stays aligned with the post-edit issuer.Tests add a shared fixture helper plus
submitMustFailcases for mismatchedissuer_idon create and edit. The packaged OpenCapTable-v34 DAR anddars.lockare updated to the rebuilt artifact.Reviewed by Cursor Bugbot for commit 68b6b25. Bugbot is set up for automated code reviews on this repo. Configure here.