Skip to content

Commit

Permalink
wip: resolve types to the same standard, rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Jun 17, 2024
1 parent bc0e791 commit f6d4e88
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bolt-sidecar/src/api/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::spec::{
};
use crate::{
client::mevboost::MevBoostClient,
types::{GetPayloadResponse, PayloadFetcher, SignedBuilderBid},
primitives::{GetPayloadResponse, PayloadFetcher, SignedBuilderBid},
};

const MAX_BLINDED_BLOCK_LENGTH: usize = 1024 * 1024;
Expand Down
5 changes: 2 additions & 3 deletions bolt-sidecar/src/api/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use ethereum_consensus::{
};
use serde::{Deserialize, Serialize, Serializer};

use crate::types::{
constraint::BatchedSignedConstraints, GetPayloadResponse, SignedBuilderBid,
SignedBuilderBidWithProofs,
use crate::primitives::{
BatchedSignedConstraints, GetPayloadResponse, SignedBuilderBid, SignedBuilderBidWithProofs,
};

use super::builder::GetHeaderParams;
Expand Down
6 changes: 2 additions & 4 deletions bolt-sidecar/src/client/mevboost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use axum::http::StatusCode;
use ethereum_consensus::{
builder::SignedValidatorRegistration, deneb::mainnet::SignedBlindedBeaconBlock,
};
use serde_json::Value;

use crate::{
api::{
Expand All @@ -16,9 +15,8 @@ use crate::{
GET_PAYLOAD_PATH, REGISTER_VALIDATORS_PATH, STATUS_PATH,
},
},
types::{
constraint::BatchedSignedConstraints, GetPayloadResponse, SignedBuilderBid,
SignedBuilderBidWithProofs,
primitives::{
BatchedSignedConstraints, GetPayloadResponse, SignedBuilderBid, SignedBuilderBidWithProofs,
},
};

Expand Down
8 changes: 1 addition & 7 deletions bolt-sidecar/src/json_rpc/api.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
use std::{num::NonZeroUsize, sync::Arc};

use beacon_api_client::mainnet::Client as BeaconApiClient;
use parking_lot::RwLock;
use serde_json::Value;
use thiserror::Error;
use tokio::sync::{mpsc, oneshot};
use tracing::info;

use crate::{
client::mevboost::MevBoostClient,
crypto::{bls::from_bls_signature_to_consensus_signature, BLSSigner},
primitives::{CommitmentRequest, InclusionRequest, Slot},
};
use crate::primitives::{CommitmentRequest, InclusionRequest, Slot};

/// Default size of the api request cache (implemented as a LRU).
const DEFAULT_API_REQUEST_CACHE_SIZE: usize = 1000;
Expand Down Expand Up @@ -74,7 +69,6 @@ impl JsonRpcApi {
/// Create a new instance of the JSON-RPC API.
pub fn new(event_tx: mpsc::Sender<ApiEvent>) -> Arc<Self> {
let cap = NonZeroUsize::new(DEFAULT_API_REQUEST_CACHE_SIZE).unwrap();
let beacon_url = reqwest::Url::parse(&beacon_url).expect("failed to parse beacon node URL");

Arc::new(Self {
cache: Arc::new(RwLock::new(lru::LruCache::new(cap))),
Expand Down
2 changes: 1 addition & 1 deletion bolt-sidecar/src/primitives/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn signature_as_str<S: serde::Serializer>(
}

impl InclusionRequest {
// TODO: actually use SSZ encoding here
/// TODO: actually use SSZ encoding here
pub fn digest(&self) -> B256 {
let mut data = Vec::new();
data.extend_from_slice(&self.slot.to_le_bytes());
Expand Down
4 changes: 3 additions & 1 deletion bolt-sidecar/src/primitives/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use alloy_primitives::keccak256;
use secp256k1::Message;
use serde::{Deserialize, Serialize};

use crate::{crypto::SignableECDSA, types::Slot};
use crate::crypto::ecdsa::SignableECDSA;

use super::Slot;

/// The API parameters to request an inclusion commitment for a given slot.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
Expand Down
17 changes: 17 additions & 0 deletions bolt-sidecar/src/primitives/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
use std::sync::{atomic::AtomicU64, Arc};

use alloy_primitives::{Bytes, TxHash, U256};
use ethereum_consensus::{
capella,
crypto::{KzgCommitment, PublicKey as BlsPublicKey, Signature as BlsSignature},
deneb::{
mainnet::{BlobsBundle, MAX_BLOB_COMMITMENTS_PER_BLOCK},
presets::mainnet::ExecutionPayloadHeader,
Hash32,
},
serde::as_str,
ssz::prelude::*,
types::mainnet::ExecutionPayload,
Fork,
};
use tokio::sync::{mpsc, oneshot};

pub mod commitment;
pub use commitment::{CommitmentRequest, InclusionRequest};

pub mod constraint;
pub use constraint::BatchedSignedConstraints;

pub mod transaction;
pub use transaction::TxInfo;

Expand Down
1 change: 0 additions & 1 deletion bolt-sidecar/src/primitives/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use alloy_consensus::TxEnvelope;
use alloy_primitives::{Address, SignatureError, U256};
use alloy_rpc_types::Transaction;

pub trait TxInfo {
fn gas_price(&self) -> Option<u128>;
Expand Down
1 change: 1 addition & 0 deletions bolt-sidecar/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use thiserror::Error;

mod execution;
pub use execution::{ExecutionState, ValidationError};

pub mod fetcher;

#[derive(Debug, Error)]
Expand Down

0 comments on commit f6d4e88

Please sign in to comment.