Skip to content

Commit a59549e

Browse files
authored
feat: engine driver (#12)
* feat: lints * feat: engine driver * test: matching_payloads * feat: code improvement * fix: lints * fix: answer comments * fix: set unsafe head to safe head before attributes building * fix: answer comments * chore: added TODO * fix: remove `reorg` method
1 parent a4cf3cc commit a59549e

File tree

9 files changed

+638
-2
lines changed

9 files changed

+638
-2
lines changed

Cargo.toml

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,122 @@ license = "MIT OR Apache-2.0"
66
exclude = [".github/"]
77

88
[workspace]
9-
members = [ "crates/network",
9+
members = [
10+
"crates/engine",
11+
"crates/network",
1012
"crates/scroll-wire"
1113
]
1214

1315
resolver = "2"
16+
17+
[workspace.lints]
18+
rust.missing_debug_implementations = "warn"
19+
rust.missing_docs = "warn"
20+
rust.rust_2018_idioms = { level = "deny", priority = -1 }
21+
rust.unreachable_pub = "warn"
22+
rust.unused_must_use = "deny"
23+
rustdoc.all = "warn"
24+
25+
[workspace.lints.clippy]
26+
borrow_as_ptr = "warn"
27+
branches_sharing_code = "warn"
28+
clear_with_drain = "warn"
29+
cloned_instead_of_copied = "warn"
30+
collection_is_never_read = "warn"
31+
dbg_macro = "warn"
32+
derive_partial_eq_without_eq = "warn"
33+
doc_markdown = "warn"
34+
empty_line_after_doc_comments = "warn"
35+
empty_line_after_outer_attr = "warn"
36+
enum_glob_use = "warn"
37+
equatable_if_let = "warn"
38+
explicit_into_iter_loop = "warn"
39+
explicit_iter_loop = "warn"
40+
flat_map_option = "warn"
41+
from_iter_instead_of_collect = "warn"
42+
if_not_else = "warn"
43+
if_then_some_else_none = "warn"
44+
implicit_clone = "warn"
45+
imprecise_flops = "warn"
46+
iter_on_empty_collections = "warn"
47+
iter_on_single_items = "warn"
48+
iter_with_drain = "warn"
49+
iter_without_into_iter = "warn"
50+
large_stack_frames = "warn"
51+
manual_assert = "warn"
52+
manual_clamp = "warn"
53+
manual_is_variant_and = "warn"
54+
manual_string_new = "warn"
55+
match_same_arms = "warn"
56+
missing_const_for_fn = "warn"
57+
mutex_integer = "warn"
58+
naive_bytecount = "warn"
59+
needless_bitwise_bool = "warn"
60+
needless_continue = "warn"
61+
needless_for_each = "warn"
62+
needless_pass_by_ref_mut = "warn"
63+
nonstandard_macro_braces = "warn"
64+
option_as_ref_cloned = "warn"
65+
or_fun_call = "warn"
66+
path_buf_push_overwrite = "warn"
67+
read_zero_byte_vec = "warn"
68+
redundant_clone = "warn"
69+
redundant_else = "warn"
70+
single_char_pattern = "warn"
71+
string_lit_as_bytes = "warn"
72+
string_lit_chars_any = "warn"
73+
suboptimal_flops = "warn"
74+
suspicious_operation_groupings = "warn"
75+
trailing_empty_array = "warn"
76+
trait_duplication_in_bounds = "warn"
77+
transmute_undefined_repr = "warn"
78+
trivial_regex = "warn"
79+
tuple_array_conversions = "warn"
80+
type_repetition_in_bounds = "warn"
81+
uninhabited_references = "warn"
82+
unnecessary_self_imports = "warn"
83+
unnecessary_struct_initialization = "warn"
84+
unnested_or_patterns = "warn"
85+
unused_peekable = "warn"
86+
unused_rounding = "warn"
87+
use_self = "warn"
88+
useless_let_if_seq = "warn"
89+
while_float = "warn"
90+
zero_sized_map_values = "warn"
91+
92+
as_ptr_cast_mut = "allow"
93+
cognitive_complexity = "allow"
94+
debug_assert_with_mut_call = "allow"
95+
fallible_impl_from = "allow"
96+
future_not_send = "allow"
97+
needless_collect = "allow"
98+
non_send_fields_in_send_ty = "allow"
99+
redundant_pub_crate = "allow"
100+
significant_drop_in_scrutinee = "allow"
101+
significant_drop_tightening = "allow"
102+
too_long_first_doc_paragraph = "allow"
103+
104+
[workspace.dependencies]
105+
# alloy
106+
alloy-primitives = { version = "0.8.15", default-features = false }
107+
108+
# reth
109+
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
110+
111+
# reth-scroll
112+
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false }
113+
114+
# misc
115+
eyre = "0.6"
116+
serde = { version = "1.0", default-features = false }
117+
tokio = { version = "1.39", default-features = false }
118+
tracing = "0.1.0"
119+
120+
[patch.crates-io]
121+
revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v53" }
122+
revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v53" }
123+
revm-interpreter = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v53" }
124+
125+
ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" }
126+
127+
alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.3.2" }

crates/engine/Cargo.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
name = "engine"
3+
version.workspace = true
4+
edition.workspace = true
5+
rust-version.workspace = true
6+
license.workspace = true
7+
exclude.workspace = true
8+
9+
[lints]
10+
workspace = true
11+
12+
[dependencies]
13+
# alloy
14+
alloy-eips = { version = "0.9.2", default-features = false }
15+
alloy-primitives.workspace = true
16+
alloy-rpc-types-engine = { version = "0.9.2", default-features = false }
17+
18+
# reth
19+
reth-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", default-features = false, features = ["scroll"] }
20+
reth-primitives = { workspace = true, features = ["scroll"] }
21+
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", default-features = false, features = ["client"] }
22+
23+
# reth-scroll
24+
reth-scroll-primitives = { workspace = true, features = ["serde"] }
25+
26+
# misc
27+
eyre.workspace = true
28+
serde = { workspace = true, features = ["derive"] }
29+
tokio.workspace = true
30+
tracing.workspace = true
31+
32+
# test-utils
33+
arbitrary = { version = "1.3", optional = true }
34+
35+
[dev-dependencies]
36+
arbitrary = "1.3"
37+
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git" }
38+
39+
[features]
40+
arbitrary = [
41+
"alloy-primitives/arbitrary",
42+
"reth-primitives/arbitrary"
43+
]
44+
test_utils = [
45+
"arbitrary",
46+
"dep:arbitrary"
47+
]

crates/engine/src/block_info.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use alloy_primitives::B256;
2+
use alloy_rpc_types_engine::ExecutionPayload;
3+
4+
/// Information about a block.
5+
#[derive(Debug, Copy, Clone)]
6+
pub struct BlockInfo {
7+
/// The block number.
8+
pub number: u64,
9+
/// The block hash.
10+
pub hash: B256,
11+
}
12+
13+
impl From<ExecutionPayload> for BlockInfo {
14+
fn from(value: ExecutionPayload) -> Self {
15+
(&value).into()
16+
}
17+
}
18+
19+
impl From<&ExecutionPayload> for BlockInfo {
20+
fn from(value: &ExecutionPayload) -> Self {
21+
Self { number: value.block_number(), hash: value.block_hash() }
22+
}
23+
}

0 commit comments

Comments
 (0)