Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/logic gas limit #708

Merged
merged 6 commits into from
Jul 24, 2024
Merged

Fix/logic gas limit #708

merged 6 commits into from
Jul 24, 2024

Conversation

amimart
Copy link
Member

@amimart amimart commented Jul 24, 2024

Closes #706

Details

Remove the max_gas limit in the logic module parameters, gas consumption are now constraints or not by the given sdk.Context.

I took the opportunity to reduce the gas consumption by decreasing the number of access to the module parameters during the initialisation of the prolog interpreter.

I also propose to change the behaviour of the max_result_count limitation by returning an error in case a ask query requests a higher number of results as it is invalid.

Summary by CodeRabbit

  • New Features
    • Enhanced documentation on resource constraints, including details about the new query-gas-limit configuration for managing gas usage.
  • Bug Fixes
    • Significant adjustments to the expected gas_used values across multiple feature tests to reflect accurate gas consumption metrics.
  • Refactor
    • Removed the max_gas field from the gas handling structure, indicating a shift towards more flexible gas management.
    • Simplified parameter handling in various functions to enhance clarity and streamline execution logic.
  • Chores
    • Removed deprecated constants and parameters from the codebase to ensure a cleaner, more maintainable code structure.

@amimart amimart self-assigned this Jul 24, 2024
Copy link
Contributor

coderabbitai bot commented Jul 24, 2024

Walkthrough

The changes primarily focus on improving the handling of gas consumption in the module, streamlining parameter management, and enhancing documentation. Key modifications include the removal of the max_gas parameter, updates to gas usage calculations, and refinements to the logic for executing queries. These adjustments aim to simplify resource management and provide clearer guidance for users, addressing concerns about gas limits in transaction contexts.

Changes

