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

Holesky testing & launch instructions #225

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5c5d6a8
feat(sidecar): constraints client init
namn-grg Sep 5, 2024
876f984
chore(sidecar): rename mevboost > constraint_client
namn-grg Sep 5, 2024
7f750c6
Merge branch 'unstable' into naman/feat/constraints-client
namn-grg Sep 5, 2024
2f0be88
chore(sidecar): digest > tree hash root
namn-grg Sep 6, 2024
b6306e6
chore(sidecar): update mock mev-boost
namn-grg Sep 6, 2024
be11e3f
chore(sidecar): rename to constraints client, remove digest
namn-grg Sep 6, 2024
a5765e8
test(sidecar): add hash tree root test
namn-grg Sep 6, 2024
49aae9c
chore(sidecar): change constraints type to fulltransaction
namn-grg Sep 6, 2024
9b5bfe8
misc(sidecar): comment
namn-grg Sep 6, 2024
d03e315
misc(sidecar): update doc link
namn-grg Sep 7, 2024
849c04c
misc(sidecar): update comments mevboost > constraints client
namn-grg Sep 9, 2024
d9d2e0e
test(sidecar): add ser/de test
namn-grg Sep 9, 2024
37356cc
chore(sidecar): specify ser/de impls
namn-grg Sep 9, 2024
5643676
fix(sidecar): various fixes, fix tests
Sep 9, 2024
a249122
feat(bolt-boost): update ConstraintsMessage digest
Sep 9, 2024
9d599d6
Merge pull request #212 from chainbound/naman/feat/constraints-client
Sep 9, 2024
dbc9852
chore(contracts): forge fmt
Sep 10, 2024
5fdccc1
doc(holesky): initial holesky launch instructions
Sep 11, 2024
2f4daf4
feat(all): various fixes & compat with commit-boost
Sep 11, 2024
977cd5b
doc(holesky): update holesky launch instructions + config
Sep 12, 2024
25fa18a
Merge pull request #221 from chainbound/feat/new-constraints-api
Sep 12, 2024
f18a635
chore(contracts): forge fmt
Sep 10, 2024
2bfa238
doc(holesky): initial holesky launch instructions
Sep 11, 2024
651aab3
feat(all): various fixes & compat with commit-boost
Sep 11, 2024
78e24d4
doc(holesky): update holesky launch instructions + config
Sep 12, 2024
2aa8ecf
fix(config): config rebase
Sep 12, 2024
7941696
fix(config): config merge
Sep 12, 2024
6375198
chore(holesky): rm some configs
Sep 12, 2024
3807669
refactor(config): prefix envs
Sep 12, 2024
f4e8462
fix(config): add correct metrics port
Sep 12, 2024
22d8b17
feat(holesky): add grafana support
Sep 12, 2024
2ff9bf6
feat(holesky): add initial bolt dashboard
Sep 12, 2024
8efc22f
feat(holesky): add update dashboard scripts + doc
Sep 12, 2024
2f8f4cb
feat(holesky): update script
Sep 12, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*_dump.log
target/
logs/
cb.docker-compose.yml
.cb.env
5 changes: 2 additions & 3 deletions bolt-boost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ COPY . .
RUN cargo build --release


FROM ubuntu AS runtime
FROM debian:bookworm-slim AS runtime
WORKDIR /app

