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(sidecar): add max_committed_gas_per_slot to sidecar Limits #150

Merged
merged 12 commits into from
Jul 19, 2024

Conversation

namn-grg
Copy link
Contributor

@namn-grg namn-grg commented Jul 19, 2024

fixes #144

Summary by CodeRabbit

  • New Features

    • Introduced enhanced gas management parameters for improved performance and resource management.
    • Added a method to calculate total committed gas in the BlockTemplate for better performance metrics.
  • Bug Fixes

    • Improved error handling with a new validation error type for gas commitment limits.
  • Documentation

    • Updated configuration documentation to reflect new parameters related to gas management.

Copy link
Contributor

coderabbitai bot commented Jul 19, 2024

Warning

Rate limit exceeded

@namn-grg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 0 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 6e3aae9 and d2e6a8e.

Walkthrough

The recent changes enhance the Bolt sidecar's execution state management by introducing new gas commitment limits. The ExecutionState now incorporates parameters for both commitment counts and gas limits, improving resource management during block processing. Additionally, the BlockTemplate has been updated to provide total committed gas, bolstering analytics capabilities. These modifications ensure a more efficient handling of resource constraints.

Changes

Files Change Summary
bolt-sidecar/bin/sidecar.rs, bolt-sidecar/src/state/execution.rs Enhanced ExecutionState with an additional gas commitment parameter and updated initialization logic accordingly.
bolt-sidecar/src/builder/template.rs Introduced a new committed_gas method to BlockTemplate to calculate total committed gas for performance metrics.
bolt-sidecar/src/config/mod.rs Expanded Opts and Limits structs to include new parameters for gas management, with default values set appropriately.

Assessment against linked issues

Objective Addressed Explanation
Add max_committed_gas_per_slot to Limits (144)
Enable limiting both number and gas amount for commitments (144)
Integrate Limits into ExecutionState (144) Limits struct is not incorporated directly into ExecutionState.

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.

@namn-grg namn-grg marked this pull request as ready for review July 19, 2024 07:30
@thedevbirb
Copy link
Contributor

Nice work! Can you please add some tests?

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 48095c3 and 28a17c5.

Files selected for processing (4)
  • bolt-sidecar/bin/sidecar.rs (1 hunks)
  • bolt-sidecar/src/builder/template.rs (1 hunks)
  • bolt-sidecar/src/config/mod.rs (3 hunks)
  • bolt-sidecar/src/state/execution.rs (13 hunks)
Additional comments not posted (10)
bolt-sidecar/bin/sidecar.rs (1)

31-35: Ensure correct usage of the new parameter.

The ExecutionState is now initialized with an additional parameter config.limits.max_committed_gas_per_slot. Ensure that this parameter is correctly used in the ExecutionState implementation.

Verification successful

Verified: The new parameter max_committed_gas_per_slot is correctly used in the ExecutionState implementation.

  • The ExecutionState struct includes the max_committed_gas_per_slot field.
  • The new method in ExecutionState correctly initializes the max_committed_gas_per_slot field with the provided parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new parameter in the `ExecutionState` implementation.

# Test: Search for the implementation of `ExecutionState::new`. Expect: The new parameter is used correctly.
ast-grep --lang rust --pattern $'impl ExecutionState {
  $$$
  fn new($_, $_, $_) {
    $$$
  }
  $$$
}'

Length of output: 105


Script:

#!/bin/bash
# Description: Search for the `ExecutionState` struct definition to understand its parameters.
ast-grep --lang rust --pattern 'struct ExecutionState {
  $$$
}'

# Description: Search for the `new` method implementation of `ExecutionState`.
ast-grep --lang rust --pattern 'impl ExecutionState {
  fn new($_, $_, $_) {
    $$$
  }
}'

Length of output: 160


Script:

#!/bin/bash
# Description: Search for the `ExecutionState` keyword in the codebase to locate its struct definition and method implementations.
rg 'ExecutionState'

Length of output: 1418


Script:

