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

consolidate all deps in workspace manifest, update deps #246

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1,165 changes: 217 additions & 948 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 31 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,41 @@ version = "0.3.0"
ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "2ce2ca4d59ef2985088168b0f69a4a8c4f953241" }
beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "2ce2ca4d59ef2985088168b0f69a4a8c4f953241" }

reth = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "8e65cb3" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "ca54552" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "ca54552" }
reth = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "5f82993c23164ce8ccdc7bf3ae5085205383a5c8" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "77c1240" }

futures = "0.3.21"
tokio = "1.0"
tokio-stream = "0.1.15"
axum = "0.6.4"
hyper = "0.14"
tracing = "0.1"
tracing-subscriber = "0.3"
http = "0.2.7"
url = { version = "2.2.2", default-features = false }

serde_json = "1.0.92"
async-trait = "0.1.53"
serde = "1.0"
thiserror = "1.0.30"
parking_lot = "0.12.1"
toml = "0.8.2"

rayon = "1.8.0"

pin-project = "1.0.12"
backoff = "0.4.0"

eyre = "0.6.8"
futures-util = "0.3.30"
sha2 = "0.10.8"
rand = "0.8.5"

clap = "4.1.4"

[patch.crates-io]
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", tag = "v1.0.1" }
Expand Down
10 changes: 5 additions & 5 deletions bin/mev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ minimal-preset = [
]

