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

feat: extract wallet api to own service #90

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
21 changes: 20 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"bin/odyssey/",
"bin/relay/",
"crates/node",
"crates/e2e-tests",
"crates/wallet",
Expand Down
1 change: 0 additions & 1 deletion bin/odyssey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ alloy-signer-local.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true
odyssey-node.workspace = true
odyssey-wallet.workspace = true
odyssey-walltime.workspace = true
eyre.workspace = true
tracing.workspace = true
Expand Down
31 changes: 0 additions & 31 deletions bin/odyssey/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use alloy_signer_local::PrivateKeySigner;
use clap::Parser;
use eyre::Context;
use odyssey_node::{chainspec::OdysseyChainSpecParser, node::OdysseyNode};
use odyssey_wallet::{OdysseyWallet, OdysseyWalletApiServer};
use odyssey_walltime::{OdysseyWallTime, OdysseyWallTimeRpcApiServer};
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
use reth_optimism_cli::Cli;
Expand All @@ -56,36 +55,6 @@ fn main() {
.with_components(OdysseyNode::components(&rollup_args))
.with_add_ons(OpAddOns::new(rollup_args.sequencer_http.clone()))
.extend_rpc_modules(move |ctx| {
// register odyssey wallet namespace
if let Ok(sk) = std::env::var("EXP1_SK") {
Comment on lines -59 to -60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my guess is we want to have a way to both run it as part of the node, and as a separate service?

Copy link
Member Author

@onbjerg onbjerg Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, although it won't use the mempool apis as it does now so it's gonna be a bit jank

let signer: PrivateKeySigner =
sk.parse().wrap_err("Invalid EXP0001 secret key.")?;
let wallet = EthereumWallet::from(signer);

let raw_delegations = std::env::var("EXP1_WHITELIST")
.wrap_err("No EXP0001 delegations specified")?;
let valid_delegations: Vec<Address> = raw_delegations
.split(',')
.map(|addr| Address::parse_checksummed(addr, None))
.collect::<Result<_, _>>()
.wrap_err("No valid EXP0001 delegations specified")?;

ctx.modules.merge_configured(
OdysseyWallet::new(
ctx.provider().clone(),
wallet,
ctx.registry.eth_api().clone(),
ctx.config().chain.chain().id(),
valid_delegations,
)
.into_rpc(),
)?;

info!(target: "reth::cli", "EXP0001 wallet configured");
} else {
warn!(target: "reth::cli", "EXP0001 wallet not configured");
}

let walltime = OdysseyWallTime::spawn(ctx.provider().canonical_state_stream());
ctx.modules.merge_configured(walltime.into_rpc())?;
info!(target: "reth::cli", "Walltime configured");
Expand Down
45 changes: 45 additions & 0 deletions bin/relay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "odyssey-relay"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
description = "Odyssey Relay is an EIP-7702 native transaction batcher and sponsor."

[lints]
workspace = true

[dependencies]
alloy-signer-local.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true
odyssey-node.workspace = true
odyssey-wallet.workspace = true
odyssey-walltime.workspace = true
eyre.workspace = true
tracing.workspace = true
reth-cli-util.workspace = true
reth-node-builder.workspace = true
reth-optimism-node.workspace = true
reth-optimism-cli.workspace = true
reth-provider.workspace = true
clap = { workspace = true, features = ["derive"] }

[features]
default = ["jemalloc"]

asm-keccak = ["reth-optimism-cli/asm-keccak"]

jemalloc = ["reth-cli-util/jemalloc"]
jemalloc-prof = ["jemalloc", "reth-cli-util/jemalloc-prof"]

min-error-logs = ["tracing/release_max_level_error"]
min-warn-logs = ["tracing/release_max_level_warn"]
min-info-logs = ["tracing/release_max_level_info"]
min-debug-logs = ["tracing/release_max_level_debug"]
min-trace-logs = ["tracing/release_max_level_trace"]

[[bin]]
name = "odyssey"
path = "src/main.rs"
5 changes: 5 additions & 0 deletions bin/relay/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//! # Odyssey Relay
//!
//! TBD
#[doc(hidden)]
fn main() {}
Loading