Commit bd8eb37
Fix medium and low findings from contract review (#180)
## Summary
Addresses three findings from the contract review. All 68 tests pass.
- `ChildAccount.setRedeemed` previously used optional chaining
(`?.setRedeemed`) which silently did nothing if `OwnedAccount` was not
found at the expected storage path. This could leave
`OwnedAccount.parents` stale — the parent would be tracked as active in
the `Manager` but remain "pending" in the child forever. Now panics
explicitly with a descriptive message.
- `publishToParent` had a dead `if` branch checking whether the
delegator storage slot was empty immediately after an `assert` that
already guaranteed it was empty. Removed the redundant conditional — the
delegator is now created unconditionally (as it always was in practice).
- `CapabilityDelegator.addCapability` had no enforcement of the
documented invariant that a capability type should exist in at most one
partition (public or private). Added pre-conditions to reject additions
that would create a cross-partition type collision.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ce985d1 commit bd8eb37
2 files changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
| |||
868 | 870 | | |
869 | 871 | | |
870 | 872 | | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
| 873 | + | |
| 874 | + | |
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| |||
0 commit comments