From 4b7a4dc0a136a29fa0165365391b59c9d474d3fa Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Wed, 17 Apr 2024 00:08:36 +0900 Subject: [PATCH] fix: remove some sepolia detritus --- README.md | 6 +++--- kinode/src/main.rs | 3 --- kinode/src/register.rs | 31 +++++++++---------------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c4d10d70..9283ed14 100644 --- a/README.md +++ b/README.md @@ -49,14 +49,14 @@ Make sure not to use the same home directory for two nodes at once! You can use TODO: document feature flags in `--simulation-mode` ```bash # OPTIONAL: --release flag -cargo +nightly run -p kinode -- home --testnet +cargo +nightly run -p kinode -- home ``` -On boot you will be prompted to navigate to `localhost:8080`. Make sure your browser wallet matches the network that the node is being booted on. Follow the registration UI -- if you want to register a new ID you will either need [Sepolia testnet tokens](https://www.infura.io/faucet/sepolia) or an invite code. +On boot you will be prompted to navigate to `localhost:8080`. Make sure your browser wallet matches the network that the node is being booted on. Follow the registration UI -- if you want to register a new ID you will either need Optimism ETH or an invite code. ## Configuring the ETH RPC Provider -By default, a node will use the hardcoded providers for the network ([testnet](./kinode/default_providers_testnet.json)/[mainnet](./kinode/default_providers_mainnet.json)) it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the `.eth_providers` file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the [default providers file here](./kinode/default_providers_testnet.json) for a template to create `.eth_providers`. +By default, a node will use the [hardcoded providers](./kinode/default_providers_mainnet.json) for the network it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the `.eth_providers` file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the [default providers file here](./kinode/default_providers_mainnet.json) for a template to create `.eth_providers`. You may also add a RPC provider or otherwise modify your configuration by sending messages from the terminal to the `eth:distro:sys` process. Use this message format to add a provider -- this will make your node's performance better when accessing a blockchain: ``` diff --git a/kinode/src/main.rs b/kinode/src/main.rs index a0d9dd02..3c8ad411 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -45,7 +45,6 @@ async fn serve_register_fe( our_ip: String, ws_networking: (tokio::net::TcpListener, bool), http_server_port: u16, - testnet: bool, maybe_rpc: Option, ) -> (Identity, Vec, Keyfile) { // check if we have keys saved on disk, encrypted @@ -74,7 +73,6 @@ async fn serve_register_fe( ws_networking, http_server_port, disk_keyfile, - testnet, maybe_rpc) => { panic!("registration failed") } @@ -304,7 +302,6 @@ async fn main() { our_ip.to_string(), (ws_tcp_handle, flag_used), http_server_port, - fakenode, // true if fakenode matches.get_one::("rpc").cloned(), ) .await; diff --git a/kinode/src/register.rs b/kinode/src/register.rs index 0c0f498e..4d1ec516 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -31,10 +31,10 @@ use warp::{ type RegistrationSender = mpsc::Sender<(Identity, Keyfile, Vec)>; -pub const KNS_SEPOLIA_ADDRESS: EthAddress = EthAddress::new([ - 0x38, 0x07, 0xFB, 0xD6, 0x92, 0xAa, 0x5c, 0x96, 0xF1, 0xD8, 0xD7, 0xc5, 0x9a, 0x13, 0x46, 0xa8, - 0x85, 0xF4, 0x0B, 0x1C, -]); +// pub const KNS_SEPOLIA_ADDRESS: EthAddress = EthAddress::new([ +// 0x38, 0x07, 0xFB, 0xD6, 0x92, 0xAa, 0x5c, 0x96, 0xF1, 0xD8, 0xD7, 0xc5, 0x9a, 0x13, 0x46, 0xa8, +// 0x85, 0xF4, 0x0B, 0x1C, +// ]); pub const KNS_OPTIMISM_ADDRESS: EthAddress = EthAddress::new([ 0xca, 0x5b, 0x58, 0x11, 0xc0, 0xC4, 0x0a, 0xAB, 0x32, 0x95, 0xf9, 0x32, 0xb1, 0xB5, 0x11, 0x2E, @@ -120,7 +120,6 @@ pub async fn register( ws_networking: (tokio::net::TcpListener, bool), http_port: u16, keyfile: Option>, - testnet: bool, maybe_rpc: Option, ) { // Networking info is generated and passed to the UI, but not used until confirmed @@ -147,17 +146,11 @@ pub async fn register( }); // KnsRegistrar contract address - let kns_address = if testnet { - KNS_SEPOLIA_ADDRESS - } else { - KNS_OPTIMISM_ADDRESS - }; + let kns_address = KNS_OPTIMISM_ADDRESS; // This ETH provider uses public rpc endpoints to verify registration signatures. let url = if let Some(rpc_url) = maybe_rpc { rpc_url - } else if testnet { - "wss://ethereum-sepolia-rpc.publicnode.com".to_string() } else { "wss://optimism-rpc.publicnode.com".to_string() }; @@ -203,13 +196,9 @@ pub async fn register( .or(warp::path("set-password") .and(warp::get()) .map(move || warp::reply::html(include_str!("register-ui/build/index.html")))) - .or(warp::path("current-chain").and(warp::get()).map(move || { - if testnet { - warp::reply::json(&"0xaa36a7") - } else { - warp::reply::json(&"0xa") - } - })) + .or(warp::path("current-chain") + .and(warp::get()) + .map(move || warp::reply::json(&"0xa"))) .or(warp::path("our").and(warp::get()).and(keyfile.clone()).map( move |keyfile: Option>| { if let Some(keyfile) = keyfile { @@ -265,7 +254,6 @@ pub async fn register( tx, our_temp_id, net_keypair, - testnet, kns_address, boot_provider, ) @@ -399,7 +387,6 @@ async fn handle_boot( sender: Arc, our: Arc, networking_keypair: Arc>, - testnet: bool, kns_address: EthAddress, provider: Arc>, ) -> Result { @@ -503,7 +490,7 @@ async fn handle_boot( .into_response()); }; - let chain_id: u64 = if testnet { 11155111 } else { 10 }; + let chain_id: u64 = 10; // manual json creation to preserve order.. let sig_data_json = format!(