docs: ADR for donation-resistant share pricing#10
Conversation
|
Warning Review limit reached
More reviews will be available in 14 minutes and 29 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds ADR 0001, documenting the decision to implement donation-resistant share pricing for the Fund. The ADR describes the ERC-4626 first-depositor inflation attack, evaluates three alternatives, recommends internal ChangesShare Pricing Design Decision
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@adrs/0001-donation-resistant-share-pricing.md`:
- Around line 80-83: Update the ADR to replace the optional phrasing about
rollouts with an explicit safety gate: state that if off-vault positions are
enabled then deposits and withdrawals must require an attested NAV (do not allow
vault-only total_assets) and otherwise off-vault deployment must remain behind a
feature flag; reference the terms total_assets (v0, vault-only), attested NAV,
deposits/withdraws, and off-vault positions in the same paragraph and add a
clear release condition sentence (e.g., “Release rule: off-vault = attested NAV
required; until attestation is implemented, off-vault must be feature-flag
disabled”) so the ADR enforces the hard gate rather than leaving it optional.
- Around line 61-74: Add a short "Pricing invariants and formulas" subsection
that states: (1) the share price MUST be computed solely from Fund.total_assets
and total_shares (or equivalent) and MUST NOT read vault.amount; (2) direct
transfers to the vault MUST NOT affect mint/mint_quote or burn/burn_quote
calculations; then provide the explicit mint/burn formulas (e.g., shares_to_mint
= floor(deposit_amount * total_shares / total_assets) or inverse for burns) and
specify initialization and rounding rules for the virtual offset constants
(initial virtual_offset_A, how it is added to total_assets for first-depositor
pricing, and the rounding direction for both minting and burning). Reference the
Fund struct, total_assets field, deposit and withdraw methods, vault.amount, and
the NAV-attestation reconciliation as the authoritative source for off-vault
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0abeb716-9ee8-40cf-aae1-f3164d5af165
📒 Files selected for processing (1)
adrs/0001-donation-resistant-share-pricing.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md
⚙️ CodeRabbit configuration file
Focus on the contents of the docs and not on cosmetic things like markdown formatting. We use markdown files for various docs including but not limited to the north star system specification, SPEC.md, the plan for how to get there, ROADMAP.md, guidelines for AI contributors, AGENTS.md, project overview and instructions for human contributors, README.md. Think about the target audience of a document when deciding what comment to leave. For specifications and designs, suggest potential product, architectural, and UI/UX improvements. For plans, suggest changes that would make things more parallelizable and deliverable-focused. For instructions, suggest better rules and guidelines and point out missing instructions. In all cases, flag needless bloat, prefer clear concise writing, and consider the structure of the document and order of the sections
Files:
adrs/0001-donation-resistant-share-pricing.md
7027d0b to
74eeac3
Compare
87665d6 to
fdcd8cc
Compare
427d382 to
0d1cf75
Compare
0d1cf75 to
b4688ff
Compare
Motivation
Auditing the deposit instruction surfaced a critical issue (#9): the share
price is read from
vault.amount, which anyone can inflate by transferringquote tokens directly into the vault — the ERC4626 first-depositor inflation
attack. The fix is a design decision (it couples with the eventual NAV /
off-vault AUM model), so it needs a recorded decision before any
implementation.
Solution
Add ADR 0001 laying out the options (virtual-offset, internal
total_assetsaccounting, dead-shares) with corrected attack-cost math, tradeoffs, and a
recommendation: internal accounting plus a virtual offset, which also seeds
the NAV model the fund needs anyway. The formula contract defines
total_sharesasshares_mint.supply(no redundant counter), mandateszero-output guards on both mint and burn, pins the donation-exclusion
invariant to the ADR 0002 tier model, requires the deposit capacity check to
migrate to
total_assets, and constrains the decimals offset against the u64supply ceiling.
The Release gate decides the sequencing: vault-only
total_assetsships now;off-vault inclusion is hard-gated on ADR 0002's redeemable-NAV model
(
redeemable_nav = verifiable_nav + floor(read_nav); Tier-3attested_navnever prices mints or burns). Only ADR 0002's owner-ratification items remain
open.
Refs #9
Closes #19
Summary by CodeRabbit