RUN apt-get update
RUN apt-get install -y openssl ca-certificates libssl3 libssl-dev
RUN apt-get update && apt-get install -y libssl-dev libssl3 openssl ca-certificates && rm -rf /var/lib/apt/lists/*

COPY --from=builder /app/target/release/bolt-boost /usr/local/bin
ENTRYPOINT ["/usr/local/bin/bolt-boost"]
2 changes: 1 addition & 1 deletion bolt-boost/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ lazy_static! {

/// The size of the constraints cache
pub static ref CONSTRAINTS_CACHE_SIZE: IntGauge = register_int_gauge_with_registry!(
"bolt_boost.constraints_cache_size",
"constraints_cache_size",
"size of the constraints cache",
BOLT_BOOST_METRICS
)
Expand Down
63 changes: 19 additions & 44 deletions bolt-boost/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use alloy::{
consensus::TxEnvelope,
eips::eip2718::{Decodable2718, Eip2718Error},
primitives::{Bytes, TxHash, B256},
primitives::{keccak256, Bytes, TxHash, B256},
rpc::types::beacon::{BlsPublicKey, BlsSignature},
signers::k256::sha2::{Digest, Sha256},
};
use axum::http::HeaderMap;
use commit_boost::prelude::tree_hash::{self, MerkleHasher, TreeHash, TreeHashType};
use commit_boost::prelude::tree_hash;
use reqwest::Url;
use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
Expand All @@ -14,7 +15,8 @@ use std::ops::Deref;
use cb_common::{
constants::COMMIT_BOOST_DOMAIN,
pbs::{DenebSpec, EthSpec, SignedExecutionPayloadHeader, Transaction, VersionedResponse},
signature::verify_signed_message,
signature::{compute_domain, compute_signing_root},
signer::schemes::bls::verify_bls_signature,
types::Chain,
};

Expand Down Expand Up @@ -42,8 +44,10 @@ impl SignedConstraints {
/// The `chain` and `COMMIT_BOOST_DOMAIN` are used to compute the signing root.
#[allow(unused)]
pub fn verify_signature(&self, chain: Chain, pubkey: &BlsPublicKey) -> bool {
verify_signed_message(chain, pubkey, &self.message, &self.signature, COMMIT_BOOST_DOMAIN)
.is_ok()
let domain = compute_domain(chain, COMMIT_BOOST_DOMAIN);
let signing_root = compute_signing_root(self.message.digest(), domain);

verify_bls_signature(pubkey, &signing_root, &self.signature).is_ok()
}
}

Expand All @@ -56,47 +60,18 @@ pub struct ConstraintsMessage {
}

impl ConstraintsMessage {
/// Returns the total number of leaves in the tree.
fn total_leaves(&self) -> usize {
4 + self.transactions.len()
}
}

impl TreeHash for ConstraintsMessage {
fn tree_hash_type() -> TreeHashType {
TreeHashType::Container
}

fn tree_hash_packed_encoding(&self) -> tree_hash::PackedEncoding {
unreachable!("ConstraintsMessage should never be packed.")
}

fn tree_hash_packing_factor() -> usize {
unreachable!("ConstraintsMessage should never be packed.")
}

fn tree_hash_root(&self) -> HashTreeRoot {
let mut hasher = MerkleHasher::with_leaves(self.total_leaves());

hasher
.write(&self.validator_index.to_le_bytes())
.expect("Should write validator index bytes");
hasher.write(&self.slot.to_le_bytes()).expect("Should write slot bytes");
hasher.write(&(self.top as u8).to_le_bytes()).expect("Should write top flag");

for transaction in &self.transactions {
hasher
.write(
Transaction::<<DenebSpec as EthSpec>::MaxBytesPerTransaction>::from(
transaction.to_vec(),
)
.tree_hash_root()
.as_bytes(),
)
.expect("Should write transaction root");
/// Returns the digest of this message.
pub fn digest(&self) -> [u8; 32] {
let mut hasher = Sha256::new();
hasher.update(self.validator_index.to_le_bytes());
hasher.update(self.slot.to_le_bytes());
hasher.update((self.top as u8).to_le_bytes());

for constraint in &self.transactions {
hasher.update(keccak256(constraint));
}

hasher.finish().unwrap()
hasher.finalize().into()
}
}

Expand Down
16 changes: 3 additions & 13 deletions bolt-contracts/script/ReadRegistry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ contract ReadRegistry is Script {
console.log("Bolt registry address:", registryAddress);
BoltRegistry registry = BoltRegistry(registryAddress);

console.log(
"Bolt registry minimum collateral:",
registry.MINIMUM_COLLATERAL()
);
console.log("Bolt registry minimum collateral:", registry.MINIMUM_COLLATERAL());

for (uint64 i = 0; i < 2000; i++) {
try registry.getOperatorForValidator(i) returns (
IBoltRegistry.Registrant memory operator
) {
console.log(
"Operator for validator found",
i,
":",
operator.operator
);
try registry.getOperatorForValidator(i) returns (IBoltRegistry.Registrant memory operator) {
console.log("Operator for validator found", i, ":", operator.operator);
console.log("Operator RPC:", operator.metadata.rpc);
} catch {
// console.log("No operator for validator", i);
Expand Down
21 changes: 7 additions & 14 deletions bolt-contracts/script/RegisterValidators.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ contract RegisterValidators is Script {
console.log("Bolt registry address:", registryAddress);
BoltRegistry registry = BoltRegistry(registryAddress);

console.log(
"Bolt registry minimum collateral:",
registry.MINIMUM_COLLATERAL()
);
console.log("Bolt registry minimum collateral:", registry.MINIMUM_COLLATERAL());

address sender = vm.addr(signerKey);

Expand All @@ -39,11 +36,7 @@ contract RegisterValidators is Script {
}

// Register with minimal collateral
registry.register{value: registry.MINIMUM_COLLATERAL()}(
validatorIndexes,
rpc,
""
);
registry.register{value: registry.MINIMUM_COLLATERAL()}(validatorIndexes, rpc, "");

vm.stopBroadcast();
}
Expand All @@ -62,7 +55,7 @@ library StringToUintArrayLib {
uint256 rangeStart;

for (uint256 i = 0; i < strBytes.length; i++) {
if (strBytes[i] == ',') {
if (strBytes[i] == ",") {
if (parsingRange) {
// Handle end of range
for (uint256 j = rangeStart; j <= tempNum; j++) {
Expand All @@ -76,15 +69,15 @@ library StringToUintArrayLib {
vecIndex++;
}
tempNum = 0;
} else if (strBytes[i] == '.') {
if (i + 1 < strBytes.length && strBytes[i + 1] == '.') {
} else if (strBytes[i] == ".") {
if (i + 1 < strBytes.length && strBytes[i + 1] == ".") {
// Handle start of range
parsingRange = true;
rangeStart = tempNum;
tempNum = 0;
i++; // Skip next dot
}
} else if (strBytes[i] >= '0' && strBytes[i] <= '9') {
} else if (strBytes[i] >= "0" && strBytes[i] <= "9") {
tempNum = tempNum * 10 + (uint8(strBytes[i]) - 48); // Convert ASCII to integer
}
}
Expand All @@ -108,4 +101,4 @@ library StringToUintArrayLib {

return result;
}
}
}
Loading
Loading