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

Static ip and port and modified kurtosis fork usage (for exex L2 RPC endpoint) #33

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,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_http_and_custom_exex_values())
.set_dev(true);

let NodeHandle { node, node_exit_future: _ } = NodeBuilder::new(node_config.clone())
Expand Down
17 changes: 13 additions & 4 deletions crates/node/core/src/args/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ impl RpcServerArgs {
self
}

// Enables the HTTP-RPC server.
pub fn with_http_and_custom_exex_values(mut self) -> Self {
Brechtpd marked this conversation as resolved.
Show resolved Hide resolved
self.http = true;
self.http_addr = Ipv4Addr::new(0,0,0,0).into();
self.http_port= 10110u16;
self.ws_port= 10111u16;
self
}

/// Enables the WS-RPC server.
pub const fn with_ws(mut self) -> Self {
self.ws = true;
Expand Down Expand Up @@ -274,19 +283,19 @@ impl RpcServerArgs {
impl Default for RpcServerArgs {
fn default() -> Self {
Self {
http: false,
Brechtpd marked this conversation as resolved.
Show resolved Hide resolved
http: true,
http_addr: Ipv4Addr::LOCALHOST.into(),
http_port: constants::DEFAULT_HTTP_RPC_PORT,
http_api: None,
http_corsdomain: None,
ws: false,
ws_addr: Ipv4Addr::LOCALHOST.into(),
ws: true,
ws_addr: Ipv4Addr::LOCALHOST.into(),//Ipv4Addr::new(0,0,0,0).into(),
ws_port: constants::DEFAULT_WS_RPC_PORT,
ws_allowed_origins: None,
ws_api: None,
ipcdisable: false,
ipcpath: constants::DEFAULT_IPC_ENDPOINT.to_string(),
auth_addr: Ipv4Addr::LOCALHOST.into(),
auth_addr: Ipv4Addr::LOCALHOST.into(),//Ipv4Addr::new(0,0,0,0).into(),
auth_port: constants::DEFAULT_AUTH_PORT,
auth_jwtsecret: None,
auth_ipc: false,
Expand Down
7 changes: 7 additions & 0 deletions crates/node/core/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ impl NodeConfig {
/// Set the rpc args for the node
pub fn with_rpc(mut self, rpc: RpcServerArgs) -> Self {
self.rpc = rpc;
let new_rpc = self.rpc.clone();

println!("Server details:");

println!("{:?}", new_rpc.http_addr);
println!("{:?}", new_rpc.http_port);

self
}

Expand Down
12 changes: 3 additions & 9 deletions packages/protocol/scripts/setup_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ 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:"
# echo "$KURTOSIS_OUTPUT"
echo "Kurtosis Output:"
echo "$KURTOSIS_OUTPUT"

# Extract the "User Services" section
USER_SERVICES_SECTION=$(echo "$KURTOSIS_OUTPUT" | awk '/^========================================== User Services ==========================================/{flag=1;next}/^$/{flag=0}flag')
Expand All @@ -99,15 +99,13 @@ echo "$USER_SERVICES_SECTION"

# Extract the dynamic port assigned to the rpc service for "el-1-reth-lighthouse"
RPC_PORT=$(echo "$USER_SERVICES_SECTION" | grep -A 5 "el-1-reth-lighthouse" | grep "rpc: 8545/tcp" | sed -E 's/.* -> 127.0.0.1:([0-9]+).*/\1/')

if [ -z "$RPC_PORT" ]; then
echo "Failed to extract RPC port from User Services section."
exit 1
else
echo "Extracted RPC port: $RPC_PORT"
echo "$RPC_PORT" > /tmp/kurtosis_rpc_port
fi

# Load the .env file and extract the PRIVATE_KEY
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
Expand All @@ -116,16 +114,12 @@ else
echo ".env file not found. Please create a .env file with your PRIVATE_KEY."
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY not found in the .env file."
exit 1
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."
Loading