add support for RHP4 pools#959
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR adds persistence and contract-manager support for RHP4 “account pools”, including the ability to credit pools via v2 contract revisions, attach/detach pools to accounts, and debit an account by draining attached pools in deterministic attachment order.
Changes:
- Add SQLite schema + store methods for RHP4 pools, pool funding sources per v2 contract, and account↔pool attachments.
- Update
RHP4DebitAccountto fall through to attached pool balances (and distribute spending back to the funding v2 contracts). - Add unit + integration test coverage for pool crediting, attach/detach idempotency, drainage behavior, and funding distribution.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| persist/sqlite/pools.go | Implements pool balance queries, crediting pools with v2 contract funding tracking, attach/detach, and pool usage distribution. |
| persist/sqlite/pools_test.go | Adds unit tests covering pool balances, attach/detach behavior, drainage ordering, and funding distribution across contracts. |
| persist/sqlite/accounts.go | Extends RHP4DebitAccount to drain attached pools and adds shared helpers for deterministic usage splitting. |
| persist/sqlite/accounts_test.go | Reuses shared v2 contract test helpers (no longer duplicates contract creation). |
| persist/sqlite/migrations.go | Adds migration v50 creating pool-related tables and indices. |
| persist/sqlite/init.sql | Adds pool-related tables and indices to the baseline schema. |
| host/contracts/pools.go | Exposes pool operations via the contracts manager. |
| host/contracts/persist.go | Extends the contracts store interface to include pool operations. |
| internal/integration/rhp/v4/rhp4_test.go | Adds integration coverage for replenishing pools, attach/detach, and draining behavior over RHP4 RPCs. |
| go.mod / go.sum | Bumps go.sia.tech/core and coreutils to versions that support the new RHP4 pool RPCs/types. |
| .changeset/add_support_for_rhp4_account_pools.md | Adds a minor changeset documenting the feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
28c6d96 to
322172e
Compare
322172e to
420a705
Compare
420a705 to
15424c1
Compare
There was a problem hiding this comment.
Courtesy of AI but there may be issues with this
hostd/persist/sqlite/consensus.go
Line 1968 in 9ac4703
Edit: I think this is what PJ was referring to above
No description provided.