Files Change Summary
proto/logic/docs.yaml Enhanced documentation on query-gas-limit for managing gas usage.
proto/logic/v1beta2/params.proto Removed max_gas field from Limits message, indicating a shift in gas management.
x/logic/keeper/features/*.feature Updated expected gas_used values across multiple feature files.
x/logic/keeper/grpc_query_ask.go Replaced gas meter handling with a "safe" implementation, refactored limit checks.
x/logic/keeper/grpc_query_ask_test.go Added maxSize parameter to TestGRPCAsk, improved error handling.
x/logic/keeper/interpreter.go Removed limits function, updated execute method to accept params.
x/logic/types/genesis.go Removed constant DefaultIndex.
x/logic/types/params.go Removed KeyInterpreter, KeyLimits, DefaultBootstrap, and WithMaxGas.
x/logic/types/params_test.go Simplified TestValidateParams by removing gas limit configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RPC as RPC Provider
    participant Keeper as Logic Keeper

    User->>RPC: Send Ask Query
    RPC->>Keeper: Execute Query with Safe Gas Meter
    Keeper->>Keeper: Validate Limits
    Keeper->>RPC: Return Results
    RPC->>User: Deliver Response
Loading

Assessment against linked issues

Objective Addressed Explanation
Remove max_gas to prevent transaction gas limit override (#[706])
Enable unlimited gas consumption by default (#[706])
Maintain gas consumption tracking without max_gas (#[706])

Poem

🐰 In the meadow, changes spry,
Gas limits gone, we leap and fly!
Queries now can dance and play,
With safer paths to guide the way.
Hooray for tweaks, so bright and true,
A joyful hop, for me and you! 🌸


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #708      +/-   ##
==========================================
+ Coverage   54.23%   54.37%   +0.14%     
==========================================
  Files          74       73       -1     
  Lines        2906     2893      -13     
==========================================
- Hits         1576     1573       -3     
+ Misses       1234     1226       -8     
+ Partials       96       94       -2     
Files Coverage Δ
x/logic/keeper/grpc_query_ask.go 91.17% <100.00%> (+11.17%) ⬆️
x/logic/keeper/interpreter.go 94.73% <100.00%> (+1.63%) ⬆️
x/logic/types/genesis.go 100.00% <ø> (ø)
x/logic/types/params.go 94.36% <ø> (-0.38%) ⬇️

@amimart amimart requested review from ccamel and bdeneux and removed request for ccamel July 24, 2024 14:02
@amimart amimart marked this pull request as ready for review July 24, 2024 14:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
x/logic/keeper/interpreter.go (1)

Issues found with the removal of the limits function.

The limits function is still referenced in various parts of the codebase, including the interpreter.go file. This indicates that its removal could lead to potential issues or breakages in the code. Please ensure that the removal of the limits function is properly handled and that any necessary replacements or updates are made.

  • Files with references to limits:
    • x/logic/types/params.go
    • x/logic/types/params.pb.go
    • x/logic/types/query.pb.go
    • x/logic/keeper/grpc_query_ask.go
    • x/logic/keeper/features_test.go
    • x/logic/keeper/interpreter.go
    • x/logic/client/cli/query_ask.go
    • app/ante.go
Analysis chain

Line range hint 12-12:
Verify the impact of removing the limits function.

The removal of the limits function indicates a change in how limits are managed. Ensure that this change does not affect any other parts of the codebase that rely on the limits function.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing the `limits` function.

# Test: Search for the usage of the `limits` function. Expect: No usages found.
rg --type go 'limits'

Length of output: 2078

x/logic/keeper/grpc_query_ask_test.go (1)

40-40: Add a description for the new maxSize parameter.

The new parameter maxSize has been added to the test cases. Ensure that its purpose and usage are documented.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e354a2d and dc1b52e.

Files ignored due to path filters (9)
  • docs/predicate/bech32_address_2.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/block_height_1.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/block_time_1.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/consult_1.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/current_output_1.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/open_3.md is excluded by !docs/predicate/**/*.md
  • docs/predicate/open_4.md is excluded by !docs/predicate/**/*.md
  • docs/proto/logic.md is excluded by !docs/proto/**/*.md
  • x/logic/types/params.pb.go is excluded by !**/*.pb.go
Files selected for processing (16)
  • proto/logic/docs.yaml (1 hunks)
  • proto/logic/v1beta2/params.proto (1 hunks)
  • x/logic/keeper/features/bech32_address_2.feature (17 hunks)
  • x/logic/keeper/features/block_height_1.feature (2 hunks)
  • x/logic/keeper/features/block_time_1.feature (2 hunks)
  • x/logic/keeper/features/consult_1.feature (3 hunks)
  • x/logic/keeper/features/current_output_1.feature (5 hunks)
  • x/logic/keeper/features/open_3.feature (1 hunks)
  • x/logic/keeper/features/open_4.feature (11 hunks)
  • x/logic/keeper/grpc_query_ask.go (3 hunks)
  • x/logic/keeper/grpc_query_ask_test.go (6 hunks)
  • x/logic/keeper/grpc_query_params_test.go (1 hunks)
  • x/logic/keeper/interpreter.go (5 hunks)
  • x/logic/types/genesis.go (1 hunks)
  • x/logic/types/params.go (3 hunks)
  • x/logic/types/params_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/logic/types/genesis.go
Additional comments not posted (64)
x/logic/keeper/features/open_3.feature (1)

34-34: Update the expected gas_used value.

The gas_used value has been updated from 2223 to 3877. Ensure that this change reflects the intended adjustment in gas consumption metrics.

Verification successful

The gas_used value has been updated correctly.

The gas_used value of 3877 is present in the specified file x/logic/keeper/features/open_3.feature, confirming the intended adjustment in gas consumption metrics.

  • x/logic/keeper/features/open_3.feature: gas_used: 3877
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the `gas_used` value in the feature tests. Expect: Only occurrences of the new value.
rg --type yaml -A 5 $'gas_used: 3877'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the presence of both old and new `gas_used` values in the feature tests.

# Search for the old `gas_used` value
rg --type yaml -A 5 $'gas_used: 2223'

# Search for the new `gas_used` value
rg --type yaml -A 5 $'gas_used: 3877'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify the presence of the `gas_used` key in the feature tests.

# Search for the `gas_used` key in all file types
rg -A 5 'gas_used:'

Length of output: 28305

x/logic/keeper/features/block_height_1.feature (2)

46-46: Update the expected gas_used value.

The gas_used value has been updated from 2223 to 3877. Ensure that this change reflects the intended adjustment in gas consumption metrics.

Verification successful

The gas_used value has been correctly updated to 3877 in the block_height_1.feature file. The old value 2223 is no longer present.

  • gas_used: 3877 found in x/logic/keeper/features/block_height_1.feature
  • gas_used: 2223 not found in x/logic/keeper/features/block_height_1.feature
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the `gas_used` value in the feature tests. Expect: Only occurrences of the new value.
rg --type yaml -A 5 $'gas_used: 3877'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the presence of `gas_used` values in the block_height_1.feature file.

# Search for the new `gas_used` value in the specific feature file.
rg 'gas_used: 3877' x/logic/keeper/features/block_height_1.feature

# Search for the old `gas_used` value in the specific feature file.
rg 'gas_used: 2223' x/logic/keeper/features/block_height_1.feature

Length of output: 158


19-19: Update the expected gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change reflects the intended adjustment in gas consumption metrics.

Verification successful

Update the expected gas_used value.

The gas_used value has been correctly updated to 3876 in the feature test files. No instances of the old value 2222 were found, confirming the intended adjustment in gas consumption metrics.

  • x/logic/keeper/features/block_height_1.feature
  • docs/predicate/block_height_1.md
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the `gas_used` value in the feature tests. Expect: Only occurrences of the new value.
rg --type yaml -A 5 $'gas_used: 3876'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the old `gas_used` value in the feature tests.
rg --type yaml -A 5 $'gas_used: 2222'

# Test: Search for the new `gas_used` value in the feature tests.
rg --type yaml -A 5 $'gas_used: 3876'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the old `gas_used` value across all files.
rg -A 5 $'gas_used: 2222'

# Test: Search for the new `gas_used` value across all files.
rg -A 5 $'gas_used: 3876'

Length of output: 16509

x/logic/keeper/features/block_time_1.feature (2)

47-47: Update the expected gas_used value.

The gas_used value has been updated from 2223 to 3877. Ensure that this change reflects the intended adjustment in gas consumption metrics.

Verification successful

Update the expected gas_used value.

The gas_used value has been updated from 2223 to 3877 across the relevant feature files, including block_time_1.feature. This change reflects the intended adjustment in gas consumption metrics.

  • x/logic/keeper/features/block_time_1.feature: gas_used: 3877
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the `gas_used` value in the feature tests. Expect: Only occurrences of the new value.
rg --type yaml -A 5 $'gas_used: 3877'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the presence of `gas_used` values in the codebase.

# Test: Search for the old and new `gas_used` values across all file types.
rg 'gas_used: 2223' -A 5
rg 'gas_used: 3877' -A 5

Length of output: 3330


19-19: Update the expected gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change reflects the intended adjustment in gas consumption metrics.

Verification successful

Update the expected gas_used value.

The gas_used value has been updated from 2222 to 3876 as intended. The change is reflected correctly in the feature tests.

  • x/logic/keeper/features/block_time_1.feature
  • Other related feature files
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for the `gas_used` value in the feature tests. Expect: Only occurrences of the new value.
rg --type yaml -A 5 $'gas_used: 3876'

Length of output: 38


Script:

#!/bin/bash
# Description: Verify the change in `gas_used` value in the feature test.

# Test: Search for both the old and new `gas_used` values in the feature tests.
rg --type yaml -A 5 $'gas_used: 2222'
rg --type yaml -A 5 $'gas_used: 3876'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify the presence of `gas_used` key in the feature tests.

# Test: Search for the `gas_used` key in all feature files.
rg 'gas_used:' -A 5

Length of output: 28305

x/logic/types/params_test.go (4)

Line range hint 14-17:
LGTM!

The test case for validating default parameters is unchanged and looks good.


Line range hint 18-31:
LGTM!

The test case for setting specific parameters and validating them looks good after the removal of the WithMaxGas parameter.


Line range hint 32-38:
LGTM!

The test case for validating invalid virtual files in the blacklist is unchanged and looks good.


Line range hint 39-45:
LGTM!

The test case for validating invalid virtual files in the whitelist is unchanged and looks good.

x/logic/keeper/grpc_query_ask.go (3)

53-67: LGTM!

The new checkLimits function correctly encapsulates the logic for checking query size and result count limits.


71-74: LGTM!

The new withSafeGasMeter function correctly returns a context with a safe gas meter.


Line range hint 25-43:
LGTM! But verify the function usage in the codebase.

The changes to the Ask function improve gas consumption handling and limit checking. Ensure that all function calls to Ask are updated accordingly.

Verification successful

LGTM! But verify the function usage in the codebase.

The changes to the Ask function improve gas consumption handling and limit checking. Ensure that all function calls to Ask are updated accordingly.

  • Files to verify:
    • x/logic/wasm/query.go
    • x/logic/types/query.pb.gw.go
    • x/logic/keeper/interpreter.go
    • x/logic/keeper/features_test.go
    • x/logic/keeper/grpc_query_ask_test.go
    • x/logic/client/cli/query_ask.go
    • app/wasm/query.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `Ask` match the new implementation.

# Test: Search for the function usage. Expect: Only occurances of the new implementation.
rg --type go -A 5 $'Ask'

Length of output: 30867

x/logic/keeper/grpc_query_params_test.go (1)

Line range hint 24-36:
LGTM!

The test case for setting specific parameters and validating them looks good after the removal of the WithMaxGas parameter.

x/logic/types/params.go (4)

12-12: Verify the impact of removing KeyInterpreter.

The removal of KeyInterpreter suggests a simplification of the parameter store keys. Ensure that this change does not affect any other parts of the codebase that rely on KeyInterpreter.

Verification successful

No issues found with the removal of KeyInterpreter.

The search across the codebase did not find any references to KeyInterpreter, indicating that its removal does not impact other parts of the codebase.

  • No usages of KeyInterpreter found in the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `KeyInterpreter`.

# Test: Search for the usage of `KeyInterpreter`. Expect: No usages found.
rg --type go 'KeyInterpreter'

Length of output: 29


Script:

#!/bin/bash
# Description: Verify the impact of removing `KeyInterpreter` by searching all file types and including comments and documentation.

# Test: Search for the usage of `KeyInterpreter` across all file types.
rg 'KeyInterpreter'

Length of output: 19


12-12: Verify the impact of removing DefaultBootstrap.

The removal of DefaultBootstrap indicates a potential shift in how bootstrap parameters are managed or initialized. Ensure that this change does not affect any other parts of the codebase that rely on DefaultBootstrap.

Verification successful

The removal of DefaultBootstrap does not impact other parts of the codebase.

No references to DefaultBootstrap were found in the codebase, comments, or documentation, indicating that its removal is safe and does not affect other functionalities.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `DefaultBootstrap`.

# Test: Search for the usage of `DefaultBootstrap`. Expect: No usages found.
rg --type go 'DefaultBootstrap'

Length of output: 31


Script:

#!/bin/bash
# Description: Verify if there are any comments or documentation referencing `DefaultBootstrap`.

# Search for `DefaultBootstrap` in comments within Go files.
rg --type go '//.*DefaultBootstrap'

# Search for `DefaultBootstrap` in markdown and text documentation files.
rg --type md,text 'DefaultBootstrap'

Length of output: 106


Script:

#!/bin/bash
# Description: Verify if there are any comments or documentation referencing `DefaultBootstrap`.

# Search for `DefaultBootstrap` in comments within Go files.
rg --type go '//.*DefaultBootstrap'

# Search for `DefaultBootstrap` in markdown files.
rg --type md 'DefaultBootstrap'

# Search for `DefaultBootstrap` in text files.
rg --type txt 'DefaultBootstrap'

Length of output: 102


12-12: Verify the impact of removing WithMaxGas.

The removal of WithMaxGas indicates a change in how gas limits are configured. Ensure that this change does not affect any other parts of the codebase that rely on WithMaxGas.


12-12: Verify the impact of removing KeyLimits.

The removal of KeyLimits suggests a simplification of the parameter store keys. Ensure that this change does not affect any other parts of the codebase that rely on KeyLimits.

Verification successful

Verify the impact of removing KeyLimits.

The initial search did not find any usages of KeyLimits in Go files. To ensure thorough verification, let's search for KeyLimits across all file types to check for any indirect references.


Verify the impact of removing KeyLimits.

The searches did not find any references to KeyLimits in the current codebase. To ensure thorough verification, let's check the git history for any past references to KeyLimits.


Verify the impact of removing KeyLimits.

The git history search revealed that KeyLimits was used in x/logic/types/params.go and x/logic/types/params_legacy.go. To ensure thorough verification, let's check the current state of these files to confirm the removal or replacement of KeyLimits.


Verify the impact of removing KeyLimits.

The search confirmed that KeyLimits is not present in x/logic/types/params.go, and the params_legacy.go file does not exist. To ensure thorough verification, let's search the entire codebase one more time for any residual references to KeyLimits.


The removal of KeyLimits does not impact the current codebase.

The searches confirmed that KeyLimits has been completely removed from the codebase, with no residual references found.

  • No references to KeyLimits were found in the current codebase.
  • The historical references to KeyLimits have been removed or refactored.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing `KeyLimits`.

# Test: Search for the usage of `KeyLimits`. Expect: No usages found.
rg --type go 'KeyLimits'

Length of output: 24


Script:

#!/bin/bash
# Description: Verify the impact of removing `KeyLimits` across all file types.

# Test: Search for the usage of `KeyLimits` in all file types. Expect: No usages found.
rg 'KeyLimits'

Length of output: 14


Script:

#!/bin/bash
# Description: Verify the impact of removing `KeyLimits` by checking git history.

# Test: Search for the usage of `KeyLimits` in git history. Expect: No historical references found.
git grep 'KeyLimits' $(git rev-list --all)

Length of output: 569


Script:

#!/bin/bash
# Description: Check the current state of `x/logic/types/params.go` and `x/logic/types/params_legacy.go` for references to `KeyLimits`.

# Test: Verify if `KeyLimits` has been removed or replaced in the current codebase.
rg 'KeyLimits' x/logic/types/params.go x/logic/types/params_legacy.go

Length of output: 140


Script:

#!/bin/bash
# Description: Confirm the complete removal of `KeyLimits` by searching the entire codebase.

# Test: Search for any residual references to `KeyLimits` across the entire codebase. Expect: No references found.
rg 'KeyLimits'

Length of output: 14

x/logic/keeper/interpreter.go (2)

47-60: Verify the impact of updating the execute function.

The execute function now accepts a new parameter, params of type types.Params. Ensure that this change does not affect any other parts of the codebase that rely on the execute function.

Verification successful

Verified the impact of updating the execute function.

The execute function has been updated to include the new params argument, and this change is correctly reflected in its usage in x/logic/keeper/grpc_query_ask.go. No other parts of the codebase are affected by this update.

  • x/logic/keeper/grpc_query_ask.go: The execute function call includes the new params argument.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of updating the `execute` function.

# Test: Search for the usage of the `execute` function. Expect: Only occurances of the new signature.
rg --type go 'execute'

Length of output: 2584


Script:

#!/bin/bash
# Description: Verify the impact of updating the `execute` function by searching for its calls within the x/logic/keeper directory.

# Test: Search for the usage of the `execute` function within the x/logic/keeper directory.
rg --type go 'execute' x/logic/keeper

Length of output: 433


Script:

#!/bin/bash
# Description: Verify if the `execute` function call in `x/logic/keeper/grpc_query_ask.go` includes the new `params` argument.

# Extract lines around the `execute` function call in `x/logic/keeper/grpc_query_ask.go`.
rg --type go -A 5 'k.execute' x/logic/keeper/grpc_query_ask.go

Length of output: 186


81-81: Verify the impact of updating the newInterpreter function.

The newInterpreter function now includes the params parameter. Ensure that this change does not affect any other parts of the codebase that rely on the newInterpreter function.

x/logic/keeper/features/current_output_1.feature (5)

107-107: Verify the updated gas_used value in the third scenario.

The gas_used value in the third scenario has been updated to 3976. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

Verification successful

Verify the updated gas_used value in the third scenario.

The gas_used value in the third scenario has been updated to 3976 in both the feature file and the documentation. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

  • x/logic/keeper/features/current_output_1.feature: gas_used: 3976
  • docs/predicate/current_output_1.md: gas_used: 3976
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the updated `gas_used` value in the third scenario.

# Test: Search for the `gas_used` value in the test results. Expect: The value 3976.
rg --type yaml 'gas_used: 3976'

Length of output: 33


Script:

#!/bin/bash
# Description: Verify the updated `gas_used` value in the third scenario across all file types.

# Test: Search for the `gas_used` value in the entire codebase. Expect: The value 3976.
rg 'gas_used: 3976'

Length of output: 261


31-31: Verify the updated gas_used value in the first scenario.

The gas_used value in the first scenario has been updated to 3976. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

Verification successful

The gas_used value has been correctly updated to 3976 in the relevant files.

The updated gas_used value of 3976 is present in both the feature file (x/logic/keeper/features/current_output_1.feature) and the documentation (docs/predicate/current_output_1.md). This confirms that the change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

  • x/logic/keeper/features/current_output_1.feature
  • docs/predicate/current_output_1.md
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the updated `gas_used` value in the first scenario.

# Test: Search for the `gas_used` value in the test results. Expect: The value 3976.
rg --type yaml 'gas_used: 3976'

Length of output: 33


Script:

#!/bin/bash
# Description: Verify the updated `gas_used` value in the first scenario.

# Test: Search for the `gas_used` value in all file types and include context lines. Expect: The value 3976.
rg 'gas_used: 3976' -A 3 -B 3

Length of output: 1650


69-69: Verify the updated gas_used value in the second scenario.

The gas_used value in the second scenario has been updated to 4010. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.


148-148: Verify the updated gas_used value in the fourth scenario.

The gas_used value in the fourth scenario has been updated to 3990. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

Verification successful

The updated gas_used value in the fourth scenario has been verified.

The gas_used value of 3990 is consistently reflected across the codebase, including feature files and documentation. This change aligns with the intended functionality and does not negatively impact the overall performance metrics or cost evaluations.

  • x/logic/keeper/features/current_output_1.feature
  • docs/predicate/current_output_1.md
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the updated `gas_used` value in the fourth scenario.

# Test: Search for the `gas_used` value in the test results. Expect: The value 3990.
rg --type yaml 'gas_used: 3990'

Length of output: 33


Script:

#!/bin/bash
# Description: Re-verify the updated `gas_used` value in the fourth scenario.

# Test: Search for the `gas_used` value in the entire codebase across all file types. Expect: The value 3990.
rg 'gas_used: 3990' -A 3 -B 3

Length of output: 839


Script:

#!/bin/bash
# Description: Examine the usage of `gas_used` in the codebase to understand its impact.

# Test: Search for the usage of `gas_used` in the entire codebase.
rg 'gas_used' -A 5 -B 5

Length of output: 57026


179-179: Verify the updated gas_used value in the fifth scenario.

The gas_used value in the fifth scenario has been updated to 4261. Ensure that this change aligns with the intended functionality and does not affect the overall performance metrics or cost evaluations.

x/logic/keeper/features/consult_1.feature (3)

37-37: Verify the correctness of the updated gas_used value.

The gas_used value is updated to 3878. Ensure that this value is consistent with the expected resource consumption for this query.


93-93: Verify the correctness of the updated gas_used value.

The gas_used value is updated to 3877. Ensure that this value is consistent with the expected resource consumption for this query.


147-147: Verify the correctness of the updated gas_used value.

The gas_used value is updated to 3877. Ensure that this value is consistent with the expected resource consumption for this query.

proto/logic/v1beta2/params.proto (1)

Line range hint 1-1:
Verify the impact of the removal of the max_gas field.

The max_gas field is removed from the Limits message. Ensure that this removal does not impact other parts of the codebase that might rely on this field.

Verification successful

Let's adjust the script to search for the max_gas field across all files to ensure we capture any references to it.


The removal of the max_gas field does not impact the rest of the codebase.

The search for the max_gas field did not return any results, indicating that it is not used elsewhere in the codebase.

  • No further action is required.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the removal of the `max_gas` field in the codebase.

# Test: Search for the usage of the `max_gas` field. Expect: No usage found.
rg --type proto 'max_gas'

Length of output: 55


Script:

#!/bin/bash
# Description: Verify the impact of the removal of the `max_gas` field in the codebase.

# Test: Search for the usage of the `max_gas` field. Expect: No usage found.
rg 'max_gas'

Length of output: 12

proto/logic/docs.yaml (1)

184-186: Verify the clarity and accuracy of the added documentation.

The documentation adds details about the query-gas-limit configuration to manage gas usage outside of transaction contexts. Ensure that this addition is clear and accurate.

x/logic/keeper/features/open_4.feature (11)

46-46: Verify the updated gas_used value.

The gas_used value has been updated to 3882. Ensure this value accurately reflects the expected gas consumption for this scenario.


89-89: Verify the updated gas_used value.

The gas_used value has been updated to 3878. Ensure this value accurately reflects the expected gas consumption for this scenario.


130-130: Verify the updated gas_used value.

The gas_used value has been updated to 3878. Ensure this value accurately reflects the expected gas consumption for this scenario.


152-152: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


173-173: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


194-194: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


215-215: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


235-235: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


254-254: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


273-273: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.


292-292: Verify the updated gas_used value.

The gas_used value has been updated to 3876. Ensure this value accurately reflects the expected gas consumption for this scenario.

x/logic/keeper/features/bech32_address_2.feature (17)

19-19: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


42-42: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


66-66: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


87-87: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


112-112: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


133-133: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


149-149: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


166-166: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


189-189: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


210-210: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


230-230: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


250-250: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


270-270: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


290-290: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


310-310: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


330-330: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.


350-350: Verify the correctness of the updated gas_used value.

The gas_used value has been updated from 2222 to 3876. Ensure that this change accurately reflects the computational resources required for the operation.

x/logic/keeper/grpc_query_ask_test.go (7)

121-122: Ensure the new error message format is correct.

The expected error message format has been updated to include MaxResultCount. Verify that this format is accurate and consistent with the implementation.


123-127: Ensure the new error message format is correct.

The expected error message format has been updated to include MaxSize. Verify that this format is accurate and consistent with the implementation.


146-146: Ensure the new error message format is correct.

The expected error message format has been updated to include out of gas details. Verify that this format is accurate and consistent with the implementation.


154-154: Ensure the new error message format is correct.

The expected error message format has been updated to include out of gas details. Verify that this format is accurate and consistent with the implementation.


287-288: Ensure the new error message format is correct.

The expected error message format has been updated to include limit and maxResultCount details. Verify that this format is accurate and consistent with the implementation.


350-353: Ensure the new maxSize parameter is correctly set.

The maxSize parameter is now included in the params.Limits. Verify that this change is correctly implemented and consistent with the logic.


372-376: Ensure the gas meter logic is correctly implemented.

The logic for setting the gas meter has been updated to differentiate between maxGas and an infinite gas meter. Verify that this change is correctly implemented and consistent with the logic.

Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@amimart amimart merged commit 8bd193e into main Jul 24, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Logic: Gas limit override tx limit
3 participants