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): integrate local builder with builder api #97

Merged
merged 21 commits into from
Jul 4, 2024

Conversation

thedevbirb
Copy link
Contributor

@thedevbirb thedevbirb commented Jun 28, 2024

  • finally got rid of TxEnvelope in favour of reth_primitives::TransactionSigned
  • debugging in the Kurtosis setup, by killing the builder and expecting a local fallback

With this PR, we will be able to build blocks locally including the preconfirmed transactions.

Summary by CodeRabbit

  • New Features

    • Introduced generic signing traits for synchronous and asynchronous BLS signature generation.
    • Added CommitmentDeadline struct for managing commitment deadlines.
    • Introduced LocalBuilder for local builder management.
  • Bug Fixes

    • Improved error handling in CommitmentsRpc and ExecutionState methods.
    • Adjusted slot-related logic in ConsensusState to manage commitments based on timing.
  • Refactor

    • Renamed various parameters and functions for clarity and consistency.
    • Reorganized and updated exported entities across multiple modules for better maintainability.
  • Tests

    • Updated tests to reflect changes in method signatures and new functionalities.
    • Added new test utilities for improved testing flexibility.

@thedevbirb thedevbirb force-pushed the feat/fallback-builder-api branch from 9116295 to 5ac37bd Compare July 1, 2024 15:26
@merklefruit merklefruit marked this pull request as ready for review July 3, 2024 12:40
@merklefruit merklefruit requested a review from mempirate July 3, 2024 12:40
Comment on lines +41 to +46
/// Poll the deadline until it is reached.
pub async fn wait(&mut self) -> Option<u64> {
let slot = poll_fn(|cx| self.poll_unpin(cx)).await;
self.sleep = None;
slot
}
Copy link
Collaborator

@merklefruit merklefruit Jul 3, 2024

Choose a reason for hiding this comment

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

note to reviewers: we haven't measured the efficiency of this future, in the context of being polled inside a tokio::select branch. Any suggestion is welcome

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just await self.sleep directly?

Copy link
Collaborator

Choose a reason for hiding this comment

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

because self.sleep is an Option

Comment on lines +49 to 66
/// Poll the deadline until it is reached.
///
/// - If already reached, the future will return `None` immediately.
/// - If not reached, the future will return `Some(slot)` when the deadline is reached.
impl Future for CommitmentDeadline {
type Output = Option<u64>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let Some(ref mut sleep) = self.sleep else {
return Poll::Ready(None);
};

match sleep.as_mut().poll(cx) {
Poll::Ready(_) => Poll::Ready(Some(self.slot)),
Poll::Pending => Poll::Pending,
}
}
}
Copy link
Collaborator

@merklefruit merklefruit Jul 3, 2024

Choose a reason for hiding this comment

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

The idea is that we select on the Some(slot) result, meaning that it won't match if the future returns None immediately, which is the case if the sleep future is already over, until Self::new() is called again

@merklefruit merklefruit requested a review from namn-grg July 3, 2024 12:54
Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

LGTM. Some questions and notes, but overall great job. What a shit show local block building turned out to be lmao

