Skip to content

Commit

Permalink
v1 preblock is different than v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Feb 20, 2024
1 parent f27418d commit ae64a57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 8 additions & 2 deletions core/appmodule/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ type HasPrecommit interface {
// It can modify consensus parameters in storage and signal the caller through the return value.
// When it returns ConsensusParamsChanged=true, the caller must refresh the consensus parameter in the finalize context.
// The new context (ctx) must be passed to all the other lifecycle methods.
type ResponsePreBlock = appmodule.ResponsePreBlock
type ResponsePreBlock interface {
IsConsensusParamsChanged() bool
}

// HasPreBlocker is the extension interface that modules should implement to run
// custom logic before BeginBlock.
type HasPreBlocker = appmodule.HasPreBlocker
type HasPreBlocker interface {
AppModule
// PreBlock is method that will be run before BeginBlock.
PreBlock(context.Context) (ResponsePreBlock, error)
}

// HasServices is the extension interface that modules should implement to register
// implementations of services defined in .proto files.
Expand Down
10 changes: 1 addition & 9 deletions core/appmodule/v2/comet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@ package appmodule

import "context"

// ResponsePreBlock represents the response from the PreBlock method.
// It can modify consensus parameters in storage and signal the caller through the return value.
// When it returns ConsensusParamsChanged=true, the caller must refresh the consensus parameter in the finalize context.
// The new context (ctx) must be passed to all the other lifecycle methods.
type ResponsePreBlock interface {
IsConsensusParamsChanged() bool
}

// HasPreBlocker is the extension interface that modules should implement to run
// custom logic before BeginBlock.
type HasPreBlocker interface {
AppModule
// PreBlock is method that will be run before BeginBlock.
PreBlock(context.Context) (ResponsePreBlock, error)
PreBlock(context.Context) error
}

0 comments on commit ae64a57

Please sign in to comment.