chore: cleanup core/app (#21368)

This commit is contained in:
Marko
2024-08-27 09:55:16 +00:00
committed by GitHub
parent 58af7ee027
commit 355f748add
28 changed files with 296 additions and 232 deletions
-24
View File
@@ -1,24 +0,0 @@
package app
import (
"cosmossdk.io/core/transaction"
)
// MsgInterfaceProtoName defines the protobuf name of the cosmos Msg interface
const MsgInterfaceProtoName = "cosmos.base.v1beta1.Msg"
type ProtoCodec interface {
Marshal(v transaction.Msg) ([]byte, error)
Unmarshal(data []byte, v transaction.Msg) error
Name() string
}
type InterfaceRegistry interface {
AnyResolver
ListImplementations(ifaceTypeURL string) []string
ListAllInterfaces() []string
}
type AnyResolver = interface {
Resolve(typeUrl string) (transaction.Msg, error)
}
-6
View File
@@ -1,6 +0,0 @@
package app
var (
RuntimeIdentity = []byte("runtime")
ConsensusIdentity = []byte("consensus")
)
+17 -35
View File
@@ -1,4 +1,4 @@
package app
package server
import (
"context"
@@ -9,17 +9,7 @@ import (
"cosmossdk.io/core/transaction"
)
type QueryRequest struct {
Height int64
Path string
Data []byte
}
type QueryResponse struct {
Height int64
Value []byte
}
// 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
@@ -32,8 +22,8 @@ type BlockRequest[T transaction.Tx] struct {
IsGenesis bool
}
// BlockResponse defines the response structure for a block coming from the state transition function to consensus server.
type BlockResponse struct {
Apphash []byte
ValidatorUpdates []appmodulev2.ValidatorUpdate
PreBlockEvents []event.Event
BeginBlockEvents []event.Event
@@ -41,30 +31,22 @@ type BlockResponse struct {
EndBlockEvents []event.Event
}
type RequestInitChain struct {
Time time.Time
ChainId string
Validators []appmodulev2.ValidatorUpdate
AppStateBytes []byte
InitialHeight int64
}
type ResponseInitChain struct {
Validators []appmodulev2.ValidatorUpdate
AppHash []byte
}
// TxResult defines the result of a transaction execution.
type TxResult struct {
Events []event.Event
Resp []transaction.Msg
Error error
Code uint32
Data []byte
Log string
Info string
// 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 uint64
Codespace string
// GasUsed is the amount of gas actually consumed.
GasUsed uint64
}
// VersionModifier defines the interface fulfilled by BaseApp
+20
View File
@@ -0,0 +1,20 @@
package server
import (
"cosmossdk.io/core/transaction"
)
// InterfaceRegistry defines the interface for resolving interfaces
// The interface registry is used to resolve interfaces from type URLs,
// this is only used for the server and not for modules
type InterfaceRegistry interface {
AnyResolver
ListImplementations(ifaceTypeURL string) []string
ListAllInterfaces() []string
}
// AnyResolver defines the interface for resolving interfaces
// This is used to avoid the gogoproto import in core
type AnyResolver = interface {
Resolve(typeUrl string) (transaction.Msg, error)
}
+4
View File
@@ -0,0 +1,4 @@
// Server Defines types and interfaces which are shared between Consensus, Appmanager and Stf
// This package is not meant to be used directly by modules instead if an advanced user would like
// to create a custom server or replace a component in the server they will need to use the app package.
package server