#!/bin/bash
# Description: Extract the `ExecutionState` struct definition from `bolt-sidecar/src/state/execution.rs`.
rg -A 20 'pub struct ExecutionState' bolt-sidecar/src/state/execution.rs

# Description: Extract the `new` method implementation from `bolt-sidecar/src/state/execution.rs`.
rg -A 30 'impl<C: StateFetcher> ExecutionState<C> {' bolt-sidecar/src/state/execution.rs

Length of output: 1205


Script:

#!/bin/bash
# Description: Extract the complete `ExecutionState` struct definition from `bolt-sidecar/src/state/execution.rs`.
rg -A 40 'pub struct ExecutionState' bolt-sidecar/src/state/execution.rs

# Description: Extract the `new` method implementation from `bolt-sidecar/src/state/execution.rs` with corrected regex.
rg -A 40 'impl<C: StateFetcher> ExecutionState<C> \{' bolt-sidecar/src/state/execution.rs

Length of output: 3031

bolt-sidecar/src/config/mod.rs (4)

143-143: Ensure correct usage of the new field.

The max_committed_gas_per_slot field is added to the Limits struct. Ensure that this field is correctly used in the application logic.


50-52: Ensure correct usage of the new field.

The max_committed_gas field is added to the Opts struct. Ensure that this field is correctly used in the configuration process.

Verification successful

Ensure correct usage of the new field.

The max_committed_gas field is added to the Opts struct and is used in various parts of the codebase. The instances found in sidecar.rs, execution.rs, and mod.rs suggest that the field is integrated into the configuration process and state management. Ensure that these usages are correct and consistent with the intended functionality.

  • bolt-sidecar/bin/sidecar.rs: Line 78
  • bolt-sidecar/src/state/execution.rs: Lines 50, 52, 54, 56, 58, 60, 62
  • bolt-sidecar/src/config/mod.rs: Lines 52, 54, 56, 58, 60
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new field `max_committed_gas` in the configuration process.

# Test: Search for the usage of `max_committed_gas`. Expect: The field is used correctly in the configuration process.
rg --type rust 'max_committed_gas'

Length of output: 1168


150-150: Verify the appropriateness of the default value.

The default value for max_committed_gas_per_slot is set to 10,000,000. Ensure that this value is appropriate for the application's requirements.


177-180: Ensure correct integration of the new option.

The max_committed_gas option is integrated into the TryFrom<Opts> implementation. Ensure that this option is correctly used in the configuration process.

Verification successful

Integration of max_committed_gas is correct.

The max_committed_gas option is correctly integrated into the TryFrom<Opts> implementation and is used appropriately in the configuration process.

  • mod.rs: Defined in the Limits struct and set within the TryFrom<Opts> implementation.
  • execution.rs: Utilized in the ExecutionState initialization and validation logic.
  • sidecar.rs: Passed to the ExecutionState during initialization.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of the `max_committed_gas` option in the `TryFrom<Opts>` implementation.

# Test: Search for the usage of `max_committed_gas` in the `TryFrom<Opts>` implementation. Expect: The option is used correctly in the configuration process.
rg --type rust 'max_committed_gas'

Length of output: 1168


Script:

#!/bin/bash
# Description: Gather detailed context for the usage of `max_committed_gas` in the relevant files.

# Display lines around the occurrences of `max_committed_gas` to understand its context and usage.
rg --type rust 'max_committed_gas' -A 5 -B 5

Length of output: 7921

bolt-sidecar/src/builder/template.rs (1)

114-124: Ensure correct implementation and usage of the new method.

The committed_gas method calculates and returns the total committed gas for the block template. Ensure that this method is correctly implemented and verify its usage.

Verification successful

The committed_gas method is correctly implemented and used.

The method is used in bolt-sidecar/src/state/execution.rs to enforce the constraint on the maximum committed gas per slot, ensuring the block template adheres to the allowed gas limits.

  • bolt-sidecar/src/state/execution.rs: Usage of committed_gas to check and enforce gas limits.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new method `committed_gas` in the `BlockTemplate` implementation.

