Skip to content

Commit

Permalink
Merge pull request #190 from chainbound/release-v0.2.0-alpha
Browse files Browse the repository at this point in the history
Release v0.2.0-alpha
  • Loading branch information
mempirate authored Aug 8, 2024
2 parents 7e2022d + d26ea0b commit 9b43af0
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 53 deletions.
37 changes: 37 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Guide on creating new releases

## 0. Pre-release checks

There is not a single end2end test procedure, but each release should at least
go through a manual test of the core components, including the happy-case and
error-case scenarios. This includes the Kurtosis devnet environment and any
live testnet deployment that is available at time of release.

For testnets, if the launch setup has changed since the previous version,
the `testnets/` directory should be updated to reflect the new setup.
Pay special attention to the `README` and `docker-compose` files.

## 1. Update the version tag in the necessary packages

For instance, for the Bolt sidecar this is in `bolt-sidecar/Cargo.toml`.
Similar changes should be made in the other packages getting updated.

We don't currently keep track of the version for flashbots forks.

Next, update the version of the Docker images used in any `docker-compose` files.
These currently only live inside the `testnets/` dir.

## 2. Create a release on Github

Create a new release on Github with the new tag and a description of the changes.

We use the built-in Github changelog feature to generate the changelog.

## 3. Build new Docker images

You can build new Docker images with the `just release <tag>` recipe.

Example: `just release v0.2.0-alpha` will build and push the Docker images
for all Bolt components with the tag `v0.2.0-alpha` for both `arm64` and `amd64`
architectures. This can take a long time... We recommend building from an ARM machine
because cross-compiling from x86 into ARM is slow as hell.
2 changes: 1 addition & 1 deletion bolt-sidecar/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bolt-sidecar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bolt-sidecar"
version = "0.1.3-alpha"
version = "0.2.0-alpha"
edition = "2021"
default-run = "bolt-sidecar"

Expand Down
5 changes: 2 additions & 3 deletions bolt-sidecar/src/config/chain.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::time::Duration;

use alloy::primitives::b256;
use clap::{Args, ValueEnum};
use std::time::Duration;

/// Default commitment deadline duration.
///
Expand Down Expand Up @@ -40,7 +39,7 @@ pub struct ChainConfig {
/// new commitments for the next block (parsed as milliseconds).
#[clap(
long,
env = "BOLT_SIDECAR_COMMITMENT_DEADLINE",
env = "BOLT_SIDECAR_COMMITMENT_DEADLINE",
default_value_t = DEFAULT_COMMITMENT_DEADLINE_IN_MILLIS
)]
commitment_deadline: u64,
Expand Down
10 changes: 5 additions & 5 deletions bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ impl<C: StateFetcher, BLS: SignerBLS, ECDSA: SignerECDSA> SidecarDriver<C, BLS,
// (as we don't need to specify genesis time and slot duration)
let head_tracker = HeadTracker::start(beacon_client.clone());

// Get the genesis time.
let genesis_time = beacon_client.get_genesis_details().await?.genesis_time;

// TODO: head tracker initializes the genesis timestamp with '0' value
// we should add an async fn to fetch the value for safety
// Initialize the consensus clock.
let consensus_clock = clock::from_system_time(
head_tracker.beacon_genesis_timestamp(),
cfg.chain.slot_time(),
SLOTS_PER_EPOCH,
);
let consensus_clock =
clock::from_system_time(genesis_time, cfg.chain.slot_time(), SLOTS_PER_EPOCH);
let slot_stream = consensus_clock.into_stream();

