Skip to content

add support for RHP4 pools#959

Merged
ChrisSchinnerl merged 5 commits into
masterfrom
nate/implement-pools
May 15, 2026
Merged

add support for RHP4 pools#959
ChrisSchinnerl merged 5 commits into
masterfrom
nate/implement-pools

Conversation

@n8mgr
Copy link
Copy Markdown
Member

@n8mgr n8mgr commented May 10, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 10, 2026 20:32
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

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.

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 10, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgo.sia.tech/​coreutils@​v0.21.3 ⏵ v0.22.098 +1100100100100

View full report

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 RHP4DebitAccount to 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.

Comment thread persist/sqlite/pools.go Outdated
Comment thread persist/sqlite/accounts.go Outdated
@n8mgr n8mgr force-pushed the nate/implement-pools branch 2 times, most recently from 28c6d96 to 322172e Compare May 10, 2026 21:52
@n8mgr n8mgr force-pushed the nate/implement-pools branch from 322172e to 420a705 Compare May 11, 2026 13:18
ChrisSchinnerl
ChrisSchinnerl previously approved these changes May 12, 2026
Comment thread persist/sqlite/pools.go
@n8mgr n8mgr moved this from In Progress to In Review in Sia May 12, 2026
Comment thread persist/sqlite/accounts.go Outdated
Comment thread persist/sqlite/init.sql
Comment thread persist/sqlite/init.sql
Comment thread persist/sqlite/init.sql
Comment thread persist/sqlite/consensus.go
@github-project-automation github-project-automation Bot moved this from In Review to In Progress in Sia May 13, 2026
Copy link
Copy Markdown
Member

@chris124567 chris124567 left a comment

Choose a reason for hiding this comment

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

Courtesy of AI but there may be issues with this

if _, err := deleteAccountStmt.Exec(source.accountDBID); err != nil {
if the account is still referenced in rhp4_account_pool_attachments

Edit: I think this is what PJ was referring to above

@n8mgr n8mgr requested review from chris124567 and peterjan May 14, 2026 16:23
@ChrisSchinnerl ChrisSchinnerl merged commit dfddf82 into master May 15, 2026
13 of 20 checks passed
@ChrisSchinnerl ChrisSchinnerl deleted the nate/implement-pools branch May 15, 2026 08:31
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sia May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants