Skip to content

Only allow creation of single denom vault#241

Closed
nullpointer0x00 wants to merge 2 commits into
mainfrom
nullpointer0x00/239-disallow-multi-denom-vault
Closed

Only allow creation of single denom vault#241
nullpointer0x00 wants to merge 2 commits into
mainfrom
nullpointer0x00/239-disallow-multi-denom-vault

Conversation

@nullpointer0x00

@nullpointer0x00 nullpointer0x00 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

closes: #239

Summary by CodeRabbit

  • New Features

    • Vault creation now enforces a single-denom configuration: the payment denom must be empty or match the underlying asset.
    • Initial payment NAV must be omitted when creating a vault.
    • Existing mixed-denom vaults remain unaffected.
  • Documentation

    • Updated API documentation and specifications to reflect the new vault creation rules.
    • Clarified pause event reason and error reporting semantics.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nullpointer0x00, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 reviews.

How do review 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 refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f9b3ab95-e64d-489f-9c6b-384aae15db87

📥 Commits

Reviewing files that changed from the base of the PR and between e722420 and cb6c265.

⛔ Files ignored due to path filters (1)
  • types/tx.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (2)
  • api/provlabs/vault/v1/tx.pulsar.go
  • proto/provlabs/vault/v1/tx.proto
📝 Walkthrough

Walkthrough

Vault creation now enforces a single payment denom matching the underlying asset and rejects initial_payment_nav. Keeper, specification, test, and simulation updates remove creation-time NAV seeding while preserving legacy mixed-denom fixture setup.

Changes

Single-denom vault creation

Layer / File(s) Summary
Creation validation and contracts
types/msgs.go, types/msgs_test.go, keeper/vault.go, keeper/vault_test.go, proto/..., api/..., spec/..., .changelog/...
Creation rejects differing payment denoms and non-empty initial payment NAV; specifications, generated comments, and tests reflect the new rules.
Keeper creation and legacy fixture setup
keeper/vault.go, keeper/suite_test.go, keeper/query_server_test.go, keeper/reconcile_test.go
Keeper creation removes initial NAV seeding, while test helpers create mixed-denom legacy state after vault creation.
Simulation creation and legacy scenarios
simulation/*.go, simulation/*_test.go
Simulation creation uses empty or underlying payment denoms, and legacy scenarios use post-creation mixed-denom setup.

Pause event documentation

Layer / File(s) Summary
Pause event field comments
api/provlabs/vault/v1/events.pulsar.go
Comments distinguish manual and automated pause reasons and clarify when forced_error is populated.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MsgCreateVaultRequest
  participant KeeperCreateVault
  participant VaultState
  Client->>MsgCreateVaultRequest: submit vault creation
  MsgCreateVaultRequest->>KeeperCreateVault: validate single-denom request
  KeeperCreateVault->>VaultState: persist vault without creation NAV seed
Loading

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: iramiller, Taztingo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: restricting vault creation to a single denom.
Linked Issues check ✅ Passed The PR enforces single-denom vault creation, rejects differing payment denoms, invalidates initial_payment_nav, and preserves existing mixed-denom vaults.
Out of Scope Changes check ✅ Passed The changes shown are all tied to the vault-creation restriction and its tests, docs, simulations, or helpers; no unrelated code is evident.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nullpointer0x00/239-disallow-multi-denom-vault

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR limits new vault creation to a single denom. The main changes are:

  • Reject create requests when payment_denom differs from underlying_asset.
  • Reject initial_payment_nav on new vault creation.
  • Keep existing mixed-denom vault behavior outside the creation path.
  • Update generated proto/API files, simulations, tests, specs, and changelog text.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
keeper/vault.go Adds keeper-level checks for single-denom vault creation and removes initial payment NAV seeding.
types/msgs.go Updates create-vault stateless validation to reject mixed-denom creation and any initial payment NAV.
proto/provlabs/vault/v1/tx.proto Marks the old payment-denom and initial-payment-NAV request fields as deprecated while preserving their field numbers.
simulation/operations.go Updates simulated vault creation to use only empty payment denom or payment equal to the underlying asset.
simulation/vault.go Removes simulation helper seeding for initial payment NAV on newly created vaults.

Reviews (2): Last reviewed commit: "add deprecated docs to protos" | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@api/provlabs/vault/v1/events.pulsar.go`:
- Around line 25902-25918: The documentation for the pause event fields was
edited in generated `events.pulsar.go` output and will be overwritten. Move the
comments for `Reason`, `TotalVaultValue`, `Forced`, and `ForcedError` to their
corresponding fields in the protobuf source, then run `make proto-all` to
regenerate the API code.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 875c1018-321c-414c-9725-dd0aba783a4d

📥 Commits

Reviewing files that changed from the base of the PR and between a41548a and e722420.

⛔ Files ignored due to path filters (2)
  • types/events.pb.go is excluded by !**/*.pb.go
  • types/tx.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (19)
  • .changelog/unreleased/improvements/239-disallow-multi-denom-vault.md
  • api/provlabs/vault/v1/events.pulsar.go
  • api/provlabs/vault/v1/tx.pulsar.go
  • keeper/query_server_test.go
  • keeper/reconcile_test.go
  • keeper/suite_test.go
  • keeper/vault.go
  • keeper/vault_test.go
  • proto/provlabs/vault/v1/tx.proto
  • simulation/estimate_accuracy_test.go
  • simulation/operations.go
  • simulation/operations_test.go
  • simulation/setup.go
  • simulation/vault.go
  • spec/01_concepts.md
  • spec/02_state.md
  • spec/03_messages.md
  • types/msgs.go
  • types/msgs_test.go
