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
+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