# Test: Search for the usage of `committed_gas`. Expect: The method is used correctly in the `BlockTemplate` implementation.
rg --type rust 'committed_gas'

Length of output: 1243


Script:

#!/bin/bash
# Description: Extract and review the context of the `committed_gas` method usage in `bolt-sidecar/src/state/execution.rs`.

# Extract 10 lines before and after the usage of `committed_gas` for context.
rg --type rust -A 10 -B 10 'template.committed_gas\(\)' bolt-sidecar/src/state/execution.rs

Length of output: 1050

bolt-sidecar/src/state/execution.rs (4)

210-226: LGTM! Verify the logic and error handling.

The addition of checks for max_committed_gas_per_slot in the validate_commitment_request function looks good.

Ensure that the logic and error handling are correctly implemented.

Verification successful

LGTM! Verify the logic and error handling.

The addition of checks for max_committed_gas_per_slot in the validate_commitment_request function looks good. The logic and error handling are correctly implemented, as evidenced by the comprehensive test cases and error handling in the actual usage.

  • Test cases in execution.rs cover various validation errors.
  • Error handling in sidecar.rs includes proper logging and response handling.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the logic and error handling for `max_committed_gas_per_slot` in the `validate_commitment_request` function.

# Test: Search for the usage of the `validate_commitment_request` function. Expect: Proper logic and error handling.
rg --type rust 'validate_commitment_request'

Length of output: 1290


Script:

#!/bin/bash
# Extract context around the usage of `validate_commitment_request` function to review logic and error handling.

# Extract 10 lines of context around each match
rg --type rust 'validate_commitment_request' -A 10 -B 10

Length of output: 17325


119-120: LGTM! Verify the initialization and usage of the new field.

The addition of max_committed_gas_per_slot to the ExecutionState struct looks good.

Ensure that the new field is correctly initialized and used in the codebase.

Verification successful

Initialization and usage of the max_committed_gas_per_slot field are correct.

  • The field is initialized with a valid non-zero value in config/mod.rs.
  • It is used appropriately for validation in execution.rs.
  • It is passed as part of the configuration in sidecar.rs.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization and usage of the new `max_committed_gas_per_slot` field in the codebase.

# Test: Search for the initialization and usage of the new field. Expect: Proper initialization and usage of the new field.
rg --type rust 'max_committed_gas_per_slot'

Length of output: 993


Script:

#!/bin/bash
# Description: Verify the initialization and usage of the new `max_committed_gas_per_slot` field in the codebase.

# Check initialization in config/mod.rs
rg --type rust 'max_committed_gas_per_slot' -A 5 bolt-sidecar/src/config/mod.rs

# Check usage in execution.rs
rg --type rust 'max_committed_gas_per_slot' -A 5 bolt-sidecar/src/state/execution.rs

# Check usage in sidecar.rs
rg --type rust 'max_committed_gas_per_slot' -A 5 bolt-sidecar/bin/sidecar.rs

Length of output: 2341


63-65: LGTM! Verify the usage of the new ValidationError variant.

The addition of MaxCommittedGasReachedForSlot to the ValidationError enum looks good and the error message format is consistent with the existing ones.

Ensure that the new error variant is correctly used and handled in the codebase.


Line range hint 153-168:
LGTM! Verify the parameter passing and initialization logic.

The modification to the new function to accept max_committed_gas_per_slot as a parameter looks good.

Ensure that the parameter passing and initialization logic are correctly implemented.

Verification successful

LGTM! The parameter passing and initialization logic for max_committed_gas_per_slot are correctly implemented.

  • The new function in ExecutionState correctly accepts max_committed_gas_per_slot as a parameter.
  • The initialization logic within the function properly assigns this parameter to the corresponding field in the Self struct.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the parameter passing and initialization logic for `max_committed_gas_per_slot` in the `new` function.

# Test: Search for the usage of the `new` function. Expect: Proper parameter passing and initialization logic.
rg --type rust 'ExecutionState::new'

Length of output: 1107


Script:

#!/bin/bash
# Description: Extract the implementation of the `new` function in `ExecutionState` to verify parameter passing and initialization logic.

