fix(consensus-db): declare PendingProposalsRepository::count with Self::Error - #393
Open
Dusk1e wants to merge 1 commit into
Open
fix(consensus-db): declare PendingProposalsRepository::count with Self::Error#393Dusk1e wants to merge 1 commit into
Dusk1e wants to merge 1 commit into
Conversation
Every method across the six repository traits and the pruning service is declared with Self::Error. PendingProposalsRepository::count is the one exception: it hardcodes StoreError. That is a compile error rather than a style point. The trait cannot be implemented by anything whose Error is not StoreError — an implementor returning its own error type from count fails with E0271. It also leaves the generated mock, built with Error = std::io::Error, returning io::Error from enforce_limit and StoreError from count. The blanket impl for &T carried the same signature and now forwards Self::Error as well. Store is unaffected, its Error already is StoreError.
Dusk1e
requested review from
ZhiyuCircle,
ancazamfir,
romac and
sergio-mena
as code owners
September 12, 2026 16:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every method across the six repository traits in
repositories/and thePruningServicetrait is declared withSelf::Error.PendingProposalsRepository::countis the one exception:That is not only a style difference. The trait cannot be implemented by anything whose
Erroris notStoreError— an implementor returning its own error type fromcountfails to compile:So the associated
Errortype is honoured by one of the trait's two methods, andMockPendingProposalsRepository, generated withError = std::io::Error, returnsio::Errorfromenforce_limitandStoreErrorfromcount.The blanket impl for
&Tcarried the same hardcoded signature and now forwardsSelf::Errortoo.Storeis unaffected: itsErroralready isStoreError. The one caller,consensus_ready.rs, goes throughwrap_err, which the trait's existingErrorbound already satisfies.The test is the implementor from the error above: it fails to compile on
mainand passes with the change.cargo test -p arc-consensus-dbis green (107 tests), as iscargo check -p arc-consensus-db --features mock.