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

feat(core): add Branch.ExecuteWithGasLimit API #18457

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

testinginprod
Copy link
Contributor

@testinginprod testinginprod commented Nov 13, 2023

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features

    • Introduced a new feature to execute functions with a specified gas limit to prevent excessive gas consumption.
  • Documentation

    • Updated the changelog to reflect the addition of gas limit execution control.
  • Bug Fixes

    • Implemented error handling for scenarios where the gas limit is exceeded during function execution.

Copy link
Contributor

coderabbitai bot commented Nov 13, 2023

Walkthrough

Walkthrough

A new feature has been introduced to limit the gas consumption during the execution of functions in an isolated context. The ExecuteWithGasLimit function has been added to the Service interface, allowing users to specify a gas limit for execution. If the execution exceeds this limit, the newly defined ErrGasLimitExceeded error is returned. This update aims to prevent unbounded gas usage, enhancing the system's robustness against potentially expensive operations.

Changes

File Change Summary
core/CHANGELOG.md Added entry for branch.ExecuteWithGasLimit in pull request #18457.
core/branch/branch.go Introduced ErrGasLimitExceeded error and ExecuteWithGasLimit function to the Service interface.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

@testinginprod testinginprod marked this pull request as ready for review November 13, 2023 15:24
@testinginprod testinginprod requested a review from a team as a code owner November 13, 2023 15:24
@github-prbot github-prbot requested review from a team, alexanderbez and likhita-809 and removed request for a team November 13, 2023 15:24
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 912390d and 95377b1.
Files selected for processing (2)
  • core/CHANGELOG.md (1 hunks)
  • core/branch/branch.go (2 hunks)
Additional comments: 3
core/CHANGELOG.md (1)
  • 37-41: The changelog update correctly reflects the addition of the new branch.ExecuteWithGasLimit feature. It's important to ensure that the versioning and release notes will be updated accordingly when the feature is officially released.
core/branch/branch.go (2)
  • 9-11: The introduction of a new error variable ErrGasLimitExceeded is clear and follows Go's idiomatic way of defining package-level errors. Ensure that this error is handled wherever ExecuteWithGasLimit is called.

  • 26-33: The ExecuteWithGasLimit function is well-documented, explaining its purpose and behavior. However, it's important to ensure that the implementation of this function correctly measures and limits the gas usage as intended, and that it is thread-safe if the service is expected to be used concurrently.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

lgtm

@testinginprod testinginprod added this pull request to the merge queue Nov 14, 2023
Merged via the queue into main with commit 569e3ff Nov 14, 2023
60 of 61 checks passed
@testinginprod testinginprod deleted the tip/core/branch/gas_limit branch November 14, 2023 10:34
@coderabbitai coderabbitai bot mentioned this pull request May 3, 2024
12 tasks
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.

4 participants