Skip to content

Commit

Permalink
fix: remove target addr from p2p client
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jan 3, 2025
1 parent 8b317aa commit 3253a31
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
4 changes: 0 additions & 4 deletions crates/clients/networking/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ use gadget_networking::setup::NetworkConfig;
use gadget_networking::{networking::NetworkMultiplexer, round_based};
use gadget_networking::{GossipMsgKeyPair, GossipMsgPublicKey};
use gadget_std::collections::BTreeMap;
use gadget_std::net::IpAddr;
use gadget_std::sync::Arc;
use round_based::PartyIndex;

pub struct P2PClient {
name: String,
config: GadgetConfiguration,
target_addr: IpAddr,
target_port: u16,
gossip_msg_keypair: GossipMsgKeyPair,
}
Expand All @@ -22,14 +20,12 @@ impl P2PClient {
pub fn new(
name: String,
config: GadgetConfiguration,
target_addr: IpAddr,
target_port: u16,
gossip_msg_keypair: GossipMsgKeyPair,
) -> Self {
Self {
name,
config,
target_addr,
target_port,
gossip_msg_keypair,
}
Expand Down
1 change: 0 additions & 1 deletion crates/contexts/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub trait P2pContext {
fn p2p_client(
&self,
name: gadget_std::string::String,
target_addr: IpAddr,
target_port: u16,
my_ecdsa_key: GossipMsgKeyPair,
) -> P2PClient;
Expand Down
2 changes: 0 additions & 2 deletions crates/macros/context-derive/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ pub fn generate_context_impl(
fn p2p_client(
&self,
name: ::gadget_macros::ext::std::string::String,
target_addr: gadget_std::net::IpAddr,
target_port: u16,
my_ecdsa_key: gadget_macros::ext::contexts::p2p::GossipMsgKeyPair,
) -> ::gadget_macros::ext::contexts::p2p::P2PClient {
::gadget_macros::ext::contexts::p2p::P2PClient::new(
name,
#field_access.clone(),
target_addr,
target_port,
my_ecdsa_key.clone()
)
Expand Down
8 changes: 1 addition & 7 deletions crates/macros/context-derive/tests/ui/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use gadget_std::sync::Arc;
use gadget_stores::local_database::LocalDatabase;
use round_based::ProtocolMessage as RoundBasedProtocolMessage;
use serde::{Deserialize, Serialize};
use std::net::{IpAddr, Ipv4Addr};
use subxt_core::ext::sp_core::Pair;

#[derive(KeystoreContext, EVMProviderContext, TangleClientContext, ServicesContext, P2pContext)]
Expand Down Expand Up @@ -54,12 +53,7 @@ fn main() {
.unwrap();
let pub_key = keystore.ecdsa_generate_new(None).unwrap();
let pair = keystore.expose_ecdsa_secret(&pub_key).unwrap().unwrap();
let p2p_client = ctx.p2p_client(
String::from("Foo"),
IpAddr::V4(Ipv4Addr::LOCALHOST),
1337,
GossipMsgKeyPair(pair.clone()),
);
let p2p_client = ctx.p2p_client(String::from("Foo"), 1337, GossipMsgKeyPair(pair.clone()));

// Test MPC context utility functions
let _config = p2p_client.config();
Expand Down

0 comments on commit 3253a31

Please sign in to comment.