Skip to content

Commit

Permalink
Merge pull request #33 from taikoxyz/l2_node_rpc_issue
Browse files Browse the repository at this point in the history
Static ip and port and modified kurtosis fork usage (for exex L2 RPC endpoint)
  • Loading branch information
adaki2004 authored Sep 2, 2024
2 parents eaa81f5 + 7125b8b commit 9c3c1cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use reth_provider::providers::BlockchainProvider;
use reth_rpc_api::{eth::{helpers::AddDevSigners, FullEthApiServer}, EngineApiClient};
use reth_tasks::TaskManager;
use reth_transaction_pool::{blobstore::DiskFileBlobStore, CoinbaseTipOrdering, EthPooledTransaction, EthTransactionValidator, Pool, TransactionValidationTaskExecutor};
use traits::RpcServerArgsExEx;
use std::{future::Future, marker::PhantomData, pin::Pin, sync::Arc};

use alloy_rlp::Decodable;
Expand Down Expand Up @@ -278,7 +279,7 @@ fn main() -> eyre::Result<()> {
.with_chain(chain_spec.clone())
.with_network(network_config.clone())
.with_unused_ports()
.with_rpc(RpcServerArgs::default().with_unused_ports().with_http())
.with_rpc(RpcServerArgs::default().with_unused_ports().with_static_l2_rpc_ip_and_port())
.set_dev(true);

let NodeHandle { node, node_exit_future: _ } = NodeBuilder::new(node_config.clone())
Expand Down
16 changes: 16 additions & 0 deletions bin/reth/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::net::Ipv4Addr;

use alloy_consensus::TxEnvelope;
use alloy_network::eip2718::Decodable2718;
use reth::{
Expand All @@ -10,8 +12,11 @@ use reth::{
server_types::eth::EthResult,
},
};
use reth_node_core::args::RpcServerArgs;
use reth_primitives::{Bytes, B256};

use crate::traits::RpcServerArgsExEx;

pub struct RpcTestContext<Node: FullNodeComponents, EthApi> {
pub inner: RpcRegistry<Node, EthApi>,
}
Expand All @@ -33,3 +38,14 @@ where
Ok(TxEnvelope::decode_2718(&mut tx.as_ref()).unwrap())
}
}

impl RpcServerArgsExEx for RpcServerArgs {
fn with_static_l2_rpc_ip_and_port(mut self) -> Self {
self.http = true;
// On the instance the program is running, we wanna have 10111 exposed as the (exex) L2's RPC port.
self.http_addr = Ipv4Addr::new(0, 0, 0, 0).into();
self.http_port = 10110u16;
self.ws_port = 10111u16;
self
}
}
3 changes: 3 additions & 0 deletions bin/reth/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ impl PayloadEnvelopeExt for ExecutionPayloadEnvelopeV3 {
self.execution_payload.clone()
}
}
pub trait RpcServerArgsExEx {
fn with_static_l2_rpc_ip_and_port(self) -> Self;
}
4 changes: 1 addition & 3 deletions packages/protocol/scripts/setup_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fi

# Run the Kurtosis command and capture its output
echo "Running Kurtosis command..."
KURTOSIS_OUTPUT=$(kurtosis run github.com/ethpandaops/ethereum-package --args-file ./scripts/confs/network_params.yaml)
KURTOSIS_OUTPUT=$(kurtosis run github.com/adaki2004/ethereum-package --args-file ./scripts/confs/network_params.yaml)

# Print the entire Kurtosis output for debugging
# echo "Kurtosis Output:"
Expand Down Expand Up @@ -124,8 +124,6 @@ fi

# Run the forge foundry script using the extracted RPC port and PRIVATE_KEY
FORGE_COMMAND="forge script --rpc-url http://127.0.0.1:$RPC_PORT scripts/DeployL1Locally.s.sol -vvvv --broadcast --private-key $PRIVATE_KEY --legacy"

echo "Running forge foundry script..."
eval $FORGE_COMMAND

echo "Script execution completed."

0 comments on commit 9c3c1cc

Please sign in to comment.