From 04d0e3be249a4feb0f70771e57c09a661d613d00 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Wed, 18 Sep 2024 14:00:20 +1000 Subject: [PATCH 01/32] feat: add Dockerfile for avs contract deployment and avs, add env sample file --- .env.sample | 16 ++++++++++++++++ Dockerfile | 25 +++++++++++++++++++++++++ avs-deploy | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .env.sample create mode 100644 Dockerfile create mode 100644 avs-deploy diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..10dddd6 --- /dev/null +++ b/.env.sample @@ -0,0 +1,16 @@ +AVS_NODE_ECDSA_PRIVATE_KEY= +AVS_PRECONF_TASK_MANAGER_CONTRACT_ADDRESS=0x6064f756f7F3dc8280C1CfA01cE41a37B5f16df1 +AVS_DIRECTORY_CONTRACT_ADDRESS=0x7E2E7DD2Aead92e2e6d05707F21D4C36004f8A2B +AVS_SERVICE_MANAGER_CONTRACT_ADDRESS=0x1912A7496314854fB890B1B88C0f1Ced653C1830 +AVS_PRECONF_REGISTRY_CONTRACT_ADDRESS=0x9D2ea2038CF6009F1Bc57E32818204726DfA63Cd +EIGEN_LAYER_STRATEGY_MANAGER_CONTRACT_ADDRESS=0xaDe68b4b6410aDB1578896dcFba75283477b6b01 +EIGEN_LAYER_SLASHER_CONTRACT_ADDRESS=0x86A0679C7987B5BA9600affA994B78D0660088ff +VALIDATOR_PUBKEY= +VALIDATOR_BLS_PRIVATEKEY= +TAIKO_CHAIN_ID=167000 +VALIDATOR_INDEX= +TAIKO_PROPOSER_URL=http://localhost:1234 +TAIKO_DRIVER_URL=http://localhost:1235 +MEV_BOOST_URL=http://139.162.249.67:33423 +L1_RPC_URL=http://139.162.249.67:32002 +L1_BEACON_URL=http://139.162.249.67:32002 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4315952 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM rust:1.77 as builder + +# Set the working directory inside the container +WORKDIR /usr/src/taiko_preconf_avs_node + +# Copy the project files +COPY taiko_preconf_avs_node/ . + +# Copy the dependency directory +COPY ../p2pNode/p2pNetwork /usr/src/p2pNode/p2pNetwork + +# Build the project in release mode +RUN cargo build -p taiko_preconf_avs_node --release + +# Use ubuntu as the base image +FROM ubuntu:latest + +# Copy the build artifact from the builder stage +COPY --from=builder /usr/src/taiko_preconf_avs_node/target/release/taiko_preconf_avs_node /usr/local/bin/taiko_preconf_avs_node + +# Expose the port that the server will run on +# EXPOSE 9000 + +# Run the binary +CMD ["taiko_preconf_avs_node"] diff --git a/avs-deploy b/avs-deploy new file mode 100644 index 0000000..9e92bc7 --- /dev/null +++ b/avs-deploy @@ -0,0 +1,35 @@ +# Use an official Node.js runtime as a parent image +FROM node:18 + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Copy the current directory contents into the container at /usr/src/app +COPY . . + +# Install Foundry (forge) +RUN curl -L https://foundry.paradigm.xyz | bash && \ + /root/.foundry/bin/foundryup + +# Change the working directory to packages/protocol +WORKDIR /usr/src/app/SmartContracts/ + +# Forge Install +RUN /root/.foundry/bin/forge install + +# Add Foundry to PATH +ENV PATH="/root/.foundry/bin:${PATH}" + +# Change the working directory to packages/protocol +WORKDIR /usr/src/app/SmartContracts/ + +# Make the script files executable +RUN chmod +x scripts/deployment/*.sh + +# Set environment variables +ENV PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 +ENV FORK_URL="http://139.162.249.67:32002" +ENV BEACON_GENESIS_TIMESTAMP=1725950369 + +# Default command to run if no arguments are provided +CMD ["sh", "-c", "scripts/deployment/deploy_avs.sh"] \ No newline at end of file From 8b974cfa5a15bcabf9f716e1ee1478dd46bb46f3 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Thu, 19 Sep 2024 10:17:50 +1000 Subject: [PATCH 02/32] debug: add temp env --- .env.sample | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.env.sample b/.env.sample index 10dddd6..18b5409 100644 --- a/.env.sample +++ b/.env.sample @@ -5,12 +5,12 @@ AVS_SERVICE_MANAGER_CONTRACT_ADDRESS=0x1912A7496314854fB890B1B88C0f1Ced653C1830 AVS_PRECONF_REGISTRY_CONTRACT_ADDRESS=0x9D2ea2038CF6009F1Bc57E32818204726DfA63Cd EIGEN_LAYER_STRATEGY_MANAGER_CONTRACT_ADDRESS=0xaDe68b4b6410aDB1578896dcFba75283477b6b01 EIGEN_LAYER_SLASHER_CONTRACT_ADDRESS=0x86A0679C7987B5BA9600affA994B78D0660088ff -VALIDATOR_PUBKEY= -VALIDATOR_BLS_PRIVATEKEY= -TAIKO_CHAIN_ID=167000 -VALIDATOR_INDEX= -TAIKO_PROPOSER_URL=http://localhost:1234 -TAIKO_DRIVER_URL=http://localhost:1235 -MEV_BOOST_URL=http://139.162.249.67:33423 +VALIDATOR_PUBKEY=0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f +VALIDATOR_BLS_PRIVATEKEY=1c511df0a39ec614499b08cf284d2d1d1aec3c231809c1c5688a4daab09f7752 +TAIKO_CHAIN_ID=167 +VALIDATOR_INDEX=7 +TAIKO_PROPOSER_URL=http://139.162.249.67:1234 +TAIKO_DRIVER_URL=http://139.162.249.67:1235 +MEV_BOOST_URL=http://139.162.249.67:33467 L1_RPC_URL=http://139.162.249.67:32002 L1_BEACON_URL=http://139.162.249.67:32002 From 567c1864c5b764ae763b96ddb35f086239e8da30 Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Thu, 19 Sep 2024 10:22:41 +1000 Subject: [PATCH 03/32] debug: add temp beancon genesis time and fork url --- SmartContracts/scripts/deployment/deploy_avs.sh | 4 ++-- SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SmartContracts/scripts/deployment/deploy_avs.sh b/SmartContracts/scripts/deployment/deploy_avs.sh index 080cd28..4bad2ce 100644 --- a/SmartContracts/scripts/deployment/deploy_avs.sh +++ b/SmartContracts/scripts/deployment/deploy_avs.sh @@ -1,13 +1,13 @@ set -e export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 -export FORK_URL= +export FORK_URL="http://139.162.249.67:32002" AVS_DIRECTORY=0x7E2E7DD2Aead92e2e6d05707F21D4C36004f8A2B \ SLASHER=0x86A0679C7987B5BA9600affA994B78D0660088ff \ TAIKO_L1=0x086f77C5686dfe3F2f8FE487C5f8d357952C8556 \ TAIKO_TOKEN=0x422A3492e218383753D8006C7Bfa97815B44373F \ -BEACON_GENESIS_TIMESTAMP=1725950369 \ +BEACON_GENESIS_TIMESTAMP=1726663179 \ BEACON_BLOCK_ROOT_CONTRACT=0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02 \ forge script scripts/deployment/DeployAVS.s.sol:DeployAVS \ --fork-url $FORK_URL \ diff --git a/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh b/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh index 5574ede..f07b96f 100644 --- a/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh +++ b/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh @@ -1,7 +1,7 @@ set -e export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 -export FORK_URL= +export FORK_URL="http://139.162.249.67:32002" forge script scripts/deployment/DeployEigenlayerMVP.s.sol:DeployEigenlayerMVP \ --rpc-url $FORK_URL \ From dafd6227a1b5f4fb7bc7e9e9c0dc7e00d3ffe2da Mon Sep 17 00:00:00 2001 From: nmjustinchan Date: Thu, 19 Sep 2024 10:50:48 +1000 Subject: [PATCH 04/32] fix: update rust lib --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4315952..bf6e816 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM rust:1.77 as builder +FROM docker.io/library/rust:1.79 as builder # Set the working directory inside the container WORKDIR /usr/src/taiko_preconf_avs_node # Copy the project files -COPY taiko_preconf_avs_node/ . +COPY ../Node /usr/src/taiko_preconf_avs_node/ # Copy the dependency directory COPY ../p2pNode/p2pNetwork /usr/src/p2pNode/p2pNetwork From d5d7f986bfa236297a2fb795541eccafe388d8a3 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 19 Sep 2024 11:14:33 +0200 Subject: [PATCH 05/32] logging improved, read lookahead at before preconf loop --- Node/src/main.rs | 14 +++++++++++--- Node/src/node/mod.rs | 10 +++++++++- Node/src/node/operator.rs | 7 +++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Node/src/main.rs b/Node/src/main.rs index 0812311..ad7d550 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -99,7 +99,15 @@ async fn main() -> Result<(), Error> { } fn init_logging() { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::DEBUG) - .init(); + use tracing_subscriber::{fmt, EnvFilter}; + + let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| { + EnvFilter::new("debug") + .add_directive("reqwest=info".parse().unwrap()) + .add_directive("hyper=info".parse().unwrap()) + .add_directive("alloy_transport=info".parse().unwrap()) + .add_directive("alloy_rpc_client=info".parse().unwrap()) + }); + + fmt().with_env_filter(filter).init(); } diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index af6d407..1d11faf 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -277,6 +277,14 @@ impl Node { // Synchronize with L1 Slot Start Time let duration_to_next_slot = self.ethereum_l1.slot_clock.duration_to_next_slot().unwrap(); sleep(duration_to_next_slot).await; + + if let Err(err) = self.operator.update_preconfer_lookahead_for_epoch().await { + tracing::error!( + "Failed to update preconfer lookahead before starting preconfirmation loop: {}", + err + ); + } + // start preconfirmation loop let mut interval = tokio::time::interval(Duration::from_secs(self.l2_slot_duration_sec)); loop { @@ -316,7 +324,7 @@ impl Node { } async fn new_epoch_started(&mut self, new_epoch: u64) -> Result<(), Error> { - tracing::debug!("Current epoch changed from {} to {}", self.epoch, new_epoch); + tracing::info!("Current epoch changed from {} to {}", self.epoch, new_epoch); self.epoch = new_epoch; self.operator = Operator::new(self.ethereum_l1.clone(), new_epoch)?; diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index 08d0741..bfee606 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -105,6 +105,13 @@ impl Operator { } pub async fn update_preconfer_lookahead_for_epoch(&mut self) -> Result<(), Error> { + tracing::debug!( + "Updating preconfer lookahead for epoch: {}", + self.ethereum_l1 + .slot_clock + .get_epoch_for_timestamp(self.epoch_begin_timestamp)? + ); + if let Some(lookahead_preconfer_addresses_next_epoch) = self.lookahead_preconfer_addresses_next_epoch.take() { From 6a09799822d3929a257856a0445db6783740afba Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 19 Sep 2024 11:15:53 +0200 Subject: [PATCH 06/32] rust:1.80 docker file --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bf6e816..f213746 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/rust:1.79 as builder +FROM docker.io/library/rust:1.80 as builder # Set the working directory inside the container WORKDIR /usr/src/taiko_preconf_avs_node From efcdd7b568858eab764fc9339e6ee1e1d6de60e5 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 19 Sep 2024 12:04:06 +0200 Subject: [PATCH 07/32] entrypoint instead of cmd in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f213746..3fe2d38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,4 +22,4 @@ COPY --from=builder /usr/src/taiko_preconf_avs_node/target/release/taiko_preconf # EXPOSE 9000 # Run the binary -CMD ["taiko_preconf_avs_node"] +ENTRYPOINT ["taiko_preconf_avs_node"] From 829227d09c05fa5fe53531b03241138d1cbe9c9d Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 19 Sep 2024 15:14:40 +0200 Subject: [PATCH 08/32] Coping only needed sources for docker build --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3fe2d38..f66a480 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -FROM docker.io/library/rust:1.80 as builder +FROM docker.io/library/rust:1.80 AS builder # Set the working directory inside the container WORKDIR /usr/src/taiko_preconf_avs_node # Copy the project files -COPY ../Node /usr/src/taiko_preconf_avs_node/ +COPY ../Node/src /usr/src/taiko_preconf_avs_node/src +COPY ../Node/Cargo.toml /usr/src/taiko_preconf_avs_node/Cargo.toml +COPY ../Node/Cargo.lock /usr/src/taiko_preconf_avs_node/Cargo.lock # Copy the dependency directory COPY ../p2pNode/p2pNetwork /usr/src/p2pNode/p2pNetwork From 4bd82c403891412a65e1c20f21b35fdb9cd9791b Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 19 Sep 2024 16:28:20 +0200 Subject: [PATCH 09/32] Dockerfile with cache for faster builds --- Dockerfile_cache | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile_cache diff --git a/Dockerfile_cache b/Dockerfile_cache new file mode 100644 index 0000000..60e9da2 --- /dev/null +++ b/Dockerfile_cache @@ -0,0 +1,29 @@ +FROM docker.io/library/rust:1.80 AS builder + +# Set the working directory inside the container +WORKDIR /usr/src/taiko_preconf_avs_node + +# Copy the project files +COPY ../Node/src /usr/src/taiko_preconf_avs_node/src +COPY ../Node/Cargo.toml /usr/src/taiko_preconf_avs_node/Cargo.toml +COPY ../Node/Cargo.lock /usr/src/taiko_preconf_avs_node/Cargo.lock + +# Copy the dependency directory +COPY ../p2pNode/p2pNetwork /usr/src/p2pNode/p2pNetwork + +# Build the project in release mode +RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/usr/src/taiko_preconf_avs_node/target \ + cargo build -p taiko_preconf_avs_node --release && \ + mv /usr/src/taiko_preconf_avs_node/target/release/taiko_preconf_avs_node /root + +# Use ubuntu as the base image +FROM ubuntu:latest + +# Copy the build artifact from the builder stage +COPY --from=builder /root/taiko_preconf_avs_node /usr/local/bin/taiko_preconf_avs_node + +# Expose the port that the server will run on +# EXPOSE 9000 + +# Run the binary +ENTRYPOINT ["taiko_preconf_avs_node"] From 10f3dfba7cdf5e4b91c99091b6f2e21f2f280011 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 20 Sep 2024 14:17:22 +0200 Subject: [PATCH 10/32] Better error handling for the registration --- Node/src/ethereum_l1/execution_layer.rs | 75 +++++++++++++++-------- Node/src/ethereum_l1/mod.rs | 1 + Node/src/ethereum_l1/registration.rs | 80 +++++++++++++++++++++++++ Node/src/ethereum_l1/ws_provider.rs | 2 +- 4 files changed, 131 insertions(+), 27 deletions(-) create mode 100644 Node/src/ethereum_l1/registration.rs diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 7be41cf..01af7b4 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -4,8 +4,8 @@ use super::{ }; use crate::{ bls::BLSService, - utils::{config, types::*}, ethereum_l1::ws_provider::WsProvider, + utils::{config, types::*}, }; use alloy::{ consensus::TypedTransaction, @@ -290,31 +290,44 @@ impl ExecutionLayer { } pub async fn register_preconfer(&self) -> Result<(), Error> { + tracing::debug!("Registering preconfer"); let strategy_manager = StrategyManager::new( self.contract_addresses.eigen_layer.strategy_manager, &self.provider_ws, ); let one_eth = U256::from(1000000000000000000u64); - let tx_hash = strategy_manager + match strategy_manager .depositIntoStrategy(Address::ZERO, Address::ZERO, one_eth) .value(one_eth) .send() - .await? - .watch() - .await?; - tracing::debug!("Deposited into strategy: {tx_hash}"); + .await + { + Ok(receipt) => { + let tx_hash = receipt.watch().await?; + tracing::info!("Deposited into strategy: {tx_hash}"); + } + Err(err) => { + tracing::error!("Depositing into strategy failed: {}", err); + } + } let slasher = Slasher::new( self.contract_addresses.eigen_layer.slasher, &self.provider_ws, ); - let tx_hash = slasher + match slasher .optIntoSlashing(self.contract_addresses.avs.service_manager) .send() - .await? - .watch() - .await?; - tracing::debug!("Opted into slashing: {tx_hash}"); + .await + { + Ok(receipt) => { + let tx_hash = receipt.watch().await?; + tracing::info!("Opted into slashing: {tx_hash}"); + } + Err(err) => { + tracing::error!("Opting into slashing failed: {}", err); + } + } let salt = Self::create_random_salt(); let avs_directory = @@ -348,13 +361,18 @@ impl ExecutionLayer { self.contract_addresses.avs.preconf_registry, &self.provider_ws, ); - let tx_hash = preconf_registry - .registerPreconfer(signature_with_salt_and_expiry) - .send() - .await? - .watch() - .await?; - tracing::debug!("Registered preconfirming: {tx_hash}"); + let tx = preconf_registry.registerPreconfer(signature_with_salt_and_expiry); + + match tx.send().await { + Ok(receipt) => { + let tx_hash = receipt.watch().await?; + tracing::info!("Preconfer registered: {:?}", tx_hash); + } + Err(err) => { + let err = super::registration::decode_register_preconfer_error(&err.to_string())?; + return Err(anyhow::anyhow!("Registering preconfer failed: {}", err)); + } + } Ok(()) } @@ -590,13 +608,18 @@ impl ExecutionLayer { self.contract_addresses.avs.preconf_registry, &self.provider_ws, ); - let tx_hash = preconf_registry - .addValidators(params) - .send() - .await? - .watch() - .await?; - tracing::debug!("Add validator to preconfer: {tx_hash}"); + let tx = preconf_registry.addValidators(params); + + match tx.send().await { + Ok(receipt) => { + let tx_hash = receipt.watch().await?; + tracing::info!("Add validator to preconfer successful: {:?}", tx_hash); + } + Err(err) => { + let err = super::registration::decode_add_validator_error(&err.to_string())?; + return Err(anyhow::anyhow!("Adding validator failed: {}", err)); + } + } Ok(()) } @@ -634,7 +657,7 @@ impl ExecutionLayer { } } Err(e) => { - tracing::error!("Error receiving log: {:?}", e); + tracing::error!("Error receiving log: {}", e); } } } diff --git a/Node/src/ethereum_l1/mod.rs b/Node/src/ethereum_l1/mod.rs index 3eb4fc0..13f548a 100644 --- a/Node/src/ethereum_l1/mod.rs +++ b/Node/src/ethereum_l1/mod.rs @@ -3,6 +3,7 @@ pub mod consensus_layer; mod el_with_cl_tests; pub mod execution_layer; pub mod merkle_proofs; +mod registration; pub mod slot_clock; mod ws_provider; diff --git a/Node/src/ethereum_l1/registration.rs b/Node/src/ethereum_l1/registration.rs new file mode 100644 index 0000000..d1838f4 --- /dev/null +++ b/Node/src/ethereum_l1/registration.rs @@ -0,0 +1,80 @@ +use anyhow::Error; + +const PRECONF_NOT_REGISTERED: &[u8] = b"PreconferNotRegistered()"; +const VALIDATOR_ALREADY_ACTIVE: &[u8] = b"ValidatorAlreadyActive()"; + +// the error is e.g. "Reverted ;l_$" +// second part is first 4 bytes of keccak encoded +// error string +pub fn decode_add_validator_error(error: &str) -> Result { + let error_bytes = error.as_bytes(); + if error_bytes.len() < 13 { + return Err(anyhow::anyhow!( + "Error string is too short for addValidator error" + )); + } + let error_selector = &error_bytes[error_bytes.len() - 4..]; + + let preconf_not_registered_selector: [u8; 4] = first_4_bytes_of_keccak(PRECONF_NOT_REGISTERED)?; + let validator_already_active_selector: [u8; 4] = + first_4_bytes_of_keccak(VALIDATOR_ALREADY_ACTIVE)?; + + if error_selector == preconf_not_registered_selector { + return Ok("Preconfer not registered".to_string()); + } + if error_selector == validator_already_active_selector { + return Ok("Validator already active".to_string()); + } + Err(anyhow::anyhow!( + "decode_add_validator_error: Unknown error: {}", + error + )) +} + +fn first_4_bytes_of_keccak(input: &[u8]) -> Result<[u8; 4], Error> { + Ok(crate::utils::bytes_tools::hash_bytes_with_keccak(input)[..4].try_into()?) +} + +const PRECONF_ALREADY_REGISTERED: &[u8] = b"PreconferAlreadyRegistered()"; + +pub fn decode_register_preconfer_error(error: &str) -> Result { + let error_bytes = error.as_bytes(); + if error_bytes.len() < 13 { + return Err(anyhow::anyhow!( + "Error string is too short for addValidator error" + )); + } + let error_selector = &error_bytes[error_bytes.len() - 4..]; + let preconf_already_registered_selector: [u8; 4] = + first_4_bytes_of_keccak(PRECONF_ALREADY_REGISTERED)?; + + if error_selector == preconf_already_registered_selector { + return Ok("Preconfer already registered".to_string()); + } + + Err(anyhow::anyhow!( + "decode_register_preconfer_error: Unknown error: {}", + error + )) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_check_add_validator_error() { + let preconf_not_registered_error = "Reverted ;l_$"; + let result = decode_add_validator_error(&preconf_not_registered_error); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "Preconfer not registered"); + } + + #[test] + fn test_check_register_preconfer_error() { + let preconf_already_registered_error = "Reverted þaM"; + let result = decode_register_preconfer_error(&preconf_already_registered_error); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "Preconfer already registered"); + } +} diff --git a/Node/src/ethereum_l1/ws_provider.rs b/Node/src/ethereum_l1/ws_provider.rs index 2269068..06c07c1 100644 --- a/Node/src/ethereum_l1/ws_provider.rs +++ b/Node/src/ethereum_l1/ws_provider.rs @@ -20,4 +20,4 @@ pub type WsProvider = alloy::providers::fillers::FillProvider< alloy::providers::RootProvider, PubSubFrontend, Ethereum, ->; \ No newline at end of file +>; From 77e83c544e345c43bd89298dfca874833efc44c1 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 20 Sep 2024 15:27:19 +0200 Subject: [PATCH 11/32] fixed call view function for registration --- Node/src/ethereum_l1/execution_layer.rs | 6 ++---- Node/src/utils/config.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 3b9d6d7..a63a307 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -341,12 +341,10 @@ impl ExecutionLayer { salt, expiration_timestamp, ) - .send() - .await? - .watch() + .call() .await?; - let digest_hash_bytes = digest_hash.to_vec(); + let digest_hash_bytes = digest_hash._0.to_vec(); // sign the digest hash with private key let signature = self.signer.sign_message_sync(&digest_hash_bytes)?; diff --git a/Node/src/utils/config.rs b/Node/src/utils/config.rs index bd6e3aa..15abdf1 100644 --- a/Node/src/utils/config.rs +++ b/Node/src/utils/config.rs @@ -126,7 +126,7 @@ impl Config { }; const TAIKO_L1_ADDRESS: &str = "TAIKO_L1_ADDRESS"; - let taiko_l1 = std::env::var(TAIKO_L1_ADDRESS).unwrap_or({ + let taiko_l1 = std::env::var(TAIKO_L1_ADDRESS).unwrap_or_else(|_| { warn!( "No TaikoL1 contract address found in {} env var, using default", TAIKO_L1_ADDRESS From f2109e678fb41d0e119b21db6c343b52700a597d Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 20 Sep 2024 16:17:53 +0200 Subject: [PATCH 12/32] fixed switching epoch at the beginning --- Node/src/node/mod.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index 2e816d4..c3d0776 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -67,8 +67,8 @@ impl Node { l2_slot_duration_sec: u64, bls_service: Arc, ) -> Result { - let current_epoch = ethereum_l1.slot_clock.get_current_epoch()?; - let operator = Operator::new(ethereum_l1.clone(), current_epoch)?; + let init_epoch = 0; + let operator = Operator::new(ethereum_l1.clone(), init_epoch)?; Ok(Self { taiko, node_block_proposed_rx: Some(node_rx), @@ -76,7 +76,7 @@ impl Node { p2p_to_node_rx: Some(p2p_to_node_rx), ethereum_l1, mev_boost, - epoch: current_epoch, + epoch: init_epoch, cl_lookahead: vec![], lookahead_preconfer_buffer: None, l2_slot_duration_sec, @@ -283,13 +283,6 @@ impl Node { tracing::error!("Failed to initialize lookahead: {}", e); } - if let Err(err) = self.operator.update_preconfer_lookahead_for_epoch().await { - tracing::error!( - "Failed to update preconfer lookahead before starting preconfirmation loop: {}", - err - ); - } - // start preconfirmation loop let mut interval = tokio::time::interval(Duration::from_secs(self.l2_slot_duration_sec)); loop { From 3f3e6d6dfaeebb5018408ce60ee24a90690874d4 Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Fri, 20 Sep 2024 21:18:31 +0200 Subject: [PATCH 13/32] Add CLI command for force pushing lookahead --- Node/src/ethereum_l1/mod.rs | 24 +++++++++++++++++++++++- Node/src/main.rs | 7 +++++++ Node/src/node/mod.rs | 25 +------------------------ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Node/src/ethereum_l1/mod.rs b/Node/src/ethereum_l1/mod.rs index 13f548a..20c3e9a 100644 --- a/Node/src/ethereum_l1/mod.rs +++ b/Node/src/ethereum_l1/mod.rs @@ -8,6 +8,7 @@ pub mod slot_clock; mod ws_provider; use crate::{bls::BLSService, utils::config::ContractAddresses}; +use anyhow::Error; use consensus_layer::ConsensusLayer; #[cfg(not(test))] use execution_layer::ExecutionLayer; @@ -37,7 +38,7 @@ impl EthereumL1 { preconf_registry_expiry_sec: u64, bls_service: Arc, l1_chain_id: u64, - ) -> Result { + ) -> Result { let consensus_layer = ConsensusLayer::new(consensus_rpc_url)?; let genesis_details = consensus_layer.get_genesis_details().await?; let slot_clock = Arc::new(SlotClock::new( @@ -64,4 +65,25 @@ impl EthereumL1 { execution_layer, }) } + + pub async fn force_push_lookahead(&self) -> Result<(), Error> { + // Get next epoch + let next_epoch = self.slot_clock.get_current_epoch()? + 1; + // Get CL lookahead for the next epoch + let cl_lookahead = self.consensus_layer.get_lookahead(next_epoch).await?; + // Get lookahead params for contract call + let lookahead_params = self + .execution_layer + .get_lookahead_params_for_epoch_using_cl_lookahead( + self.slot_clock.get_epoch_begin_timestamp(next_epoch)?, + &cl_lookahead, + ) + .await?; + // Force push lookahead to the contract + self.execution_layer + .force_push_lookahead(lookahead_params) + .await?; + + Ok(()) + } } diff --git a/Node/src/main.rs b/Node/src/main.rs index df5be06..a0cbda4 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -24,6 +24,8 @@ struct Cli { register: bool, #[clap(long, help = "Add validator to preconfer")] add_validator: bool, + #[clap(long, help = "Force Push lookahead to the PreconfTaskManager contract")] + force_push_lookahead: bool, } #[tokio::main] @@ -59,6 +61,11 @@ async fn main() -> Result<(), Error> { return Ok(()); } + if args.force_push_lookahead { + ethereum_l1.force_push_lookahead().await?; + return Ok(()); + } + let (node_to_p2p_tx, node_to_p2p_rx) = mpsc::channel(MESSAGE_QUEUE_SIZE); let (p2p_to_node_tx, p2p_to_node_rx) = mpsc::channel(MESSAGE_QUEUE_SIZE); let (block_proposed_tx, block_proposed_rx) = mpsc::channel(MESSAGE_QUEUE_SIZE); diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index c3d0776..c150f61 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -302,30 +302,7 @@ impl Node { .is_lookahead_tail_zero() .await?; if is_zero { - // Get next epoch - let next_epoch = self.ethereum_l1.slot_clock.get_current_epoch()? + 1; - // Get CL lookahead for the next epoch - self.cl_lookahead = self - .ethereum_l1 - .consensus_layer - .get_lookahead(next_epoch) - .await?; - // Get lookahead params for contract call - let lookahead_params = self - .ethereum_l1 - .execution_layer - .get_lookahead_params_for_epoch_using_cl_lookahead( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(next_epoch)?, - &self.cl_lookahead, - ) - .await?; - // Force push lookahead to the contract - self.ethereum_l1 - .execution_layer - .force_push_lookahead(lookahead_params) - .await?; + self.ethereum_l1.force_push_lookahead().await?; } Ok(()) } From 2ef5c7288cf15f8541a500beb37fa0ca71e3cb43 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Mon, 23 Sep 2024 12:00:52 +0200 Subject: [PATCH 14/32] gas limit increased to 500_000 --- Node/src/ethereum_l1/execution_layer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 14e16d4..0b00e12 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -252,7 +252,7 @@ impl ExecutionLayer { ) .chain_id(self.l1_chain_id) .nonce(nonce) - .gas(50_000) + .gas(500_000) .max_fee_per_gas(20_000_000_000) .max_priority_fee_per_gas(1_000_000_000); From 042214e850cac1ec028e0354274cc1e5a75f4707 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Tue, 24 Sep 2024 09:44:01 +0200 Subject: [PATCH 15/32] force update lookahead when no txs --- Node/src/ethereum_l1/mod.rs | 1 + Node/src/node/mod.rs | 49 +++++++++++++++++-------- Node/src/node/operator.rs | 7 +++- Node/src/node/preconfirmation_helper.rs | 4 ++ 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/Node/src/ethereum_l1/mod.rs b/Node/src/ethereum_l1/mod.rs index 20c3e9a..d6003b6 100644 --- a/Node/src/ethereum_l1/mod.rs +++ b/Node/src/ethereum_l1/mod.rs @@ -79,6 +79,7 @@ impl EthereumL1 { &cl_lookahead, ) .await?; + tracing::debug!("Got {} lookahead params.", lookahead_params.len()); // Force push lookahead to the contract self.execution_layer .force_push_lookahead(lookahead_params) diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index c150f61..40aa8b0 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -356,9 +356,7 @@ impl Node { Ok(()) } - async fn get_lookahead_params( - &mut self, - ) -> Result<(u64, Vec), Error> { + async fn get_lookahead_pointer(&mut self) -> Result { let current_timestamp = std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH)? .as_secs(); @@ -379,7 +377,14 @@ impl Node { "get_lookahead_params: Preconfer not found in lookahead" ))? as u64; + Ok(lookahead_pointer) + } + + async fn get_lookahead_params( + &mut self, + ) -> Result>, Error> { if self.operator.should_post_lookahead().await? { + tracing::debug!("Should post lookahead params, getting them"); let lookahead_params = self .ethereum_l1 .execution_layer @@ -391,10 +396,11 @@ impl Node { ) .await?; - return Ok((lookahead_pointer, lookahead_params)); - } + tracing::debug!("Got Lookahead params: {}", lookahead_params.len()); - Ok((lookahead_pointer, vec![])) + return Ok(Some(lookahead_params)); + } + Ok(None) } async fn preconfirm_last_slot(&mut self) -> Result<(), Error> { @@ -449,15 +455,27 @@ impl Node { self.ethereum_l1.slot_clock.get_current_slot()? ); - let (lookahead_pointer, lookahead_params) = self.get_lookahead_params().await?; - + let lookahead_params = self.get_lookahead_params().await?; let pending_tx_lists = self.taiko.get_pending_l2_tx_lists().await?; - if pending_tx_lists.tx_list_bytes.is_empty() { + let pending_tx_lists_bytes = if pending_tx_lists.tx_list_bytes.is_empty() { + if let Some(lookahead_params) = lookahead_params { + tracing::debug!("No pending transactions to preconfirm, force pushing lookahead"); + self.preconfirmation_helper.increment_nonce(); + self.ethereum_l1 + .execution_layer + .force_push_lookahead(lookahead_params) + .await?; + } return Ok(()); - } + } else { + tracing::debug!( + "Pending {} transactions to preconfirm", + pending_tx_lists.tx_list_bytes.len() + ); + pending_tx_lists.tx_list_bytes[0].clone() // TODO: handle multiple tx lists + }; let new_block_height = pending_tx_lists.parent_block_id + 1; - let nonce = self.preconfirmation_helper.get_next_nonce(); let (commit_hash, signature) = self.generate_commit_hash_and_signature(&pending_tx_lists, new_block_height)?; @@ -469,7 +487,7 @@ impl Node { let preconf_message = PreconfirmationMessage::new( new_block_height, pending_tx_lists.tx_lists.clone(), - &pending_tx_lists.tx_list_bytes[0], //TODO: handle rest tx lists + &pending_tx_lists_bytes, proof.clone(), ); self.send_preconfirmations_to_the_avs_p2p(preconf_message.clone()) @@ -478,15 +496,16 @@ impl Node { .advance_head_to_new_l2_block(pending_tx_lists.tx_lists) .await?; + let lookahead_pointer = self.get_lookahead_pointer().await?; let tx = self .ethereum_l1 .execution_layer .propose_new_block( - nonce, - pending_tx_lists.tx_list_bytes[0].clone(), //TODO: handle rest tx lists, + self.preconfirmation_helper.get_next_nonce(), + pending_tx_lists_bytes, pending_tx_lists.parent_meta_hash, lookahead_pointer, - lookahead_params, + lookahead_params.unwrap_or(vec![]), send_to_contract, ) .await?; diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index bfee606..686e8e4 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -20,6 +20,7 @@ pub enum Status { impl Operator { pub fn new(ethereum_l1: Arc, epoch: Epoch) -> Result { + tracing::debug!("Operator::new: epoch: {}", epoch); let l1_slots_per_epoch = ethereum_l1.slot_clock.get_slots_per_epoch(); let epoch_begin_timestamp = ethereum_l1.slot_clock.get_epoch_begin_timestamp(epoch)?; Ok(Self { @@ -91,11 +92,15 @@ impl Operator { pub async fn should_post_lookahead(&mut self) -> Result { if !self.lookahead_required_contract_called { + tracing::debug!("Operator::should_post_lookahead: checking if lookahead is required"); self.lookahead_required_contract_called = true; if self .ethereum_l1 .execution_layer - .is_lookahead_required(self.epoch_begin_timestamp) + .is_lookahead_required( + self.epoch_begin_timestamp + + self.ethereum_l1.slot_clock.get_epoch_duration_secs(), + ) .await? { return Ok(true); diff --git a/Node/src/node/preconfirmation_helper.rs b/Node/src/node/preconfirmation_helper.rs index 6eb3246..a63ffdd 100644 --- a/Node/src/node/preconfirmation_helper.rs +++ b/Node/src/node/preconfirmation_helper.rs @@ -22,6 +22,10 @@ impl PreconfirmationHelper { nonce } + pub fn increment_nonce(&mut self) { + self.nonce += 1; + } + pub fn increment_final_slot_perconfirmation(&mut self) { self.final_slot_perconfirmation_count += 1; } From c88d8267bed93ed5de417ffd89346c0beb51286a Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Tue, 24 Sep 2024 10:31:57 +0200 Subject: [PATCH 16/32] operator using epoch instead of timestamp --- Node/src/node/operator.rs | 57 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index 686e8e4..908294d 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -4,7 +4,7 @@ use std::sync::Arc; pub struct Operator { ethereum_l1: Arc, - epoch_begin_timestamp: u64, + epoch: u64, lookahead_required_contract_called: bool, lookahead_preconfer_addresses: Vec, lookahead_preconfer_addresses_next_epoch: Option>, @@ -22,10 +22,9 @@ impl Operator { pub fn new(ethereum_l1: Arc, epoch: Epoch) -> Result { tracing::debug!("Operator::new: epoch: {}", epoch); let l1_slots_per_epoch = ethereum_l1.slot_clock.get_slots_per_epoch(); - let epoch_begin_timestamp = ethereum_l1.slot_clock.get_epoch_begin_timestamp(epoch)?; Ok(Self { ethereum_l1, - epoch_begin_timestamp, + epoch, lookahead_required_contract_called: false, lookahead_preconfer_addresses: vec![], lookahead_preconfer_addresses_next_epoch: None, @@ -73,8 +72,9 @@ impl Operator { .ethereum_l1 .execution_layer .get_lookahead_preconfer_addresses_for_epoch( - self.epoch_begin_timestamp - + self.ethereum_l1.slot_clock.get_epoch_duration_secs(), + self.ethereum_l1 + .slot_clock + .get_epoch_begin_timestamp(self.epoch + 1)?, ) .await?; let address = lookahead_preconfer_addresses_next_epoch[0]; @@ -90,32 +90,27 @@ impl Operator { next_preconfer_address != self.ethereum_l1.execution_layer.get_preconfer_address() } - pub async fn should_post_lookahead(&mut self) -> Result { - if !self.lookahead_required_contract_called { - tracing::debug!("Operator::should_post_lookahead: checking if lookahead is required"); - self.lookahead_required_contract_called = true; - if self - .ethereum_l1 - .execution_layer - .is_lookahead_required( - self.epoch_begin_timestamp - + self.ethereum_l1.slot_clock.get_epoch_duration_secs(), - ) - .await? - { - return Ok(true); - } - } - Ok(false) + pub async fn should_post_lookahead_for_next_epoch(&mut self) -> Result { + // if !self.lookahead_required_contract_called { + // tracing::debug!("Operator::should_post_lookahead: checking if lookahead is required"); + // self.lookahead_required_contract_called = true; + self.ethereum_l1 + .execution_layer + .is_lookahead_required( + self.ethereum_l1 + .slot_clock + .get_epoch_begin_timestamp(self.epoch + 1)?, + ) + .await + // { + // return Ok(true); + // } + // } + // Ok(false) } pub async fn update_preconfer_lookahead_for_epoch(&mut self) -> Result<(), Error> { - tracing::debug!( - "Updating preconfer lookahead for epoch: {}", - self.ethereum_l1 - .slot_clock - .get_epoch_for_timestamp(self.epoch_begin_timestamp)? - ); + tracing::debug!("Updating preconfer lookahead for epoch: {}", self.epoch); if let Some(lookahead_preconfer_addresses_next_epoch) = self.lookahead_preconfer_addresses_next_epoch.take() @@ -125,7 +120,11 @@ impl Operator { self.lookahead_preconfer_addresses = self .ethereum_l1 .execution_layer - .get_lookahead_preconfer_addresses_for_epoch(self.epoch_begin_timestamp) + .get_lookahead_preconfer_addresses_for_epoch( + self.ethereum_l1 + .slot_clock + .get_epoch_begin_timestamp(self.epoch)?, + ) .await?; } Ok(()) From 0f374011c16fb770f92a8eda7ccda07a474e5d64 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Tue, 24 Sep 2024 13:34:48 +0200 Subject: [PATCH 17/32] slot clock test --- Node/src/ethereum_l1/slot_clock.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Node/src/ethereum_l1/slot_clock.rs b/Node/src/ethereum_l1/slot_clock.rs index 3c55748..4082c14 100644 --- a/Node/src/ethereum_l1/slot_clock.rs +++ b/Node/src/ethereum_l1/slot_clock.rs @@ -208,4 +208,14 @@ mod tests { let epoch_duration = slot_clock.get_epoch_duration_secs(); assert_eq!(epoch_duration, 384); // 12 slots per epoch * 32 seconds per slot } + + + #[test] + fn test_get_epoch_begin_timestamp() { + let genesis_slot = Slot::from(0u64); + let slot_clock = SlotClock::new(genesis_slot, 0, 12, 32); + + let epoch_begin_timestamp = slot_clock.get_epoch_begin_timestamp(1).unwrap(); + assert_eq!(epoch_begin_timestamp, 384); + } } From bf5c47fbbc8b49d1b122af87bb3c2304061f568f Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Tue, 24 Sep 2024 15:21:13 +0200 Subject: [PATCH 18/32] build fixed --- Node/src/node/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index 40aa8b0..2bcbe7d 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -328,6 +328,7 @@ impl Node { } OperatorStatus::None => { tracing::debug!("Not my slot to preconfirm: {}", current_slot); + // self.update_lookahead_when_needed().await?; } } @@ -383,7 +384,7 @@ impl Node { async fn get_lookahead_params( &mut self, ) -> Result>, Error> { - if self.operator.should_post_lookahead().await? { + if self.operator.should_post_lookahead_for_next_epoch().await? { tracing::debug!("Should post lookahead params, getting them"); let lookahead_params = self .ethereum_l1 @@ -558,4 +559,17 @@ impl Node { .await .map_err(|e| any_err!("Failed to send message to node_to_p2p_tx: {}", e)) } + + async fn update_lookahead_when_needed(&mut self) -> Result<(), Error> { + if let Some(lookahead_params) = self.get_lookahead_params().await? { + tracing::debug!("No lookahead posted, force pushing lookahead"); + self.preconfirmation_helper.increment_nonce(); + self.ethereum_l1 + .execution_layer + .force_push_lookahead(lookahead_params) + .await?; + } + + Ok(()) + } } From 8ff179f1a8fc6ebcc398fc2196b82b1693276327 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 25 Sep 2024 08:09:55 +0200 Subject: [PATCH 19/32] slot clock genesis log --- Node/src/ethereum_l1/slot_clock.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/Node/src/ethereum_l1/slot_clock.rs b/Node/src/ethereum_l1/slot_clock.rs index 4082c14..8476b71 100644 --- a/Node/src/ethereum_l1/slot_clock.rs +++ b/Node/src/ethereum_l1/slot_clock.rs @@ -20,6 +20,7 @@ impl SlotClock { slot_duration_sec: u64, slots_per_epoch: u64, ) -> Self { + tracing::info!("SlotClock: genesis_timestamp_sec: {}, genesis_slot: {}", genesis_timestamp_sec, genesis_slot); Self { genesis_slot, genesis_duration: Duration::from_secs(genesis_timestamp_sec), From 29b2e9429917ca367c7cb2e1abc44e1ffbc72cfb Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 25 Sep 2024 11:25:30 +0200 Subject: [PATCH 20/32] better debug logs --- Node/src/ethereum_l1/execution_layer.rs | 35 ++++++++++++++++++++++++- Node/src/node/mod.rs | 4 +-- Node/src/node/operator.rs | 33 ++++++++++++----------- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 1d930d8..42f460f 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -591,14 +591,28 @@ impl ExecutionLayer { &self, lookahead_set_params: Vec, ) -> Result<(), Error> { + tracing::debug!( + "Force pushing lookahead, {} params", + lookahead_set_params.len() + ); + let contract = PreconfTaskManager::new( self.contract_addresses.avs.preconf_task_manager, &self.provider_ws, ); + let tx = contract.forcePushLookahead(lookahead_set_params); + let call_result = tx.call().await; + if let Err(err) = call_result { + tracing::error!( + "force_push_lookahead call failed: {}", + err.to_avs_contract_error() + ); + } match tx.send().await { Ok(receipt) => { + tracing::debug!("Force push lookahead sent"); let tx_hash = receipt.watch().await?; tracing::info!("Force pushed lookahead: {}", tx_hash); } @@ -738,6 +752,14 @@ impl ExecutionLayer { epoch_begin_timestamp: u64, cl_lookahead: &[ProposerDuty], ) -> Result, Error> { + tracing::debug!( + "Epoch {}, timestamp: {}, getting lookahead params for epoch using CL lookahead (first 2): {:?}", + self.slot_clock + .get_epoch_for_timestamp(epoch_begin_timestamp)?, + epoch_begin_timestamp, + cl_lookahead.iter().take(2).collect::>().as_slice() + ); + if cl_lookahead.len() != self.slot_clock.get_slots_per_epoch() as usize { return Err(anyhow::anyhow!( "Operator::find_slots_to_preconfirm: unexpected number of proposer duties in the lookahead" @@ -762,7 +784,7 @@ impl ExecutionLayer { .await } - pub async fn get_lookahead_params_for_epoch( + async fn get_lookahead_params_for_epoch( &self, epoch_begin_timestamp: u64, validator_bls_pub_keys: &[BLSCompressedPublicKey; 32], @@ -781,6 +803,11 @@ impl ExecutionLayer { .await? ._0; + tracing::debug!( + "get_lookahead_params_for_epoch params len: {}", + params.len() + ); + Ok(params) } @@ -818,6 +845,11 @@ impl ExecutionLayer { } pub async fn is_lookahead_required(&self, epoch_begin_timestamp: u64) -> Result { + tracing::debug!( + "Checking if lookahead is required for epoch: {}", + self.slot_clock + .get_epoch_for_timestamp(epoch_begin_timestamp)? + ); let contract = PreconfTaskManager::new( self.contract_addresses.avs.preconf_task_manager, &self.provider_ws, @@ -828,6 +860,7 @@ impl ExecutionLayer { .call() .await?; + tracing::debug!("is_lookahead_required: {}", is_required._0); Ok(is_required._0) } diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index 2bcbe7d..a317c0e 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -327,7 +327,7 @@ impl Node { self.preconfirm_block(true).await?; } OperatorStatus::None => { - tracing::debug!("Not my slot to preconfirm: {}", current_slot); + tracing::info!("Not my slot to preconfirm: {}", current_slot); // self.update_lookahead_when_needed().await?; } } @@ -451,7 +451,7 @@ impl Node { } async fn preconfirm_block(&mut self, send_to_contract: bool) -> Result<(), Error> { - tracing::debug!( + tracing::info!( "Preconfirming for the slot: {:?}", self.ethereum_l1.slot_clock.get_current_slot()? ); diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index 908294d..ffbb184 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -91,22 +91,23 @@ impl Operator { } pub async fn should_post_lookahead_for_next_epoch(&mut self) -> Result { - // if !self.lookahead_required_contract_called { - // tracing::debug!("Operator::should_post_lookahead: checking if lookahead is required"); - // self.lookahead_required_contract_called = true; - self.ethereum_l1 - .execution_layer - .is_lookahead_required( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(self.epoch + 1)?, - ) - .await - // { - // return Ok(true); - // } - // } - // Ok(false) + if !self.lookahead_required_contract_called { + tracing::debug!("Operator::should_post_lookahead: checking if lookahead is required"); + self.lookahead_required_contract_called = true; + if self + .ethereum_l1 + .execution_layer + .is_lookahead_required( + self.ethereum_l1 + .slot_clock + .get_epoch_begin_timestamp(self.epoch + 1)?, + ) + .await? + { + return Ok(true); + } + } + Ok(false) } pub async fn update_preconfer_lookahead_for_epoch(&mut self) -> Result<(), Error> { From 5d6e98eadc3af59dfee30d18a805c8fd0fb25165 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 25 Sep 2024 13:10:23 +0200 Subject: [PATCH 21/32] removed eth_call from force lookahead --- Node/src/ethereum_l1/execution_layer.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 42f460f..12a6643 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -602,14 +602,6 @@ impl ExecutionLayer { ); let tx = contract.forcePushLookahead(lookahead_set_params); - let call_result = tx.call().await; - if let Err(err) = call_result { - tracing::error!( - "force_push_lookahead call failed: {}", - err.to_avs_contract_error() - ); - } - match tx.send().await { Ok(receipt) => { tracing::debug!("Force push lookahead sent"); From e436c1a85cddc93e28ac05680becdba1d7a5444f Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 25 Sep 2024 15:37:54 +0200 Subject: [PATCH 22/32] removed misleading lookahead kept for next epoch in operator increased gas limit for the force lookahead --- Node/src/ethereum_l1/execution_layer.rs | 13 ++++++---- Node/src/ethereum_l1/slot_clock.rs | 20 ++++----------- Node/src/main.rs | 3 +++ Node/src/node/mod.rs | 14 ----------- Node/src/node/operator.rs | 33 ++++++------------------- 5 files changed, 23 insertions(+), 60 deletions(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 12a6643..17bcc0b 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -601,12 +601,12 @@ impl ExecutionLayer { &self.provider_ws, ); - let tx = contract.forcePushLookahead(lookahead_set_params); + let tx = contract + .forcePushLookahead(lookahead_set_params) + .gas(1_000_000); match tx.send().await { Ok(receipt) => { - tracing::debug!("Force push lookahead sent"); - let tx_hash = receipt.watch().await?; - tracing::info!("Force pushed lookahead: {}", tx_hash); + tracing::debug!("Force push lookahead sent: {}", receipt.tx_hash()); } Err(err) => { return Err(anyhow::anyhow!(err.to_avs_contract_error())); @@ -805,8 +805,11 @@ impl ExecutionLayer { pub async fn get_lookahead_preconfer_addresses_for_epoch( &self, - epoch_begin_timestamp: u64, + epoch: u64, ) -> Result, Error> { + tracing::debug!("Getting lookahead preconfer addresses for epoch: {}", epoch); + let epoch_begin_timestamp = self.slot_clock.get_epoch_begin_timestamp(epoch)?; + let contract = PreconfTaskManager::new( self.contract_addresses.avs.preconf_task_manager, &self.provider_ws, diff --git a/Node/src/ethereum_l1/slot_clock.rs b/Node/src/ethereum_l1/slot_clock.rs index 8476b71..9ccee01 100644 --- a/Node/src/ethereum_l1/slot_clock.rs +++ b/Node/src/ethereum_l1/slot_clock.rs @@ -20,7 +20,11 @@ impl SlotClock { slot_duration_sec: u64, slots_per_epoch: u64, ) -> Self { - tracing::info!("SlotClock: genesis_timestamp_sec: {}, genesis_slot: {}", genesis_timestamp_sec, genesis_slot); + tracing::info!( + "SlotClock: genesis_timestamp_sec: {}, genesis_slot: {}", + genesis_timestamp_sec, + genesis_slot + ); Self { genesis_slot, genesis_duration: Duration::from_secs(genesis_timestamp_sec), @@ -125,10 +129,6 @@ impl SlotClock { Ok(now.as_secs() + 60) } - pub fn get_epoch_duration_secs(&self) -> u64 { - self.slot_duration.as_secs() * self.slots_per_epoch - } - pub fn get_current_slot_of_epoch(&self) -> Result { let now = SystemTime::now().duration_since(UNIX_EPOCH)?; let cur_slot = self.slot_of(now)?; @@ -201,16 +201,6 @@ mod tests { assert!(current_epoch > 0); } - #[test] - fn test_get_epoch_duration_secs() { - let genesis_slot = Slot::from(0u64); - let slot_clock = SlotClock::new(genesis_slot, 0, 12, 32); - - let epoch_duration = slot_clock.get_epoch_duration_secs(); - assert_eq!(epoch_duration, 384); // 12 slots per epoch * 32 seconds per slot - } - - #[test] fn test_get_epoch_begin_timestamp() { let genesis_slot = Slot::from(0u64); diff --git a/Node/src/main.rs b/Node/src/main.rs index a0cbda4..30f1c23 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -31,6 +31,9 @@ struct Cli { #[tokio::main] async fn main() -> Result<(), Error> { init_logging(); + + tracing::info!("Starting AVS Node"); + let args = Cli::parse(); let config = utils::config::Config::read_env_variables(); diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index a317c0e..707838d 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -328,7 +328,6 @@ impl Node { } OperatorStatus::None => { tracing::info!("Not my slot to preconfirm: {}", current_slot); - // self.update_lookahead_when_needed().await?; } } @@ -559,17 +558,4 @@ impl Node { .await .map_err(|e| any_err!("Failed to send message to node_to_p2p_tx: {}", e)) } - - async fn update_lookahead_when_needed(&mut self) -> Result<(), Error> { - if let Some(lookahead_params) = self.get_lookahead_params().await? { - tracing::debug!("No lookahead posted, force pushing lookahead"); - self.preconfirmation_helper.increment_nonce(); - self.ethereum_l1 - .execution_layer - .force_push_lookahead(lookahead_params) - .await?; - } - - Ok(()) - } } diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index ffbb184..ade258b 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -7,7 +7,6 @@ pub struct Operator { epoch: u64, lookahead_required_contract_called: bool, lookahead_preconfer_addresses: Vec, - lookahead_preconfer_addresses_next_epoch: Option>, l1_slots_per_epoch: u64, } @@ -27,7 +26,6 @@ impl Operator { epoch, lookahead_required_contract_called: false, lookahead_preconfer_addresses: vec![], - lookahead_preconfer_addresses_next_epoch: None, l1_slots_per_epoch, }) } @@ -71,16 +69,9 @@ impl Operator { let lookahead_preconfer_addresses_next_epoch = self .ethereum_l1 .execution_layer - .get_lookahead_preconfer_addresses_for_epoch( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(self.epoch + 1)?, - ) + .get_lookahead_preconfer_addresses_for_epoch(self.epoch + 1) .await?; - let address = lookahead_preconfer_addresses_next_epoch[0]; - self.lookahead_preconfer_addresses_next_epoch = - Some(lookahead_preconfer_addresses_next_epoch); - Ok(address) + Ok(lookahead_preconfer_addresses_next_epoch[0]) } else { Ok(self.lookahead_preconfer_addresses[(slot_mod_slots_per_epoch + 1) as usize]) } @@ -113,21 +104,11 @@ impl Operator { pub async fn update_preconfer_lookahead_for_epoch(&mut self) -> Result<(), Error> { tracing::debug!("Updating preconfer lookahead for epoch: {}", self.epoch); - if let Some(lookahead_preconfer_addresses_next_epoch) = - self.lookahead_preconfer_addresses_next_epoch.take() - { - self.lookahead_preconfer_addresses = lookahead_preconfer_addresses_next_epoch; - } else { - self.lookahead_preconfer_addresses = self - .ethereum_l1 - .execution_layer - .get_lookahead_preconfer_addresses_for_epoch( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(self.epoch)?, - ) - .await?; - } + self.lookahead_preconfer_addresses = self + .ethereum_l1 + .execution_layer + .get_lookahead_preconfer_addresses_for_epoch(self.epoch) + .await?; Ok(()) } } From ca15d21be4e2a231fcbf0fc48d379bf9642e2475 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 26 Sep 2024 08:24:34 +0200 Subject: [PATCH 23/32] rpc url for the tx spammer --- tools/tx_spammer/tx_spammer.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/tx_spammer/tx_spammer.py b/tools/tx_spammer/tx_spammer.py index 6f4b4e7..eafc5e2 100644 --- a/tools/tx_spammer/tx_spammer.py +++ b/tools/tx_spammer/tx_spammer.py @@ -18,11 +18,12 @@ RECIPIENT_ADDRESS= 5. Run the script: - python tx_spammer.py [--count COUNT] [--amount AMOUNT] + python tx_spammer.py [--count COUNT] [--amount AMOUNT] [--rpc RPC_URL] CLI Parameters: --count: Number of transactions to send (default: 1) --amount: Amount of ETH to send per transaction (default: 0.006) +--rpc: RPC URL for the Taiko network (default: https://RPC.helder.taiko.xyz) """ @@ -47,10 +48,11 @@ parser = argparse.ArgumentParser(description='Spam transactions on the Taiko network.') parser.add_argument('--count', type=int, default=1, help='Number of transactions to send') parser.add_argument('--amount', type=float, default=0.006, help='Amount of ETH to send per transaction') +parser.add_argument('--rpc', type=str, default='https://RPC.helder.taiko.xyz', help='RPC URL for the Taiko network') args = parser.parse_args() # Connect to the Taiko network -w3 = Web3(Web3.HTTPProvider('https://RPC.helder.taiko.xyz')) +w3 = Web3(Web3.HTTPProvider(args.rpc)) # Check if connected if not w3.is_connected(): @@ -69,9 +71,10 @@ def send_transaction(nonce : int): 'gasPrice': w3.to_wei('10', 'gwei'), 'chainId': w3.eth.chain_id } - print(f'Sending transaction: {tx}') + print(f'Sending transaction: {tx} by RPC: {args.rpc}') + print(f'Sending from: {account.address}') signed_tx = w3.eth.account.sign_transaction(tx, private_key) - tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction) + tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction) print(f'Transaction sent: {tx_hash.hex()}') def spam_transactions(count): From 2f1ded2952a7fa9dae9f966b40aa761b297fa30c Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Thu, 26 Sep 2024 08:41:53 +0200 Subject: [PATCH 24/32] remove validator --- Node/src/ethereum_l1/execution_layer.rs | 58 +++++++++++++++++++++++++ Node/src/main.rs | 8 ++++ Node/src/registration/mod.rs | 5 +++ 3 files changed, 71 insertions(+) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 17bcc0b..c27e51e 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -674,6 +674,64 @@ impl ExecutionLayer { Ok(()) } + pub async fn remove_validator(&self) -> Result<(), Error> { + // Build remove message + // Operation.REMOVE + let operation = 2; + // Message expired after 60 seconds + let expiry = U256::from(self.slot_clock.get_now_plus_minute()?); + + let data = MessageData::from(( + U256::from(self.l1_chain_id), + operation, + expiry, + self.preconfer_address, + )); + let message = data.abi_encode_packed(); + + // Convert bls public key to G1Point + let pk_point = self.bls_service.get_public_key(); + let pubkey = PreconfRegistry::G1Point { + x: BLSService::biguint_to_u256_array(BigUint::from(pk_point.x)), + y: BLSService::biguint_to_u256_array(BigUint::from(pk_point.y)), + }; + + // Sign message and convert to G2Point + let signature_point = self.bls_service.sign_as_point(&message, &vec![]); + + let signature = PreconfRegistry::G2Point { + x: BLSService::biguint_to_u256_array(BigUint::from(signature_point.x.c0)), + x_I: BLSService::biguint_to_u256_array(BigUint::from(signature_point.x.c1)), + y: BLSService::biguint_to_u256_array(BigUint::from(signature_point.y.c0)), + y_I: BLSService::biguint_to_u256_array(BigUint::from(signature_point.y.c1)), + }; + + // Call contract + let params = vec![PreconfRegistry::RemoveValidatorParam { + pubkey, + signature, + signatureExpiry: expiry, + }]; + + let preconf_registry = PreconfRegistry::new( + self.contract_addresses.avs.preconf_registry, + &self.provider_ws, + ); + let tx = preconf_registry.removeValidators(params); + + match tx.send().await { + Ok(receipt) => { + let tx_hash = receipt.watch().await?; + tracing::info!("Validator removed successfully: {:?}", tx_hash); + } + Err(err) => { + return Err(anyhow::anyhow!(err.to_avs_contract_error())); + } + } + + Ok(()) + } + pub async fn subscribe_to_validator_added_event( &self, ) -> Result, Error> { diff --git a/Node/src/main.rs b/Node/src/main.rs index 30f1c23..a166efa 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -24,6 +24,8 @@ struct Cli { register: bool, #[clap(long, help = "Add validator to preconfer")] add_validator: bool, + #[clap(long, help = "Remove validator for preconfer")] + remove_validator: bool, #[clap(long, help = "Force Push lookahead to the PreconfTaskManager contract")] force_push_lookahead: bool, } @@ -64,6 +66,12 @@ async fn main() -> Result<(), Error> { return Ok(()); } + if args.remove_validator { + let registration = registration::Registration::new(ethereum_l1); + registration.remove_validator().await?; + return Ok(()); + } + if args.force_push_lookahead { ethereum_l1.force_push_lookahead().await?; return Ok(()); diff --git a/Node/src/registration/mod.rs b/Node/src/registration/mod.rs index e6f38b1..f301752 100644 --- a/Node/src/registration/mod.rs +++ b/Node/src/registration/mod.rs @@ -47,4 +47,9 @@ impl Registration { Ok(()) } + + pub async fn remove_validator(&self) -> Result<(), Error> { + self.ethereum_l1.execution_layer.remove_validator().await?; + Ok(()) + } } From c6898d71ae32435fbfe11515ceeb50b8a9c41ffb Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Fri, 27 Sep 2024 15:36:24 +0200 Subject: [PATCH 25/32] Fix force push lookahead --- Node/Cargo.lock | 139 ++++++++++++------------ Node/src/ethereum_l1/execution_layer.rs | 1 + 2 files changed, 72 insertions(+), 68 deletions(-) diff --git a/Node/Cargo.lock b/Node/Cargo.lock index d5ac7f8..c86c708 100644 --- a/Node/Cargo.lock +++ b/Node/Cargo.lock @@ -143,9 +143,9 @@ dependencies = [ [[package]] name = "alloy-chains" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf770dad29577cd3580f3dd09005799224a912b8cdfdd6dc04d030d42b3df4e" +checksum = "8158b4878c67837e5413721cc44298e6a2d88d39203175ea025e51892a16ba4c" dependencies = [ "num_enum", "strum", @@ -227,7 +227,7 @@ dependencies = [ "alloy-serde", "c-kzg", "derive_more 0.99.18", - "k256 0.13.3", + "k256 0.13.4", "once_cell", "serde", "sha2 0.10.8", @@ -310,7 +310,7 @@ checksum = "16faebb9ea31a244fd6ce3288d47df4be96797d9c3c020144b8f2c31543a4512" dependencies = [ "alloy-genesis", "alloy-primitives 0.7.7", - "k256 0.13.3", + "k256 0.13.4", "serde_json", "tempfile", "thiserror", @@ -331,7 +331,7 @@ dependencies = [ "derive_more 0.99.18", "hex-literal", "itoa", - "k256 0.13.3", + "k256 0.13.4", "keccak-asm", "proptest", "rand 0.8.5", @@ -342,23 +342,28 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411aff151f2a73124ee473708e82ed51b2535f68928b6a1caa8bc1246ae6f7cd" +checksum = "260d3ff3bff0bb84599f032a2f2c6828180b0ea0cd41fdaf44f39cef3ba41861" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", "derive_more 1.0.0", + "hashbrown 0.14.5", "hex-literal", + "indexmap 2.5.0", "itoa", - "k256 0.13.3", + "k256 0.13.4", "keccak-asm", + "paste", "proptest", "rand 0.8.5", "ruint", + "rustc-hash", "serde", + "sha3", "tiny-keccak", ] @@ -548,7 +553,7 @@ dependencies = [ "async-trait", "auto_impl", "elliptic-curve 0.13.8", - "k256 0.13.3", + "k256 0.13.4", "thiserror", ] @@ -563,7 +568,7 @@ dependencies = [ "alloy-primitives 0.7.7", "alloy-signer", "async-trait", - "k256 0.13.3", + "k256 0.13.4", "rand 0.8.5", "thiserror", ] @@ -1300,9 +1305,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -1376,9 +1381,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -1647,9 +1652,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.21" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" dependencies = [ "shlex", ] @@ -1726,9 +1731,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -1736,9 +1741,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -1748,9 +1753,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -2401,7 +2406,7 @@ dependencies = [ "bytes", "ed25519-dalek", "hex", - "k256 0.13.3", + "k256 0.13.4", "log", "rand 0.8.5", "serde", @@ -2515,7 +2520,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e999563461faea0ab9bc0024e5e66adcee35881f3d5062f52f31a4070fe1522" dependencies = [ - "alloy-primitives 0.8.3", + "alloy-primitives 0.8.5", "itertools 0.13.0", "smallvec", ] @@ -2545,7 +2550,7 @@ dependencies = [ "elliptic-curve 0.13.8", "ethabi", "generic-array", - "k256 0.13.3", + "k256 0.13.4", "num_enum", "open-fastrlp", "rand 0.8.5", @@ -3371,9 +3376,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -3384,7 +3389,6 @@ dependencies = [ "pin-project-lite", "socket2 0.5.7", "tokio", - "tower", "tower-service", "tracing", ] @@ -3683,9 +3687,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.24.4" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd1ead9fb95614e8dc5556d12a8681c2f6d352d0c1d3efc8708c7ccbba47bc6" +checksum = "126b48a5acc3c52fbd5381a77898cb60e145123179588a29e7ac48f9c06e401b" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -3696,9 +3700,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.24.4" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff79651479f69ada7bda604ef2acf3f1aa50755d97cc36d25ff04c2664f9d96f" +checksum = "b0e503369a76e195b65af35058add0e6900b794a4e9a9316900ddd3a87a80477" dependencies = [ "async-trait", "bytes", @@ -3719,9 +3723,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.24.4" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ed8b301b19f4dad8ddc66ed956a70fc227def5c19b3898e0a29ce8f0edee06" +checksum = "f2c0caba4a6a8efbafeec9baa986aa22a75a96c29d3e4b0091b0098d6470efb5" dependencies = [ "async-trait", "base64 0.22.1", @@ -3744,9 +3748,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.24.4" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe2198e5fd96cf2153ecc123364f699b6e2151317ea09c7bf799c43c2fe1415" +checksum = "af6e6c9b6d975edcb443565d648b605f3e85a04ec63aa6941811a8894cc9cded" dependencies = [ "futures-util", "http 1.1.0", @@ -3771,9 +3775,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.24.4" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531e386460425e49679587871a056f2895a47dade21457324ad1262cd78ef6d9" +checksum = "d8fb16314327cbc94fdf7965ef7e4422509cd5597f76d137bd104eb34aeede67" dependencies = [ "http 1.1.0", "serde", @@ -3810,9 +3814,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa 0.16.9", @@ -3858,9 +3862,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libm" @@ -3885,7 +3889,7 @@ dependencies = [ "libp2p-core 0.41.3", "libp2p-identity", "libp2p-swarm 0.44.2", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "pin-project", "rw-stream-sink", "thiserror", @@ -3933,7 +3937,7 @@ dependencies = [ "libp2p-websocket-websys", "libp2p-webtransport-websys", "libp2p-yamux", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "pin-project", "rw-stream-sink", "thiserror", @@ -4025,7 +4029,7 @@ dependencies = [ "futures", "futures-timer", "libp2p-identity", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "multihash 0.19.1", "multistream-select", "once_cell", @@ -4053,7 +4057,7 @@ dependencies = [ "futures", "futures-timer", "libp2p-identity", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "multihash 0.19.1", "multistream-select", "once_cell", @@ -4333,7 +4337,7 @@ dependencies = [ "futures", "libp2p-core 0.42.0", "libp2p-identity", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "multihash 0.19.1", "once_cell", "quick-protobuf", @@ -4667,7 +4671,7 @@ dependencies = [ "libp2p-core 0.42.0", "libp2p-identity", "libp2p-noise", - "multiaddr 0.18.1", + "multiaddr 0.18.2", "multihash 0.19.1", "send_wrapper 0.6.0", "thiserror", @@ -4966,9 +4970,9 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b852bc02a2da5feed68cd14fa50d0774b92790a5bdbfa932a813926c8472070" +checksum = "fe6351f60b488e04c1d21bc69e56b89cb3f5e8f5d22557d6e8031bdfd79b6961" dependencies = [ "arrayref", "byteorder", @@ -4979,7 +4983,7 @@ dependencies = [ "percent-encoding", "serde", "static_assertions", - "unsigned-varint 0.7.2", + "unsigned-varint 0.8.0", "url", ] @@ -5450,7 +5454,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.4", + "redox_syscall 0.5.6", "smallvec", "windows-targets 0.52.6", ] @@ -5572,9 +5576,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polling" @@ -6024,9 +6028,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ "bitflags 2.6.0", ] @@ -6622,9 +6626,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -7200,7 +7204,7 @@ dependencies = [ "futures-util", "hex", "jsonrpsee", - "k256 0.13.3", + "k256 0.13.4", "lazy_static", "mockall", "mockall_double", @@ -7248,18 +7252,18 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -7450,9 +7454,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.21" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.5.0", "toml_datetime", @@ -7469,7 +7473,6 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite", - "tokio", "tower-layer", "tower-service", "tracing", @@ -8150,9 +8153,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index c27e51e..532ba8e 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -603,6 +603,7 @@ impl ExecutionLayer { let tx = contract .forcePushLookahead(lookahead_set_params) + .nonce(self.get_preconfer_nonce().await?) .gas(1_000_000); match tx.send().await { Ok(receipt) => { From 935e8c7396c6cd6e2179b94b1d7a54fad17d3456 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 27 Sep 2024 17:08:23 +0200 Subject: [PATCH 26/32] Block proposed event receiving fixed --- Node/src/ethereum_l1/block_proposed.rs | 4 ++-- Node/src/ethereum_l1/execution_layer.rs | 8 ++++---- Node/src/main.rs | 14 +++++++------- Node/src/node/block_proposed_receiver.rs | 2 ++ Node/src/node/lookahead_updated_receiver.rs | 2 ++ 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Node/src/ethereum_l1/block_proposed.rs b/Node/src/ethereum_l1/block_proposed.rs index b071511..ec06ee6 100644 --- a/Node/src/ethereum_l1/block_proposed.rs +++ b/Node/src/ethereum_l1/block_proposed.rs @@ -1,4 +1,4 @@ -use alloy::{contract::EventPoller, pubsub::PubSubFrontend, sol}; +use alloy::{contract::EventSubscription, sol}; use anyhow::Error; sol!( @@ -30,4 +30,4 @@ impl BlockProposed { } } -pub struct EventPollerBlockProposed(pub EventPoller); +pub struct EventSubscriptionBlockProposed(pub EventSubscription); diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 532ba8e..9ed8e99 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -1,6 +1,6 @@ use super::{ avs_contract_error::AVSContractError, - block_proposed::{BlockProposed, EventPollerBlockProposed, TaikoEvents}, + block_proposed::{BlockProposed, EventSubscriptionBlockProposed, TaikoEvents}, slot_clock::SlotClock, }; use crate::{ @@ -789,13 +789,13 @@ impl ExecutionLayer { pub async fn subscribe_to_block_proposed_event( &self, - ) -> Result { + ) -> Result { let taiko_events = TaikoEvents::new(self.contract_addresses.taiko_l1, &self.provider_ws); - let block_proposed_filter = taiko_events.BlockProposed_filter().watch().await?; + let block_proposed_filter = taiko_events.BlockProposed_filter().subscribe().await?; tracing::debug!("Subscribed to block proposed event"); - Ok(EventPollerBlockProposed(block_proposed_filter)) + Ok(EventSubscriptionBlockProposed(block_proposed_filter)) } pub async fn get_lookahead_params_for_epoch_using_cl_lookahead( diff --git a/Node/src/main.rs b/Node/src/main.rs index a166efa..5f7159e 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -93,6 +93,13 @@ async fn main() -> Result<(), Error> { let mev_boost = mev_boost::MevBoost::new(&config.mev_boost_url, config.validator_index); let ethereum_l1 = Arc::new(ethereum_l1); + let block_proposed_event_checker = + BlockProposedEventReceiver::new(ethereum_l1.clone(), block_proposed_tx); + BlockProposedEventReceiver::start(block_proposed_event_checker); + + let lookahead_updated_event_checker = LookaheadUpdatedEventReceiver::new(ethereum_l1.clone()); + lookahead_updated_event_checker.start(); + let node = node::Node::new( block_proposed_rx, node_to_p2p_tx, @@ -106,13 +113,6 @@ async fn main() -> Result<(), Error> { .await?; node.entrypoint().await?; - let block_proposed_event_checker = - BlockProposedEventReceiver::new(ethereum_l1.clone(), block_proposed_tx); - BlockProposedEventReceiver::start(block_proposed_event_checker); - - let lookahead_updated_event_checker = LookaheadUpdatedEventReceiver::new(ethereum_l1.clone()); - lookahead_updated_event_checker.start(); - Ok(()) } diff --git a/Node/src/node/block_proposed_receiver.rs b/Node/src/node/block_proposed_receiver.rs index 2142570..ded5ba3 100644 --- a/Node/src/node/block_proposed_receiver.rs +++ b/Node/src/node/block_proposed_receiver.rs @@ -18,6 +18,7 @@ impl BlockProposedEventReceiver { } pub fn start(receiver: Self) { + info!("Starting block proposed event receiver"); tokio::spawn(async move { receiver.check_for_events().await; }); @@ -69,6 +70,7 @@ impl BlockProposedEventReceiver { None => { error!("No block proposed event received, stream closed"); // TODO: recreate a stream in this case? + return; } } } diff --git a/Node/src/node/lookahead_updated_receiver.rs b/Node/src/node/lookahead_updated_receiver.rs index ba5bb6c..ecf3351 100644 --- a/Node/src/node/lookahead_updated_receiver.rs +++ b/Node/src/node/lookahead_updated_receiver.rs @@ -21,6 +21,7 @@ impl LookaheadUpdatedEventReceiver { } pub fn start(self) { + info!("Starting lookahead updated event receiver"); tokio::spawn(async move { self.check_for_events().await; }); @@ -61,6 +62,7 @@ impl LookaheadUpdatedEventReceiver { None => { error!("No lookahead updated event received, stream closed"); // TODO: recreate a stream in this case? + return; } } } From 895fe29a84d14637cfd0153c93dd352539a1756a Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Fri, 27 Sep 2024 22:06:54 +0200 Subject: [PATCH 27/32] Automatically detect parentMetaHash in the smart contract --- Node/src/ethereum_l1/execution_layer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 9ed8e99..4d16df5 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -229,7 +229,7 @@ impl ExecutionLayer { &self.wallet, ), extraData: FixedBytes::from(&[0u8; 32]), - parentMetaHash: FixedBytes::from(&parent_meta_hash), + parentMetaHash: FixedBytes::from(&[0u8; 32]), hookCalls: vec![], signature: Bytes::from(vec![0; 32]), l1StateBlockNumber: 0, From 5902a529c1d492c0a4f440dbed65042e16069bcb Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 27 Sep 2024 22:33:21 +0200 Subject: [PATCH 28/32] enable preconfirmation env flag Added a lookahead monitor for this case, not to complicate the node, which is entirely aimed at preconfirmation. --- Node/src/ethereum_l1/execution_layer.rs | 41 ++++--------- Node/src/ethereum_l1/mod.rs | 5 +- Node/src/main.rs | 32 ++++++---- Node/src/node/lookahead_monitor.rs | 67 +++++++++++++++++++++ Node/src/node/lookahead_updated_receiver.rs | 6 +- Node/src/node/mod.rs | 5 +- Node/src/node/operator.rs | 6 +- Node/src/utils/config.rs | 9 +++ 8 files changed, 113 insertions(+), 58 deletions(-) create mode 100644 Node/src/node/lookahead_monitor.rs diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 9ed8e99..a63cf3a 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -800,15 +800,15 @@ impl ExecutionLayer { pub async fn get_lookahead_params_for_epoch_using_cl_lookahead( &self, - epoch_begin_timestamp: u64, + epoch: u64, cl_lookahead: &[ProposerDuty], ) -> Result, Error> { + let epoch_begin_timestamp = self.slot_clock.get_epoch_begin_timestamp(epoch)?; tracing::debug!( - "Epoch {}, timestamp: {}, getting lookahead params for epoch using CL lookahead (first 2): {:?}", - self.slot_clock - .get_epoch_for_timestamp(epoch_begin_timestamp)?, + "Epoch {}, timestamp: {}, getting lookahead params for epoch using CL lookahead len: {}", + epoch, epoch_begin_timestamp, - cl_lookahead.iter().take(2).collect::>().as_slice() + cl_lookahead.len() ); if cl_lookahead.len() != self.slot_clock.get_slots_per_epoch() as usize { @@ -898,42 +898,25 @@ impl ExecutionLayer { Ok(lookahead) } - pub async fn is_lookahead_required(&self, epoch_begin_timestamp: u64) -> Result { - tracing::debug!( - "Checking if lookahead is required for epoch: {}", - self.slot_clock - .get_epoch_for_timestamp(epoch_begin_timestamp)? - ); + pub async fn is_lookahead_required(&self, epoch: u64) -> Result { let contract = PreconfTaskManager::new( self.contract_addresses.avs.preconf_task_manager, &self.provider_ws, ); - + let epoch_begin_timestamp = self.slot_clock.get_epoch_begin_timestamp(epoch)?; let is_required = contract .isLookaheadRequired(U256::from(epoch_begin_timestamp)) .call() .await?; - tracing::debug!("is_lookahead_required: {}", is_required._0); + tracing::debug!( + "is_lookahead_required for epoch {}: {}", + epoch, + is_required._0 + ); Ok(is_required._0) } - /* fn create_provider(&self) -> impl Provider> { - ProviderBuilder::new() - .with_recommended_fillers() - .wallet(self.wallet.clone()) - .on_http(self.rpc_url.clone()) - } - - async fn create_provider_ws(&self) -> impl Provider { - ProviderBuilder::new() - .with_recommended_fillers() - .wallet(self.wallet.clone()) - .on_ws(self.ws.clone()) - .await - .unwrap() - }*/ - #[cfg(test)] pub async fn new_from_pk( ws_rpc_url: String, diff --git a/Node/src/ethereum_l1/mod.rs b/Node/src/ethereum_l1/mod.rs index 83f3348..7fce3bb 100644 --- a/Node/src/ethereum_l1/mod.rs +++ b/Node/src/ethereum_l1/mod.rs @@ -74,10 +74,7 @@ impl EthereumL1 { // Get lookahead params for contract call let lookahead_params = self .execution_layer - .get_lookahead_params_for_epoch_using_cl_lookahead( - self.slot_clock.get_epoch_begin_timestamp(next_epoch)?, - &cl_lookahead, - ) + .get_lookahead_params_for_epoch_using_cl_lookahead(next_epoch, &cl_lookahead) .await?; tracing::debug!("Got {} lookahead params.", lookahead_params.len()); // Force push lookahead to the contract diff --git a/Node/src/main.rs b/Node/src/main.rs index 5f7159e..323122f 100644 --- a/Node/src/main.rs +++ b/Node/src/main.rs @@ -100,18 +100,26 @@ async fn main() -> Result<(), Error> { let lookahead_updated_event_checker = LookaheadUpdatedEventReceiver::new(ethereum_l1.clone()); lookahead_updated_event_checker.start(); - let node = node::Node::new( - block_proposed_rx, - node_to_p2p_tx, - p2p_to_node_rx, - taiko.clone(), - ethereum_l1.clone(), - mev_boost, - config.l2_slot_duration_sec, - bls_service, - ) - .await?; - node.entrypoint().await?; + if config.enable_preconfirmation { + let node = node::Node::new( + block_proposed_rx, + node_to_p2p_tx, + p2p_to_node_rx, + taiko.clone(), + ethereum_l1.clone(), + mev_boost, + config.l2_slot_duration_sec, + bls_service, + ) + .await?; + node.entrypoint().await?; + } else { + let lookahead_monitor = node::lookahead_monitor::LookaheadMonitor::new( + ethereum_l1.clone(), + config.l1_slot_duration_sec, + ); + lookahead_monitor.start().await; + } Ok(()) } diff --git a/Node/src/node/lookahead_monitor.rs b/Node/src/node/lookahead_monitor.rs new file mode 100644 index 0000000..bd7afb3 --- /dev/null +++ b/Node/src/node/lookahead_monitor.rs @@ -0,0 +1,67 @@ +// Special mode of the AVS node that monitors the lookahead availability in the contract +// and push the lookahead if it is required. +use crate::ethereum_l1::EthereumL1; +use anyhow::Error; +use std::sync::Arc; +use tokio::time::Duration; +use tracing::{debug, error, info}; + +pub struct LookaheadMonitor { + ethereum_l1: Arc, + l1_slot_duration_sec: u64, +} + +impl LookaheadMonitor { + pub fn new(ethereum_l1: Arc, l1_slot_duration_sec: u64) -> Self { + Self { + ethereum_l1, + l1_slot_duration_sec, + } + } + + pub async fn start(self) { + // start lookahead monitor loop + let mut interval = tokio::time::interval(Duration::from_secs(self.l1_slot_duration_sec)); + loop { + interval.tick().await; + + if let Err(err) = self.lookahead_monitor_step().await { + error!("Failed to execute lookahead monitor step: {}", err); + } + } + } + + async fn lookahead_monitor_step(&self) -> Result<(), Error> { + info!( + "Monitoring lookahead, slot: {}", + self.ethereum_l1.slot_clock.get_current_slot()? + ); + + let next_epoch = self.ethereum_l1.slot_clock.get_current_epoch()? + 1; + if self + .ethereum_l1 + .execution_layer + .is_lookahead_required(next_epoch) + .await? + { + debug!("Lookahead is required, pushing it"); + let cl_lookahead = self + .ethereum_l1 + .consensus_layer + .get_lookahead(next_epoch) + .await?; + + let lookahead_params = self + .ethereum_l1 + .execution_layer + .get_lookahead_params_for_epoch_using_cl_lookahead(next_epoch, &cl_lookahead) + .await?; + + self.ethereum_l1 + .execution_layer + .force_push_lookahead(lookahead_params) + .await?; + } + Ok(()) + } +} diff --git a/Node/src/node/lookahead_updated_receiver.rs b/Node/src/node/lookahead_updated_receiver.rs index ecf3351..7c5a612 100644 --- a/Node/src/node/lookahead_updated_receiver.rs +++ b/Node/src/node/lookahead_updated_receiver.rs @@ -98,10 +98,6 @@ impl LookaheadUpdatedEventHandler { .slot_clock .get_epoch_for_timestamp(lookahead_updated_next_epoch[0].timestamp.try_into()?)?; - let epoch_begin_timestamp = self - .ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(epoch)?; let epoch_duties = self .ethereum_l1 .consensus_layer @@ -110,7 +106,7 @@ impl LookaheadUpdatedEventHandler { let epoch_lookahead_params = self .ethereum_l1 .execution_layer - .get_lookahead_params_for_epoch_using_cl_lookahead(epoch_begin_timestamp, &epoch_duties) + .get_lookahead_params_for_epoch_using_cl_lookahead(epoch, &epoch_duties) .await?; if let Some(slot_timestamp) = Self::find_a_slot_timestamp_to_prove_incorrect_lookahead( diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index 707838d..a345724 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -1,5 +1,6 @@ pub mod block_proposed_receiver; mod commit; +pub mod lookahead_monitor; pub mod lookahead_updated_receiver; mod operator; mod preconfirmation_helper; @@ -389,9 +390,7 @@ impl Node { .ethereum_l1 .execution_layer .get_lookahead_params_for_epoch_using_cl_lookahead( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(self.epoch + 1)?, + self.epoch + 1, &self.cl_lookahead, ) .await?; diff --git a/Node/src/node/operator.rs b/Node/src/node/operator.rs index ade258b..f686ad9 100644 --- a/Node/src/node/operator.rs +++ b/Node/src/node/operator.rs @@ -88,11 +88,7 @@ impl Operator { if self .ethereum_l1 .execution_layer - .is_lookahead_required( - self.ethereum_l1 - .slot_clock - .get_epoch_begin_timestamp(self.epoch + 1)?, - ) + .is_lookahead_required(self.epoch + 1) .await? { return Ok(true); diff --git a/Node/src/utils/config.rs b/Node/src/utils/config.rs index 15abdf1..3021c4b 100644 --- a/Node/src/utils/config.rs +++ b/Node/src/utils/config.rs @@ -20,6 +20,7 @@ pub struct Config { pub l1_chain_id: u64, pub validator_index: u64, pub enable_p2p: bool, + pub enable_preconfirmation: bool, } #[derive(Debug)] @@ -242,6 +243,11 @@ impl Config { .parse::() .expect("ENABLE_P2P must be a boolean"); + let enable_preconfirmation = std::env::var("ENABLE_PRECONFIRMATION") + .unwrap_or("true".to_string()) + .parse::() + .expect("ENABLE_PRECONFIRMATION must be a boolean"); + let config = Self { taiko_proposer_url: std::env::var("TAIKO_PROPOSER_URL") .unwrap_or("http://127.0.0.1:1234".to_string()), @@ -265,6 +271,7 @@ impl Config { l1_chain_id, validator_index, enable_p2p, + enable_preconfirmation, }; info!( @@ -285,6 +292,7 @@ taiko chain id: {} l1 chain id: {} validator index: {} enable p2p: {} +enable preconfirmation: {} "#, config.taiko_proposer_url, config.taiko_driver_url, @@ -301,6 +309,7 @@ enable p2p: {} config.l1_chain_id, config.validator_index, config.enable_p2p, + config.enable_preconfirmation, ); config From dcedf4b4d309170ffebc4479d65abded41a05a32 Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Fri, 27 Sep 2024 22:56:55 +0200 Subject: [PATCH 29/32] Remove unused variable --- Node/Cargo.lock | 82 ++++++++++++------------ Node/src/ethereum_l1/el_with_cl_tests.rs | 2 +- Node/src/ethereum_l1/execution_layer.rs | 3 +- Node/src/node/mod.rs | 1 - 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/Node/Cargo.lock b/Node/Cargo.lock index c86c708..f3b1c63 100644 --- a/Node/Cargo.lock +++ b/Node/Cargo.lock @@ -444,7 +444,7 @@ checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -584,7 +584,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -601,7 +601,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "syn-solidity", "tiny-keccak", ] @@ -619,7 +619,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.77", + "syn 2.0.79", "syn-solidity", ] @@ -1001,7 +1001,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "synstructure 0.13.1", ] @@ -1013,7 +1013,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1294,7 +1294,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1311,7 +1311,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1376,7 +1376,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1760,7 +1760,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2001,7 +2001,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2025,7 +2025,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2036,7 +2036,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2153,7 +2153,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2173,7 +2173,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "unicode-xid", ] @@ -2237,7 +2237,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2423,7 +2423,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2534,7 +2534,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2803,7 +2803,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4554,7 +4554,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4905,7 +4905,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4917,7 +4917,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5243,7 +5243,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5324,7 +5324,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5528,7 +5528,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5782,7 +5782,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -6420,9 +6420,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-platform-verifier" @@ -6699,7 +6699,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7045,7 +7045,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7067,9 +7067,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -7085,7 +7085,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7123,7 +7123,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7267,7 +7267,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7370,7 +7370,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7510,7 +7510,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -7805,7 +7805,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -7839,7 +7839,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -8309,7 +8309,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -8329,5 +8329,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] diff --git a/Node/src/ethereum_l1/el_with_cl_tests.rs b/Node/src/ethereum_l1/el_with_cl_tests.rs index aaf8282..02b2178 100644 --- a/Node/src/ethereum_l1/el_with_cl_tests.rs +++ b/Node/src/ethereum_l1/el_with_cl_tests.rs @@ -30,7 +30,7 @@ mod tests { // .unwrap(); let lookahead_params = Vec::::new(); - el.propose_new_block(0, vec![0; 32], [0; 32], 0, lookahead_params, true) + el.propose_new_block(0, vec![0; 32], 0, lookahead_params, true) .await .unwrap(); } diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index 45066fd..c63a846 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -213,7 +213,6 @@ impl ExecutionLayer { &self, nonce: u64, tx_list: Vec, - parent_meta_hash: [u8; 32], lookahead_pointer: u64, lookahead_set_params: Vec, send_to_contract: bool, @@ -1037,7 +1036,7 @@ mod tests { .await .unwrap(); - el.propose_new_block(0, vec![0; 32], [0; 32], 0, vec![], true) + el.propose_new_block(0, vec![0; 32], 0, vec![], true) .await .unwrap(); } diff --git a/Node/src/node/mod.rs b/Node/src/node/mod.rs index a345724..d4203ea 100644 --- a/Node/src/node/mod.rs +++ b/Node/src/node/mod.rs @@ -502,7 +502,6 @@ impl Node { .propose_new_block( self.preconfirmation_helper.get_next_nonce(), pending_tx_lists_bytes, - pending_tx_lists.parent_meta_hash, lookahead_pointer, lookahead_params.unwrap_or(vec![]), send_to_contract, From fbdd2c2106e4e7c31b026f70aeaa7cf06048ce35 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Fri, 27 Sep 2024 22:58:58 +0200 Subject: [PATCH 30/32] .env.sample --- Node/.env.sample | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Node/.env.sample diff --git a/Node/.env.sample b/Node/.env.sample new file mode 100644 index 0000000..e0a1dbe --- /dev/null +++ b/Node/.env.sample @@ -0,0 +1,21 @@ +AVS_NODE_ECDSA_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000 +VALIDATOR_BLS_PRIVATEKEY=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef +AVS_PRECONF_TASK_MANAGER_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +AVS_DIRECTORY_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +AVS_SERVICE_MANAGER_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +AVS_PRECONF_REGISTRY_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +EIGEN_LAYER_STRATEGY_MANAGER_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +EIGEN_LAYER_SLASHER_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000 +TAIKO_L1_ADDRESS=0x0000000000000000000000000000000000000000 +TAIKO_CHAIN_ID=167 +L1_CHAIN_ID=3151908 +VALIDATOR_INDEX=1 +TAIKO_PROPOSER_URL=http://127.0.0.1:1234 +TAIKO_DRIVER_URL=http://127.0.0.1:1235 +MEV_BOOST_URL=http://127.0.0.1:33661 +L1_WS_RPC_URL=ws://127.0.0.1:32003 +L1_BEACON_URL=http://127.0.0.1:33001 +ENABLE_P2P=true +ENABLE_PRECONFIRMATION=true +RUST_LOG=debug,reqwest=info,hyper=info,alloy_transport=info,alloy_rpc_client=info,alloy_provider=info + From eaf9c031717e64fd653c3aec7e4cb24b61e73662 Mon Sep 17 00:00:00 2001 From: mikhailUshakoff Date: Sat, 28 Sep 2024 00:09:50 +0200 Subject: [PATCH 31/32] Improve the process of sending new block proposals --- Node/src/ethereum_l1/execution_layer.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Node/src/ethereum_l1/execution_layer.rs b/Node/src/ethereum_l1/execution_layer.rs index c63a846..56ad7dc 100644 --- a/Node/src/ethereum_l1/execution_layer.rs +++ b/Node/src/ethereum_l1/execution_layer.rs @@ -259,8 +259,7 @@ impl ExecutionLayer { // Build transaction let tx = builder.as_ref().clone().build_typed_tx(); let Ok(TypedTransaction::Eip1559(mut tx)) = tx else { - // TODO fix - panic!("Not EIP1559 transaction"); + return Err(anyhow::anyhow!("Not EIP1559 transaction")); }; // Sign transaction @@ -279,8 +278,6 @@ impl ExecutionLayer { let pending = self .provider_ws .send_raw_transaction(&buf) - .await? - .register() .await?; tracing::debug!("Proposed new block, with hash {}", pending.tx_hash()); From 84ead8d834054ade47ce46b8c31bc88f37e37ff7 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Sat, 28 Sep 2024 12:31:58 +0200 Subject: [PATCH 32/32] removed private keys and URLs from scripts --- .env.sample | 16 ---------------- SmartContracts/scripts/deployment/deploy_avs.sh | 3 --- .../scripts/deployment/deploy_eigenlayer_mvp.sh | 3 --- avs-deploy | 4 ++-- 4 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 .env.sample diff --git a/.env.sample b/.env.sample deleted file mode 100644 index 18b5409..0000000 --- a/.env.sample +++ /dev/null @@ -1,16 +0,0 @@ -AVS_NODE_ECDSA_PRIVATE_KEY= -AVS_PRECONF_TASK_MANAGER_CONTRACT_ADDRESS=0x6064f756f7F3dc8280C1CfA01cE41a37B5f16df1 -AVS_DIRECTORY_CONTRACT_ADDRESS=0x7E2E7DD2Aead92e2e6d05707F21D4C36004f8A2B -AVS_SERVICE_MANAGER_CONTRACT_ADDRESS=0x1912A7496314854fB890B1B88C0f1Ced653C1830 -AVS_PRECONF_REGISTRY_CONTRACT_ADDRESS=0x9D2ea2038CF6009F1Bc57E32818204726DfA63Cd -EIGEN_LAYER_STRATEGY_MANAGER_CONTRACT_ADDRESS=0xaDe68b4b6410aDB1578896dcFba75283477b6b01 -EIGEN_LAYER_SLASHER_CONTRACT_ADDRESS=0x86A0679C7987B5BA9600affA994B78D0660088ff -VALIDATOR_PUBKEY=0x87231421a08ed28e7d357e2b37a26a458155c8d822d829344bd1029e5d175b5edfaa78f16f784f724a2caef124944c4f -VALIDATOR_BLS_PRIVATEKEY=1c511df0a39ec614499b08cf284d2d1d1aec3c231809c1c5688a4daab09f7752 -TAIKO_CHAIN_ID=167 -VALIDATOR_INDEX=7 -TAIKO_PROPOSER_URL=http://139.162.249.67:1234 -TAIKO_DRIVER_URL=http://139.162.249.67:1235 -MEV_BOOST_URL=http://139.162.249.67:33467 -L1_RPC_URL=http://139.162.249.67:32002 -L1_BEACON_URL=http://139.162.249.67:32002 diff --git a/SmartContracts/scripts/deployment/deploy_avs.sh b/SmartContracts/scripts/deployment/deploy_avs.sh index 4bad2ce..f85dc73 100644 --- a/SmartContracts/scripts/deployment/deploy_avs.sh +++ b/SmartContracts/scripts/deployment/deploy_avs.sh @@ -1,8 +1,5 @@ set -e -export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 -export FORK_URL="http://139.162.249.67:32002" - AVS_DIRECTORY=0x7E2E7DD2Aead92e2e6d05707F21D4C36004f8A2B \ SLASHER=0x86A0679C7987B5BA9600affA994B78D0660088ff \ TAIKO_L1=0x086f77C5686dfe3F2f8FE487C5f8d357952C8556 \ diff --git a/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh b/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh index f07b96f..e57e1c2 100644 --- a/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh +++ b/SmartContracts/scripts/deployment/deploy_eigenlayer_mvp.sh @@ -1,8 +1,5 @@ set -e -export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 -export FORK_URL="http://139.162.249.67:32002" - forge script scripts/deployment/DeployEigenlayerMVP.s.sol:DeployEigenlayerMVP \ --rpc-url $FORK_URL \ --broadcast \ diff --git a/avs-deploy b/avs-deploy index 9e92bc7..ae9aedf 100644 --- a/avs-deploy +++ b/avs-deploy @@ -27,8 +27,8 @@ WORKDIR /usr/src/app/SmartContracts/ RUN chmod +x scripts/deployment/*.sh # Set environment variables -ENV PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 -ENV FORK_URL="http://139.162.249.67:32002" +ENV PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000 +ENV FORK_URL="http://127.0.0.1:32002" ENV BEACON_GENESIS_TIMESTAMP=1725950369 # Default command to run if no arguments are provided