Skip to content

Commit 2ae42f7

Browse files
mskrzypkowsCopilot
andauthored
Preconf router config read in Operator (#586)
* WIP * moved whitelist specific L1 functions to whitelist crate * Moved all functions using provider to the ExecutionLayerInner * Update dependencies in Cargo.lock and Cargo.toml - Removed outdated dependencies from Cargo.lock, including several async-related packages. - Updated the libp2p dependency in Cargo.toml to version 0.55.0, enabling the "macros" feature while disabling others for a more streamlined build. - Cleaned up unnecessary entries to optimize the dependency tree. * fixed test_gas * Remove MPL-2.0 exception for attohttpc from deny.toml and ensure bitbucket source entry has a newline at the end of the file. * fixing test_gas * Moved template type from ExecutionLayer to upper level, to the EthereumL1 structure * test-gas fix * removed node.rs * comment * Handover window slots from preconf router contract config * Checking config from preconf router in Operator Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> * better error * Update whitelist/src/node/operator.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fixed copilot improvement * removed ruint dependency --------- Signed-off-by: Maciej Skrzypkowski <mskr@gmx.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 296eff0 commit 2ae42f7

File tree

6 files changed

+219
-23
lines changed

6 files changed

+219
-23
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resolver = "2"
1212
default-members = ["whitelist"]
1313

1414
[workspace.package]
15-
version = "1.7.3"
15+
version = "1.8.0"
1616
edition = "2024"
1717
repository = "https://github.com/NethermindEth/Catalyst"
1818
license = "MIT"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"type":"constructor","inputs":[{"name":"_proposeBatchEntrypoint","type":"address","internalType":"address"},{"name":"_preconfWhitelist","type":"address","internalType":"address"},{"name":"_fallbackPreconfer","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"acceptOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"fallbackPreconfer","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"impl","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"inNonReentrant","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"init","inputs":[{"name":"_owner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"pause","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"paused","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"pendingOwner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"preconfWhitelist","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IPreconfWhitelist"}],"stateMutability":"view"},{"type":"function","name":"proposeBatch","inputs":[{"name":"_params","type":"bytes","internalType":"bytes"},{"name":"_txList","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"meta_","type":"tuple","internalType":"struct ITaikoInbox.BatchMetadata","components":[{"name":"infoHash","type":"bytes32","internalType":"bytes32"},{"name":"proposer","type":"address","internalType":"address"},{"name":"batchId","type":"uint64","internalType":"uint64"},{"name":"proposedAt","type":"uint64","internalType":"uint64"}]}],"stateMutability":"nonpayable"},{"type":"function","name":"proposeBatchEntrypoint","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IProposeBatch"}],"stateMutability":"view"},{"type":"function","name":"proxiableUUID","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"resolver","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unpause","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"upgradeTo","inputs":[{"name":"newImplementation","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"upgradeToAndCall","inputs":[{"name":"newImplementation","type":"address","internalType":"address"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"payable"},{"type":"event","name":"AdminChanged","inputs":[{"name":"previousAdmin","type":"address","indexed":false,"internalType":"address"},{"name":"newAdmin","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"name":"beacon","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"name":"account","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"name":"account","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"name":"implementation","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"ACCESS_DENIED","inputs":[]},{"type":"error","name":"FUNC_NOT_IMPLEMENTED","inputs":[]},{"type":"error","name":"ForcedInclusionNotSupported","inputs":[]},{"type":"error","name":"INVALID_PAUSE_STATUS","inputs":[]},{"type":"error","name":"InvalidLastBlockId","inputs":[{"name":"_actual","type":"uint96","internalType":"uint96"},{"name":"_expected","type":"uint96","internalType":"uint96"}]},{"type":"error","name":"NotPreconferOrFallback","inputs":[]},{"type":"error","name":"ProposerIsNotPreconfer","inputs":[]},{"type":"error","name":"REENTRANT_CALL","inputs":[]},{"type":"error","name":"RESOLVER_NOT_FOUND","inputs":[]},{"type":"error","name":"ZERO_ADDRESS","inputs":[]},{"type":"error","name":"ZERO_VALUE","inputs":[]}]
1+
[{"type":"constructor","inputs":[{"name":"_proposeBatchEntrypoint","type":"address","internalType":"address"},{"name":"_preconfWhitelist","type":"address","internalType":"address"},{"name":"_fallbackPreconfer","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"acceptOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"fallbackPreconfer","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"impl","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"inNonReentrant","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"init","inputs":[{"name":"_owner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"pause","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"paused","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"pendingOwner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"preconfWhitelist","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IPreconfWhitelist"}],"stateMutability":"view"},{"type":"function","name":"proposeBatch","inputs":[{"name":"_params","type":"bytes","internalType":"bytes"},{"name":"_txList","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"meta_","type":"tuple","internalType":"struct ITaikoInbox.BatchMetadata","components":[{"name":"infoHash","type":"bytes32","internalType":"bytes32"},{"name":"proposer","type":"address","internalType":"address"},{"name":"batchId","type":"uint64","internalType":"uint64"},{"name":"proposedAt","type":"uint64","internalType":"uint64"}]}],"stateMutability":"nonpayable"},{"type":"function","name":"proposeBatchEntrypoint","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IProposeBatch"}],"stateMutability":"view"},{"type":"function","name":"proxiableUUID","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"renounceOwnership","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"resolver","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"transferOwnership","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unpause","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"upgradeTo","inputs":[{"name":"newImplementation","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"upgradeToAndCall","inputs":[{"name":"newImplementation","type":"address","internalType":"address"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"payable"},{"type":"event","name":"AdminChanged","inputs":[{"name":"previousAdmin","type":"address","indexed":false,"internalType":"address"},{"name":"newAdmin","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"name":"beacon","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"name":"account","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"name":"account","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"name":"implementation","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"type":"error","name":"ACCESS_DENIED","inputs":[]},{"type":"error","name":"FUNC_NOT_IMPLEMENTED","inputs":[]},{"type":"error","name":"ForcedInclusionNotSupported","inputs":[]},{"type":"error","name":"INVALID_PAUSE_STATUS","inputs":[]},{"type":"error","name":"InvalidLastBlockId","inputs":[{"name":"_actual","type":"uint96","internalType":"uint96"},{"name":"_expected","type":"uint96","internalType":"uint96"}]},{"type":"error","name":"NotPreconferOrFallback","inputs":[]},{"type":"error","name":"ProposerIsNotPreconfer","inputs":[]},{"type":"error","name":"REENTRANT_CALL","inputs":[]},{"type":"error","name":"RESOLVER_NOT_FOUND","inputs":[]},{"type":"error","name":"ZERO_ADDRESS","inputs":[]},{"type":"error","name":"ZERO_VALUE","inputs":[]}]

whitelist/src/l1/bindings.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ sol!(
9090
"src/l1/abi/PreconfRouter.json"
9191
);
9292

93+
pub mod preconf_router {
94+
use super::*;
95+
96+
sol!(
97+
#[allow(missing_docs)]
98+
#[sol(rpc)]
99+
interface IPreconfRouter is IProposeBatch {
100+
error ForcedInclusionNotSupported();
101+
error NotPreconferOrFallback();
102+
error ProposerIsNotPreconfer();
103+
104+
struct Config {
105+
uint256 handOverSlots;
106+
}
107+
108+
function getConfig() external view returns (Config memory);
109+
}
110+
);
111+
}
112+
93113
pub mod taiko_wrapper {
94114
use super::*;
95115

whitelist/src/l1/execution_layer.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use super::{
22
bindings::{
33
BatchParams, BlockParams, PreconfWhitelist,
44
forced_inclusion_store::{IForcedInclusionStore, IForcedInclusionStore::ForcedInclusion},
5+
preconf_router::IPreconfRouter,
56
taiko_inbox, taiko_wrapper,
67
},
78
config::EthereumL1Config,
@@ -396,16 +397,30 @@ impl ExecutionLayer {
396397
info,
397398
)
398399
}
400+
401+
pub async fn get_preconf_router_config(&self) -> Result<IPreconfRouter::Config, Error> {
402+
let contract = IPreconfRouter::new(
403+
self.config.contract_addresses.preconf_router,
404+
self.provider.clone(),
405+
);
406+
contract
407+
.getConfig()
408+
.call()
409+
.await
410+
.map_err(|e| Error::msg(format!("Failed to get preconf router config: {e}")))
411+
}
399412
}
400413

401-
use std::future::Future;
402414
pub trait PreconfOperator {
403415
fn is_operator_for_current_epoch(&self) -> impl Future<Output = Result<bool, Error>> + Send;
404416
fn is_operator_for_next_epoch(&self) -> impl Future<Output = Result<bool, Error>> + Send;
405417
fn is_preconf_router_specified_in_taiko_wrapper(
406418
&self,
407419
) -> impl Future<Output = Result<bool, Error>> + Send;
408420
fn get_l2_height_from_taiko_inbox(&self) -> impl Future<Output = Result<u64, Error>> + Send;
421+
fn get_preconf_router_config(
422+
&self,
423+
) -> impl Future<Output = Result<IPreconfRouter::Config, Error>> + Send;
409424
}
410425

411426
impl PreconfOperator for ExecutionLayer {
@@ -427,4 +442,8 @@ impl PreconfOperator for ExecutionLayer {
427442
async fn get_l2_height_from_taiko_inbox(&self) -> Result<u64, Error> {
428443
self.get_l2_height_from_taiko_inbox().await
429444
}
445+
446+
async fn get_preconf_router_config(&self) -> Result<IPreconfRouter::Config, Error> {
447+
self.get_preconf_router_config().await
448+
}
430449
}

0 commit comments

Comments
 (0)