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: repo README updates #294

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 64 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<picture>
<source srcset="./.github/assets/bolt-logo-wm-dark.png" media="(prefers-color-scheme: dark)">
<source srcset="./.github/assets/bolt-logo-wm-light.png" media="(prefers-color-scheme: light)">
<img src="./.github/assets/bolt-logo-wm-light.png" alt="BOLT" width="600px">
<img src="./.github/assets/bolt-logo-wm-light.png" alt="BOLT" width="450px">
</picture>
</div>

Expand All @@ -16,44 +16,46 @@

> [!IMPORTANT]
> Bolt is an implementation of _permissionless proposer commitments through
merklefruit marked this conversation as resolved.
Show resolved Hide resolved
> PBS_. In its essence, it consists in a light fork of the current MEV-Boost
> stack that allows users to request **preconfirmations** from proposers, and
> then adds a way for proposers to commit to transaction inclusion in a way that
> is easily verifiable.
> PBS_. In its essence, it consists in a fork of the MEV-Boost stack that allows
> users to request **preconfirmations** from proposers, and then adds a way for
> proposers to commit to transaction inclusion in a way that is verifiable on-chain.

<!-- vim-markdown-toc Marked -->

* [How it works](#how-it-works)
* [Scope of this repository](#scope-of-this-repository)
* [Devnet and demo app](#devnet-and-demo-app)
* [Requirements and setup](#requirements-and-setup)
* [Running the devnet and demo](#running-the-devnet-and-demo)
* [Stopping the devnet and demo](#stopping-the-devnet-and-demo)
* [Telemetry & Metrics](#telemetry-&-metrics)
* [License](#license)
- [How it works](#how-it-works)
- [Repository structure](#repository-structure)
- [Kurtosis Devnet](#kurtosis-devnet)
- [Requirements and setup](#requirements-and-setup)
- [Running the devnet](#running-the-devnet-and-demo)
- [Stopping the devnet](#stopping-the-devnet-and-demo)
- [Telemetry & Metrics](#telemetry-&-metrics)
- [License](#license)

<!-- vim-markdown-toc -->

## How it works

The flow of Bolt can be summarized in the following steps:
The technical flow of Bolt can be summarized in the following steps:

1. Users submit transactions to an RPC endpoint that will forward them to the
proposer opted-in to Bolt in the consensus lookahead window.
2. The proposer can accept this request and turn it into a "constraint" on the block
that it is going to propose. This constraint acts as guarantee of inclusion of
proposer opted-in to Bolt in the beacon chain lookahead window.
2. The proposer can accept this request and turn it into a _commitment_ relative to the
block that it is going to propose. This commitment acts as guarantee of inclusion of
the transaction in the block, also known as a _preconfirmation_.
3. Builders subscribe to proposer constraints in real time through a new relay
streaming endpoint to keep informed about the preconfirmations.
4. Builders build valid blocks that adhere to all constraints, and append inclusion
proofs together with the bids to the relay.
5. When it's time to propose a block, the proposer will fetch the best valid bid
3. Near the time of block proposal, the proposer will share the list of committed transactions
with the relays that are connected to block builders. This list is called a _constraint_.
4. Builders subscribe to proposer constraints in real time through a new relay
streaming endpoint to keep informed about the outstanding preconfirmations.
5. Builders build valid blocks that adhere to all _constraints_, and append inclusion
proofs together with the bids to the relay for trustless verification.
6. When it's time to propose a block, the proposer will fetch the best valid bid
from the relay, and verify its inclusion proofs locally before signing the header.
6. If the constraints are respected, the proposer can propose the payload as usual
7. If the constraints are respected, the proposer can propose the payload as usual
by sending the signed header back to the relay. If not, the proposer can self-build
a payload and propose it directly instead.

The following diagram illustrates the flow:
<details>
<summary>Here is a diagram illustrating the flow explained above:</summary>

```mermaid
sequenceDiagram
Expand Down Expand Up @@ -85,34 +87,45 @@ sequenceDiagram
end
```

## Scope of this repository
</details>

This repository contains all the necessary components to illustrate the flow
described above. It can be thought of a reference implementation.
## Repository structure

This monorepo contains all the necessary components of the Bolt protocol stack.
In particular, the core components are:

- [**Bolt Sidecar**](./bolt-sidecar/): New validator software (akin to [mev-boost][fb-mev-boost])
that handles the receipt of preconfirmation requests from users, translates them
into constraints, and forwards them to relays. Additionally, it handles the
into _constraints_, and forwards them to relays. Additionally, it handles the
fallback logic to produce a block locally when relays send invalid inclusion proofs.
- [**Builder**](./builder/): A fork of the [Flashbots builder][fb-builder] that
subscribes to new constraints from relays, builds blocks that respect them, and
includes the necessary proofs of inclusion in the bid submitted to relays.
- [**Relay**](./mev-boost-relay/): A fork of the [Flashbots relay][fb-relay] that
includes the necessary proofs of inclusion in the bids submitted to relays.
- [**MEV-Boost Relay**](./mev-boost-relay/): A fork of the [Flashbots relay][fb-relay] that
receives constraints from proposers, and forwards them to builders. It also
receives bids with proofs of inclusion from builders, verifies them and forwards
the best bid to proposers for block proposal.
- [**MEV-Boost**](./mev-boost/): A fork of the [Flashbots MEV-Boost][fb-mev-boost] sidecar
that includes new API endpoints to proxy requests from the Bolt Sidecar to the connected relays.
- [**Bolt Contracts**](./bolt-contracts/): A set of smart contracts for peripheral functionality
such as proposer registration and permissionless dispute resolution for attributable faults.
- [**Bolt Boost**](./bolt-boost/): A [Commit-Boost][commit-boost] module that implements the
Constraints-API and is compatible with the Bolt Sidecar.
- [**Bolt client**](./bolt-client/): A CLI tool to send preconfirmations on enabled test networks.
- [**Bolt Kurtosis client**](./bolt-kurtosis-client/): A CLI tool to send preconfirmations on our Kurtosis devnet.
- [**Bolt delegations CLI**](./bolt-delegations-cli/): A CLI tool to generate signed delegation and revocation messages for ETH validators.
- [**Testnets**](./testnets/): A set of guides and scripts to deploy the Bolt contracts on testnets.

Additionally, this repository contains the necessary scripts to spin up a [Kurtosis][kurtosis]
devnet with all the components running.

Additionally, this repository contains the necessary scripts to spin up a [Kurtosis][kurtosis] devnet
with all the components running, and a simple [web demo](./bolt-web-demo/) to showcase the preconfirmation flow.
> [!NOTE]
> Bolt also works with external components that aren't part of this repository,
> such as [Helix][helix] by Gattaca, which will replace the MEV-Boost relay soon.
merklefruit marked this conversation as resolved.
Show resolved Hide resolved

## Devnet and demo app
## Kurtosis Devnet

We are using a full [Kurtosis][kurtosis] devnet stack, with custom Docker images
We are using a forked [Kurtosis][kurtosis] devnet stack, with custom Docker images
for the core components outlined above. The exact version of the Ethereum-package used
in our devnet can be seen [here](https://github.com/chainbound/ethereum-package).

Expand All @@ -127,8 +140,9 @@ Make sure you have the following requirements on your machine:
- [Just](https://github.com/casey/just) installed
- [Kurtosis CLI](https://docs.kurtosis.com/install/) installed
- [Foundry](https://book.getfoundry.sh/getting-started/installation) installed
- [Rust & Cargo](https://www.rust-lang.org/tools/install) installed

> [!WARNING]
> [!NOTE]
> The Kurtosis CLI version tested is `0.88.16`. Some issues may arise if you are
> using a different version.
>
Expand All @@ -140,9 +154,9 @@ Then, clone this repository and navigate to the root directory of the project:
git clone git@github.com:chainbound/bolt.git && cd bolt
```

### Running the devnet and demo
### Running the devnet

Running the devnet and demo is straightforward once you have the requirements
Running the devnet is straightforward once you have the requirements
installed. Just run the following commands in your terminal:

```shell
Expand All @@ -151,20 +165,16 @@ just build-images

# spin up the kurtosis devnet on your machine
just up

# run the web demo servers.
just demo
```

The web demo will be available on your browser at [`http://localhost:3000`](http://localhost:3000).
merklefruit marked this conversation as resolved.
Show resolved Hide resolved

**Commit-Boost support**

The devnet by default will run using a fork of MEV-Boost which
supports the [Constraints-API](https://docs.boltprotocol.xyz/api/builder).
Bolt also supports [Commit-Boost](https://commit-boost.github.io/commit-boost-client/)
by providing a compatible MEV-Boost module called _Bolt-Boost_
that implements the Constraints-API. To use it in the devnet
The devnet by default will run using a fork of MEV-Boost which supports
the [Constraints-API](https://docs.boltprotocol.xyz/api/builder). Bolt also
supports [Commit-Boost][commit-boost] by providing a compatible MEV-Boost module
called _Bolt-Boost_ that implements the Constraints-API. To use it in the devnet
add the appropriate `bolt_boost_image` in the `kurtosis_config.yaml` file:

```yaml
Expand All @@ -177,10 +187,7 @@ mev_params:
# ... the rest of the `mev_params`
```

### Stopping the devnet and demo

The demo app will remain open until you press `Ctrl+C` in the terminal where
you ran the `just demo` command.
### Stopping the devnet

To stop the devnet, run the following command:

Expand All @@ -192,28 +199,23 @@ just down
just clean
```

> [!WARNING]
> [!NOTE]
> Remember to shut down the devnet environment when you are done with it, as it
> consumes significant resources (CPU & RAM) on your machine.

## License

MIT. Forked repositories have their own licenses.

<!-- Links -->

[twitter]: https://twitter.com/chainbound_
[discord]: https://discord.gg/pK8GgjxYQS
[docs]: https://chainbound.github.io/bolt-docs/
[docs]: https://docs.boltprotocol.xyz/
[new-issue]: https://github.com/chainbound/bolt/issues/new
[fb-mev-boost]: https://github.com/flashbots/mev-boost
[fb-relay]: https://github.com/flashbots/mev-boost-relay
[fb-builder]: https://github.com/flashbots/builder
[kurtosis]: https://www.kurtosis.com/

## Telemetry & Metrics

The Bolt sidecar offers an optional set of metrics that can be scraped by a Prometheus server, and shown in Grafana dashboards.
They show various informations such as the number of constraints received, the number of blocks proposed, etc.

These metrics are enabled by default but can be disabled by setting running the sidecar with the `--metrics` flag set to `false`.

## License

MIT. Forked repositories have their own licenses.
[helix]: https://github.com/gattaca-com/helix
[commit-boost]: https://commit-boost.github.io/commit-boost-client/
10 changes: 8 additions & 2 deletions bolt-boost/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Bolt-Boost

Bolt-Boost is a [commit-boost](https://commit-boost.github.io/commit-boost-client) module that extends the default PBS module with the [constraints-API](https://chainbound.github.io/bolt-docs/api/builder).
It inherits the PBS module configuration for the modified `get_header` call.
Bolt-Boost is a [Commit-Boost][commit-boost] module that extends the default PBS module
with the [constraints-API][constraints-api]. It inherits the PBS module configuration
for the modified `get_header` call.

[commit-boost]: https://commit-boost.github.io/commit-boost-client
[constraints-api]: https://docs.boltprotocol.xyz/api/builder

<!-- TODO: Add usage docs -->
2 changes: 1 addition & 1 deletion bolt-client/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bolt CLI client

This is a simple CLI tool to interact with Bolt.
This is a CLI tool to interact with Bolt by sending preconfirmation requests.

## Requirements

Expand Down
4 changes: 2 additions & 2 deletions bolt-client/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BoltRegistry {
}
}

/// Gets the next pre-confirmation slot and proposer RPC URL from the registry contract
/// Gets the next preconfirmation slot and proposer RPC URL from the registry contract
///
/// Returns Ok(None) if no registered validators are found in the lookahead
pub async fn next_preconfer_from_registry(
Expand All @@ -89,7 +89,7 @@ impl BoltRegistry {
next_preconfer_slot = duty.slot;
proposer_rpc = token_raw.metadata.rpc;
info!(
"pre-confirmation will be sent for slot {} to validator with index {} at url {}",
"preconfirmation will be sent for slot {} to validator with index {} at url {}",
duty.slot,
duty.validator_index,
proposer_rpc,
Expand Down
1 change: 1 addition & 0 deletions bolt-delegations-cli/delegations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions bolt-delegations-cli/private_key.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1a28765fd3e2a37f8477b8ec79434e682c538eb3d79ecbd6690d4d1712a8ac58
14 changes: 9 additions & 5 deletions bolt-kurtosis-client/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## A pre-confirmation spammer for the Helder testnet
## A preconfirmation sender for the Kurtosis devnet

To run the spammer, make sure to set the following environment variables in a `.env` file:
To run the tool, make sure to set the following environment variables in a `.env` file:

```text
EL_PROVIDER_URL=https://rpc.helder-devnets.xyz
Expand All @@ -12,6 +12,10 @@ REGISTRY_ABI_PATH=./registry_abi.json

This template can be found in the `env.example` file.

Then, just run the spammer with `cargo run`. It will fetch all the validators of the current epoch,
and try to send a pre-confirmation to the first one registered on the Bolt registry.
If no validators are found, the program will gracefully exit. Please try again in the next epoch!
Then, just run the tool with `cargo run`.

It will fetch all the validators of the current epoch, and try to send a
preconfirmation to the first one registered on the Bolt registry.

If no validators are found, the program will gracefully exit.
Please try again in the next epoch!
Loading