let consensus = ConsensusState::new(
Expand Down
7 changes: 5 additions & 2 deletions bolt-sidecar/src/state/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{

use beacon_api_client::{mainnet::Client, ProposerDuty};
use ethereum_consensus::phase0::mainnet::SLOTS_PER_EPOCH;
use tracing::debug;

use super::CommitmentDeadline;
use crate::{
Expand Down Expand Up @@ -101,8 +102,8 @@ impl ConsensusState {
}

// If the request is for the next slot, check if it's within the commitment deadline
if req.slot == self.latest_slot + 1 &&
self.latest_slot_timestamp + self.commitment_deadline_duration < Instant::now()
if req.slot == self.latest_slot + 1
&& self.latest_slot_timestamp + self.commitment_deadline_duration < Instant::now()
{
return Err(ConsensusError::DeadlineExceeded);
}
Expand All @@ -115,6 +116,7 @@ impl ConsensusState {

/// Update the latest head and fetch the relevant data from the beacon chain.
pub async fn update_slot(&mut self, slot: u64) -> Result<(), ConsensusError> {
debug!("Updating slot to {slot}");
// Reset the commitment deadline to start counting for the next slot.
self.commitment_deadline =
CommitmentDeadline::new(slot + 1, self.commitment_deadline_duration);
Expand All @@ -128,6 +130,7 @@ impl ConsensusState {

// If the epoch has changed, update the proposer duties
if epoch != self.epoch.value {
debug!("Updating epoch to {epoch}");
self.epoch.value = epoch;
self.epoch.start_slot = epoch * SLOTS_PER_EPOCH;

Expand Down
34 changes: 2 additions & 32 deletions bolt-sidecar/src/state/head_tracker.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
use std::{
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
time::Duration,
};

use alloy::rpc::types::beacon::events::HeadEvent;
use beacon_api_client::Topic;
use futures::StreamExt;
use std::time::Duration;
use tokio::{sync::broadcast, task::AbortHandle, time::sleep};
use tracing::warn;

Expand All @@ -26,8 +19,6 @@ const RETRY_DELAY: Duration = Duration::from_secs(1);
pub struct HeadTracker {
/// Channel to receive updates of the "Head" beacon topic
new_heads_rx: broadcast::Receiver<HeadEvent>,
/// The genesis timestamp of the beacon chain, used for calculating proposal times
beacon_genesis_timestamp: Arc<AtomicU64>,
/// Handle to the background task that listens for new head events.
/// Kept to allow for graceful shutdown.
quit: AbortHandle,
Expand All @@ -49,24 +40,8 @@ impl HeadTracker {
pub fn start(beacon_client: BeaconClient) -> Self {
let (new_heads_tx, new_heads_rx) = broadcast::channel(32);

let beacon_genesis_timestamp = Arc::new(AtomicU64::new(0));
let beacon_genesis_timestamp_clone = beacon_genesis_timestamp.clone();

let task = tokio::spawn(async move {
loop {
// First, try to get the genesis timestamp and cache it.
let genesis_time = loop {
match beacon_client.get_genesis_details().await {
Ok(genesis_info) => break genesis_info.genesis_time,
Err(err) => {
warn!(?err, "failed to get genesis details");
sleep(RETRY_DELAY).await;
continue;
}
}
};
beacon_genesis_timestamp_clone.store(genesis_time, Ordering::Relaxed);

let mut event_stream = match beacon_client.get_events::<NewHeadsTopic>().await {
Ok(events) => events,
Err(err) => {
Expand Down Expand Up @@ -96,7 +71,7 @@ impl HeadTracker {
}
});

Self { new_heads_rx, beacon_genesis_timestamp, quit: task.abort_handle() }
Self { new_heads_rx, quit: task.abort_handle() }
}

/// Stop the tracker and cleanup resources
Expand All @@ -116,11 +91,6 @@ impl HeadTracker {
pub fn subscribe_new_heads(&self) -> broadcast::Receiver<HeadEvent> {
self.new_heads_rx.resubscribe()
}

/// Get the genesis timestamp of the beacon chain
pub fn beacon_genesis_timestamp(&self) -> u64 {
self.beacon_genesis_timestamp.load(Ordering::Relaxed)
}
}

#[cfg(test)]
Expand Down
14 changes: 7 additions & 7 deletions testnets/helder/docker-compose.pbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
ADMINER_PLUGINS: tables-filter tinymce

builder:
image: ghcr.io/chainbound/bolt-builder:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-builder:v0.2.0-alpha
restart: unless-stopped
volumes:
- "chaindata:/var/lib/chaindata"
Expand Down Expand Up @@ -61,7 +61,7 @@ services:
entrypoint: /scripts/run-bn.sh

relay-housekeeper:
image: ghcr.io/chainbound/bolt-relay:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-relay:v0.2.0-alpha
restart: unless-stopped
depends_on:
db:
Expand All @@ -84,11 +84,11 @@ services:
"--redis-uri",
"redis:6379",
"--beacon-uris",
"http://beacon:4000",
"http://beacon:4000"
]

relay-api:
image: ghcr.io/chainbound/bolt-relay:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-relay:v0.2.0-alpha
restart: unless-stopped
depends_on:
relay-housekeeper:
Expand Down Expand Up @@ -117,11 +117,11 @@ services:
"--secret-key",
"0x607a11b45a7219cc61a3d9c5fd08c7eebd602a6a19a977f8d3771d5711a550f2",
"--listen-addr",
"0.0.0.0:9062",
"0.0.0.0:9062"
]

relay-website:
image: ghcr.io/chainbound/bolt-relay:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-relay:v0.2.0-alpha
restart: always
depends_on:
relay-api:
Expand All @@ -144,5 +144,5 @@ services:
"--redis-uri",
"redis:6379",
"--listen-addr",
"0.0.0.0:9060",
"0.0.0.0:9060"
]
4 changes: 2 additions & 2 deletions testnets/helder/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
bolt-sidecar:
image: ghcr.io/chainbound/bolt-sidecar:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-sidecar:v0.2.0-alpha
container_name: bolt-sidecar
restart: unless-stopped
ports:
Expand All @@ -10,7 +10,7 @@ services:
entrypoint: /bin/sh -c '/bolt-sidecar --port $$BOLT_RPC_PORT --chain helder --validator-indexes $$VALIDATOR_INDEXES --beacon-api-url $$BEACON_API_URL --execution-api-url $$EXECUTION_API_URL --engine-api-url $$ENGINE_API_URL --private-key $$SIGNING_KEY --mevboost-url http://bolt-boost:18550 --mevboost-proxy-port 18551 --jwt-hex $$JWT_HEX --fee-recipient $$FEE_RECIPIENT'

bolt-boost:
image: ghcr.io/chainbound/bolt-mev-boost:v0.1.3-alpha
image: ghcr.io/chainbound/bolt-mev-boost:v0.2.0-alpha
container_name: bolt-boost
restart: unless-stopped
env_file: ./launch.env
Expand Down

0 comments on commit 9b43af0

Please sign in to comment.