[dependencies]
tokio = { version = "1.0", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

mev-boost-rs = { path = "../../mev-boost-rs", optional = true }
mev-relay-rs = { path = "../../mev-relay-rs", optional = true }
mev-build-rs = { path = "../../mev-build-rs", optional = true }
mev-rs = { path = "../../mev-rs" }

serde = { version = "1.0", features = ["derive"] }
serde = { workspace = true, features = ["derive"] }

clap = { version = "4.1.4", features = ["derive", "env"] }
clap = { workspace = true, features = ["derive", "env"] }
eyre = { workspace = true }

ethereum-consensus = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions bin/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.0", features = ["full"] }
url = { version = "2.2.2", default-features = false }
tokio = { workspace = true, features = ["full"] }
url = { workspace = true }

mev-rs = { path = "../../mev-rs" }

serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0.92" }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

ethereum-consensus = { workspace = true }
beacon-api-client = { workspace = true }
17 changes: 8 additions & 9 deletions mev-boost-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ minimal-preset = [
]

[dependencies]
tokio = { version = "1.0", features = ["full"] }
tracing = "0.1"
async-trait = "0.1.53"
pin-project = "1.0.12"
rand = "0.8.5"
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
async-trait = { workspace = true }
pin-project = { workspace = true }
futures-util = { workspace = true }
rand = { workspace = true }

serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0.30"
parking_lot = "0.12.1"
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
parking_lot = { workspace = true }

ethereum-consensus = { workspace = true }
beacon-api-client = { workspace = true }

mev-rs = { path = "../mev-rs" }

[dev-dependencies]
rand = "0.8.5"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
url = { version = "2.2.2", default-features = false }
serde_json = "1.0.81"
Expand Down
17 changes: 8 additions & 9 deletions mev-build-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ default = []
minimal-preset = ["mev-rs/minimal-preset"]

[dependencies]
tokio = { version = "1.0", features = ["full"] }
tokio-stream = "0.1.15"
tracing = "0.1"
async-trait = "0.1.53"
pin-project = "1.0.12"
tokio = { workspace = true, features = ["full"] }
tokio-stream = { workspace = true }
tracing = { workspace = true }
async-trait = { workspace = true }
pin-project = { workspace = true }
futures-util = { workspace = true }

thiserror = "1.0.30"
serde = { version = "1.0", features = ["derive"] }
thiserror = { workspace = true }
serde = { workspace = true, features = ["derive"] }

ethereum-consensus = { workspace = true }
beacon-api-client = { workspace = true }
Expand All @@ -35,6 +35,5 @@ alloy-signer = { workspace = true }
alloy-signer-wallet = { workspace = true, features = ["mnemonic"] }

sha2 = { workspace = true }
ethers = "2.0"
eyre = { workspace = true }
clap = { version = "4.1.4", features = ["derive", "env"] }
clap = { workspace = true, features = ["derive", "env"] }
22 changes: 17 additions & 5 deletions mev-build-rs/src/auctioneer/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl<
proposer: Proposer,
relays: HashSet<RelayIndex>,
mut attributes: BuilderPayloadBuilderAttributes,
) {
) -> Option<PayloadId> {
let (bidder, revenue_updates) = mpsc::channel(DEFAULT_BUILDER_BIDDER_CHANNEL_SIZE);
let proposal = ProposalAttributes {
proposer_gas_limit: proposer.gas_limit,
Expand All @@ -235,10 +235,19 @@ impl<

if let Err(err) = self.builder.new_payload(auction.attributes.clone()).await {
warn!(%err, "could not start build with payload builder");
return
return None
}

let payload_id = auction.attributes.payload_id();
self.bidder.start_bid(auction, revenue_updates);
Some(payload_id)
}

// Record `payload_id` as processed so that we can identify duplicate notifications.
// Return value indicates if the `payload_id` has been observed before or not.
fn observe_payload_id(&mut self, slot: Slot, payload_id: PayloadId) -> bool {
let processed_set = self.processed_payload_attributes.entry(slot).or_default();
processed_set.insert(payload_id)
}

async fn on_payload_attributes(&mut self, attributes: BuilderPayloadBuilderAttributes) {
Expand All @@ -249,8 +258,7 @@ impl<
)
.expect("is past genesis");

let processed_set = self.processed_payload_attributes.entry(slot).or_default();
let is_new = processed_set.insert(attributes.payload_id());
let is_new = self.observe_payload_id(slot, attributes.payload_id());

if !is_new {
trace!(payload_id = %attributes.payload_id(), "ignoring duplicate payload attributes");
Expand All @@ -259,7 +267,11 @@ impl<

if let Some(proposals) = self.get_proposals(slot) {
for (proposer, relays) in proposals {
self.open_auction(slot, proposer, relays, attributes.clone()).await;
if let Some(payload_id) =
self.open_auction(slot, proposer, relays, attributes.clone()).await
{
self.observe_payload_id(slot, payload_id);
}
}
}
}
Expand Down
37 changes: 9 additions & 28 deletions mev-build-rs/src/payload/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ use reth::{
primitives::{
alloy_primitives::private::alloy_rlp::Encodable,
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Address, ChainSpec, Header, Withdrawals, B256,
Address, ChainSpec, Header, Withdrawals, B256, B64,
},
rpc::types::engine::PayloadAttributes,
};
use sha2::Digest;
use std::convert::Infallible;
use tokio::sync::mpsc::Sender;

pub fn payload_id_with_bytes(
parent: &B256,
attributes: &PayloadAttributes,
proposal: Option<&ProposalAttributes>,
) -> (PayloadId, [u8; 8]) {
pub fn payload_id(parent: &B256, attributes: &PayloadAttributes) -> PayloadId {
let mut hasher = sha2::Sha256::new();
hasher.update(parent.as_slice());
hasher.update(&attributes.timestamp.to_be_bytes()[..]);
Expand All @@ -33,20 +29,11 @@ pub fn payload_id_with_bytes(
hasher.update(parent_beacon_block);
}

if let Some(proposal) = proposal {
hasher.update(proposal.proposer_gas_limit.to_be_bytes());
hasher.update(proposal.proposer_fee_recipient.as_slice());
}

let out = hasher.finalize();
let inner: [u8; 8] = out.as_slice()[..8].try_into().expect("sufficient length");
(PayloadId::new(inner), inner)
PayloadId::new(out.as_slice()[..8].try_into().expect("sufficient length"))
}

pub fn mix_proposal_into_payload_id(
payload_id: [u8; 8],
proposal: &ProposalAttributes,
) -> PayloadId {
pub fn mix_proposal_into_payload_id(payload_id: B64, proposal: &ProposalAttributes) -> PayloadId {
let mut hasher = sha2::Sha256::new();
hasher.update(payload_id);

Expand All @@ -67,15 +54,12 @@ pub struct ProposalAttributes {
#[derive(Debug, Clone)]
pub struct BuilderPayloadBuilderAttributes {
pub inner: EthPayloadBuilderAttributes,
// TODO: can skip this if we expose the inner value upstream
// NOTE: save this here to avoid recomputing later
payload_id: Option<[u8; 8]>,
pub proposal: Option<ProposalAttributes>,
}

impl BuilderPayloadBuilderAttributes {
pub fn new(parent: B256, attributes: PayloadAttributes) -> Self {
let (id, id_bytes) = payload_id_with_bytes(&parent, &attributes, None);
let id = payload_id(&parent, &attributes);

let inner = EthPayloadBuilderAttributes {
id,
Expand All @@ -86,16 +70,13 @@ impl BuilderPayloadBuilderAttributes {
withdrawals: attributes.withdrawals.unwrap_or_default().into(),
parent_beacon_block_root: attributes.parent_beacon_block_root,
};
Self { inner, payload_id: Some(id_bytes), proposal: None }
Self { inner, proposal: None }
}

pub fn attach_proposal(&mut self, proposal: ProposalAttributes) {
// NOTE: error to call this more than once; see note on this field, hopefully this goes away
if let Some(payload_id) = self.payload_id.take() {
let id = mix_proposal_into_payload_id(payload_id, &proposal);
self.inner.id = id;
self.proposal = Some(proposal);
}
let id = mix_proposal_into_payload_id(self.inner.id.0, &proposal);
self.inner.id = id;
self.proposal = Some(proposal);
}
}

Expand Down
22 changes: 11 additions & 11 deletions mev-relay-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ default = []
minimal-preset = ["mev-rs/minimal-preset"]

[dependencies]
tokio = { version = "1.0", features = ["full"] }
tracing = "0.1"
futures = "0.3.21"
async-trait = "0.1.53"
parking_lot = "0.12.1"
pin-project = "1.0.12"
backoff = { version = "0.4.0", features = ["tokio"] }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
futures = { workspace = true }
async-trait = { workspace = true }
parking_lot = { workspace = true }
pin-project = { workspace = true }
backoff = { workspace = true, features = ["tokio"] }

thiserror = "1.0.30"
http = "0.2.7"
url = { version = "2.2.2", default-features = false }
serde = { version = "1.0", features = ["derive"] }
thiserror = { workspace = true }
url = { workspace = true, default-features = false }
serde = { workspace = true, features = ["derive"] }
http = { workspace = true }

ethereum-consensus = { workspace = true }
beacon-api-client = { workspace = true }
Expand Down
24 changes: 12 additions & 12 deletions mev-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ api = ["tokio", "axum", "hyper", "beacon-api-client", "tracing", "serde_json"]
minimal-preset = []

[dependencies]
tokio = { version = "1.0", optional = true }
axum = { version = "0.6.4", optional = true }
hyper = { version = "0.14", optional = true }
tracing = { version = "0.1", optional = true }
tokio = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
hyper = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }

async-trait = "0.1.53"
serde = { version = "1.0", features = ["derive"], optional = true }
thiserror = "1.0.30"
parking_lot = "0.12.1"
url = { version = "2.2.2", default-features = false }
async-trait = { workspace = true }
serde = { workspace = true, features = ["derive"], optional = true }
thiserror = { workspace = true }
parking_lot = { workspace = true }
url = { workspace = true }

serde_json = { version = "1.0.92", optional = true }
toml = "0.8.2"
serde_json = { workspace = true, optional = true }
toml = { workspace = true }

rayon = "1.8.0"
rayon = { workspace = true }

ethereum-consensus = { workspace = true }
beacon-api-client = { workspace = true, optional = true }
Expand Down
Loading