You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Motivation**
Include geth's
[admin_addPeer](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin#admin-addpeer)
endpoint since we found it necessary for running eip7934 hive tests with
the `ethereum/eels/consume-sync ` simulation.
Besides Nethermind, Reth, Besu, Erigon and other execution clients
implement it.
**Description**
This pr introduces the RPC endpoint `admin_addPeer`. Since this endpoint
needed to access p2p's generic server used to establish connections, the
`init_l1` function was restructure so the genserver is saved within the
peer_handler struct and can later be accessed from the `RPCApiContext`.
In `admin_addPeer` the connection is tried in a period of 10 seconds
waiting 100 milliseconds in between each message casted. This is because
connections are asynchronous so to check if the connection with the peer
was made we need to wait until it's established.
---------
Co-authored-by: SDartayet <[email protected]>
Co-authored-by: SDartayet <[email protected]>
Co-authored-by: ElFantasma <[email protected]>
// TODO: The Web3Signer refactor introduced a limitation where the committer key cannot be accessed directly because the signer could be either Local or Remote.
218
+
// The Signer enum cannot be used in the P2PBasedContext struct due to cyclic dependencies between the l2-rpc and p2p crates.
219
+
// As a temporary solution, a dummy committer key is used until a proper mechanism to utilize the Signer enum is implemented.
220
+
// This should be replaced with the Signer enum once the refactor is complete.
let initiator = RLPxInitiator::spawn(p2p_context.clone()).await;
237
+
let peer_handler = PeerHandler::new(PeerTable::spawn(opts.node_opts.target_peers), initiator);
238
+
207
239
let cancel_token = tokio_util::sync::CancellationToken::new();
208
240
209
241
init_rpc_api(
210
242
&opts.node_opts,
211
243
&opts,
212
-
peer_handler.peer_table.clone(),
244
+
peer_handler.clone(),
213
245
local_p2p_node.clone(),
214
246
local_node_record.clone(),
215
247
store.clone(),
@@ -241,28 +273,10 @@ pub async fn init_l2(
241
273
&opts.node_opts,
242
274
&network,
243
275
&datadir,
244
-
local_p2p_node,
245
-
signer,
246
276
peer_handler.clone(),
247
-
store.clone(),
248
277
tracker,
249
278
blockchain.clone(),
250
-
Some(P2PBasedContext{
251
-
store_rollup: rollup_store.clone(),
252
-
// TODO: The Web3Signer refactor introduced a limitation where the committer key cannot be accessed directly because the signer could be either Local or Remote.
253
-
// The Signer enum cannot be used in the P2PBasedContext struct due to cyclic dependencies between the l2-rpc and p2p crates.
254
-
// As a temporary solution, a dummy committer key is used until a proper mechanism to utilize the Signer enum is implemented.
255
-
// This should be replaced with the Signer enum once the refactor is complete.
0 commit comments