Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resolver = "2"
default-members = ["node"]

[workspace.package]
version = "1.27.1"
version = "1.28.0"
edition = "2024"
repository = "https://github.com/NethermindEth/Catalyst"
license = "MIT"
Expand Down
36 changes: 25 additions & 11 deletions pacaya/src/l2/execution_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ impl L2ExecutionLayer {
alloy_tools::construct_alloy_provider(&self.config.signer, &self.config.taiko_geth_url)
.await?;

self.transfer_eth_from_l2_to_l1_with_provider(
Self::transfer_eth_from_l2_to_l1_with_provider(
self.config.taiko_bridge_address,
provider,
amount,
self.chain_id,
dest_chain_id,
preconfer_address,
bridge_relayer_fee,
Expand All @@ -147,27 +149,29 @@ impl L2ExecutionLayer {
Ok(())
}

async fn transfer_eth_from_l2_to_l1_with_provider(
&self,
pub async fn transfer_eth_from_l2_to_l1_with_provider(
taiko_bridge_address: Address,
provider: DynProvider,
amount: u128,
src_chain_id: u64,
dest_chain_id: u64,
preconfer_address: Address,
bridge_relayer_fee: u64,
) -> Result<(), Error> {
let contract = Bridge::new(self.config.taiko_bridge_address, provider.clone());
let contract = Bridge::new(taiko_bridge_address, provider.clone());
let gas_limit = contract
.getMessageMinGasLimit(Uint::<256, 4>::from(0))
.call()
.await?;
.await
.map_err(|e| anyhow::anyhow!("Failed to get message min gas limit: {}", e))?;
debug!("Bridge message gas limit: {}", gas_limit);

let message = Bridge::Message {
id: 0,
fee: bridge_relayer_fee,
gasLimit: gas_limit + 1,
from: preconfer_address,
srcChainId: self.chain_id,
srcChainId: src_chain_id,
srcOwner: preconfer_address,
destChainId: dest_chain_id,
destOwner: preconfer_address,
Expand All @@ -176,14 +180,20 @@ impl L2ExecutionLayer {
data: Bytes::new(),
};

let mut fees = provider.estimate_eip1559_fees().await?;
let mut fees = provider
.estimate_eip1559_fees()
.await
.map_err(|e| anyhow::anyhow!("Failed to estimate EIP-1559 fees: {}", e))?;
const ONE_GWEI: u128 = 1000000000;
if fees.max_priority_fee_per_gas < ONE_GWEI {
fees.max_priority_fee_per_gas = ONE_GWEI;
fees.max_fee_per_gas += ONE_GWEI;
}
debug!("Fees: {:?}", fees);
let nonce = provider.get_transaction_count(preconfer_address).await?;
let nonce = provider
.get_transaction_count(preconfer_address)
.await
.map_err(|e| anyhow::anyhow!("Failed to get transaction count: {}", e))?;

let tx_send_message = contract
.sendMessage(message)
Expand All @@ -192,14 +202,17 @@ impl L2ExecutionLayer {
))
.from(preconfer_address)
.nonce(nonce)
.chain_id(self.chain_id)
.chain_id(src_chain_id)
.max_fee_per_gas(fees.max_fee_per_gas)
.max_priority_fee_per_gas(fees.max_priority_fee_per_gas);

let tx_request = tx_send_message.into_transaction_request();
const GAS_LIMIT: u64 = 500000;
let tx_request = tx_request.gas_limit(GAS_LIMIT);
let pending_tx = provider.send_transaction(tx_request).await?;
let pending_tx = provider
.send_transaction(tx_request)
.await
.map_err(|e| anyhow::anyhow!("Failed to send transaction: {}", e))?;

let tx_hash = *pending_tx.tx_hash();
info!("Bridge sendMessage tx hash: {}", tx_hash);
Expand All @@ -208,7 +221,8 @@ impl L2ExecutionLayer {
let receipt = pending_tx
.with_timeout(Some(RECEIPT_TIMEOUT))
.get_receipt()
.await?;
.await
.map_err(|e| anyhow::anyhow!("Failed to get receipt: {}", e))?;

if receipt.status() {
let block_number = if let Some(block_number) = receipt.block_number() {
Expand Down
2 changes: 1 addition & 1 deletion pacaya/src/l2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod bindings;
pub mod config;
mod execution_layer;
pub mod execution_layer;
pub mod taiko;
1 change: 0 additions & 1 deletion shasta/src/l2/abi/BondManager.json

This file was deleted.

1 change: 0 additions & 1 deletion shasta/src/l2/abi/Bridge.json

This file was deleted.

17 changes: 0 additions & 17 deletions shasta/src/l2/bindings.rs

This file was deleted.

24 changes: 6 additions & 18 deletions shasta/src/l2/execution_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use common::shared::{
};
use pacaya::l2::config::TaikoConfig;
use taiko_bindings::anchor::{Anchor, ICheckpointStore::Checkpoint};
use tracing::{debug, info, warn};
use tracing::{debug, info};

use serde_json::Value;
pub struct L2ExecutionLayer {
Expand Down Expand Up @@ -129,29 +129,17 @@ impl L2ExecutionLayer {
alloy_tools::construct_alloy_provider(&self.config.signer, &self.config.taiko_geth_url)
.await?;

self.transfer_eth_from_l2_to_l1_with_provider(
pacaya::l2::execution_layer::L2ExecutionLayer::transfer_eth_from_l2_to_l1_with_provider(
self.config.taiko_bridge_address,
provider,
amount,
self.chain_id,
dest_chain_id,
preconfer_address,
bridge_relayer_fee,
)
.await?;

Ok(())
}

async fn transfer_eth_from_l2_to_l1_with_provider(
&self,
_provider: DynProvider,
_amount: u128,
_dest_chain_id: u64,
_preconfer_address: Address,
_bridge_relayer_fee: u64,
) -> Result<(), Error> {
// TODO: implement the actual transfer logic
warn!("Implement bridge transfer logic here");
Ok(())
.await
.map_err(|e| anyhow::anyhow!("Failed to transfer ETH from L2 to L1: {}", e))
}

pub async fn get_last_synced_proposal_id_from_geth(&self) -> Result<u64, Error> {
Expand Down
1 change: 0 additions & 1 deletion shasta/src/l2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod bindings;
pub mod execution_layer;
pub mod extra_data;
pub mod taiko;