@@ -22,7 +22,7 @@ use super::{MUX_PATH_ENV, PbsConfig, RelayConfig, load_optional_env_var};
2222use crate :: {
2323 config:: { remove_duplicate_keys, safe_read_http_response} ,
2424 pbs:: RelayClient ,
25- types:: { BlsPublicKey , Chain } ,
25+ types:: { BlsPublicKey , Chain , HoleskyModules , HoodiModules , MainnetModules } ,
2626} ;
2727
2828#[ derive( Debug , Deserialize , Serialize ) ]
@@ -167,6 +167,8 @@ pub enum MuxKeysLoader {
167167 Registry {
168168 registry : NORegistry ,
169169 node_operator_id : u64 ,
170+ #[ serde( default ) ]
171+ lido_module_id : Option < u8 >
170172 } ,
171173}
172174
@@ -210,7 +212,7 @@ impl MuxKeysLoader {
210212 . wrap_err ( "failed to fetch mux keys from HTTP endpoint" )
211213 }
212214
213- Self :: Registry { registry, node_operator_id } => match registry {
215+ Self :: Registry { registry, node_operator_id, lido_module_id } => match registry {
214216 NORegistry :: Lido => {
215217 let Some ( rpc_url) = rpc_url else {
216218 bail ! ( "Lido registry requires RPC URL to be set in the PBS config" ) ;
@@ -220,6 +222,7 @@ impl MuxKeysLoader {
220222 rpc_url,
221223 chain,
222224 U256 :: from ( * node_operator_id) ,
225+ * lido_module_id,
223226 http_timeout,
224227 )
225228 . await
@@ -257,21 +260,58 @@ sol! {
257260 "src/abi/LidoNORegistry.json"
258261}
259262
260- // Fetching Lido Curated Module
261- fn lido_registry_address ( chain : Chain ) -> eyre:: Result < Address > {
262- match chain {
263- Chain :: Mainnet => Ok ( address ! ( "55032650b14df07b85bF18A3a3eC8E0Af2e028d5" ) ) ,
264- Chain :: Holesky => Ok ( address ! ( "595F64Ddc3856a3b5Ff4f4CC1d1fb4B46cFd2bAC" ) ) ,
265- Chain :: Hoodi => Ok ( address ! ( "5cDbE1590c083b5A2A64427fAA63A7cfDB91FbB5" ) ) ,
266- Chain :: Sepolia => Ok ( address ! ( "33d6E15047E8644F8DDf5CD05d202dfE587DA6E3" ) ) ,
267- _ => bail ! ( "Lido registry not supported for chain: {chain:?}" ) ,
268- }
263+ fn lido_registry_addresses_by_module ( ) -> HashMap < Chain , HashMap < u8 , Address > > {
264+ let mut map: HashMap < Chain , HashMap < u8 , Address > > = HashMap :: new ( ) ;
265+
266+ // --- Mainnet ---
267+ let mut mainnet = HashMap :: new ( ) ;
268+ mainnet. insert ( MainnetModules :: Curated as u8 , address ! ( "55032650b14df07b85bF18A3a3eC8E0Af2e028d5" ) ) ;
269+ mainnet. insert ( MainnetModules :: SimpleDVT as u8 , address ! ( "aE7B191A31f627b4eB1d4DaC64eaB9976995b433" ) ) ;
270+ mainnet. insert ( MainnetModules :: CommunityStaking as u8 , address ! ( "dA7dE2ECdDfccC6c3AF10108Db212ACBBf9EA83F" ) ) ;
271+ map. insert ( Chain :: Mainnet , mainnet) ;
272+
273+ // --- Holesky ---
274+ let mut holesky = HashMap :: new ( ) ;
275+ holesky. insert ( HoleskyModules :: Curated as u8 , address ! ( "595F64Ddc3856a3b5Ff4f4CC1d1fb4B46cFd2bAC" ) ) ;
276+ holesky. insert ( HoleskyModules :: SimpleDVT as u8 , address ! ( "11a93807078f8BB880c1BD0ee4C387537de4b4b6" ) ) ;
277+ holesky. insert ( HoleskyModules :: Sandbox as u8 , address ! ( "D6C2ce3BB8bea2832496Ac8b5144819719f343AC" ) ) ;
278+ holesky. insert ( HoleskyModules :: CommunityStaking as u8 , address ! ( "4562c3e63c2e586cD1651B958C22F88135aCAd4f" ) ) ;
279+ map. insert ( Chain :: Holesky , holesky) ;
280+
281+ // --- Hoodi ---
282+ let mut hoodi = HashMap :: new ( ) ;
283+ hoodi. insert ( HoodiModules :: Curated as u8 , address ! ( "5cDbE1590c083b5A2A64427fAA63A7cfDB91FbB5" ) ) ;
284+ hoodi. insert ( HoodiModules :: SimpleDVT as u8 , address ! ( "0B5236BECA68004DB89434462DfC3BB074d2c830" ) ) ;
285+ hoodi. insert ( HoodiModules :: Sandbox as u8 , address ! ( "682E94d2630846a503BDeE8b6810DF71C9806891" ) ) ;
286+ hoodi. insert ( HoodiModules :: CommunityStaking as u8 , address ! ( "79CEf36D84743222f37765204Bec41E92a93E59d" ) ) ;
287+ map. insert ( Chain :: Hoodi , hoodi) ;
288+
289+ // --- Sepolia --
290+ let mut sepolia = HashMap :: new ( ) ;
291+ sepolia. insert ( 1 , address ! ( "33d6E15047E8644F8DDf5CD05d202dfE587DA6E3" ) ) ;
292+ map. insert ( Chain :: Sepolia , sepolia) ;
293+
294+ map
295+ }
296+
297+ // Fetching appropiate registry address
298+ fn lido_registry_address ( chain : Chain , maybe_module : Option < u8 > ) -> eyre:: Result < Address > {
299+ lido_registry_addresses_by_module ( )
300+ . get ( & chain)
301+ . ok_or_else ( || eyre:: eyre!( "Lido registry not supported for chain: {chain:?}" ) ) ?
302+ . get ( & maybe_module. unwrap_or ( 1 ) )
303+ . copied ( )
304+ . ok_or_else ( || eyre:: eyre!(
305+ "Lido module id {:?} not found for chain: {chain:?}" ,
306+ maybe_module. unwrap_or( 1 )
307+ ) )
269308}
270309
271310async fn fetch_lido_registry_keys (
272311 rpc_url : Url ,
273312 chain : Chain ,
274313 node_operator_id : U256 ,
314+ lido_module_id : Option < u8 > ,
275315 http_timeout : Duration ,
276316) -> eyre:: Result < Vec < BlsPublicKey > > {
277317 debug ! ( ?chain, %node_operator_id, "loading operator keys from Lido registry" ) ;
@@ -283,7 +323,7 @@ async fn fetch_lido_registry_keys(
283323 let rpc_client = RpcClient :: new ( http, is_local) ;
284324 let provider = ProviderBuilder :: new ( ) . connect_client ( rpc_client) ;
285325
286- let registry_address = lido_registry_address ( chain) ?;
326+ let registry_address = lido_registry_address ( chain, lido_module_id ) ?;
287327 let registry = LidoRegistry :: new ( registry_address, provider) ;
288328
289329 let total_keys = registry. getTotalSigningKeyCount ( node_operator_id) . call ( ) . await ?. try_into ( ) ?;
0 commit comments