Skip to content

Commit

Permalink
renamed according to the review
Browse files Browse the repository at this point in the history
  • Loading branch information
mskrzypkows committed Jul 4, 2024
1 parent 9a8152f commit a31733a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Node/src/ethereum_l1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::str::FromStr;
pub struct EthereumL1 {
rpc_url: reqwest::Url,
wallet: EthereumWallet,
new_block_proposal_contract_address: Address,
taiko_preconfirming_address: Address,
}

sol!(
Expand Down Expand Up @@ -46,15 +46,15 @@ impl EthereumL1 {
pub fn new(
rpc_url: &str,
private_key: &str,
new_block_proposal_contract_address: &str,
taiko_preconfirming_address: &str,
) -> Result<Self, Error> {
let signer = PrivateKeySigner::from_str(private_key)?;
let wallet = EthereumWallet::from(signer);

Ok(Self {
rpc_url: rpc_url.parse()?,
wallet,
new_block_proposal_contract_address: new_block_proposal_contract_address.parse()?,
taiko_preconfirming_address: taiko_preconfirming_address.parse()?,
})
}

Expand All @@ -68,7 +68,7 @@ impl EthereumL1 {
.wallet(self.wallet.clone())
.on_http(self.rpc_url.clone());

let contract = PreconfTaskManager::new(self.new_block_proposal_contract_address, provider);
let contract = PreconfTaskManager::new(self.taiko_preconfirming_address, provider);

let block_params = BlockParams {
assignedProver: Address::ZERO,
Expand Down Expand Up @@ -111,7 +111,7 @@ impl EthereumL1 {
Ok(Self {
rpc_url,
wallet,
new_block_proposal_contract_address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // some random address for test
taiko_preconfirming_address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // some random address for test
.parse()?,
})
}
Expand Down
2 changes: 1 addition & 1 deletion Node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() -> Result<(), Error> {
let ethereum_l1 = ethereum_l1::EthereumL1::new(
&config.mev_boost_url,
&config.ethereum_private_key,
&config.new_block_proposal_contract_address,
&config.taiko_preconfirming_address,
)?;
let mev_boost = mev_boost::MevBoost::new(&config.mev_boost_url);
let node = node::Node::new(node_rx, avs_p2p_tx, taiko, ethereum_l1, mev_boost);
Expand Down
2 changes: 1 addition & 1 deletion Node/src/taiko/l2_tx_lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde_json::Value;
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct RPCReplyL2TxLists {
pub tx_lists: Value,
pub tx_lists: Value, // TODO: decode and create tx_list_bytes on AVS node side
#[serde(deserialize_with = "deserialize_tx_lists_bytes")]
pub tx_list_bytes: Vec<Vec<u8>>,
#[serde(deserialize_with = "deserialize_parent_meta_hash")]
Expand Down
15 changes: 8 additions & 7 deletions Node/src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ pub struct Config {
pub taiko_driver_url: String,
pub ethereum_private_key: String,
pub mev_boost_url: String,
pub new_block_proposal_contract_address: String,
pub taiko_preconfirming_address: String,
}

impl Config {
pub fn read_env_variables() -> Self {
const ETHEREUM_PRIVATE_KEY: &str = "ETHEREUM_PRIVATE_KEY";
const NEW_BLOCK_PROPOSAL_CONTRACT_ADDRESS: &str = "NEW_BLOCK_PROPOSAL_CONTRACT_ADDRESS";
const TAIKO_PRECONFIRMING_ADDRESS: &str = "TAIKO_PRECONFIRMING_ADDRESS";

let config = Self {
taiko_proposer_url: std::env::var("TAIKO_PROPOSER_URL")
.unwrap_or_else(|_| "http://127.0.0.1:1234".to_string()),
taiko_driver_url: std::env::var("TAIKO_DRIVER_URL")
.unwrap_or_else(|_| "http://127.0.0.1:1235".to_string()),
new_block_proposal_contract_address: std::env::var(NEW_BLOCK_PROPOSAL_CONTRACT_ADDRESS)
.unwrap_or_else(|_| {
taiko_preconfirming_address: std::env::var(TAIKO_PRECONFIRMING_ADDRESS).unwrap_or_else(
|_| {
warn!(
"No new block proposal contract address found in {} env var, using default",
NEW_BLOCK_PROPOSAL_CONTRACT_ADDRESS
TAIKO_PRECONFIRMING_ADDRESS
);
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2".to_string()
}),
},
),
ethereum_private_key: std::env::var(ETHEREUM_PRIVATE_KEY).unwrap_or_else(|_| {
warn!(
"No Ethereum private key found in {} env var, using default",
Expand All @@ -42,7 +43,7 @@ impl Config {
config.taiko_proposer_url,
config.taiko_driver_url,
config.mev_boost_url,
config.new_block_proposal_contract_address
config.taiko_preconfirming_address
);

config
Expand Down

0 comments on commit a31733a

Please sign in to comment.