bolt-sidecar/bin/sidecar.rs Outdated Show resolved Hide resolved
bolt-sidecar/bin/sidecar.rs Show resolved Hide resolved
bolt-sidecar/src/builder/mod.rs Show resolved Hide resolved
bolt-sidecar/src/builder/mod.rs Show resolved Hide resolved
bolt-sidecar/src/builder/mod.rs Show resolved Hide resolved
bolt-sidecar/src/builder/payload_builder.rs Show resolved Hide resolved
bolt-sidecar/src/state/execution.rs Outdated Show resolved Hide resolved
Comment on lines +41 to +46
/// Poll the deadline until it is reached.
pub async fn wait(&mut self) -> Option<u64> {
let slot = poll_fn(|cx| self.poll_unpin(cx)).await;
self.sleep = None;
slot
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just await self.sleep directly?

@merklefruit merklefruit force-pushed the feat/fallback-builder-api branch from f2020f0 to bf76777 Compare July 3, 2024 14:12
Copy link
Contributor

@namn-grg namn-grg left a comment

Choose a reason for hiding this comment

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

LGTM, great work!

@mempirate
Copy link
Contributor

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes to the bolt-sidecar repository involve updates and enhancements across several modules. These include introducing new traits and methods for BLS signatures, refactoring API request handling, updating transaction handling, renaming functions and parameters for clarity, and modifying state management and consensus logic. The overall aim is to improve the readability, robustness, and functionality of the codebase.

Changes

Files/Modules Change Summary
bolt-sidecar/src/crypto/bls.rs Added new declarations for fixed-size byte arrays, generic signing traits for synchronous and asynchronous BLS signature generation.
bolt-sidecar/src/crypto/mod.rs Updated public exports to include new generic signing traits.
bolt-sidecar/src/json_rpc/api.rs Refactored API request handling, updated request types, and improved error management.
bolt-sidecar/src/json_rpc/mod.rs Renamed start_server to start_rpc_server.
bolt-sidecar/src/lib.rs Renamed and reorganized exported entities. Introduced LocalBuilder.
bolt-sidecar/src/primitives/commitment.rs Refactored transaction serialization/deserialization and fee validation logic.
bolt-sidecar/src/primitives/constraint.rs Changed method from encode_2718 to encode_enveloped for building constraints.
bolt-sidecar/src/primitives/mod.rs Renamed modules, updated function parameters, and modified data structures.
bolt-sidecar/src/state/consensus.rs Introduced CommitmentDeadline struct and refactored slot-related logic.
bolt-sidecar/src/state/execution.rs Reorganized imports, refactored ExecutionState fields/methods, and added commit_transaction.
bolt-sidecar/src/state/fetcher.rs Renamed parameters in StateFetcher methods and refactored StateClient initialization.
bolt-sidecar/src/state/head_tracker.rs Renamed beacon_url to beacon_api_url.
bolt-sidecar/src/state/mod.rs Introduced CommitmentDeadline struct and updated state management methods and tests.
bolt-sidecar/src/test_util.rs Added new functions (try_get_engine_api_url, get_test_config), and modified default_test_transaction to accept an optional nonce parameter.

Sequence Diagram(s)

N/A


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 Configration 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
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 comments (7)
bolt-sidecar/src/client/commit_boost.rs (2)

Line range hint 35-49: Improve error handling in the spawned task.

The function CommitBoostClient::new correctly initializes a new CommitBoostClient instance. However, the error handling in the spawned task could be improved by adding proper error handling instead of using expect.

- tokio::spawn(async move {
-     this.load_pubkeys().await.expect("failed to load pubkeys");
- });
+ tokio::spawn(async move {
+     if let Err(e) = this.load_pubkeys().await {
+         tracing::error!(error = ?e, "failed to load pubkeys");
+     }
+ });

Line range hint 51-74: Add a retry limit to the loop.

The function load_pubkeys correctly loads public keys from a remote client and stores them locally. However, it could benefit from a retry limit to avoid potential infinite loops.

- loop {
+ let mut attempts = 0;
+ while attempts < 10 {
+     attempts += 1;
bolt-sidecar/src/api/builder.rs (3)

Line range hint 87-94: LGTM!

The register_validators function is well-structured.

Reminder: Intercept this request to register Bolt validators on-chain as well.

The TODO comment indicates future work.

Do you want me to generate the code to intercept this request or open a GitHub issue to track this task?


Line range hint 106-150: LGTM!

The get_header function is well-structured and handles errors appropriately.

Reminder: Handle failure when no local payload is produced.

The TODO comment indicates a need to handle this case.

Do you want me to generate the code to handle this failure or open a GitHub issue to track this task?


Line range hint 188-230: LGTM!

The get_payload function is well-structured and handles errors appropriately.

Reminder: Handle failures when submitting the signed blinded block.

The TODO comment indicates a need to handle this case.

Do you want me to generate the code to handle these failures or open a GitHub issue to track this task?

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

Line range hint 117-171: LGTM!

The try_commit function is well-structured and handles validation appropriately.

Reminder: Check max_fee_per_blob_gas against the blob_base_fee.

The TODO comment indicates a need to handle this case.

Do you want me to generate the code to handle this check or open a GitHub issue to track this task?

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

Line range hint 103-237: LGTM!

The build_fallback_payload function is well-structured and handles the payload building process appropriately.

Reminder: Handle potential reorgs and refactor once ConsensusState is ready.

The TODO comments indicate a need to handle these cases.

Do you want me to generate the code to handle potential reorgs and refactor or open a GitHub issue to track these tasks?

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between b4f57cb and d074de9.

Files ignored due to path filters (1)
  • bolt-sidecar/Cargo.lock is excluded by !**/*.lock
Files selected for processing (29)
  • Justfile (2 hunks)
  • bolt-sidecar/Cargo.toml (1 hunks)
  • bolt-sidecar/bin/sidecar.rs (1 hunks)
  • bolt-sidecar/src/api/builder.rs (10 hunks)
  • bolt-sidecar/src/api/spec.rs (3 hunks)
  • bolt-sidecar/src/builder/compat.rs (5 hunks)
  • bolt-sidecar/src/builder/mod.rs (2 hunks)
  • bolt-sidecar/src/builder/payload_builder.rs (9 hunks)
  • bolt-sidecar/src/builder/signature.rs (1 hunks)
  • bolt-sidecar/src/builder/template.rs (6 hunks)
  • bolt-sidecar/src/client/commit_boost.rs (2 hunks)
  • bolt-sidecar/src/client/mevboost.rs (1 hunks)
  • bolt-sidecar/src/client/pubsub.rs (1 hunks)
  • bolt-sidecar/src/common.rs (4 hunks)
  • bolt-sidecar/src/config.rs (5 hunks)
  • bolt-sidecar/src/crypto/bls.rs (2 hunks)
  • bolt-sidecar/src/crypto/mod.rs (1 hunks)
  • bolt-sidecar/src/json_rpc/api.rs (5 hunks)
  • bolt-sidecar/src/json_rpc/mod.rs (1 hunks)
  • bolt-sidecar/src/lib.rs (2 hunks)
  • bolt-sidecar/src/primitives/commitment.rs (4 hunks)
  • bolt-sidecar/src/primitives/constraint.rs (2 hunks)
  • bolt-sidecar/src/primitives/mod.rs (7 hunks)
  • bolt-sidecar/src/state/consensus.rs (6 hunks)
  • bolt-sidecar/src/state/execution.rs (8 hunks)
  • bolt-sidecar/src/state/fetcher.rs (7 hunks)
  • bolt-sidecar/src/state/head_tracker.rs (1 hunks)
  • bolt-sidecar/src/state/mod.rs (7 hunks)
  • bolt-sidecar/src/test_util.rs (4 hunks)
Additional comments not posted (102)
bolt-sidecar/src/crypto/mod.rs (1)

3-3: Exported items look good.

The added exports for SignerBLS and SignerBLSAsync are correctly implemented and consistent with the rest of the code.

bolt-sidecar/src/client/pubsub.rs (1)

17-17: Implementation of PubsubClient looks good.

The PubsubClient implementation is correctly implemented and consistent with the rest of the code.

bolt-sidecar/src/lib.rs (4)

9-10: Exported items look good.

The added exports for start_builder_proxy_server and BuilderProxyConfig are correctly implemented and consistent with the rest of the code.


24-24: Exported item looks good.

The added export for LocalBuilder is correctly implemented and consistent with the rest of the code.


28-28: Exported items look good.

The added exports for Chain, Config, and Opts are correctly implemented and consistent with the rest of the code.


35-35: Exported item looks good.

The added export for start_rpc_server is correctly implemented and consistent with the rest of the code.

bolt-sidecar/Cargo.toml (1)

17-18: Added dependencies look good.

The added dependencies for tree_hash and tree_hash_derive are correctly implemented and consistent with the rest of the code.

bolt-sidecar/src/common.rs (3)

2-2: Added import looks good.

The added import for TransactionSigned is correctly implemented and consistent with the rest of the code.


29-32: Implementation of max_transaction_cost looks good.

The max_transaction_cost function is correctly implemented and consistent with the rest of the code.


Line range hint 43-47: Implementation of validate_transaction looks good.

The validate_transaction function is correctly implemented and consistent with the rest of the code.

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

22-22: LGTM!

The start_rpc_server function is well-structured and follows good practices for setting up a server.


Line range hint 41-41: LGTM!

The handle_rpc_request function handles parsing and method dispatching appropriately. Error handling is in place.


Line range hint 66-66: LGTM!

The handle_rejection function handles different types of rejections and provides meaningful error messages.

bolt-sidecar/src/primitives/constraint.rs (2)

92-92: LGTM!

The change to use encode_enveloped instead of encode_2718 is consistent with the new encoding method.


Line range hint 102-102: LGTM!

The as_bytes function is well-implemented.

bolt-sidecar/src/state/head_tracker.rs (3)

36-37: LGTM!

The change to use beacon_api_url instead of beacon_url improves clarity and is consistent with naming conventions.


Line range hint 72-72: LGTM!

The stop function is well-implemented.


Line range hint 78-78: LGTM!

The next_head function is well-implemented.

bolt-sidecar/src/crypto/bls.rs (3)

39-42: LGTM!

The SignerBLS trait is well-defined and provides a clear interface for synchronous BLS signature generation.


46-49: LGTM!

The SignerBLSAsync trait is well-defined and provides a clear interface for asynchronous BLS signature generation.


Line range hint 54-54: LGTM!

The Signer struct implements the SignerBLS and SignerBLSAsync traits and provides methods for BLS signature generation and verification.

Justfile (1)

81-83: LGTM!

The kill-builder task is well-implemented and follows good practices for stopping a Docker container.

bolt-sidecar/src/test_util.rs (5)

38-44: LGTM!

The function try_get_engine_api_url correctly checks the reachability of the test engine client.


63-79: LGTM!

The function get_test_config correctly constructs the test configuration and handles potential errors.


87-95: LGTM!

The function default_test_transaction correctly creates a default transaction template for tests and allows an optional nonce parameter.


Line range hint 97-99: LGTM!

The function test_bls_secret_key correctly creates a default BLS secret key.


Line range hint 102-132: LGTM!

The struct TestSignableData and its implementations for SignableBLS and SignableECDSA are correctly defined and implemented.

bolt-sidecar/src/client/commit_boost.rs (1)

Line range hint 67-82: LGTM!

The function sign correctly signs data asynchronously using BLS signatures.

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

38-49: LGTM!

The function add_transaction correctly adds a transaction to the block template and updates the state diff.


61-65: LGTM!

The function blob_count correctly returns the blob count of the block template.


Line range hint 73-79: LGTM!

The function remove_transaction_at_index correctly removes a transaction at a specified index and updates the state diff.


Line range hint 83-109: LGTM!

The function retain correctly retains transactions that do not conflict with the given account state.


Line range hint 133-137: LGTM!

The function get_diff correctly returns the nonce and balance diff for a given address.


Line range hint 127-131: LGTM!

The struct StateDiff correctly tracks intermediate changes to the state according to the block template.


Line range hint 19-28: LGTM!

The struct BlockTemplate correctly serves as a fallback block template and keeps intermediary state for new commitment requests.

bolt-sidecar/src/primitives/commitment.rs (6)

47-53: LGTM!

The function deserialize_tx_signed correctly deserializes a signed transaction.


56-63: LGTM!

The function serialize_tx_signed correctly serializes a signed transaction.


Line range hint 66-71: LGTM!

The function deserialize_from_str correctly deserializes a value from a string.


Line range hint 74-82: LGTM!

The function signature_as_str correctly serializes a signature as a string.


88-91: LGTM!

The function digest correctly returns the digest of an inclusion request.


Line range hint 106-144: LGTM!

The tests correctly cover deserialization of inclusion and commitment requests.

bolt-sidecar/src/builder/signature.rs (6)

17-31: LGTM!

The function sign_builder_message correctly signs a builder message using a BLS secret key.


35-48: LGTM!

The function verify_signed_builder_message correctly verifies a signed builder message using a BLS public key.


51-63: LGTM!

The function verify_signature correctly verifies a BLS signature for a given message and public key.


69-72: LGTM!

The function sign_message correctly signs arbitrary bytes with a BLS secret key.


83-89: LGTM!

The function compute_signing_root correctly computes the signing root for a given object root and signing domain.


96-114: LGTM!

The function compute_builder_domain correctly computes the Application Builder domain for signing arbitrary builder-api messages.

bolt-sidecar/src/client/mevboost.rs (2)

126-126: LGTM!

The code changes are approved.


126-126: LGTM!

The code changes are approved.

bolt-sidecar/src/state/fetcher.rs (5)

28-28: LGTM!

The code changes are approved.


51-51: LGTM!

The code changes are approved.


78-83: LGTM!

The code changes are approved.


105-111: LGTM!

The code changes are approved.


146-146: LGTM!

The code changes are approved.

bolt-sidecar/src/api/spec.rs (2)

67-68: LGTM!

The code changes are approved.


110-112: LGTM!

The code changes are approved.

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

73-81: LGTM!

The code changes are approved.


86-91: LGTM!

The code changes are approved.


96-148: LGTM!

The code changes are approved.

bolt-sidecar/bin/sidecar.rs (8)

3-3: LGTM!

The code changes are approved.


25-25: LGTM!

The code changes are approved.


31-58: LGTM!

The code changes are approved.


68-120: LGTM!

The code changes are approved.


121-132: LGTM!

The code changes are approved.


133-144: LGTM!

The code changes are approved.


145-159: LGTM!

The code changes are approved.


160-164: LGTM!

The code changes are approved.

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

Line range hint 10-17: Update import paths for deneb module.

The import paths have been updated to reflect the new module structure. Ensure that all references to the deneb module are correctly updated across the codebase.

Verification successful

The search results show multiple references to the deneb module across various files. Here are the locations:

  • bolt-sidecar/src/builder/compat.rs
  • bolt-sidecar/src/builder/signature.rs
  • bolt-sidecar/src/builder/mod.rs
  • bolt-sidecar/src/state/consensus.rs
  • bolt-sidecar/src/crypto/bls.rs
  • bolt-sidecar/src/primitives/mod.rs
  • bolt-sidecar/src/api/spec.rs
  • bolt-sidecar/src/api/builder.rs
  • bolt-sidecar/src/client/mevboost.rs

We need to ensure that all these references are correctly updated and consistent with the new module structure.


All references to the deneb module are correctly updated.

The references to the deneb module across the codebase are consistent and correctly reflect the new module structure. No issues were found.

  • bolt-sidecar/src/crypto/bls.rs
  • bolt-sidecar/src/state/consensus.rs
  • bolt-sidecar/src/builder/signature.rs
  • bolt-sidecar/src/builder/mod.rs
  • bolt-sidecar/src/builder/compat.rs
  • bolt-sidecar/src/api/spec.rs
  • bolt-sidecar/src/api/builder.rs
  • bolt-sidecar/src/primitives/mod.rs
  • bolt-sidecar/src/client/mevboost.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `deneb` module are correctly updated.

# Test: Search for references to `deneb`. Expect: Only updated references.
rg --type rust 'deneb'

Length of output: 1027


Script:

#!/bin/bash
# Description: Check the context around each reference to the `deneb` module in the listed files to ensure correctness.

# Extract 5 lines before and after each reference to `deneb` for context.
for file in $(rg --files-with-matches 'deneb' --type rust); do
    echo "File: $file"
    rg -C 5 'deneb' $file
    echo "----------------------------------------"
done

Length of output: 6279


90-90: Update field name in FetchPayloadRequest.

The field name response has been updated to response_tx for clarity and consistency.

Verification successful

Update field name in FetchPayloadRequest.

The field name response has been correctly updated to response_tx for clarity and consistency.

  • bolt-sidecar/src/primitives/mod.rs: Line 90
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to `response_tx` are correctly updated.

# Test: Search for references to `response_tx`. Expect: Only updated references.
rg --type rust 'response_tx'

Length of output: 1278


Script:

#!/bin/bash
# Description: Verify the definition of `response_tx` in `json_rpc/api.rs`.

# Test: Search for the definition of `response_tx` to confirm its context.
rg --type rust 'response_tx' --context 5 json_rpc/api.rs

Length of output: 112


Script:

#!/bin/bash
# Description: Verify the definition of `response_tx` in existing files.

# Test: Search for the definition of `response_tx` to confirm its context.
rg --type rust 'response_tx' --context 5

Length of output: 7457


148-148: Update field in PayloadAndBlobs.

The blobs_bundle field is no longer optional, ensuring it is always present.

bolt-sidecar/src/state/consensus.rs (5)

11-11: Introduce CommitmentDeadline struct.

The CommitmentDeadline struct is introduced to handle commitment deadlines in the ConsensusState struct.


87-90: Update validate_request method to check commitment deadline.

The validate_request method now includes logic to check the commitment deadline, ensuring that requests are validated against the deadline.


101-104: Update update_head method to reset commitment deadline.

The update_head method now includes logic to reset the commitment deadline when the head is updated.


38-49: Update ConsensusState struct to include new fields.

The ConsensusState struct now includes latest_slot_timestamp, latest_slot, commitment_deadline, and commitment_deadline_duration to enhance slot and deadline tracking.


26-26: Update Epoch struct to include proposer_duties.

The Epoch struct now includes proposer_duties to track proposer duties.

Verification successful

Update Epoch struct to include proposer_duties.

The Epoch struct now includes proposer_duties to track proposer duties. All references to proposer_duties are correctly updated within the bolt-sidecar/src/state/consensus.rs file, and there are no references outside this file that need updating.

  • bolt-sidecar/src/state/consensus.rs: All references to proposer_duties are correctly updated.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to `proposer_duties` are correctly updated.

# Test: Search for references to `proposer_duties`. Expect: Only updated references.
rg --type rust 'proposer_duties'

Length of output: 732


Script:

#!/bin/bash
# Description: Verify all references to `proposer_duties` outside `bolt-sidecar/src/state/consensus.rs`.

# Test: Search for references to `proposer_duties` in the entire codebase except `bolt-sidecar/src/state/consensus.rs`.
rg --type rust 'proposer_duties' --glob '!bolt-sidecar/src/state/consensus.rs'

Length of output: 78

bolt-sidecar/src/json_rpc/api.rs (2)

10-10: Introduce CommitmentRequest struct.

The CommitmentRequest struct is introduced to handle commitment requests in the ApiEvent struct.


55-58: Update field name in ApiEvent.

The field name response has been updated to response_tx for clarity and consistency.

Verification successful

Update field name in ApiEvent.

The field name response has been successfully updated to response_tx for clarity and consistency. No remaining references to the old response field were found.

  • bolt-sidecar/bin/sidecar.rs
  • bolt-sidecar/src/json_rpc/api.rs
  • bolt-sidecar/src/primitives/mod.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to `response_tx` are correctly updated.

# Test: Search for references to `response_tx`. Expect: Only updated references.
rg --type rust 'response_tx'

Length of output: 1278


Script:

#!/bin/bash
# Description: Verify no remaining references to the old `response` field.

# Test: Search for references to `response`. Expect: No references to the old field.
rg --type rust '\bresponse\b'

Length of output: 4730

bolt-sidecar/src/builder/compat.rs (3)

8-8: Introduce TransactionSigned type.

The TransactionSigned type is introduced to ensure compatibility with the new transaction structure.


Line range hint 146-163: Update to_consensus_execution_payload function to use TransactionSigned.

The to_consensus_execution_payload function now uses the TransactionSigned type to ensure compatibility with the new transaction structure.


180-188: Update to_consensus_withdrawal function to use ExecutionAddress.

The to_consensus_withdrawal function now uses the ExecutionAddress type to ensure compatibility with the new address structure.

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

4-8: Introduce CommitmentDeadline struct.

The CommitmentDeadline struct is introduced to handle commitment deadlines.


27-32: Update CommitmentDeadline struct to include sleep field.

The CommitmentDeadline struct now includes a sleep field to handle sleep durations.


41-46: Update wait method to handle sleep field.

The wait method now includes logic to handle the sleep field, ensuring that the method correctly handles sleep durations.

bolt-sidecar/src/api/builder.rs (3)

Line range hint 35-43: LGTM!

The BuilderProxyServer struct is well-defined and the new fields are appropriately added.


Line range hint 249-266: LGTM!

The start_builder_proxy_server function is well-structured and the changes are appropriate.


274-276: LGTM!

The index function is straightforward and appropriate.

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

Line range hint 14-42: LGTM!

The ValidationError enum is well-defined and appropriately documents each error.


Line range hint 63-80: LGTM!

The ExecutionState struct is well-defined and the fields are appropriately documented.


84-91: LGTM!

The new function is well-structured and the changes are appropriate.


Line range hint 176-185: LGTM!

The commit_transaction function is well-structured and the changes are appropriate.


187-197: LGTM!

The update_head function is well-structured and the changes are appropriate.


Line range hint 200-207: LGTM!

The apply_state_update function is well-structured and the changes are appropriate.


Line range hint 209-237: LGTM!

The refresh_templates function is well-structured and the changes are appropriate.

bolt-sidecar/src/config.rs (2)

Line range hint 1-70: LGTM!

The constants and command-line options are well-defined and documented.


Line range hint 71-306: LGTM!

The Config struct and related implementations are well-defined and appropriately handle the configuration options.

bolt-sidecar/src/builder/payload_builder.rs (7)

41-47: LGTM!

The FallbackPayloadBuilder struct is well-defined and appropriately documents its purpose and fields.


52-65: LGTM!

The new function is well-structured and the changes are appropriate.


Line range hint 263-313: LGTM!

The fetch_next_payload_hint function is well-structured and the changes are appropriate.


Line range hint 316-324: LGTM!

The parse_geth_response function is well-structured and the changes are appropriate.


Line range hint 327-377: LGTM!

The build_header_with_hints_and_context function is well-structured and the changes are appropriate.


396-424: LGTM!

The test_build_fallback_payload function is well-structured and the changes are appropriate.


427-433: LGTM!

The test_empty_el_withdrawals_root function is well-structured and the changes are appropriate.

feat: refactor config and add ChainConfig
@mempirate mempirate self-requested a review July 4, 2024 07:22
@thedevbirb thedevbirb merged commit 3ad9942 into feat/sidecar/builder-api Jul 4, 2024
@thedevbirb thedevbirb deleted the feat/fallback-builder-api branch July 4, 2024 07:23
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