Closed archbear closed 1 week ago
The changes involve major refactoring of the comet
package to cometbft
with the introduction of generics to enhance flexibility and type safety. Modules and function signatures have been updated to integrate these improvements. New error handling mechanisms and clearer byte slice initializations were also added. Dependencies on the gogoproto
module have been adjusted for direct inclusion.
File/Path | Change Summary |
---|---|
mod/consensus/go.mod |
Added gogoproto v1.5.0 as a direct dependency. |
.../consensus/pkg/cometbft/consensus.go |
Renamed package to cometbft , refactored Consensus to ConsensusEngine , incorporated generics. Updated function signatures. |
.../pkg/cometbft/errors.go |
Renamed package to cometbft . |
.../pkg/cometbft/helpers.go |
Renamed package to cometbft , modified convertValidatorUpdate to use generics. |
.../pkg/cometbft/types.go |
Introduced Middleware interface with new methods for consensus operations. |
.../pkg/builder/builder.go |
Updated imports from comet to cometbft , adjusted instantiations to use NewConsensusEngine . |
.../pkg/components/module/module.go |
Updated imports, function signatures to match new cometbft and appmodule conventions. |
.../pkg/hex/bytes_test.go |
Enhanced readability of byte slice initialization without logic changes. |
mod/runtime/go.mod |
Adjusted gogoproto dependency from indirect to direct. |
.../pkg/middleware/abci.go |
Updated imports and function signatures for ABCIMiddleware . |
.../pkg/middleware/errors.go |
Added new error variables for specific invalid request types. |
sequenceDiagram
participant Middleware
participant ConsensusEngine
participant ValidatorUpdateT
participant HandleErrors
Middleware->>+ConsensusEngine: NewConsensusEngine[ValidatorUpdateT](m Middleware)
ConsensusEngine->>ValidatorUpdateT: InitGenesis(ctx, genesisBz)
ValidatorUpdateT-->>ConsensusEngine: ValidatorUpdate Data
ConsensusEngine-->>Middleware: Initialized ConsensusEngine
Middleware->>+ConsensusEngine: PrepareProposal(ctx, req)
ConsensusEngine-->>Middleware: ProposalPreparation Response
Middleware->>ConsensusEngine: ProcessProposal(ctx, req)
ConsensusEngine->>ValidatorUpdateT: Process Proposal
ValidatorUpdateT-->>ConsensusEngine: Proposal Process Response
ConsensusEngine-->>Middleware: Proposal Processed Response
Middleware->>ConsensusEngine: PreBlock(ctx, req)
ConsensusEngine-->>Middleware: PreBlock processed
Middleware->>ConsensusEngine: EndBlock(ctx)
ConsensusEngine->>ValidatorUpdateT: End Block operations
ValidatorUpdateT-->>ConsensusEngine: Validator Updates
ConsensusEngine-->>Middleware: End Block completed
Changes swept across the code, A cosmic shift, a lighter load. With
cometbft
, the stars align, Generics dance, the types entwine. Errors now more clearly found, As code in elegance is crowned.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 0%
with 43 lines
in your changes missing coverage. Please review.
Project coverage is 23.02%. Comparing base (
624c8bd
) to head (d8cc562
).
Summary by CodeRabbit
New Features
Middleware
interface to support advanced genesis initialization, proposal preparation, proposal processing, pre-block actions, and end-block handling in the consensus algorithm.Refactor
comet
package tocometbft
.Consensus
struct toConsensusEngine
with generic types to improve flexibility and consistency.Bug Fixes
Style
BenchmarkDecodeFixedText
test by adding line breaks in byte slice initialization.Chores