-
Notifications
You must be signed in to change notification settings - Fork 6
feat(database): support getting inactive items #1090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe PR adds an includeInactive bool parameter to metadata getters (GetAccount, GetPool, GetDrep) across Database and MetadataStore layers and updates all call sites to pass that flag. SQLite metadata implementations use the flag to conditionally filter out inactive records (accounts, pools with retirement/AddedSlot logic, drep lookup). GetDrep’s signature and return semantics change to return models.Drep (value) and the new package-level error ErrDrepNotFound is introduced. Benchmarks and internal callers are updated to pass false to preserve prior behavior. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
database/plugin/metadata/sqlite/drep.go (1)
24-28: Consider adding documentation for the includeInactive parameter.The function comment is minimal. Consider expanding it to explain the purpose of
includeInactive:// GetDrep retrieves a DRep by credential. // If includeInactive is false, only active DReps are returned. // If includeInactive is true, both active and inactive DReps are returned.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
database/account.go(1 hunks)database/drep.go(1 hunks)database/models/drep.go(1 hunks)database/plugin/metadata/sqlite/account.go(1 hunks)database/plugin/metadata/sqlite/drep.go(1 hunks)database/plugin/metadata/sqlite/pool.go(3 hunks)database/plugin/metadata/sqlite/transaction.go(7 hunks)database/plugin/metadata/store.go(3 hunks)database/pool.go(1 hunks)ledger/benchmark_test.go(6 hunks)ledger/view.go(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-24T21:56:15.978Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 975
File: database/models/transaction.go:21-26
Timestamp: 2025-10-24T21:56:15.978Z
Learning: In database/models/transaction.go, the Transaction struct uses a dual foreign-key pattern for UTXO associations: Outputs []Utxo uses TransactionID→ID (where UTXOs were created), and Inputs []Utxo uses SpentAtTxId→Hash (where UTXOs were consumed). Explicit GORM tags `gorm:"foreignKey:SpentAtTxId;references:Hash"` for Inputs and `gorm:"foreignKey:TransactionID;references:ID"` for Outputs prevent association conflicts and preserve UTXO provenance.
Applied to files:
database/plugin/metadata/sqlite/transaction.go
📚 Learning: 2025-10-22T21:29:26.924Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 971
File: ledger/state_test.go:248-248
Timestamp: 2025-10-22T21:29:26.924Z
Learning: For tests under ledger/, prefer constructing a minimal ledger Block (MockBlock mirroring chain/chain_test.go) and pass it to Chain.AddBlock, rather than using database/models.Block or relying on models.Block.Decode().
Applied to files:
ledger/benchmark_test.go
📚 Learning: 2025-10-22T20:19:26.360Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 971
File: utxorpc/sync_test.go:91-91
Timestamp: 2025-10-22T20:19:26.360Z
Learning: In utxorpc/sync_test.go, tests should not construct database/models.Block directly for sync server use. Instead, build a models.Block only as a container for CBOR and call models.Block.Decode() to obtain a github.com/blinklabs-io/gouroboros/ledger/common.Block (or the repository’s ledger.Block interface), and use that decoded value in the test.
Applied to files:
ledger/benchmark_test.go
📚 Learning: 2025-10-22T21:28:48.396Z
Learnt from: wolf31o2
Repo: blinklabs-io/dingo PR: 971
File: utxorpc/sync_test.go:339-339
Timestamp: 2025-10-22T21:28:48.396Z
Learning: In utxorpc/sync_test.go, tests must not pass database/models.Block into chain.Chain.AddBlock. They should call models.Block.Decode() and pass the resulting github.com/blinklabs-io/gouroboros/ledger/common.Block to AddBlock.
Applied to files:
ledger/benchmark_test.go
🧬 Code graph analysis (6)
database/plugin/metadata/sqlite/account.go (1)
database/models/account.go (1)
Account(27-35)
database/plugin/metadata/sqlite/drep.go (1)
database/models/drep.go (1)
Drep(25-33)
database/drep.go (2)
database/txn.go (1)
Txn(27-34)database/models/drep.go (1)
Drep(25-33)
database/pool.go (1)
database/models/pool.go (1)
Pool(26-38)
database/plugin/metadata/sqlite/pool.go (1)
database/models/account.go (2)
Registration(72-78)Registration(80-82)
database/account.go (3)
database/txn.go (1)
Txn(27-34)database/models/account.go (1)
Account(27-35)database/models/transaction.go (2)
Transaction(20-39)Transaction(41-43)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: go-test (1.25.x, windows-latest)
- GitHub Check: go-test (1.24.x, ubuntu-latest)
- GitHub Check: go-test (1.24.x, windows-latest)
- GitHub Check: go-test (1.24.x, macos-latest)
- GitHub Check: go-test (1.25.x, macos-latest)
- GitHub Check: lint
- GitHub Check: nilaway
- GitHub Check: Analyze (go)
🔇 Additional comments (13)
database/models/drep.go (1)
17-23: LGTM!The addition of
ErrDrepNotFoundfollows Go conventions for sentinel errors and is consistent with the existing error patterns in the codebase (e.g.,ErrAccountNotFound,ErrPoolNotFound).database/plugin/metadata/sqlite/account.go (1)
26-47: LGTM!The conditional filtering logic is correct: when
includeInactiveisfalse, the query filters foractive = true, restricting results to active accounts only. The implementation is clean and consistent with similar patterns in the codebase.database/plugin/metadata/sqlite/pool.go (2)
40-43: Good addition of Retirement preload.The new
Retirementpreload is necessary for the post-query filtering logic that determines pool activity status.
55-62: Pool activity filtering logic is correct.The filtering logic properly implements Cardano pool activity semantics. A pool is correctly treated as inactive when:
- No registration exists, or
- The most recent retirement's
AddedSlotexceeds the most recent registration'sAddedSlotComparing
AddedSlotvalues (block slot numbers) accurately determines certificate recency. All production callers useincludeInactive=false, confirming this behavior aligns with expected usage.database/plugin/metadata/sqlite/transaction.go (3)
106-106: LGTM!The
includeInactiveparameter is correctly set tofalse, ensuring certificate processing only operates on active accounts. This maintains existing behavior.
526-526: LGTM!Both
GetPoolcalls correctly passfalseforincludeInactive, ensuring only active pools are considered during certificate processing. This maintains existing behavior.Also applies to: 626-626
654-654: LGTM!Both
GetAccountcalls correctly passfalseforincludeInactive, maintaining the existing behavior of only operating on active accounts during deregistration certificate processing.Also applies to: 689-689
ledger/view.go (1)
84-84: LGTM!Passing
falseforincludeInactiveis correct forPoolCurrentState, which specifically retrieves the current active pool registration certificate, as documented in the function comment on line 79-80.database/pool.go (1)
23-40: LGTM!The implementation correctly:
- Adds the
includeInactiveparameter to control filtering behavior- Forwards it to the metadata layer
- Returns
models.ErrPoolNotFoundwhen the pool is not foundThis provides a consistent error handling pattern for pool lookups.
database/account.go (1)
22-43: LGTM!The implementation correctly adds the
includeInactiveparameter and forwards it to the metadata layer. The nil check properly returnsmodels.ErrAccountNotFoundwhen the account is not found, providing consistent error handling.database/plugin/metadata/store.go (1)
46-74: LGTM! Interface changes are consistent.The three getter methods (GetPool, GetAccount, GetDrep) have been consistently updated with the
includeInactiveboolean parameter. The inline comments provide helpful clarity about the parameter's purpose.ledger/benchmark_test.go (1)
520-520: LGTM! Benchmark call sites properly updated.All six benchmark functions have been correctly updated to pass
falsefor the newincludeInactiveparameter, maintaining the existing behavior of excluding inactive items. The changes are consistent across:
BenchmarkAccountLookupByStakeKeyNoDataandBenchmarkAccountLookupByStakeKeyRealDataBenchmarkPoolLookupByKeyHashNoDataandBenchmarkPoolLookupByKeyHashRealDataBenchmarkDRepLookupByKeyHashNoDataandBenchmarkDRepLookupByKeyHashRealDataAlso applies to: 594-594, 624-624, 698-698, 728-728, 803-803
database/plugin/metadata/sqlite/drep.go (1)
31-38: Query building logic is correct, and all call sites have been updated.The implementation properly handles the
includeInactiveparameter and transaction context. The active filter is correctly applied whenincludeInactiveis false. AllGetDrep()call sites (benchmark tests and the database wrapper) have been updated with the new parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 11 files
c2ef475 to
c6b00d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ledger/benchmark_test.go (1)
518-523: Benchmarks correctly updated to pass includeInactive=falseAll benchmark call sites now supply the new
includeInactiveflag asfalseforGetAccount,GetPool, andGetDrep, which preserves the prior “active-only” behavior while matching the updated APIs. If you ever want to measure worst-case query performance over inactive history, you could add separate benchmarks withincludeInactive = true, but it’s not required for this PR.Also applies to: 592-597, 622-627, 696-701, 727-731, 801-805
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
database/account.go(1 hunks)database/drep.go(1 hunks)database/models/drep.go(1 hunks)database/plugin/metadata/sqlite/account.go(1 hunks)database/plugin/metadata/sqlite/drep.go(2 hunks)database/plugin/metadata/sqlite/pool.go(3 hunks)database/plugin/metadata/sqlite/transaction.go(7 hunks)database/plugin/metadata/store.go(3 hunks)database/pool.go(1 hunks)ledger/benchmark_test.go(6 hunks)ledger/view.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- database/pool.go
- database/account.go
- database/plugin/metadata/sqlite/pool.go
- ledger/view.go
🧰 Additional context used
🧬 Code graph analysis (4)
database/plugin/metadata/sqlite/account.go (1)
database/models/account.go (1)
Account(27-35)
database/drep.go (1)
database/models/drep.go (2)
Drep(25-33)ErrDrepNotFound(23-23)
database/plugin/metadata/store.go (1)
database/models/drep.go (1)
Drep(25-33)
database/plugin/metadata/sqlite/drep.go (1)
database/models/drep.go (1)
Drep(25-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: nilaway
- GitHub Check: go-test (1.25.x, macos-latest)
- GitHub Check: go-test (1.25.x, windows-latest)
- GitHub Check: go-test (1.24.x, macos-latest)
- GitHub Check: go-test (1.24.x, windows-latest)
- GitHub Check: Analyze (go)
🔇 Additional comments (7)
database/models/drep.go (1)
17-23: ErrDrepNotFound definition looks goodExplicit
ErrDrepNotFoundplus the newerrorsimport is straightforward and consistent with typical model-level not-found errors. No issues here.database/drep.go (1)
17-39: GetDrep wiring and not-found handling are consistentThe new
GetDrepmethod correctly mirrors the existing Database patterns: it owns transaction lifecycle whentxnis nil, delegates tometadata.GetDrep, and normalizes a nil result tomodels.ErrDrepNotFound. That gives a clean, consistent API surface.database/plugin/metadata/sqlite/account.go (1)
28-39: includeInactive flag handling in GetAccount is soundConditionally scoping the query with
WHERE active = truewhenincludeInactiveis false cleanly preserves the existing “active-only” behavior while allowing future callers to opt into inactive records. The not-found behavior (returningnil, nil) remains consistent.database/plugin/metadata/sqlite/drep.go (1)
18-45: SQLite GetDrep correctly implements includeInactive and not-found semanticsUsing a shared
queryrooted attxn(ord.DB()when nil) plus the conditionalactive = truefilter mirrors the account getter and cleanly supports active-only vs. all-DRep lookups. Returning(nil, nil)ongorm.ErrRecordNotFoundis appropriate given that the Database layer normalizes this tomodels.ErrDrepNotFound.database/plugin/metadata/sqlite/transaction.go (2)
101-118: Confirm intended semantics of using includeInactive=false for internal account/pool lookupsAll internal call sites now pass
includeInactive = falsewhen fetching accounts and pools (get-or-create path and deregistration/retirement paths). This means:
- Certificate handling only “sees” currently-active rows; previously, inactive rows would also have been returned by these getters.
- For already-deregistered/retired entities, subsequent certs will behave as if there is no current record and will rely on upsert behavior to reconcile state.
Given ledger rules, you shouldn’t get repeated deregistrations/retirements for the same key without reactivation in between, so this is probably safe, but it is a behavioral change. Please sanity-check this against your expected Cardano invariants and any historical data quirks.
Also applies to: 524-527, 626-627, 653-656, 688-691
210-213: Formatting-only changes around upsert error and Redeemer ExUnitsThe rewrapped
fmt.Errorf("failed to fetch transaction ID after upsert: %w", err)block and the multi-lineExUnitsMemory/ExUnitsCPUinitializers keep the same logic and just improve readability. No behavioral impact.Also applies to: 488-493
database/plugin/metadata/store.go (1)
47-51: AllMetadataStoreimplementations have been updated correctly. The SQLite plugin now matches the interface signatures:GetPool(lcommon.PoolKeyHash, bool, *gorm.DB),GetAccount([]byte, bool, *gorm.DB), andGetDrep([]byte, bool, *gorm.DB)all with proper return types andincludeInactiveflag usage.
c6b00d0 to
00dc365
Compare
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
00dc365 to
c61387b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
database/plugin/metadata/sqlite/account.go (1)
51-61:activeparameter in SetAccount is unused and may desync the Active flag
SetAccountaccepts anactive boolbut never assigns it tomodels.Account.Active, so callers cannot actually control the stored Active state via this API, even thoughGetAccountnow filters onactive. This is likely to cause confusing or incorrect behavior around active/inactive accounts.Consider wiring the parameter through:
tmpItem := models.Account{ - StakingKey: stakeKey, - AddedSlot: slot, - Pool: pkh, - Drep: drep, + StakingKey: stakeKey, + AddedSlot: slot, + Pool: pkh, + Drep: drep, + Active: active, }and verifying that any callers pass the intended value.
♻️ Duplicate comments (1)
database/drep.go (1)
21-35: GetDrep semantics are inconsistent with GetPool/GetAccount and don’t use ErrDrepNotFoundRight now
GetDrep:
- Returns a value (
models.Drep) instead of*models.Drep, unlikeGetPool/GetAccount.- Simply propagates the metadata error and never maps a not‑found condition to
models.ErrDrepNotFound.This makes the DRep path behave differently from the others and leaves the new sentinel error effectively unused. I’d recommend either:
- Aligning with the existing patterns:
-func (d *Database) GetDrep( - cred []byte, - includeInactive bool, - txn *Txn, -) (models.Drep, error) { +func (d *Database) GetDrep( + cred []byte, + includeInactive bool, + txn *Txn, +) (*models.Drep, error) { if txn == nil { txn = d.Transaction(false) defer txn.Commit() //nolint:errcheck } - ret, err := d.metadata.GetDrep(cred, includeInactive, txn.Metadata()) - if err != nil { - return models.Drep{}, err - } - return ret, nil + ret, err := d.metadata.GetDrep(cred, includeInactive, txn.Metadata()) + if err != nil { + return nil, err + } + if ret == nil { + return nil, models.ErrDrepNotFound + } + return ret, nil }…with the corresponding pointer return in the
MetadataStoreand sqlite implementation; or
- If you prefer value semantics, at least normalize not‑found errors (e.g., wrap
gorm.ErrRecordNotFoundasmodels.ErrDrepNotFound) so callers don’t need to reach into storage‑specific errors.
🧹 Nitpick comments (3)
database/models/drep.go (1)
17-23: Sentinel error looks good; consider wiring it into lookup pathsDefining
ErrDrepNotFoundas a package‑level sentinel is idiomatic and fine. As a follow‑up, ensure your DRep retrieval code (sqlite +Database.GetDrep) actually maps “not found” conditions to this error so callers can rely on a stable domain error instead ofgorm.ErrRecordNotFound.database/plugin/metadata/sqlite/drep.go (1)
29-42: IncludeInactive logic is correct; consider simplifying and mapping not‑found to ErrDrepNotFoundThe
includeInactivefiltering and transaction handling look good. Two small improvements you might consider:
- You don’t need both
retandtmpDrep; a single variable is enough:-func (d *MetadataStoreSqlite) GetDrep( - cred []byte, - includeInactive bool, - txn *gorm.DB, -) (models.Drep, error) { - ret := models.Drep{} - tmpDrep := models.Drep{} +func (d *MetadataStoreSqlite) GetDrep( + cred []byte, + includeInactive bool, + txn *gorm.DB, +) (models.Drep, error) { + var drep models.Drep @@ - if result := query.First(&tmpDrep, "credential = ?", cred); result.Error != nil { - return ret, result.Error - } - ret = tmpDrep - return ret, nil + if result := query.First(&drep, "credential = ?", cred); result.Error != nil { + return models.Drep{}, result.Error + } + return drep, nil }
- Given
models.ErrDrepNotFoundnow exists, you may also want to translategorm.ErrRecordNotFoundinto that sentinel here so higher layers don’t depend on gorm’s error type.database/plugin/metadata/sqlite/transaction.go (1)
102-118: Verify that always passingincludeInactive=falsematches desired certificate semanticsAll internal metadata lookups here now explicitly use
includeInactive=false:
getOrCreateAccount→GetAccount(stakeKey, false, txn)- Pool registration and retirement certificates →
GetPool(..., false, txn)- Stake deregistration and generic deregistration certificates →
GetAccount(stakeKey, false, txn)This keeps behavior “active-only”, but it also means:
- Previously inactive accounts/pools are treated as “not found” by these helpers, even if a row exists.
- In the pool retirement and (re-)registration paths, any state stored on an inactive row won’t be loaded and will instead be rebuilt from scratch or treated as missing.
Please double-check that for re-registration, multiple deregistrations, and retiring already-retired pools, this “ignore inactive rows” behavior is what you want, especially now that
Activeis part of your model and Get* APIs.Also applies to: 629-630, 735-736, 767-768, 805-806
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
database/account.go(1 hunks)database/drep.go(1 hunks)database/models/drep.go(1 hunks)database/plugin/metadata/sqlite/account.go(1 hunks)database/plugin/metadata/sqlite/drep.go(1 hunks)database/plugin/metadata/sqlite/pool.go(3 hunks)database/plugin/metadata/sqlite/transaction.go(6 hunks)database/plugin/metadata/store.go(3 hunks)database/pool.go(1 hunks)ledger/benchmark_test.go(6 hunks)ledger/view.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
database/plugin/metadata/sqlite/pool.go (1)
database/models/account.go (2)
Registration(72-78)Registration(80-82)
database/plugin/metadata/sqlite/account.go (1)
database/models/account.go (1)
Account(27-35)
database/drep.go (3)
database/database.go (1)
Database(44-49)database/txn.go (1)
Txn(27-34)database/models/drep.go (1)
Drep(25-33)
database/account.go (1)
database/models/account.go (1)
Account(27-35)
database/plugin/metadata/sqlite/drep.go (1)
database/models/drep.go (1)
Drep(25-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Analyze (go)
- GitHub Check: lint
- GitHub Check: go-test (1.25.x, windows-latest)
- GitHub Check: nilaway
- GitHub Check: go-test (1.24.x, macos-latest)
- GitHub Check: go-test (1.25.x, macos-latest)
- GitHub Check: go-test (1.24.x, ubuntu-latest)
- GitHub Check: go-test (1.24.x, windows-latest)
🔇 Additional comments (9)
database/pool.go (1)
22-39: GetPool includeInactive plumbing is consistent and preserves existing semanticsThe new
includeInactiveparameter is correctly threaded through tometadata.GetPool, and the nil check/ErrPoolNotFoundbehavior remains intact. This should preserve existing callers’ behavior when they passfalsewhile enabling the new inactive‑inclusive queries.database/plugin/metadata/sqlite/pool.go (1)
25-63: Pool active/inactive filtering and preloading look correctThe sqlite
GetPoolimplementation correctly:
- Preloads the latest
RegistrationandRetirement.- Returns
(nil, nil)for missing pools.- Filters out logically inactive pools when
includeInactiveis false by comparing the latestRetirement.AddedSlotto the latestRegistration.AddedSlot.This aligns with
Database.GetPool’sErrPoolNotFoundbehavior and with howPoolCurrentStateinterprets the result.database/account.go (1)
21-42: GetAccount includeInactive wiring matches GetPool patternThe new
includeInactiveparameter is cleanly threaded through to the metadata store, and the existing not‑found handling viaErrAccountNotFoundremains unchanged. This is consistent with the pool path and should preserve behavior for callers that passfalse.ledger/view.go (1)
81-88: PoolCurrentState correctly opts out of inactive poolsUpdating the call to
GetPool(pkh, false, lv.txn)keepsPoolCurrentStatefocused on active pools while preserving the existingErrPoolNotFoundhandling. This matches the newincludeInactivecontract without changing the method’s observable behavior.database/plugin/metadata/store.go (1)
46-74: MetadataStore interface extensions are coherent with implementation changesAdding the
includeInactiveboolean toGetPool,GetAccount, andGetDrephere lines up with the updated database and sqlite implementations. Just ensure any otherMetadataStoreplugins are updated to this new signature so they continue to satisfy the interface.database/plugin/metadata/sqlite/account.go (1)
26-40: includeInactive handling in GetAccount is clear and preserves prior behaviorUsing a local
queryand conditionally addingactive = truewhenincludeInactiveis false cleanly preserves the old behavior while enabling the new flag. Returning(nil, nil)onErrRecordNotFoundkeeps existing call-site semantics.database/plugin/metadata/sqlite/transaction.go (1)
480-495: Clamping ExUnits before uint64 cast is a good safety improvementUsing
uint64(max(0, value.ExUnits.Memory))/uint64(max(0, value.ExUnits.Steps))avoids negative-to-unsigned underflow and makes the cast safe by construction. Just ensure your Go toolchain version supports the built-inmaxyou’re relying on.ledger/benchmark_test.go (2)
520-520: Benchmarks correctly pass includeInactive=false to preserve prior behaviorUpdating the account and pool lookup benchmarks to call
GetAccount(..., false, nil)andGetPool(..., false, nil)keeps behavior equivalent to the old signatures while exercising the new API shape. This matches the “internal callers default to active-only” goal.Also applies to: 595-595, 624-624, 698-699
728-731: Review comment is incorrect—benchmarks are already aligned with GetDrep's actual error contractThe DRep benchmarks correctly check for
gorm.ErrRecordNotFoundbecause that is whatGetDrepactually returns. The SQLite implementation passes through GORM's error directly (line 39 ofdatabase/plugin/metadata/sqlite/drep.go), and GORM returnsgorm.ErrRecordNotFoundwhenFirst()finds no matching record.While
models.ErrDrepNotFoundexists as a sentinel in the codebase, it is not currently used byGetDrepand is not part of its error contract. The benchmarks require no changes.Likely an incorrect or invalid review comment.
Summary by cubic
Add includeInactive support to account, pool, and drep lookups so callers can fetch inactive records when needed. Default behavior remains active-only; callers updated to pass false.
New Features
Migration
Written for commit c61387b. Summary will update automatically on new commits.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.