From db9164b7037e91c656d738d0f9f6b9c6f3027a3e Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:08:57 +0200 Subject: [PATCH 1/6] fix(logic)!: remove max gas module parameter --- proto/logic/v1beta2/params.proto | 10 -- x/logic/keeper/grpc_query_ask.go | 22 ++--- x/logic/types/genesis.go | 3 - x/logic/types/params.go | 17 +--- x/logic/types/params.pb.go | 153 ++++++++++--------------------- x/logic/types/params_legacy.go | 24 ----- 6 files changed, 58 insertions(+), 171 deletions(-) delete mode 100644 x/logic/types/params_legacy.go diff --git a/proto/logic/v1beta2/params.proto b/proto/logic/v1beta2/params.proto index e161c04c..ac5cf81b 100644 --- a/proto/logic/v1beta2/params.proto +++ b/proto/logic/v1beta2/params.proto @@ -35,16 +35,6 @@ message Params { message Limits { option (gogoproto.goproto_stringer) = true; - // max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when - // executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type - // of operations that are executed, as well as, in some cases, the complexity of the processed data. - // nil value remove max gas limitation. - string max_gas = 1 [ - (gogoproto.moretags) = "yaml:\"max_gas\",omitempty", - (gogoproto.customtype) = "cosmossdk.io/math.Uint", - (gogoproto.nullable) = true - ]; - // max_size specifies the maximum size, in bytes, that is accepted for a program. // nil value remove size limitation. string max_size = 3 [ diff --git a/x/logic/keeper/grpc_query_ask.go b/x/logic/keeper/grpc_query_ask.go index b082c118..bed5b716 100644 --- a/x/logic/keeper/grpc_query_ask.go +++ b/x/logic/keeper/grpc_query_ask.go @@ -3,6 +3,7 @@ package keeper import ( goctx "context" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" @@ -17,18 +18,11 @@ import ( var defaultSolutionsLimit = sdkmath.OneUint() func (k Keeper) Ask(ctx goctx.Context, req *types.QueryServiceAskRequest) (response *types.QueryServiceAskResponse, err error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - if req == nil { return nil, errorsmod.Wrap(types.InvalidArgument, "request is nil") } - limits := k.limits(ctx) - if err := checkLimits(req, limits); err != nil { - return nil, err - } - - sdkCtx = withGasMeter(sdkCtx, limits) + sdkCtx := withSafeGasMeter(sdk.UnwrapSDKContext(ctx)) defer func() { if r := recover(); r != nil { if gasError, ok := r.(storetypes.ErrorOutOfGas); ok { @@ -42,7 +36,11 @@ func (k Keeper) Ask(ctx goctx.Context, req *types.QueryServiceAskRequest) (respo panic(r) } }() - sdkCtx.GasMeter().ConsumeGas(sdkCtx.GasMeter().GasConsumed(), types.ModuleName) + + limits := k.limits(ctx) + if err := checkLimits(req, limits); err != nil { + return nil, err + } return k.execute( sdkCtx, @@ -51,10 +49,10 @@ func (k Keeper) Ask(ctx goctx.Context, req *types.QueryServiceAskRequest) (respo util.DerefOrDefault(req.Limit, defaultSolutionsLimit)) } -// withGasMeter returns a new context with a gas meter that has the given limit. +// withSafeGasMeter returns a new context with a gas meter that has the given limit. // The gas meter is go-router-safe. -func withGasMeter(sdkCtx sdk.Context, limits types.Limits) sdk.Context { - gasMeter := meter.WithSafeMeter(storetypes.NewGasMeter(limits.MaxGas.Uint64())) +func withSafeGasMeter(sdkCtx sdk.Context) sdk.Context { + gasMeter := meter.WithSafeMeter(sdkCtx.GasMeter()) return sdkCtx.WithGasMeter(gasMeter) } diff --git a/x/logic/types/genesis.go b/x/logic/types/genesis.go index a0e77ef0..91064234 100644 --- a/x/logic/types/genesis.go +++ b/x/logic/types/genesis.go @@ -1,8 +1,5 @@ package types -// DefaultIndex is the default global index. -const DefaultIndex uint64 = 1 - // DefaultGenesis returns the default genesis state. func DefaultGenesis() *GenesisState { return &GenesisState{ diff --git a/x/logic/types/params.go b/x/logic/types/params.go index c3124cfd..16ce83ee 100644 --- a/x/logic/types/params.go +++ b/x/logic/types/params.go @@ -9,16 +9,12 @@ import ( // Parameter store keys. var ( - ParamsKey = []byte("Params") - KeyInterpreter = []byte("Interpreter") - KeyLimits = []byte("Limits") + ParamsKey = []byte("Params") ) var ( DefaultPredicatesWhitelist = make([]string, 0) DefaultPredicatesBlacklist = make([]string, 0) - DefaultBootstrap = "" - DefaultMaxGas = math.NewUint(uint64(100000)) DefaultMaxSize = math.NewUint(uint64(5000)) DefaultMaxResultCount = math.NewUint(uint64(1)) ) @@ -129,13 +125,6 @@ func validateInterpreter(i interface{}) error { // LimitsOption is a functional option for configuring the Limits. type LimitsOption func(*Limits) -// WithMaxGas sets the max gas limits for interpreter. -func WithMaxGas(maxGas math.Uint) LimitsOption { - return func(i *Limits) { - i.MaxGas = &maxGas - } -} - // WithMaxSize sets the max size limits accepted for a prolog program. func WithMaxSize(maxSize math.Uint) LimitsOption { return func(i *Limits) { @@ -164,10 +153,6 @@ func NewLimits(opts ...LimitsOption) Limits { opt(&l) } - if l.MaxGas == nil { - l.MaxGas = &DefaultMaxGas - } - if l.MaxSize == nil { l.MaxSize = &DefaultMaxSize } diff --git a/x/logic/types/params.pb.go b/x/logic/types/params.pb.go index 3950e0ef..c7bf7a3e 100644 --- a/x/logic/types/params.pb.go +++ b/x/logic/types/params.pb.go @@ -91,11 +91,6 @@ func (m *Params) GetGasPolicy() GasPolicy { // Limits defines the limits of the logic module. type Limits struct { - // max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when - // executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type - // of operations that are executed, as well as, in some cases, the complexity of the processed data. - // nil value remove max gas limitation. - MaxGas *cosmossdk_io_math.Uint `protobuf:"bytes,1,opt,name=max_gas,json=maxGas,proto3,customtype=cosmossdk.io/math.Uint" json:"max_gas,omitempty" yaml:"max_gas",omitempty` // max_size specifies the maximum size, in bytes, that is accepted for a program. // nil value remove size limitation. MaxSize *cosmossdk_io_math.Uint `protobuf:"bytes,3,opt,name=max_size,json=maxSize,proto3,customtype=cosmossdk.io/math.Uint" json:"max_size,omitempty" yaml:"max_size"` @@ -395,55 +390,53 @@ func init() { func init() { proto.RegisterFile("logic/v1beta2/params.proto", fileDescriptor_3af0daa241de0fa3) } var fileDescriptor_3af0daa241de0fa3 = []byte{ - // 756 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xc1, 0x6a, 0xdb, 0x4a, - 0x14, 0xb5, 0x6c, 0xe3, 0xf7, 0x34, 0x26, 0x89, 0x33, 0x38, 0x79, 0x7a, 0x7e, 0x2f, 0xb6, 0x99, - 0x55, 0x16, 0xad, 0x4c, 0x52, 0x48, 0x69, 0xa0, 0x14, 0x94, 0x92, 0xb4, 0x34, 0xd0, 0xa0, 0x10, - 0x28, 0xdd, 0x98, 0xb1, 0x3c, 0x91, 0x87, 0x48, 0x1e, 0xa1, 0x19, 0x25, 0x76, 0x96, 0x5d, 0x74, - 0xdd, 0x45, 0x17, 0x5d, 0x74, 0xd1, 0xcf, 0xc9, 0xaa, 0x64, 0x59, 0xba, 0x30, 0x25, 0xf9, 0x83, - 0x7c, 0x41, 0xd1, 0x68, 0x2c, 0xd9, 0x6a, 0xc0, 0xed, 0x4e, 0xbe, 0xe7, 0x9e, 0x73, 0x8f, 0xee, - 0x9c, 0xb1, 0x40, 0xc3, 0x63, 0x2e, 0x75, 0x3a, 0xe7, 0x5b, 0x3d, 0x22, 0xf0, 0x76, 0x27, 0xc0, - 0x21, 0xf6, 0xb9, 0x19, 0x84, 0x4c, 0x30, 0xb8, 0x24, 0x31, 0x53, 0x61, 0x8d, 0xba, 0xcb, 0x5c, - 0x26, 0x91, 0x4e, 0xfc, 0x94, 0x34, 0xa1, 0x77, 0x45, 0x50, 0x39, 0x92, 0x2c, 0xf8, 0x06, 0x54, - 0xe9, 0x50, 0x90, 0x30, 0x08, 0x89, 0x20, 0xa1, 0xa1, 0xb5, 0xb5, 0xcd, 0xea, 0x76, 0xc3, 0x9c, - 0x53, 0x31, 0x5f, 0x66, 0x1d, 0x56, 0xe3, 0x6a, 0xd2, 0x2a, 0xd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 0xab, 0x6e, 0x3d, 0x59, 0xa8, 0xfa, 0x4f, 0xa6, 0x3a, 0xcb, 0x47, 0xf6, 0xb2, 0x8f, 0x47, 0xb6, - 0xac, 0xec, 0xc5, 0x05, 0x38, 0x04, 0xf5, 0xb8, 0x29, 0xe2, 0x24, 0xec, 0xb2, 0x48, 0x04, 0x91, - 0x48, 0xec, 0x97, 0xe5, 0xa0, 0xa7, 0x0b, 0x07, 0xfd, 0x97, 0x0d, 0xca, 0x6b, 0x20, 0x7b, 0xd5, - 0xc7, 0xa3, 0x13, 0x4e, 0xc2, 0xd7, 0xb2, 0x18, 0xbf, 0x94, 0x3c, 0x08, 0x0d, 0x8d, 0x40, 0x65, - 0x9f, 0x7a, 0x71, 0x64, 0x76, 0x80, 0x7e, 0x31, 0xa0, 0x82, 0x78, 0x94, 0x0b, 0x43, 0x6b, 0x97, - 0x36, 0x75, 0xcb, 0x88, 0x87, 0xde, 0x4d, 0x5a, 0xb5, 0x44, 0x3a, 0x85, 0x91, 0x9d, 0xb5, 0xc6, - 0xbc, 0x9e, 0x87, 0x9d, 0x33, 0xc9, 0x2b, 0xde, 0xc7, 0x4b, 0x61, 0x64, 0x67, 0xad, 0xe8, 0x73, - 0x11, 0x54, 0x67, 0xb2, 0x0d, 0xfb, 0x60, 0x35, 0x08, 0x49, 0x9f, 0x3a, 0x58, 0x10, 0xde, 0x3d, - 0x95, 0xa6, 0xd4, 0x95, 0xc8, 0xa7, 0x37, 0x71, 0x6c, 0xb5, 0x55, 0xe0, 0x54, 0x1c, 0x7e, 0x61, - 0x23, 0xbb, 0x96, 0xd5, 0xb2, 0xb7, 0xec, 0x31, 0x26, 0xb8, 0x08, 0x71, 0xa0, 0x92, 0x91, 0x77, - 0x3b, 0x85, 0x63, 0xb7, 0xd3, 0x67, 0x48, 0x41, 0xfd, 0x9c, 0x86, 0x22, 0xc2, 0x5e, 0x2c, 0x9e, - 0x19, 0x2c, 0xff, 0x81, 0x41, 0x49, 0x1c, 0x73, 0x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 0x36, - 0x24, 0x0f, 0xe5, 0x07, 0xc4, 0x61, 0x5e, 0xf2, 0xb3, 0xdf, 0x19, 0x75, 0x92, 0x8f, 0x91, 0x18, - 0x07, 0x84, 0xf7, 0x2a, 0x12, 0x7e, 0xf4, 0x33, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x71, 0xc9, 0x6e, - 0xa2, 0x06, 0x00, 0x00, + // 732 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6a, 0xdb, 0x48, + 0x18, 0xb7, 0x6c, 0xe3, 0x5d, 0x8f, 0x49, 0xe2, 0x0c, 0x4e, 0x56, 0xeb, 0xdd, 0xd8, 0x66, 0x4e, + 0x39, 0xec, 0xca, 0x24, 0x0b, 0x59, 0x1a, 0x28, 0x05, 0xa5, 0xa4, 0x2d, 0x0d, 0x34, 0x4c, 0x09, + 0x94, 0x5e, 0xcc, 0x58, 0x9e, 0xc8, 0x43, 0x24, 0x8f, 0xd0, 0x8c, 0x12, 0x3b, 0xc7, 0x3e, 0x41, + 0x0f, 0x3d, 0xf4, 0xd0, 0x43, 0x5f, 0xa1, 0x6f, 0x91, 0x53, 0xc9, 0xb1, 0xf4, 0x60, 0x4a, 0xf2, + 0x06, 0x79, 0x82, 0xa2, 0x19, 0x59, 0xb2, 0xd5, 0x80, 0xc9, 0x6d, 0xfc, 0xfd, 0xbe, 0xdf, 0x9f, + 0xf9, 0xe6, 0xb3, 0x0d, 0x9a, 0x1e, 0x77, 0x99, 0xd3, 0x3d, 0xdf, 0xe9, 0x53, 0x49, 0x76, 0xbb, + 0x01, 0x09, 0x89, 0x2f, 0xac, 0x20, 0xe4, 0x92, 0xc3, 0x15, 0x85, 0x59, 0x09, 0xd6, 0x6c, 0xb8, + 0xdc, 0xe5, 0x0a, 0xe9, 0xc6, 0x27, 0xdd, 0x84, 0xde, 0x15, 0x41, 0xe5, 0x58, 0x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0xdc, 0xef, 0x92, 0x31, 0x1f, 0xd1, 0x7f, 0xd5, 0x6f, 0xbd, 0xc3, 0x3d, 0xfd, 0x71, + 0xd0, 0x1d, 0x77, 0xf5, 0xff, 0x86, 0x9c, 0x04, 0x54, 0xf4, 0x2b, 0x0a, 0xfe, 0xef, 0x67, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x0c, 0x3c, 0xbb, 0xd7, 0x4d, 0x06, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -555,18 +548,6 @@ func (m *Limits) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.MaxGas != nil { - { - size := m.MaxGas.Size() - i -= size - if _, err := m.MaxGas.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -796,10 +777,6 @@ func (m *Limits) Size() (n int) { } var l int _ = l - if m.MaxGas != nil { - l = m.MaxGas.Size() - n += 1 + l + sovParams(uint64(l)) - } if m.MaxResultCount != nil { l = m.MaxResultCount.Size() n += 1 + l + sovParams(uint64(l)) @@ -1077,42 +1054,6 @@ func (m *Limits) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Limits: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxGas", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v cosmossdk_io_math.Uint - m.MaxGas = &v - if err := m.MaxGas.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxResultCount", wireType) diff --git a/x/logic/types/params_legacy.go b/x/logic/types/params_legacy.go deleted file mode 100644 index e9ec65d1..00000000 --- a/x/logic/types/params_legacy.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - -// ParamKeyTable the param key table for launch module. -// -// Deprecated: kept for migration purpose, -// will be removed soon. -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamSetPairs get the params.ParamSet. -// -// Deprecated: kept for migration purpose, -// will be removed soon. -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return []paramtypes.ParamSetPair{ - paramtypes.NewParamSetPair(KeyInterpreter, &p.Interpreter, validateInterpreter), - paramtypes.NewParamSetPair(KeyLimits, &p.Limits, validateLimits), - } -} From 8e84adce827ed1b0be271ac9d992d75322262a9f Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:10:07 +0200 Subject: [PATCH 2/6] docs(logic): update gas related logic docs --- docs/proto/logic.md | 5 +++-- proto/logic/docs.yaml | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/proto/logic.md b/docs/proto/logic.md index 9d333380..85558ad0 100644 --- a/docs/proto/logic.md +++ b/docs/proto/logic.md @@ -182,10 +182,12 @@ to submit transactions or make changes to the blockchain's state. It is therefor To control the cpu and memory usage of the module, the module is limited by several different mechanisms: -- `max_gas`: the maximum amount of gas that can be used to evaluate a query. - `max_size`: the maximum size of the program that can be evaluated. - `max_result_count`: the maximum number of results that can be returned by a query. +The existing `query-gas-limit` configuration present in the `app.toml` can be used to constraint gas usage when not used +in the context of a transaction. + Additional limitations are being considered for the future, such as restricting the number of variables that can be utilized within a query, or limiting the depth of the backtracking algorithm. @@ -274,7 +276,6 @@ Limits defines the limits of the logic module. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `max_gas` | [string](#string) | | max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when executing a request by the interpreter. The interpreter calculates the gas consumption based on the number and type of operations that are executed, as well as, in some cases, the complexity of the processed data. nil value remove max gas limitation. | | `max_size` | [string](#string) | | max_size specifies the maximum size, in bytes, that is accepted for a program. nil value remove size limitation. | | `max_result_count` | [string](#string) | | max_result_count specifies the maximum number of results that can be requested for a query. nil value remove max result count limitation. | | `max_user_output_size` | [string](#string) | | max_user_output_size specifies the maximum number of bytes to keep in the user output. If the user output exceeds this size, the interpreter will overwrite the oldest bytes with the new ones to keep the size constant. nil value or 0 value means that no user output is used at all. | diff --git a/proto/logic/docs.yaml b/proto/logic/docs.yaml index d0b2b2c8..9217812a 100644 --- a/proto/logic/docs.yaml +++ b/proto/logic/docs.yaml @@ -178,9 +178,11 @@ description: | To control the cpu and memory usage of the module, the module is limited by several different mechanisms: - - `max_gas`: the maximum amount of gas that can be used to evaluate a query. - `max_size`: the maximum size of the program that can be evaluated. - `max_result_count`: the maximum number of results that can be returned by a query. + + The existing `query-gas-limit` configuration present in the `app.toml` can be used to constraint gas usage when not used + in the context of a transaction. Additional limitations are being considered for the future, such as restricting the number of variables that can be utilized within a query, or limiting the depth of the backtracking algorithm. From c6e6bf65576bba7ffbbcb36ca916ec1bc7633cf7 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:10:26 +0200 Subject: [PATCH 3/6] test(logic): adapt tests according to new gas behaviour --- .../keeper/features/bech32_address_2.feature | 34 +++++++++---------- .../keeper/features/block_height_1.feature | 4 +-- x/logic/keeper/features/block_time_1.feature | 4 +-- x/logic/keeper/features/consult_1.feature | 6 ++-- .../keeper/features/current_output_1.feature | 10 +++--- x/logic/keeper/features/open_3.feature | 2 +- x/logic/keeper/features/open_4.feature | 22 ++++++------ x/logic/keeper/grpc_query_ask_test.go | 18 +++++----- x/logic/keeper/grpc_query_params_test.go | 1 - x/logic/types/params_test.go | 1 - 10 files changed, 51 insertions(+), 51 deletions(-) diff --git a/x/logic/keeper/features/bech32_address_2.feature b/x/logic/keeper/features/bech32_address_2.feature index e2745db9..efc982fa 100644 --- a/x/logic/keeper/features/bech32_address_2.feature +++ b/x/logic/keeper/features/bech32_address_2.feature @@ -16,7 +16,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Address"] @@ -39,7 +39,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Hrp", "Address"] @@ -63,7 +63,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Address"] @@ -84,7 +84,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -109,7 +109,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false results: @@ -130,7 +130,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false results: @@ -146,7 +146,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false results: @@ -163,7 +163,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Hrp"] @@ -186,7 +186,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Address"] @@ -207,7 +207,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["X"] @@ -227,7 +227,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -247,7 +247,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -267,7 +267,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -287,7 +287,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -307,7 +307,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Bech32"] @@ -327,7 +327,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Address", "Bech32"] @@ -347,7 +347,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Hrp", "Bech32"] diff --git a/x/logic/keeper/features/block_height_1.feature b/x/logic/keeper/features/block_height_1.feature index cf2bc6ef..a7caff9a 100644 --- a/x/logic/keeper/features/block_height_1.feature +++ b/x/logic/keeper/features/block_height_1.feature @@ -16,7 +16,7 @@ Feature: block_height/1 Then the answer we get is: """ yaml height: 100 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Height"] @@ -43,7 +43,7 @@ Feature: block_height/1 Then the answer we get is: """ yaml height: 101 - gas_used: 2223 + gas_used: 6033 answer: has_more: false variables: ["Height"] diff --git a/x/logic/keeper/features/block_time_1.feature b/x/logic/keeper/features/block_time_1.feature index 05d674e8..d9657291 100644 --- a/x/logic/keeper/features/block_time_1.feature +++ b/x/logic/keeper/features/block_time_1.feature @@ -16,7 +16,7 @@ Feature: block_time/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Time"] @@ -44,7 +44,7 @@ Feature: block_time/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2223 + gas_used: 6033 answer: has_more: false variables: ["Time"] diff --git a/x/logic/keeper/features/consult_1.feature b/x/logic/keeper/features/consult_1.feature index b2b4164e..68c062f6 100644 --- a/x/logic/keeper/features/consult_1.feature +++ b/x/logic/keeper/features/consult_1.feature @@ -34,7 +34,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2224 + gas_used: 6034 answer: has_more: false variables: ["Who"] @@ -90,7 +90,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2223 + gas_used: 6033 answer: has_more: false variables: ["X"] @@ -144,7 +144,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2223 + gas_used: 6033 answer: has_more: false variables: ["File"] diff --git a/x/logic/keeper/features/current_output_1.feature b/x/logic/keeper/features/current_output_1.feature index b4063dec..06b4cada 100644 --- a/x/logic/keeper/features/current_output_1.feature +++ b/x/logic/keeper/features/current_output_1.feature @@ -28,7 +28,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2241 + gas_used: 6150 answer: has_more: false variables: @@ -66,7 +66,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2248 + gas_used: 6190 answer: has_more: false variables: @@ -104,7 +104,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2241 + gas_used: 6150 answer: has_more: false variables: @@ -145,7 +145,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2255 + gas_used: 6164 answer: has_more: false variables: @@ -176,7 +176,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 2607 + gas_used: 6417 answer: has_more: false variables: diff --git a/x/logic/keeper/features/open_3.feature b/x/logic/keeper/features/open_3.feature index 4e26ad9f..d42da376 100644 --- a/x/logic/keeper/features/open_3.feature +++ b/x/logic/keeper/features/open_3.feature @@ -31,7 +31,7 @@ Feature: open/3 Then the answer we get is: """ yaml height: 42 - gas_used: 2223 + gas_used: 6033 answer: has_more: false variables: diff --git a/x/logic/keeper/features/open_4.feature b/x/logic/keeper/features/open_4.feature index 33b99faf..cec3cf88 100644 --- a/x/logic/keeper/features/open_4.feature +++ b/x/logic/keeper/features/open_4.feature @@ -43,7 +43,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2228 + gas_used: 6038 answer: has_more: false variables: ["URI"] @@ -86,7 +86,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2224 + gas_used: 6034 answer: has_more: false variables: ["Chars"] @@ -127,7 +127,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2224 + gas_used: 6034 answer: has_more: false variables: ["Chars"] @@ -149,7 +149,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -170,7 +170,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -191,7 +191,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -212,7 +212,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -232,7 +232,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -251,7 +251,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Stream"] @@ -270,7 +270,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Resource", "Stream"] @@ -289,7 +289,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 2222 + gas_used: 6032 answer: has_more: false variables: ["Mode", "Stream"] diff --git a/x/logic/keeper/grpc_query_ask_test.go b/x/logic/keeper/grpc_query_ask_test.go index 2a778242..3d5b8e05 100644 --- a/x/logic/keeper/grpc_query_ask_test.go +++ b/x/logic/keeper/grpc_query_ask_test.go @@ -141,16 +141,16 @@ func TestGRPCAsk(t *testing.T) { }, { query: "bank_balances(X, Y).", - maxGas: 3000, - expectedError: "out of gas: logic (4204/3000): limit exceeded", + maxGas: 3500, + expectedError: "out of gas: logic (5243/3500): limit exceeded", }, { query: "block_height(X).", - maxGas: 3000, + maxGas: 3500, predicateCosts: map[string]uint64{ "block_height/1": 10000, }, - expectedError: "out of gas: logic (12353/3000): limit exceeded", + expectedError: "out of gas: logic (13467/3500): limit exceeded", }, { program: "father(bob, 'élodie').", @@ -351,10 +351,6 @@ foo(a4). if tc.predicateBlacklist != nil { params.Interpreter.PredicatesFilter.Blacklist = tc.predicateBlacklist } - if tc.maxGas != 0 { - maxGas := sdkmath.NewUint(tc.maxGas) - params.Limits.MaxGas = &maxGas - } if tc.predicateCosts != nil { predicateCosts := make([]types.PredicateCost, 0, len(tc.predicateCosts)) for predicate, cost := range tc.predicateCosts { @@ -370,6 +366,12 @@ foo(a4). So(err, ShouldBeNil) + if tc.maxGas != 0 { + testCtx.Ctx = testCtx.Ctx.WithGasMeter(storetypes.NewGasMeter(tc.maxGas)) + } else { + testCtx.Ctx = testCtx.Ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + } + Convey("and given a query with program and query to grpc", func() { queryHelper := baseapp.NewQueryServerTestHelper(testCtx.Ctx, encCfg.InterfaceRegistry) types.RegisterQueryServiceServer(queryHelper, logicKeeper) diff --git a/x/logic/keeper/grpc_query_params_test.go b/x/logic/keeper/grpc_query_params_test.go index 5c2976a3..032da10a 100644 --- a/x/logic/keeper/grpc_query_params_test.go +++ b/x/logic/keeper/grpc_query_params_test.go @@ -40,7 +40,6 @@ func TestGRPCParams(t *testing.T) { types.WithVirtualFilesWhitelist([]string{"file2"}), ), types.NewLimits( - types.WithMaxGas(math.NewUint(1)), types.WithMaxSize(math.NewUint(2)), types.WithMaxResultCount(math.NewUint(3)), types.WithMaxUserOutputSize(math.NewUint(4)), diff --git a/x/logic/types/params_test.go b/x/logic/types/params_test.go index dad490d6..a1791a84 100644 --- a/x/logic/types/params_test.go +++ b/x/logic/types/params_test.go @@ -36,7 +36,6 @@ func TestValidateParams(t *testing.T) { types.WithVirtualFilesWhitelist([]string{"file2"}), ), types.NewLimits( - types.WithMaxGas(math.NewUint(1)), types.WithMaxSize(math.NewUint(2)), types.WithMaxResultCount(math.NewUint(3)), types.WithMaxUserOutputSize(math.NewUint(4)), From 92e6d054d06cd3096a199d3a1ba8d504ec4a3520 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:46:38 +0200 Subject: [PATCH 4/6] perf(logic): reduce read params in ask query --- .../keeper/features/bech32_address_2.feature | 34 +++++++++---------- .../keeper/features/block_height_1.feature | 4 +-- x/logic/keeper/features/block_time_1.feature | 4 +-- x/logic/keeper/features/consult_1.feature | 6 ++-- .../keeper/features/current_output_1.feature | 10 +++--- x/logic/keeper/features/open_3.feature | 2 +- x/logic/keeper/features/open_4.feature | 22 ++++++------ x/logic/keeper/grpc_query_ask.go | 23 +++++++++++-- x/logic/keeper/grpc_query_ask_test.go | 29 +++++++++------- x/logic/keeper/interpreter.go | 26 +++----------- 10 files changed, 81 insertions(+), 79 deletions(-) diff --git a/x/logic/keeper/features/bech32_address_2.feature b/x/logic/keeper/features/bech32_address_2.feature index efc982fa..053c911b 100644 --- a/x/logic/keeper/features/bech32_address_2.feature +++ b/x/logic/keeper/features/bech32_address_2.feature @@ -16,7 +16,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -39,7 +39,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Hrp", "Address"] @@ -63,7 +63,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -84,7 +84,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -109,7 +109,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false results: @@ -130,7 +130,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false results: @@ -146,7 +146,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false results: @@ -163,7 +163,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Hrp"] @@ -186,7 +186,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -207,7 +207,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["X"] @@ -227,7 +227,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -247,7 +247,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -267,7 +267,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -287,7 +287,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -307,7 +307,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -327,7 +327,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Address", "Bech32"] @@ -347,7 +347,7 @@ Feature: bech32_address/2 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Hrp", "Bech32"] diff --git a/x/logic/keeper/features/block_height_1.feature b/x/logic/keeper/features/block_height_1.feature index a7caff9a..f1f2d271 100644 --- a/x/logic/keeper/features/block_height_1.feature +++ b/x/logic/keeper/features/block_height_1.feature @@ -16,7 +16,7 @@ Feature: block_height/1 Then the answer we get is: """ yaml height: 100 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Height"] @@ -43,7 +43,7 @@ Feature: block_height/1 Then the answer we get is: """ yaml height: 101 - gas_used: 6033 + gas_used: 3877 answer: has_more: false variables: ["Height"] diff --git a/x/logic/keeper/features/block_time_1.feature b/x/logic/keeper/features/block_time_1.feature index d9657291..ae35c9e6 100644 --- a/x/logic/keeper/features/block_time_1.feature +++ b/x/logic/keeper/features/block_time_1.feature @@ -16,7 +16,7 @@ Feature: block_time/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Time"] @@ -44,7 +44,7 @@ Feature: block_time/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6033 + gas_used: 3877 answer: has_more: false variables: ["Time"] diff --git a/x/logic/keeper/features/consult_1.feature b/x/logic/keeper/features/consult_1.feature index 68c062f6..27ac3ef8 100644 --- a/x/logic/keeper/features/consult_1.feature +++ b/x/logic/keeper/features/consult_1.feature @@ -34,7 +34,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6034 + gas_used: 3878 answer: has_more: false variables: ["Who"] @@ -90,7 +90,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6033 + gas_used: 3877 answer: has_more: false variables: ["X"] @@ -144,7 +144,7 @@ Feature: consult/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6033 + gas_used: 3877 answer: has_more: false variables: ["File"] diff --git a/x/logic/keeper/features/current_output_1.feature b/x/logic/keeper/features/current_output_1.feature index 06b4cada..1468a9b0 100644 --- a/x/logic/keeper/features/current_output_1.feature +++ b/x/logic/keeper/features/current_output_1.feature @@ -28,7 +28,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6150 + gas_used: 3976 answer: has_more: false variables: @@ -66,7 +66,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6190 + gas_used: 4010 answer: has_more: false variables: @@ -104,7 +104,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6150 + gas_used: 3976 answer: has_more: false variables: @@ -145,7 +145,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6164 + gas_used: 3990 answer: has_more: false variables: @@ -176,7 +176,7 @@ Feature: current_output/1 Then the answer we get is: """ yaml height: 42 - gas_used: 6417 + gas_used: 4261 answer: has_more: false variables: diff --git a/x/logic/keeper/features/open_3.feature b/x/logic/keeper/features/open_3.feature index d42da376..d9e52e3d 100644 --- a/x/logic/keeper/features/open_3.feature +++ b/x/logic/keeper/features/open_3.feature @@ -31,7 +31,7 @@ Feature: open/3 Then the answer we get is: """ yaml height: 42 - gas_used: 6033 + gas_used: 3877 answer: has_more: false variables: diff --git a/x/logic/keeper/features/open_4.feature b/x/logic/keeper/features/open_4.feature index cec3cf88..b59f6ff1 100644 --- a/x/logic/keeper/features/open_4.feature +++ b/x/logic/keeper/features/open_4.feature @@ -43,7 +43,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6038 + gas_used: 3882 answer: has_more: false variables: ["URI"] @@ -86,7 +86,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6034 + gas_used: 3878 answer: has_more: false variables: ["Chars"] @@ -127,7 +127,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6034 + gas_used: 3878 answer: has_more: false variables: ["Chars"] @@ -149,7 +149,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -170,7 +170,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -191,7 +191,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -212,7 +212,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -232,7 +232,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -251,7 +251,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -270,7 +270,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Resource", "Stream"] @@ -289,7 +289,7 @@ Feature: open/4 Then the answer we get is: """ yaml height: 42 - gas_used: 6032 + gas_used: 3876 answer: has_more: false variables: ["Mode", "Stream"] diff --git a/x/logic/keeper/grpc_query_ask.go b/x/logic/keeper/grpc_query_ask.go index bed5b716..9fd129d3 100644 --- a/x/logic/keeper/grpc_query_ask.go +++ b/x/logic/keeper/grpc_query_ask.go @@ -2,7 +2,7 @@ package keeper import ( goctx "context" - + "math" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" @@ -37,18 +37,35 @@ func (k Keeper) Ask(ctx goctx.Context, req *types.QueryServiceAskRequest) (respo } }() - limits := k.limits(ctx) - if err := checkLimits(req, limits); err != nil { + params := k.GetParams(sdkCtx) + if err := checkLimits(req, params.Limits); err != nil { return nil, err } return k.execute( sdkCtx, + params, req.Program, req.Query, util.DerefOrDefault(req.Limit, defaultSolutionsLimit)) } +func checkLimits(request *types.QueryServiceAskRequest, limits types.Limits) error { + size := sdkmath.NewUint(uint64(len(request.GetQuery()))) + maxSize := util.DerefOrDefault(limits.MaxSize, sdkmath.NewUint(math.MaxInt64)) + if size.GT(maxSize) { + return errorsmod.Wrapf(types.LimitExceeded, "query: %d > MaxSize: %d", size.Uint64(), maxSize.Uint64()) + } + + resultCount := util.DerefOrDefault(request.Limit, defaultSolutionsLimit) + maxResultCount := util.DerefOrDefault(limits.MaxResultCount, sdkmath.NewUint(math.MaxInt64)) + if resultCount.GT(maxResultCount) { + return errorsmod.Wrapf(types.LimitExceeded, "query: %d > MaxResultCount: %d", resultCount.Uint64(), maxResultCount.Uint64()) + } + + return nil +} + // withSafeGasMeter returns a new context with a gas meter that has the given limit. // The gas meter is go-router-safe. func withSafeGasMeter(sdkCtx sdk.Context) sdk.Context { diff --git a/x/logic/keeper/grpc_query_ask_test.go b/x/logic/keeper/grpc_query_ask_test.go index 3d5b8e05..360c594b 100644 --- a/x/logic/keeper/grpc_query_ask_test.go +++ b/x/logic/keeper/grpc_query_ask_test.go @@ -37,6 +37,7 @@ func TestGRPCAsk(t *testing.T) { query string limit int maxResultCount int + maxSize int predicateBlacklist []string maxGas uint64 predicateCosts map[string]uint64 @@ -117,13 +118,13 @@ func TestGRPCAsk(t *testing.T) { query: "father(bob, X).", limit: 2, maxResultCount: 1, - expectedAnswer: &types.Answer{ - HasMore: true, - Variables: []string{"X"}, - Results: []types.Result{{Substitutions: []types.Substitution{{ - Variable: "X", Expression: "alice", - }}}}, - }, + expectedError: "query: 2 > MaxResultCount: 1: limit exceeded", + }, + { + program: "father(bob, alice). father(bob, john).", + query: "father(bob, X).", + maxSize: 5, + expectedError: "query: 15 > MaxSize: 5: limit exceeded", }, { query: "block_height(X).", @@ -141,16 +142,16 @@ func TestGRPCAsk(t *testing.T) { }, { query: "bank_balances(X, Y).", - maxGas: 3500, - expectedError: "out of gas: logic (5243/3500): limit exceeded", + maxGas: 3000, + expectedError: "out of gas: logic (3093/3000): limit exceeded", }, { query: "block_height(X).", - maxGas: 3500, + maxGas: 3000, predicateCosts: map[string]uint64{ "block_height/1": 10000, }, - expectedError: "out of gas: logic (13467/3500): limit exceeded", + expectedError: "out of gas: logic (11167/3000): limit exceeded", }, { program: "father(bob, 'élodie').", @@ -283,8 +284,8 @@ foo(a3) :- throw(error(resource_error(foo))). foo(a4). `, query: `foo(X).`, - limit: 5, - maxResultCount: 3, + limit: 3, + maxResultCount: 5, expectedAnswer: &types.Answer{ Variables: []string{"X"}, Results: []types.Result{ @@ -346,8 +347,10 @@ foo(a4). }, ) maxResultCount := sdkmath.NewUint(uint64(lo.If(tc.maxResultCount == 0, 1).Else(tc.maxResultCount))) + maxSize := sdkmath.NewUint(uint64(lo.If(tc.maxSize == 0, 5000).Else(tc.maxSize))) params := types.DefaultParams() params.Limits.MaxResultCount = &maxResultCount + params.Limits.MaxSize = &maxSize if tc.predicateBlacklist != nil { params.Interpreter.PredicatesFilter.Blacklist = tc.predicateBlacklist } diff --git a/x/logic/keeper/interpreter.go b/x/logic/keeper/interpreter.go index 36e4a51f..189e5dc8 100644 --- a/x/logic/keeper/interpreter.go +++ b/x/logic/keeper/interpreter.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "math" "strings" "github.com/ichiban/prolog" @@ -37,11 +36,6 @@ type writerStringer interface { fmt.Stringer } -func (k Keeper) limits(ctx context.Context) types.Limits { - params := k.GetParams(sdk.UnwrapSDKContext(ctx)) - return params.GetLimits() -} - func (k Keeper) enhanceContext(ctx context.Context) context.Context { sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx = sdkCtx.WithValue(types.AuthKeeperContextKey, k.authKeeper) @@ -50,13 +44,12 @@ func (k Keeper) enhanceContext(ctx context.Context) context.Context { } func (k Keeper) execute( - ctx context.Context, program, query string, solutionsLimit sdkmath.Uint, + ctx context.Context, params types.Params, program, query string, solutionsLimit sdkmath.Uint, ) (*types.QueryServiceAskResponse, error) { ctx = k.enhanceContext(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx) - limits := k.limits(sdkCtx) - i, userOutput, err := k.newInterpreter(ctx) + i, userOutput, err := k.newInterpreter(ctx, params) if err != nil { return nil, errorsmod.Wrapf(types.Internal, "error creating interpreter: %v", err.Error()) } @@ -64,7 +57,7 @@ func (k Keeper) execute( return nil, errorsmod.Wrapf(types.InvalidArgument, "error compiling query: %v", err.Error()) } - answer, err := k.queryInterpreter(ctx, i, query, sdkmath.MinUint(solutionsLimit, *limits.MaxResultCount)) + answer, err := k.queryInterpreter(ctx, i, query, solutionsLimit) if err != nil { return nil, err } @@ -85,9 +78,8 @@ func (k Keeper) queryInterpreter( } // newInterpreter creates a new interpreter properly configured. -func (k Keeper) newInterpreter(ctx context.Context) (*prolog.Interpreter, fmt.Stringer, error) { +func (k Keeper) newInterpreter(ctx context.Context, params types.Params) (*prolog.Interpreter, fmt.Stringer, error) { sdkctx := sdk.UnwrapSDKContext(ctx) - params := k.GetParams(sdkctx) interpreterParams := params.GetInterpreter() gasPolicy := params.GetGasPolicy() @@ -148,16 +140,6 @@ func (k Keeper) newInterpreter(ctx context.Context) (*prolog.Interpreter, fmt.St return i, userOutputBuffer, err } -func checkLimits(request *types.QueryServiceAskRequest, limits types.Limits) error { - size := sdkmath.NewUint(uint64(len(request.GetQuery()))) - maxSize := util.DerefOrDefault(limits.MaxSize, sdkmath.NewUint(math.MaxInt64)) - if size.GT(maxSize) { - return errorsmod.Wrapf(types.LimitExceeded, "query: %d > MaxSize: %d", size, maxSize) - } - - return nil -} - func lookupCost(predicate string, defaultCost uint64, costs []types.PredicateCost) uint64 { for _, c := range costs { if prolog2.PredicateMatches(predicate)(c.Predicate) { From bea1189777b5e0d8cc3c714996a2cab7ffc8e2e8 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:49:31 +0200 Subject: [PATCH 5/6] style: give linters some love --- proto/logic/docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/logic/docs.yaml b/proto/logic/docs.yaml index 9217812a..39eb0c88 100644 --- a/proto/logic/docs.yaml +++ b/proto/logic/docs.yaml @@ -180,7 +180,7 @@ description: | - `max_size`: the maximum size of the program that can be evaluated. - `max_result_count`: the maximum number of results that can be returned by a query. - + The existing `query-gas-limit` configuration present in the `app.toml` can be used to constraint gas usage when not used in the context of a transaction. From dc1b52e8277cf0dd8475fab5373b5f754783958f Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:55:33 +0200 Subject: [PATCH 6/6] docs: update generated docs --- docs/predicate/bech32_address_2.md | 14 +++++++------- docs/predicate/block_height_1.md | 4 ++-- docs/predicate/block_time_1.md | 4 ++-- docs/predicate/consult_1.md | 6 +++--- docs/predicate/current_output_1.md | 8 ++++---- docs/predicate/open_3.md | 2 +- docs/predicate/open_4.md | 14 +++++++------- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/predicate/bech32_address_2.md b/docs/predicate/bech32_address_2.md index ea090900..4416ce5f 100644 --- a/docs/predicate/bech32_address_2.md +++ b/docs/predicate/bech32_address_2.md @@ -43,7 +43,7 @@ bech32_address(Address, 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4'). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -72,7 +72,7 @@ bech32_address(-(Hrp, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4'). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Hrp", "Address"] @@ -102,7 +102,7 @@ bech32_address(-(axone, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4' ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -129,7 +129,7 @@ bech32_address(-('axone', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,1 ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Bech32"] @@ -162,7 +162,7 @@ axone_addr('axone1p8u47en82gmzfm259y6z93r9qe63l25d858vqu'). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false results: @@ -188,7 +188,7 @@ bech32_address(Address, axoneincorrect). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Address"] @@ -215,7 +215,7 @@ bech32_address(-('axone', X), foo(bar)). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["X"] diff --git a/docs/predicate/block_height_1.md b/docs/predicate/block_height_1.md index f59b79ef..9699df38 100644 --- a/docs/predicate/block_height_1.md +++ b/docs/predicate/block_height_1.md @@ -44,7 +44,7 @@ block_height(Height). ``` yaml height: 100 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Height"] @@ -79,7 +79,7 @@ Height > 100. ``` yaml height: 101 -gas_used: 2223 +gas_used: 3877 answer: has_more: false variables: ["Height"] diff --git a/docs/predicate/block_time_1.md b/docs/predicate/block_time_1.md index 0a485e5b..2a048b6a 100644 --- a/docs/predicate/block_time_1.md +++ b/docs/predicate/block_time_1.md @@ -44,7 +44,7 @@ block_time(Time). ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Time"] @@ -80,7 +80,7 @@ Time > 1709550216. ``` yaml height: 42 -gas_used: 2223 +gas_used: 3877 answer: has_more: false variables: ["Time"] diff --git a/docs/predicate/consult_1.md b/docs/predicate/consult_1.md index 8484d3d3..3a1129c3 100644 --- a/docs/predicate/consult_1.md +++ b/docs/predicate/consult_1.md @@ -65,7 +65,7 @@ hello(Who). ``` yaml height: 42 -gas_used: 2224 +gas_used: 3878 answer: has_more: false variables: ["Who"] @@ -129,7 +129,7 @@ response: | ``` yaml height: 42 -gas_used: 2223 +gas_used: 3877 answer: has_more: false variables: ["X"] @@ -194,7 +194,7 @@ source_file(File). ``` yaml height: 42 -gas_used: 2223 +gas_used: 3877 answer: has_more: false variables: ["File"] diff --git a/docs/predicate/current_output_1.md b/docs/predicate/current_output_1.md index 3584d1aa..250f274d 100644 --- a/docs/predicate/current_output_1.md +++ b/docs/predicate/current_output_1.md @@ -61,7 +61,7 @@ write_char_to_user_output(x). ``` yaml height: 42 -gas_used: 2241 +gas_used: 3976 answer: has_more: false variables: @@ -108,7 +108,7 @@ log_message('Hello world!'). ``` yaml height: 42 -gas_used: 2248 +gas_used: 4010 answer: has_more: false variables: @@ -155,7 +155,7 @@ log_message('Hello world!'). ``` yaml height: 42 -gas_used: 2241 +gas_used: 3976 answer: has_more: false variables: @@ -205,7 +205,7 @@ log_message("Hello 🧙!"). ``` yaml height: 42 -gas_used: 2255 +gas_used: 3990 answer: has_more: false variables: diff --git a/docs/predicate/open_3.md b/docs/predicate/open_3.md index 0fd13956..dd6677e3 100644 --- a/docs/predicate/open_3.md +++ b/docs/predicate/open_3.md @@ -62,7 +62,7 @@ open( ``` yaml height: 42 -gas_used: 2223 +gas_used: 3877 answer: has_more: false variables: diff --git a/docs/predicate/open_4.md b/docs/predicate/open_4.md index 2799b163..241bf3ba 100644 --- a/docs/predicate/open_4.md +++ b/docs/predicate/open_4.md @@ -100,7 +100,7 @@ open(URI, read, _, []). ``` yaml height: 42 -gas_used: 2228 +gas_used: 3882 answer: has_more: false variables: ["URI"] @@ -152,7 +152,7 @@ read_resource('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08x ``` yaml height: 42 -gas_used: 2224 +gas_used: 3878 answer: has_more: false variables: ["Chars"] @@ -202,7 +202,7 @@ read_resource('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08x ``` yaml height: 42 -gas_used: 2224 +gas_used: 3878 answer: has_more: false variables: ["Chars"] @@ -229,7 +229,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -255,7 +255,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -281,7 +281,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Stream"] @@ -306,7 +306,7 @@ open('cosmwasm:storage:axone15ekvz3qdter33mdnk98v8whv5qdr53yusksnfgc08xd26fpdn3t ``` yaml height: 42 -gas_used: 2222 +gas_used: 3876 answer: has_more: false variables: ["Stream"]