refactor(core,x/**): simplify core service api and embed environment in keepers (#20071)

This commit is contained in:
Julien Robert
2024-04-17 18:18:16 +00:00
committed by GitHub
parent a4ff821981
commit 5e7aae0db1
115 changed files with 546 additions and 651 deletions
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"time"
)
// CometInfoService is an interface that can be used to get information specific to Comet
type CometInfoService interface {
GetCometInfo(context.Context) Info
// Service is an interface that can be used to get information specific to Comet
type Service interface {
CometInfo(context.Context) Info
}
// Info is the information comet provides apps in ABCI
+9 -8
View File
@@ -24,23 +24,24 @@ const NoGasLimit Gas = math.MaxUint64
// gas.Service is a core API type that should be provided by the runtime module being used to
// build an app via depinject.
type Service interface {
// GetGasMeter returns the current transaction-level gas meter. A non-nil meter
// GasMeter returns the current transaction-level gas meter. A non-nil meter
// is always returned. When one is unavailable in the context an infinite gas meter
// will be returned.
GetGasMeter(context.Context) Meter
// GetBlockGasMeter returns the current block-level gas meter. A non-nil meter
// is always returned. When one is unavailable in the context an infinite gas meter
// will be returned.
GetBlockGasMeter(context.Context) Meter
GasMeter(context.Context) Meter
// WithGasMeter returns a new context with the provided transaction-level gas meter.
WithGasMeter(ctx context.Context, meter Meter) context.Context
// BlockGasMeter returns the current block-level gas meter. A non-nil meter
// is always returned. When one is unavailable in the context an infinite gas meter
// will be returned.
BlockGasMeter(context.Context) Meter
// WithBlockGasMeter returns a new context with the provided block-level gas meter.
WithBlockGasMeter(ctx context.Context, meter Meter) context.Context
GetGasConfig(ctx context.Context) GasConfig
// GasConfig returns the gas costs.
GasConfig(ctx context.Context) GasConfig
}
// Meter represents a gas meter for modules consumption
+1 -1
View File
@@ -7,7 +7,7 @@ import (
// Service defines the interface in which you can get header information
type Service interface {
GetHeaderInfo(context.Context) Info
HeaderInfo(context.Context) Info
}
// Info defines a struct that contains information about the header
+1 -1
View File
@@ -3,7 +3,7 @@ package store
// DatabaseService provides access to the underlying database for CRUD operations of non-consensus data.
// WARNING: using this api will make your module unprovable for fraud and validity proofs
type DatabaseService interface {
GetDatabase() NonConsensusStore
Database() NonConsensusStore
}
// NonConsensusStore is a simple key-value store that is used to store non-consensus data.