-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: unify version modifier for v2 (#21508)
(cherry picked from commit dce0365) # Conflicts: # baseapp/utils_test.go # core/server/app.go # runtime/v2/module.go # server/v2/stf/core_branch_service.go # server/v2/stf/core_branch_service_test.go
- Loading branch information
1 parent
889becd
commit 1dde9de
Showing
12 changed files
with
644 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package server | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
appmodulev2 "cosmossdk.io/core/appmodule/v2" | ||
"cosmossdk.io/core/event" | ||
"cosmossdk.io/core/transaction" | ||
) | ||
|
||
// BlockRequest defines the request structure for a block coming from consensus server to the state transition function. | ||
type BlockRequest[T transaction.Tx] struct { | ||
Height uint64 | ||
Time time.Time | ||
Hash []byte | ||
ChainId string | ||
AppHash []byte | ||
Txs []T | ||
|
||
// IsGenesis indicates if this block is the first block of the chain. | ||
IsGenesis bool | ||
} | ||
|
||
// BlockResponse defines the response structure for a block coming from the state transition function to consensus server. | ||
type BlockResponse struct { | ||
ValidatorUpdates []appmodulev2.ValidatorUpdate | ||
PreBlockEvents []event.Event | ||
BeginBlockEvents []event.Event | ||
TxResults []TxResult | ||
EndBlockEvents []event.Event | ||
} | ||
|
||
// TxResult defines the result of a transaction execution. | ||
type TxResult struct { | ||
// Events produced by the transaction. | ||
Events []event.Event | ||
// Response messages produced by the transaction. | ||
Resp []transaction.Msg | ||
// Error produced by the transaction. | ||
Error error | ||
// Code produced by the transaction. | ||
// A non-zero code is an error that is either define by the module via the cosmossdk.io/errors/v2 package | ||
// or injected through the antehandler along the execution of the transaction. | ||
Code uint32 | ||
// GasWanted is the maximum units of work we allow this tx to perform. | ||
GasWanted uint64 | ||
// GasUsed is the amount of gas actually consumed. | ||
GasUsed uint64 | ||
} | ||
|
||
// VersionModifier defines the interface fulfilled by BaseApp | ||
// which allows getting and setting its appVersion field. This | ||
// in turn updates the consensus params that are sent to the | ||
// consensus engine in EndBlock | ||
type VersionModifier interface { | ||
SetAppVersion(context.Context, uint64) error | ||
AppVersion(context.Context) (uint64, error) | ||
} |
This file contains 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
Oops, something went wrong.