💤 Files with no reviewable changes (1)
  • simulation/vault.go

Comment on lines +25902 to 25918
// reason is the reason for pausing the vault. For a manual pause (PauseVault
// tx) this is the user-supplied reason. For an automated auto-pause triggered
// in the begin/end blocker, this carries the hard-coded reason describing the
// critical error that forced the pause.
Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
// total_vault_value is the total value of the vault's assets at the time of pausing.
TotalVaultValue string `protobuf:"bytes,4,opt,name=total_vault_value,json=totalVaultValue,proto3" json:"total_vault_value,omitempty"`
// forced indicates the pause used the force path, waiving the strict
// reconcile/valuation gate. False for a normal strict pause; true for a
// forced manual pause and for automated auto-pauses.
Forced bool `protobuf:"varint,5,opt,name=forced,proto3" json:"forced,omitempty"`
// forced_error records the reconcile and/or valuation error that was
// tolerated when forced is true. Empty when nothing failed. When non-empty,
// total_vault_value may be stale or zero.
// forced_error records the reconcile and/or valuation error tolerated by a
// manual force pause (PauseVault tx). Empty when nothing failed. When
// non-empty, total_vault_value may be stale or zero. Only the tx path sets
// this; automated auto-pauses leave it empty and instead encode their error
// in reason.
ForcedError string `protobuf:"bytes,6,opt,name=forced_error,json=forcedError,proto3" json:"forced_error,omitempty"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Update the protobuf source instead of editing generated API code.

These comments are modified directly in api/provlabs/vault/v1/events.pulsar.go, so the next make proto-all may overwrite them. Move the documentation to the corresponding .proto fields, then regenerate the API output.

🤖 Prompt for 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.

In `@api/provlabs/vault/v1/events.pulsar.go` around lines 25902 - 25918, The
documentation for the pause event fields was edited in generated
`events.pulsar.go` output and will be overwritten. Move the comments for
`Reason`, `TotalVaultValue`, `Forced`, and `ForcedError` to their corresponding
fields in the protobuf source, then run `make proto-all` to regenerate the API
code.

Source: Coding guidelines

@nullpointer0x00 nullpointer0x00 marked this pull request as draft July 13, 2026 15:50
@nullpointer0x00

Copy link
Copy Markdown
Collaborator Author

We are just removing multi-denom completely now with PR #243

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.

Disallow vault creation with mixed underlying and payment denoms

1 participant