Skip to content

Commit e617907

Browse files
authored
URC and whitelst functionalities sharing the same common code base (#577)
* new registration module Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> * registry ABI * adding registry abi wip * Two separate binaries for whitelist and URC * removed unneeded * desugar async trait function to add Send trait to return value * Introduced 3 separate crate catalyst-common, catalyst-urc, catalyst-whitelist * inner execution layer field * chain_id example cont. * specific config for Extension Trait * get logs compiles * Getting logs improvements * removed catalyst from crates names * moved node module to the whitelist crate * tests work * sort dependencies * Set publish to false in Cargo.toml * Update Cargo.toml files to use workspace for common dependency Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> * fmt * Add Default implementation for Metrics struct * Refactor test_gas module: Move test_gas from common to whitelist crate and implement test_gas_params function for transaction handling. Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> * Update Cargo.lock to remove catalyst_node package and bump versions for common, urc, and whitelist packages to 1.6.0. Refactor slot_clock initialization in operator.rs for improved clarity. * v1.7.0 * Refactor project structure: Rename 'urc' to 'permissionless' and 'whitelist' to 'catalyst_whitelist'. Update Dockerfile and Cargo files accordingly. Add 'permissionless' package to Cargo.lock. * renamed directories Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> * .env.sample * Update log message to reflect the correct node name: changed from 'URC Node' to 'Permissionless Node'. --------- Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com>
1 parent e27a3dc commit e617907

File tree

97 files changed

+982
-664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+982
-664
lines changed

node/.env.sample renamed to .env.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ TAIKO_DRIVER_URL=http://127.0.0.1:1235
1010
L1_RPC_URLS=ws://127.0.0.1:32003,wss://123.123.123.123:32001
1111
L1_BEACON_URL=http://127.0.0.1:33001
1212
RUST_LOG=debug,reqwest=info,hyper=info,alloy_transport=info,alloy_rpc_client=info,alloy_provider=info
13-
JWT_SECRET_FILE_PATH=/some/path/jwtsecret.hex
14-
13+
JWT_SECRET_FILE_PATH=/some/path/jwtsecret.hex

Cargo.lock

Lines changed: 64 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11

22
[workspace]
33
members = [
4-
"node",
4+
"common",
5+
"permissionless",
56
"tools/p2p_node/p2p_boot_node",
67
"tools/p2p_node/p2p_network",
78
"tools/p2p_node/p2p_test_node",
9+
"whitelist",
810
]
911
resolver = "2"
10-
default-members = ["node"]
12+
default-members = ["whitelist"]
1113

1214
[workspace.package]
13-
version = "1.6.0"
15+
version = "1.7.0"
1416
edition = "2024"
1517
repository = "https://github.com/NethermindEth/Catalyst"
1618
license = "MIT"
@@ -42,6 +44,7 @@ clap = { version = "4.5", default-features = false, features = [
4244
"suggestions",
4345
"derive",
4446
] }
47+
common = { path = "common" }
4548
discv5 = { version = "0.9.1", default-features = false, features = ["libp2p"] }
4649
dotenvy = { version = "0.15", default-features = false }
4750
ecdsa = { version = "0.16", default-features = false }

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y \
88
&& rm -rf /var/lib/apt/lists/*
99

1010
# Set the working directory inside the container
11-
WORKDIR /app/catalyst_node
11+
WORKDIR /app/catalyst_whitelist
1212

1313
# Copy only the toolchain file first
1414
COPY rust-toolchain.toml .
@@ -19,19 +19,19 @@ RUN rustup show
1919
# Now copy the rest of the files
2020
COPY . .
2121

22-
# Build catalyst_node
22+
# Build catalyst_whitelist
2323
RUN --mount=type=cache,target=/usr/local/cargo/registry \
2424
--mount=type=cache,target=/usr/local/cargo/git \
25-
--mount=type=cache,target=/app/catalyst_node/target \
26-
cargo build -p catalyst_node --release \
27-
&& mv /app/catalyst_node/target/release/catalyst_node /root
25+
--mount=type=cache,target=/app/catalyst_whitelist/target \
26+
cargo build -p whitelist --release \
27+
&& mv /app/catalyst_whitelist/target/release/catalyst_whitelist /root
2828

2929
# Use small size system for final image
3030
FROM gcr.io/distroless/cc
3131

3232
# Copy artifacts
33-
COPY --from=builder /root/catalyst_node /usr/local/bin/catalyst_node
33+
COPY --from=builder /root/catalyst_whitelist /usr/local/bin/catalyst_whitelist
3434
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
3535
COPY --from=builder /bin/sleep /bin/sleep
3636

37-
ENTRYPOINT ["catalyst_node"]
37+
ENTRYPOINT ["catalyst_whitelist"]

_typos.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[files]
22
extend-exclude = [
3-
"node/src/ethereum_l1/abi/*.json",
4-
"node/src/taiko/abi/*.json"
3+
"node/src/l1/abi/*.json",
4+
"node/src/l2/abi/*.json"
55
]

node/Cargo.toml renamed to common/Cargo.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
[package]
2-
name = "catalyst_node"
2+
name = "common"
33
version.workspace = true
44
edition.workspace = true
55
repository.workspace = true
66
license.workspace = true
7+
publish = false
78

89
[features]
9-
# A testing feature that allows the node to send only
10-
# a proposeBatch transaction and then stop.
11-
# Useful for validating transaction sending logic
12-
# without running the full flow
13-
test-gas = ["clap"]
14-
15-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10+
test-gas = []
1611

1712
[dependencies]
1813
alloy = { workspace = true }
@@ -22,7 +17,6 @@ anyhow = { workspace = true }
2217
async-trait = { workspace = true }
2318
c-kzg = { workspace = true }
2419
chrono = { workspace = true }
25-
clap = { workspace = true, optional = true }
2620
dotenvy = { workspace = true }
2721
ecdsa = { workspace = true }
2822
elliptic-curve = { workspace = true }
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ use std::{sync::Arc, time::Duration};
33
use alloy::{eips::eip4844::kzg_to_versioned_hash, primitives::B256, rpc::types::Transaction};
44
use anyhow::Error;
55

6+
use super::blob_decoder::BlobDecoder;
7+
use crate::l1::{ethereum_l1::EthereumL1, extension::ELExtension};
68
use crate::shared::l2_tx_lists::uncompress_and_decode;
7-
use crate::{ethereum_l1::EthereumL1, utils::blob::decode_blob};
89

9-
pub async fn extract_transactions_from_blob(
10-
ethereum_l1: Arc<EthereumL1>,
10+
pub async fn extract_transactions_from_blob<T: ELExtension>(
11+
ethereum_l1: Arc<EthereumL1<T>>,
1112
block: u64,
1213
blob_hash: Vec<B256>,
1314
tx_list_offset: u32,
@@ -27,8 +28,8 @@ pub async fn extract_transactions_from_blob(
2728
Ok(txs)
2829
}
2930

30-
async fn blob_to_vec(
31-
ethereum_l1: Arc<EthereumL1>,
31+
async fn blob_to_vec<T: ELExtension>(
32+
ethereum_l1: Arc<EthereumL1<T>>,
3233
block: u64,
3334
blob_hash: Vec<B256>,
3435
tx_list_offset: u32,
@@ -54,7 +55,7 @@ async fn blob_to_vec(
5455
for hash in blob_hash {
5556
for (i, sidecar) in sidecars.data.iter().enumerate() {
5657
if sidecar_hashes[i] == hash {
57-
let data = decode_blob(sidecar.blob.as_ref())?;
58+
let data = BlobDecoder::decode_blob(sidecar.blob.as_ref())?;
5859
result.extend(data);
5960
break;
6061
}
@@ -80,12 +81,11 @@ async fn blob_to_vec(
8081

8182
#[cfg(test)]
8283
mod tests {
83-
use super::*;
8484
use crate::{
85+
blob::{BlobDecoder, build_blob_sidecar},
8586
shared::l2_tx_lists::{
8687
decompose_pending_lists_json_from_geth, encode_and_compress, uncompress_and_decode,
8788
},
88-
utils::blob::build_blob_sidecar,
8989
};
9090

9191
#[test]
@@ -97,7 +97,7 @@ mod tests {
9797
let compress = encode_and_compress(&txs).unwrap();
9898
let blob = build_blob_sidecar(&compress).unwrap();
9999
assert_eq!(blob.blobs.len(), 1);
100-
let blob_data = decode_blob(&blob.blobs[0]).unwrap();
100+
let blob_data = BlobDecoder::decode_blob(&blob.blobs[0]).unwrap();
101101
assert_eq!(blob_data, compress);
102102
let decoded_txs = uncompress_and_decode(&blob_data).unwrap();
103103
assert_eq!(decoded_txs, txs);

0 commit comments

Comments
 (0)