Skip to content

Commit

Permalink
Merge branch 'unstable' into lore/feat/holesky-launch
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 28, 2024
2 parents 34cf8c5 + 304cd37 commit 73a6fd3
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 53 deletions.
8 changes: 8 additions & 0 deletions .github/.linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dirs:
- .

excludedDirs:
- bolt-contracts/lib
- testnets/helder

useGitIgnore: true
10 changes: 9 additions & 1 deletion .github/workflows/contracts_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Bolt-contracts CI

on: [push, pull_request]
on:
push:
paths:
- "bolt-contracts/**"
branches:
- unstable
pull_request:
paths:
- "bolt-contracts/**"

jobs:
check:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Linkspector

on:
pull_request:
push:
branches:
- unstable

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-links:
name: runner / linkspector
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run linkspector
uses: umbrelladocs/[email protected]
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
config_file: .github/.linkspector.yml
fail_on_error: true
filter_mode: nofilter
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
- [Additional components](#additional-components)
- [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)
- [Running the devnet](#running-the-devnet)
- [Stopping the devnet](#stopping-the-devnet)
- [License](#license)

<!-- vim-markdown-toc -->
Expand Down Expand Up @@ -178,7 +177,7 @@ just up
**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
the [Constraints-API](https://docs.boltprotocol.xyz/technical-docs/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:
Expand Down
2 changes: 1 addition & 1 deletion bolt-boost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ with the [constraints-API][constraints-api]. It inherits the PBS module configur
for the modified `get_header` call.

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

<!-- TODO: Add usage docs -->
11 changes: 5 additions & 6 deletions bolt-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
- [Admin Privileges](#admin-privileges)
- [Validator Registration: `BoltValidators`](#validator-registration-boltvalidators)
- [Bolt Network Entrypoint: `BoltManager`](#bolt-network-entrypoint-boltmanager)
- [Fault Proof Challenge and Slashing: `BoltChallenger`](#fault-proof-challenge-and-slashing-boltchallenger)
- [Fault Proof Challenge: `BoltChallenger`](#fault-proof-challenge-boltchallenger)
- [Holesky Deployments](#holesky-deployments)
- [Testing](#testing)
- [Security Considerations](#security-considerations)
- [Conclusion](#conclusion)

## Overview

Expand All @@ -38,7 +37,7 @@ and multiple system-wide parameters can be changed by this administrator in the

## System-wide Parameters: `BoltParameters`

[`BoltParameters`](./src/contracts/BoltParameters.sol) is an upgradeable storage contract that stores system-wide parameters that the other
[`BoltParameters`](./src/contracts/BoltParametersV1.sol) is an upgradeable storage contract that stores system-wide parameters that the other
contracts can read from. An overview is given in the table below:

| Parameter | Initial Value | Mutable after deployment |
Expand All @@ -58,7 +57,7 @@ The values of these parameters can also be found in [`parameters.json`](./config

## Validator Registration: `BoltValidators`

The [`BoltValidators`](./src/contracts/BoltValidators.sol) contract is the only point of entry for
The [`BoltValidators`](./src/contracts/BoltValidatorsV1.sol) contract is the only point of entry for
validators to signal their intent to participate in Bolt Protocol and authenticate with their BLS private key.

The registration process includes the following steps:
Expand All @@ -77,7 +76,7 @@ will allow us to test the registration flow in a controlled environment.

## Bolt Network Entrypoint: `BoltManager`

The [`BoltManager`](./src/contracts/BoltManager.sol) contract is a crucial component of Bolt that
The [`BoltManager`](./src/contracts/BoltManagerV1.sol) contract is a crucial component of Bolt that
integrates with restaking ecosystems Symbiotic and Eigenlayer. It manages the registration and
coordination of validators, operators, and vaults within the Bolt network.

Expand All @@ -92,7 +91,7 @@ the `IBoltMiddleware` contracts, such as `BoltSymbioticMiddleware` and `BoltEige

## Fault Proof Challenge: `BoltChallenger`

The [`BoltChallenger`](./src/contracts/BoltChallenger.sol) contract is the component responsible
The [`BoltChallenger`](./src/contracts/BoltChallengerV1.sol) contract is the component responsible
for handling fault attribution in the case of a validator failing to meet their commitments.

In short, the challenger contract allows any user to challenge a validator's commitment by opening
Expand Down
2 changes: 1 addition & 1 deletion bolt-contracts/docs/admin/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bytes memory initManager = abi.encodeCall(BoltManagerV2.initialize, (params));
Upgrades.upgradeProxy(proxy, "BoltManagerV2.sol", initManager, opts);
```

Before an upgrade, update the [`Upgrade.s.sol`](../script/holesky/Upgrade.s.sol) script to include the correct contracts, references and configurations.
Before an upgrade, update the [`Upgrade.s.sol](../../script/holesky/admin/Upgrade.s.sol) script to include the correct contracts, references and configurations.

## Unsafe
In order to run an unsafe upgrade, set `Options.unsafeSkipAllChecks` to `true`:
Expand Down
2 changes: 0 additions & 2 deletions bolt-sidecar/bin/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,4 @@ async fn main() -> Result<()> {
}
}
}

Ok(())
}
8 changes: 4 additions & 4 deletions bolt-sidecar/src/builder/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,25 @@ mod tests {
fn test_compute_builder_domain() {
let mainnet = ChainConfig::mainnet();
assert_eq!(
compute_builder_domain(mainnet.fork_version(), None),
compute_builder_domain(mainnet.chain.fork_version(), None),
mainnet.application_builder_domain()
);

let holesky = ChainConfig::holesky();
assert_eq!(
compute_builder_domain(holesky.fork_version(), None),
compute_builder_domain(holesky.chain.fork_version(), None),
holesky.application_builder_domain()
);

let kurtosis = ChainConfig::kurtosis(0, 0);
assert_eq!(
compute_builder_domain(kurtosis.fork_version(), None),
compute_builder_domain(kurtosis.chain.fork_version(), None),
kurtosis.application_builder_domain()
);

let helder = ChainConfig::helder();
assert_eq!(
compute_builder_domain(helder.fork_version(), None),
compute_builder_domain(helder.chain.fork_version(), None),
helder.application_builder_domain()
);
}
Expand Down
66 changes: 42 additions & 24 deletions bolt-sidecar/src/config/chain.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use core::fmt;
use std::{fmt::Display, time::Duration};
use std::{
fmt::{Display, Formatter},
time::Duration,
};

use clap::{Args, ValueEnum};
use ethereum_consensus::deneb::{compute_fork_data_root, Root};
Expand All @@ -21,8 +24,14 @@ pub const APPLICATION_BUILDER_DOMAIN_MASK: [u8; 4] = [0, 0, 0, 1];
/// The domain mask for signing commit-boost messages.
pub const COMMIT_BOOST_DOMAIN_MASK: [u8; 4] = [109, 109, 111, 67];

pub const DEFAULT_CHAIN_CONFIG: ChainConfig = ChainConfig {
chain: Chain::Mainnet,
commitment_deadline: DEFAULT_COMMITMENT_DEADLINE_IN_MILLIS,
slot_time: DEFAULT_SLOT_TIME_IN_SECONDS,
enable_unsafe_lookahead: false,
};

/// Configuration for the chain the sidecar is running on.
/// This allows to customize the slot time for custom Kurtosis devnets.
#[derive(Debug, Clone, Copy, Args, Deserialize)]
pub struct ChainConfig {
/// Chain on which the sidecar is running
Expand All @@ -33,26 +42,30 @@ pub struct ChainConfig {
#[clap(
long,
env = "BOLT_SIDECAR_COMMITMENT_DEADLINE",
default_value_t = DEFAULT_COMMITMENT_DEADLINE_IN_MILLIS
default_value_t = DEFAULT_CHAIN_CONFIG.commitment_deadline
)]
commitment_deadline: u64,
pub(crate) commitment_deadline: u64,
/// The slot time duration in seconds. If provided,
/// it overrides the default for the selected [Chain].
#[clap(
long,
env = "BOLT_SIDECAR_SLOT_TIME",
default_value_t = DEFAULT_SLOT_TIME_IN_SECONDS
default_value_t = DEFAULT_CHAIN_CONFIG.slot_time,
)]
pub(crate) slot_time: u64,
/// Toggle to enable unsafe lookahead for the sidecar. If `true`, commitments requests will be
/// validated against a two-epoch lookahead window.
#[clap(
long,
env = "BOLT_SIDECAR_ENABLE_UNSAFE_LOOKAHEAD",
default_value_t = DEFAULT_CHAIN_CONFIG.enable_unsafe_lookahead
)]
slot_time: u64,
pub(crate) enable_unsafe_lookahead: bool,
}

impl Default for ChainConfig {
fn default() -> Self {
Self {
chain: Chain::Mainnet,
commitment_deadline: DEFAULT_COMMITMENT_DEADLINE_IN_MILLIS,
slot_time: DEFAULT_SLOT_TIME_IN_SECONDS,
}
DEFAULT_CHAIN_CONFIG
}
}

Expand All @@ -76,10 +89,20 @@ impl Chain {
Chain::Kurtosis => "kurtosis",
}
}

/// Get the fork version for the given chain.
pub fn fork_version(&self) -> [u8; 4] {
match self {
Chain::Mainnet => [0, 0, 0, 0],
Chain::Holesky => [1, 1, 112, 0],
Chain::Helder => [16, 0, 0, 0],
Chain::Kurtosis => [16, 0, 0, 56],
}
}
}

impl Display for Chain {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.name())
}
}
Expand Down Expand Up @@ -115,16 +138,6 @@ impl ChainConfig {
self.compute_domain_from_mask(COMMIT_BOOST_DOMAIN_MASK)
}

/// Get the fork version for the given chain.
pub fn fork_version(&self) -> [u8; 4] {
match self.chain {
Chain::Mainnet => [0, 0, 0, 0],
Chain::Holesky => [1, 1, 112, 0],
Chain::Helder => [16, 0, 0, 0],
Chain::Kurtosis => [16, 0, 0, 56],
}
}

/// Get the commitment deadline duration for the given chain.
pub fn commitment_deadline(&self) -> Duration {
Duration::from_millis(self.commitment_deadline)
Expand All @@ -134,7 +147,7 @@ impl ChainConfig {
fn compute_domain_from_mask(&self, mask: [u8; 4]) -> [u8; 32] {
let mut domain = [0; 32];

let fork_version = self.fork_version();
let fork_version = self.chain.fork_version();

// Note: the application builder domain specs require the genesis_validators_root
// to be 0x00 for any out-of-protocol message. The commit-boost domain follows the
Expand Down Expand Up @@ -163,7 +176,12 @@ impl ChainConfig {
}

pub fn kurtosis(slot_time_in_seconds: u64, commitment_deadline: u64) -> Self {
Self { chain: Chain::Kurtosis, slot_time: slot_time_in_seconds, commitment_deadline }
Self {
chain: Chain::Kurtosis,
slot_time: slot_time_in_seconds,
commitment_deadline,
..Default::default()
}
}
}

Expand Down
1 change: 1 addition & 0 deletions bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl<C: StateFetcher, ECDSA: SignerECDSA> SidecarDriver<C, ECDSA> {
beacon_client,
opts.validator_indexes.clone(),
opts.chain.commitment_deadline(),
opts.chain.enable_unsafe_lookahead,
);

let (payload_requests_tx, payload_requests_rx) = mpsc::channel(16);
Expand Down
Loading

0 comments on commit 73a6fd3

Please sign in to comment.