# Fetch the implementation of the `new` function in `ExecutionState`.
ast-grep --lang rust --pattern 'impl ExecutionState {
  pub async fn new($_, $_, $_) -> Result<Self, TransportError> {
    $$$
  }
}' --debug

Length of output: 361


Script:

#!/bin/bash
# Description: Extract the implementation of the `new` function in `ExecutionState` to verify parameter passing and initialization logic.

# Fetch the implementation of the `new` function in `ExecutionState`.
ast-grep --lang rust --pattern 'impl ExecutionState {
  pub async fn new($_, $_, $_) -> Result<Self, TransportError> {
    $$$
  }
}' --debug-query

Length of output: 346


Script:

#!/bin/bash
# Description: Extract the implementation of the `new` function in `ExecutionState` to verify parameter passing and initialization logic.

# Fetch the implementation of the `new` function in `ExecutionState`.
rg 'impl ExecutionState' -A 50 --type rust

Length of output: 44


Script:

#!/bin/bash
# Description: Extract the implementation of the `new` function in `ExecutionState` to verify parameter passing and initialization logic.

# Fetch the implementation of the `new` function in `ExecutionState`.
rg 'pub async fn new' -A 50 --type rust

Length of output: 9023

Comment on lines 222 to 229
// Check if the committed gas exceeds the maximum
if template.committed_gas().to::<u64>() >= max_committed_gas_per_slot {
return Err(ValidationError::MaxCommittedGasReachedForSlot(
self.slot,
max_committed_gas_per_slot,
));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here I think you should check if
template.committed_gas() + tx.gas_limit >= max_committed_gas_per_slot
otherwise with the previous request I can ask for huge gas limit and overcome the max value.
Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good point! Then I think we should also do the tx.gas_limit >= max_committed_gas_per_slot check in case no template is there right? updated

@namn-grg namn-grg marked this pull request as draft July 19, 2024 08:15
Copy link
Collaborator

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

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

Great! LGTM so far

@namn-grg namn-grg marked this pull request as ready for review July 19, 2024 10:58
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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 28a17c5 and 75f4dfe.

Files selected for processing (3)
  • bolt-sidecar/bin/sidecar.rs (1 hunks)
  • bolt-sidecar/src/builder/template.rs (1 hunks)
  • bolt-sidecar/src/state/execution.rs (17 hunks)
Additional comments not posted (6)
bolt-sidecar/bin/sidecar.rs (1)

31-31: LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ExecutionState::new match the new signature.

Verification successful

All instances of ExecutionState::new match the new signature.

The function calls to ExecutionState::new are consistent with the new signature across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

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

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type rust -A 5 $'ExecutionState::new'

Length of output: 5228

bolt-sidecar/src/builder/template.rs (1)

114-124: LGTM! The committed_gas method is well-implemented.

The method correctly calculates the total committed gas in the block template.

bolt-sidecar/src/state/execution.rs (4)

64-66: New validation error type added.

The MaxCommittedGasReachedForSlot variant is correctly added to the ValidationError enum.


120-121: New field added to ExecutionState.

The max_committed_gas_per_slot field is correctly added to the ExecutionState struct.


Line range hint 151-165:
Constructor updated to accept Limits struct.

The constructor is correctly updated to accept the Limits struct and initialize the new field.


Line range hint 207-233:
Validation logic updated to check committed gas.

The validation logic is correctly updated to check the committed gas against the new limit.

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 75f4dfe and 0a2d652.

Files selected for processing (1)
  • bolt-sidecar/src/state/execution.rs (16 hunks)
Additional comments not posted (5)
bolt-sidecar/src/state/execution.rs (5)

64-66: Addition of new validation error type looks good.

The new MaxCommittedGasReachedForSlot error type is correctly defined.


120-121: Addition of new field max_committed_gas_per_slot looks good.

The new field max_committed_gas_per_slot is correctly defined.


Line range hint 151-165:
Modification of constructor method new looks good.

The constructor method new has been correctly updated to accept a Limits struct.


217-235: Addition of checks for maximum committed gas looks good.

The new checks for maximum committed gas have been correctly added to the validate_commitment_request method.


Line range hint 725-926:
Addition of new test test_invalid_inclusion_request_with_excess_gas looks good.

The new test test_invalid_inclusion_request_with_excess_gas is correctly defined.

Comment on lines 117 to 122
chain_id: u64,
/// The maximum number of commitments per slot.
max_commitments_per_slot: NonZero<usize>,
/// The maximum committed gas per slot.
max_committed_gas_per_slot: NonZero<u64>,
/// The KZG settings for validating blobs.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it better to make them into a single field - limits?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes in my opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Co-authored-by: Lorenzo <lorenzo.feroleto.dev@gmail.com>
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 0a2d652 and c36b542.

Files selected for processing (1)
  • bolt-sidecar/src/state/execution.rs (16 hunks)
Additional comments not posted (4)
bolt-sidecar/src/state/execution.rs (4)

64-66: Addition of new validation error variant looks good.

The new variant MaxCommittedGasReachedForSlot has been correctly added to the ValidationError enum.


120-121: Addition of new field max_committed_gas_per_slot looks good.

The new field max_committed_gas_per_slot has been correctly added to the ExecutionState struct.


Line range hint 151-165:
Updates to the constructor method new look good.

The constructor method new has been correctly updated to accept a Limits struct and initialize the new field max_committed_gas_per_slot.


602-605: New test cases look good.

The new test cases correctly validate the behavior of the system when the committed gas exceeds the defined limit.

Also applies to: 724-754, 871-925

bolt-sidecar/src/state/execution.rs Outdated Show resolved Hide resolved
bolt-sidecar/bin/sidecar.rs Outdated Show resolved Hide resolved
Comment on lines 117 to 122
chain_id: u64,
/// The maximum number of commitments per slot.
max_commitments_per_slot: NonZero<usize>,
/// The maximum committed gas per slot.
max_committed_gas_per_slot: NonZero<u64>,
/// The KZG settings for validating blobs.
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes in my opinion

bolt-sidecar/src/state/execution.rs Show resolved Hide resolved
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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between c36b542 and 6e3aae9.

Files selected for processing (3)
  • bolt-sidecar/bin/sidecar.rs (1 hunks)
  • bolt-sidecar/src/config/mod.rs (3 hunks)
  • bolt-sidecar/src/state/execution.rs (16 hunks)
Additional comments not posted (8)
bolt-sidecar/bin/sidecar.rs (1)

31-31: Initialization of ExecutionState with config.limits looks good.

The change improves the flexibility and maintainability of the initialization process.

bolt-sidecar/src/config/mod.rs (3)

50-52: Addition of max_committed_gas to Opts struct looks good.

The new field aligns with the PR objectives and is correctly integrated.


143-150: Addition of max_committed_gas_per_slot to Limits struct and update to default implementation look good.

The new field aligns with the PR objectives and is correctly integrated.


177-179: Modification to TryFrom<Opts> for Config looks good.

The change ensures that the new gas limit is integrated into the configuration process.

bolt-sidecar/src/state/execution.rs (4)

64-66: Addition of MaxCommittedGasReachedForSlot to ValidationError enum looks good.

The new variant aligns with the PR objectives and is correctly integrated.


118-119: Update to ExecutionState struct to include limits field looks good.

The change improves the management of limits related to transaction commitments and gas usage.


Line range hint 149-162:
Update to new method of ExecutionState to accept Limits struct looks good.

The change improves the initialization process by passing the entire limits object.


206-226: Updates to validate_commitment_request look good.

The method has been correctly updated to include checks for the new max_committed_gas_per_slot limit. Ensure that redundant checks are avoided.

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

Let's gooo

@thedevbirb thedevbirb merged commit 3e4ad89 into unstable Jul 19, 2024
2 checks passed
@thedevbirb thedevbirb deleted the ng/feat/sidecar/committed-gas-limit branch July 19, 2024 12:32
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.

feat(sidecar): add max_committed_gas_per_slot to sidecar Limits
3 participants