mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-05 17:07:24 +03:00
little cleanup
This commit is contained in:
parent
989645c419
commit
94c934f67c
@ -29,7 +29,9 @@ cargo +nightly build --release
|
|||||||
### Boot
|
### Boot
|
||||||
Get an eth-sepolia-rpc API key and pass that as an argument. You can get one for free at `alchemy.com`.
|
Get an eth-sepolia-rpc API key and pass that as an argument. You can get one for free at `alchemy.com`.
|
||||||
|
|
||||||
Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use `home`.
|
Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use `home`. The `--` here separates cargo arguments from binary arguments.
|
||||||
|
|
||||||
|
TODO: document feature flags here, `--llm` and `--simulation-mode`
|
||||||
```bash
|
```bash
|
||||||
cargo +nightly run --release -- home --rpc wss://eth-sepolia.g.alchemy.com/v2/<your-api-key>
|
cargo +nightly run --release -- home --rpc wss://eth-sepolia.g.alchemy.com/v2/<your-api-key>
|
||||||
```
|
```
|
||||||
@ -71,6 +73,6 @@ On boot you will be prompted to navigate to `localhost:8080`. Make sure your ETH
|
|||||||
|
|
||||||
Download and install an app:
|
Download and install an app:
|
||||||
```
|
```
|
||||||
!message our main:app_store:uqbar {"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}
|
!m our@main:app_store:uqbar {"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}
|
||||||
!message our main:app_store:uqbar {"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}
|
!m our@main:app_store:uqbar {"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}
|
||||||
```
|
```
|
||||||
|
1
modules/tester/tester/Cargo.lock
generated
1
modules/tester/tester/Cargo.lock
generated
@ -280,6 +280,7 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "uqbar_process_lib"
|
name = "uqbar_process_lib"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=9684d33#9684d338967c871e1611c608a4b2fa362598e194"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -17,8 +17,7 @@ indexmap = "2.1"
|
|||||||
serde = {version = "1.0", features = ["derive"] }
|
serde = {version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
uqbar_process_lib = { path = "../../../../process_lib" }
|
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "9684d33" }
|
||||||
# uqbar_process_lib = { git = "https://github.com/uqbar-dao/process_lib", rev = "9684d33" }
|
|
||||||
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{arg, value_parser, Command};
|
use clap::{arg, value_parser, Command};
|
||||||
use ring::rand::SystemRandom;
|
|
||||||
use ring::signature;
|
|
||||||
use ring::signature::KeyPair;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
use tokio::{fs, time::timeout};
|
use tokio::{fs, time::timeout};
|
||||||
|
|
||||||
|
#[cfg(feature = "simulation-mode")]
|
||||||
|
use ring::{rand::SystemRandom, signature, signature::KeyPair};
|
||||||
|
|
||||||
mod eth_rpc;
|
mod eth_rpc;
|
||||||
mod filesystem;
|
mod filesystem;
|
||||||
mod http;
|
mod http;
|
||||||
|
@ -32,9 +32,9 @@ abigen!(
|
|||||||
|
|
||||||
type RegistrationSender = mpsc::Sender<(Identity, Keyfile, Vec<u8>)>;
|
type RegistrationSender = mpsc::Sender<(Identity, Keyfile, Vec<u8>)>;
|
||||||
|
|
||||||
pub const QNS_SEPOLIA_ADDRESS: &str = "0x9e5ed0e7873E0d7f10eEb6dE72E87fE087A12776";
|
pub const _QNS_SEPOLIA_ADDRESS: &str = "0x9e5ed0e7873E0d7f10eEb6dE72E87fE087A12776";
|
||||||
|
|
||||||
pub fn ip_to_number(ip: &str) -> Result<u32, &'static str> {
|
pub fn _ip_to_number(ip: &str) -> Result<u32, &'static str> {
|
||||||
let octets: Vec<&str> = ip.split('.').collect();
|
let octets: Vec<&str> = ip.split('.').collect();
|
||||||
|
|
||||||
if octets.len() != 4 {
|
if octets.len() != 4 {
|
||||||
@ -58,7 +58,7 @@ pub fn ip_to_number(ip: &str) -> Result<u32, &'static str> {
|
|||||||
Ok(ip_num)
|
Ok(ip_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hex_string_to_u8_array(hex_str: &str) -> Result<[u8; 32], &'static str> {
|
fn _hex_string_to_u8_array(hex_str: &str) -> Result<[u8; 32], &'static str> {
|
||||||
if !hex_str.starts_with("0x") || hex_str.len() != 66 {
|
if !hex_str.starts_with("0x") || hex_str.len() != 66 {
|
||||||
// "0x" + 64 hex chars
|
// "0x" + 64 hex chars
|
||||||
return Err("Invalid hex format or length");
|
return Err("Invalid hex format or length");
|
||||||
@ -346,7 +346,7 @@ async fn handle_boot(
|
|||||||
async fn handle_import_keyfile(
|
async fn handle_import_keyfile(
|
||||||
info: ImportKeyfileInfo,
|
info: ImportKeyfileInfo,
|
||||||
ip: String,
|
ip: String,
|
||||||
rpc_url: String,
|
_rpc_url: String,
|
||||||
sender: RegistrationSender,
|
sender: RegistrationSender,
|
||||||
) -> Result<impl Reply, Rejection> {
|
) -> Result<impl Reply, Rejection> {
|
||||||
// if keyfile was not present in node and is present from user upload
|
// if keyfile was not present in node and is present from user upload
|
||||||
@ -420,7 +420,7 @@ async fn handle_import_keyfile(
|
|||||||
async fn handle_login(
|
async fn handle_login(
|
||||||
info: LoginInfo,
|
info: LoginInfo,
|
||||||
ip: String,
|
ip: String,
|
||||||
rpc_url: String,
|
_rpc_url: String,
|
||||||
sender: RegistrationSender,
|
sender: RegistrationSender,
|
||||||
encoded_keyfile: Vec<u8>,
|
encoded_keyfile: Vec<u8>,
|
||||||
) -> Result<impl Reply, Rejection> {
|
) -> Result<impl Reply, Rejection> {
|
||||||
@ -614,14 +614,14 @@ async fn success_response(
|
|||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn networking_info_valid(rpc_url: String, ip: String, ws_port: u16, our: &Identity) -> bool {
|
async fn _networking_info_valid(rpc_url: String, ip: String, ws_port: u16, our: &Identity) -> bool {
|
||||||
// check if Identity for this username has correct networking keys,
|
// check if Identity for this username has correct networking keys,
|
||||||
// if not, prompt user to reset them.
|
// if not, prompt user to reset them.
|
||||||
let Ok(ws_rpc) = Provider::<Ws>::connect(rpc_url.clone()).await else {
|
let Ok(ws_rpc) = Provider::<Ws>::connect(rpc_url.clone()).await else {
|
||||||
println!("1");
|
println!("1");
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
let Ok(qns_address): Result<EthAddress, _> = QNS_SEPOLIA_ADDRESS.parse() else {
|
let Ok(qns_address): Result<EthAddress, _> = _QNS_SEPOLIA_ADDRESS.parse() else {
|
||||||
println!("2");
|
println!("2");
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -646,7 +646,7 @@ async fn networking_info_valid(rpc_url: String, ip: String, ws_port: u16, our: &
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let current_ip = match ip_to_number(&ip) {
|
let current_ip = match _ip_to_number(&ip) {
|
||||||
Ok(ip_num) => ip_num,
|
Ok(ip_num) => ip_num,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("5");
|
println!("5");
|
||||||
@ -654,7 +654,7 @@ async fn networking_info_valid(rpc_url: String, ip: String, ws_port: u16, our: &
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(networking_key_bytes) = hex_string_to_u8_array(&our.networking_key) else {
|
let Ok(networking_key_bytes) = _hex_string_to_u8_array(&our.networking_key) else {
|
||||||
println!("6");
|
println!("6");
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::kernel::process::wit;
|
use crate::kernel::process::wit;
|
||||||
use clap::Parser;
|
|
||||||
use ring::signature;
|
use ring::signature;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
Loading…
Reference in New Issue
Block a user