Просмотр исходного кода

bin/darkirc, bin/tau: use default ports, and remove bin/genev

dasman 1 месяц назад
Родитель
Сommit
04803b7df0

+ 0 - 38
Cargo.lock

@@ -3401,44 +3401,6 @@ dependencies = [
  "zeroize",
  "zeroize",
 ]
 ]
 
 
-[[package]]
-name = "genev"
-version = "0.5.0"
-dependencies = [
- "clap 4.6.1",
- "darkfi",
- "darkfi-serial",
- "genevd",
- "smol",
- "tinyjson",
- "tracing",
- "tracing-subscriber",
- "url",
-]
-
-[[package]]
-name = "genevd"
-version = "0.5.0"
-dependencies = [
- "async-trait",
- "blake3",
- "darkfi",
- "darkfi-serial",
- "easy-parallel",
- "serde",
- "signal-hook",
- "signal-hook-async-std",
- "sled-overlay",
- "smol",
- "structopt",
- "structopt-toml",
- "tinyjson",
- "tracing",
- "tracing-appender",
- "tracing-subscriber",
- "url",
-]
-
 [[package]]
 [[package]]
 name = "getifaddrs"
 name = "getifaddrs"
 version = "0.6.2"
 version = "0.6.2"

+ 0 - 2
Cargo.toml

@@ -21,8 +21,6 @@ members = [
     "bin/drk",
     "bin/drk",
     "bin/fud/fu",
     "bin/fud/fu",
     "bin/fud/fud",
     "bin/fud/fud",
-    "bin/genev/genevd",
-    "bin/genev/genev-cli",
     "bin/darkirc",
     "bin/darkirc",
     "bin/tau/taud",
     "bin/tau/taud",
     "bin/vanityaddr",
     "bin/vanityaddr",

+ 19 - 19
bin/darkirc/darkirc_config.toml

@@ -54,7 +54,7 @@ autojoin = [
 ## JSON-RPC settings
 ## JSON-RPC settings
 [rpc]
 [rpc]
 ## JSON-RPC listen URL
 ## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:26660"
+rpc_listen = "tcp://127.0.0.1:9605"
 
 
 ## Disabled RPC methods
 ## Disabled RPC methods
 rpc_disabled_methods = ["p2p.get_info"]
 rpc_disabled_methods = ["p2p.get_info"]
@@ -108,53 +108,53 @@ active_profiles = ["tor"]
 
 
 [net.profiles."tcp+tls"]
 [net.profiles."tcp+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
-seeds = ["tcp+tls://lilith0.dark.fi:25551", "tcp+tls://lilith1.dark.fi:25551"]
+seeds = ["tcp+tls://lilith0.dark.fi:9600", "tcp+tls://lilith1.dark.fi:9600"]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp+tls://0.0.0.0:26661", "tcp+tls://[::]:26661"]
+#inbound = ["tcp+tls://0.0.0.0:9600", "tcp+tls://[::]:9600"]
 
 
 ## Addresses we want to advertise to peers (optional)
 ## Addresses we want to advertise to peers (optional)
 ## These should be reachable externally
 ## These should be reachable externally
-#external_addrs = ["tcp+tls://my.resolveable.address:26661"]
+#external_addrs = ["tcp+tls://my.resolveable.address:9600"]
 
 
 [net.profiles."tor"]
 [net.profiles."tor"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:25552",
-    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:25552",
+    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:9600",
+    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:9600",
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tor://127.0.0.1:26661"]
+#inbound = ["tor://127.0.0.1:9601"]
 
 
 [net.profiles."i2p"]
 [net.profiles."i2p"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
     ##TODO: replace with an official seed address
     ##TODO: replace with an official seed address
-    "i2p://6l2rdfriixo2nh5pr5bt555lyz56qox2ikzia4kuzm4okje7gtmq.b32.i2p:5262"
+    "i2p://6l2rdfriixo2nh5pr5bt555lyz56qox2ikzia4kuzm4okje7gtmq.b32.i2p:9600"
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp://127.0.0.1:25551"]
+#inbound = ["tcp://127.0.0.1:9601"]
 
 
 ## Addresses we want to advertise to peers (optional)
 ## Addresses we want to advertise to peers (optional)
 ## These should be reachable externally
 ## These should be reachable externally
-#external_addrs = ["i2p://youraddress.b32.i2p:25551"]
+#external_addrs = ["i2p://youraddress.b32.i2p:9601"]
 
 
 [net.profiles."socks5"]
 [net.profiles."socks5"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "socks5://127.0.0.1:9050/g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:25552",
-    "socks5://127.0.0.1:9050/yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:25552",
+    "socks5://127.0.0.1:9050/g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:9600",
+    "socks5://127.0.0.1:9050/yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:9600",
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -163,8 +163,8 @@ seeds = [
 [net.profiles."socks5+tls"]
 [net.profiles."socks5+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    #"socks5+tls://127.0.0.1:9050/lilith0.dark.fi:25551",
-    #"socks5+tls://127.0.0.1:1080/lilith1.dark.fi:25551"
+    #"socks5+tls://127.0.0.1:9050/lilith0.dark.fi:9600",
+    #"socks5+tls://127.0.0.1:1080/lilith1.dark.fi:9600"
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -173,8 +173,8 @@ seeds = [
 [net.profiles."tor+tls"]
 [net.profiles."tor+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "tor+tls://lilith0.dark.fi:25551",
-    "tor+tls://lilith1.dark.fi:25551"
+    "tor+tls://lilith0.dark.fi:9600",
+    "tor+tls://lilith1.dark.fi:9600"
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -182,16 +182,16 @@ seeds = [
 
 
 [net.profiles."tcp"]
 [net.profiles."tcp"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
-#seeds = ["tcp://127.0.0.1:25551"]
+#seeds = ["tcp://127.0.0.1:9600"]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp://127.0.0.1:26661"]
+#inbound = ["tcp://127.0.0.1:9600"]
 
 
 ## Addresses we want to advertise to peers
 ## Addresses we want to advertise to peers
-#external_addrs = ["tcp://127.0.0.1:26661"]
+#external_addrs = ["tcp://127.0.0.1:9600"]
 
 
 ## ====================
 ## ====================
 ## IRC channel settings
 ## IRC channel settings

+ 0 - 25
bin/genev/genev-cli/Cargo.toml

@@ -1,25 +0,0 @@
-[package]
-name = "genev"
-description = "Generic Event example CLI"
-version = "0.5.0"
-edition = "2021"
-authors = ["Dyne.org foundation <foundation@dyne.org>"]
-license = "AGPL-3.0-only"
-homepage = "https://dark.fi"
-repository = "https://codeberg.org/darkrenaissance/darkfi"
-
-[dependencies]
-genevd = {path = "../genevd"}
-
-darkfi = {path = "../../../", features = ["event-graph", "rpc", "bs58"]}
-darkfi-serial = {path = "../../../src/serial"}
-
-smol = "2.0.2"
-clap = {version = "4.4.11", features = ["derive"]}
-tracing = "0.1.44"
-tracing-subscriber = { version = "0.3.23", default-features = false, features = ["fmt"] }
-tinyjson = "2.5.1"
-url = "2.5.8"
-
-[lints]
-workspace = true

+ 0 - 41
bin/genev/genev-cli/Makefile

@@ -1,41 +0,0 @@
-.POSIX:
-
-# Install prefix
-PREFIX = $(HOME)/.cargo
-
-# Cargo binary
-CARGO = cargo
-
-# Compile target
-RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
-# Uncomment when doing musl static builds
-#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
-
-SRC = \
-	Cargo.toml \
-	../../../Cargo.toml \
-	$(shell find src -type f -name '*.rs') \
-	$(shell find ../../../src -type f -name '*.rs') \
-
-BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
-
-all: $(BIN)
-
-$(BIN): $(SRC)
-	RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
-	cp -f ../../../target/$(RUST_TARGET)/release/$@ $@
-	cp -f ../../../target/$(RUST_TARGET)/release/$@ ../../../$@
-
-clean:
-	RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
-	rm -f $(BIN) ../../../$(BIN)
-
-install: all
-	mkdir -p $(DESTDIR)$(PREFIX)/bin
-	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
-	chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
-
-uninstall:
-	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
-
-.PHONY: all clean install uninstall

+ 0 - 94
bin/genev/genev-cli/src/main.rs

@@ -1,94 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2026 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-use std::sync::Arc;
-
-use clap::{Parser, Subcommand};
-use darkfi::{rpc::client::RpcClient, util::logger::setup_logging, Result};
-use smol::Executor;
-use url::Url;
-
-use genevd::GenEvent;
-
-mod rpc;
-use rpc::Gen;
-
-#[derive(Parser)]
-#[clap(name = "genev", version)]
-struct Args {
-    #[arg(short, action = clap::ArgAction::Count)]
-    /// Increase verbosity (-vvv supported)
-    verbose: u8,
-
-    #[clap(short, long, default_value = "tcp://127.0.0.1:28880")]
-    /// JSON-RPC endpoint
-    endpoint: Url,
-
-    #[clap(subcommand)]
-    command: Option<SubCmd>,
-}
-
-#[derive(Subcommand)]
-enum SubCmd {
-    Add { values: Vec<String> },
-
-    List,
-}
-
-fn main() -> Result<()> {
-    let args = Args::parse();
-
-    setup_logging(args.verbose, None)?;
-
-    let executor = Arc::new(Executor::new());
-
-    smol::block_on(executor.run(async {
-        let rpc_client = RpcClient::new(args.endpoint, executor.clone()).await?;
-        let gen = Gen { rpc_client };
-
-        match args.command {
-            Some(subcmd) => match subcmd {
-                SubCmd::Add { values } => {
-                    let event = GenEvent {
-                        nick: values[0].clone(),
-                        title: values[1].clone(),
-                        text: values[2..].join(" "),
-                    };
-
-                    return gen.add(event).await
-                }
-
-                SubCmd::List => {
-                    let events = gen.list().await?;
-                    for event in events {
-                        println!("=============================");
-                        println!(
-                            "- nickname: {}, title: {}, text: {}",
-                            event.nick, event.title, event.text
-                        );
-                    }
-                }
-            },
-            None => println!("none"),
-        }
-
-        gen.close_connection().await;
-
-        Ok(())
-    }))
-}

+ 0 - 61
bin/genev/genev-cli/src/rpc.rs

@@ -1,61 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2026 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-use darkfi::{
-    rpc::{client::RpcClient, jsonrpc::JsonRequest},
-    util::encoding::base64,
-    Result,
-};
-use darkfi_serial::{deserialize, serialize};
-use genevd::GenEvent;
-use tinyjson::JsonValue;
-use tracing::debug;
-
-pub struct Gen {
-    pub rpc_client: RpcClient,
-}
-
-impl Gen {
-    pub async fn close_connection(&self) {
-        self.rpc_client.stop().await;
-    }
-
-    /// Add a new task.
-    pub async fn add(&self, event: GenEvent) -> Result<()> {
-        let event = JsonValue::String(base64::encode(&serialize(&event)));
-
-        let req = JsonRequest::new("add", JsonValue::Array([event].to_vec()));
-        let rep = self.rpc_client.request(req).await?;
-
-        debug!("Got reply: {rep:?}");
-        Ok(())
-    }
-
-    /// Get current open tasks ids.
-    pub async fn list(&self) -> Result<Vec<GenEvent>> {
-        let req = JsonRequest::new("list", JsonValue::Array([].to_vec()));
-        let rep = self.rpc_client.request(req).await?;
-
-        debug!("reply: {rep:?}");
-
-        let bytes: Vec<u8> = base64::decode(rep.get::<String>().unwrap()).unwrap();
-        let events: Vec<GenEvent> = deserialize(&bytes)?;
-
-        Ok(events)
-    }
-}

+ 0 - 53
bin/genev/genevd/Cargo.toml

@@ -1,53 +0,0 @@
-[package]
-name = "genevd"
-description = "Generic Event example daemon"
-version = "0.5.0"
-edition = "2021"
-authors = ["Dyne.org foundation <foundation@dyne.org>"]
-license = "AGPL-3.0-only"
-homepage = "https://dark.fi"
-repository = "https://codeberg.org/darkrenaissance/darkfi"
-
-[lib]
-name = "genevd"
-path = "src/lib.rs"
-
-[[bin]]
-name = "genevd"
-path = "src/main.rs"
-
-[dependencies]
-darkfi = { path = "../../../", features = [
-    "async-daemonize",
-    "event-graph",
-    "rpc",
-] }
-darkfi-serial = {path = "../../../src/serial"}
-
-# Crypto
-blake3 = "1.8.5"
-
-# Event Graph DB
-sled-overlay = "0.1.20"
-
-# Misc
-async-trait = "0.1.89"
-tracing = "0.1.44"
-tinyjson = "2.5.1"
-url = "2.5.8"
-
-# Daemon
-easy-parallel = "3.3.1"
-signal-hook-async-std = "0.4.0"
-signal-hook = "0.4.4"
-tracing-subscriber = { version = "0.3.23", default-features = false, features = ["fmt"] }
-tracing-appender = "0.2.5"
-smol = "2.0.2"
-
-# Argument parsing
-serde = { version = "1.0.228", features = ["derive"] }
-structopt = "0.3.26"
-structopt-toml = "0.5.1"
-
-[lints]
-workspace = true

+ 0 - 41
bin/genev/genevd/Makefile

@@ -1,41 +0,0 @@
-.POSIX:
-
-# Install prefix
-PREFIX = $(HOME)/.cargo
-
-# Cargo binary
-CARGO = cargo
-
-# Compile target
-RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
-# Uncomment when doing musl static builds
-#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
-
-SRC = \
-	Cargo.toml \
-	../../../Cargo.toml \
-	$(shell find src -type f -name '*.rs') \
-	$(shell find ../../../src -type f -name '*.rs') \
-
-BIN = $(shell grep '^name = ' Cargo.toml | sed 1q | cut -d' ' -f3 | tr -d '"')
-
-all: $(BIN)
-
-$(BIN): $(SRC)
-	RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
-	cp -f ../../../target/$(RUST_TARGET)/release/$@ $@
-	cp -f ../../../target/$(RUST_TARGET)/release/$@ ../../../$@
-
-clean:
-	RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
-	rm -f $(BIN) ../../../$(BIN)
-
-install: all
-	mkdir -p $(DESTDIR)$(PREFIX)/bin
-	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
-	chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
-
-uninstall:
-	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
-
-.PHONY: all clean install uninstall

+ 0 - 41
bin/genev/genevd/genev_config.toml

@@ -1,41 +0,0 @@
-## Current display name
-#nickname="NICKNAME"
-
-## Sets Datastore Path
-#datastore = "~/.local/share/darkfi/genev_db"
-
-## Sets DB logs replay datastore path
-#replay_datastore = "~/.local/share/darkfi/replayed_darkirc_db"
-
-## Run in replay mode to store Sled DB instructions
-## (for eventgraph debugging tool)
-#replay_mode = false
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28880"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-outbound_connections = 8
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp+tls"]
-
-[net.profiles."tcp+tls"]
-## P2P accept addresses
-#inbound = ["tcp+tls://127.0.0.1:28881"]
-
-## P2P external addresses
-#external_addr = ["tcp+tls://127.0.0.1:28881"]
-
-## Peers to connect to
-#peers = ["tcp+tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-#seeds = []

+ 0 - 26
bin/genev/genevd/src/lib.rs

@@ -1,26 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2026 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
-
-#[derive(SerialEncodable, SerialDecodable, Clone, Debug)]
-pub struct GenEvent {
-    pub nick: String,
-    pub title: String,
-    pub text: String,
-}

+ 0 - 305
bin/genev/genevd/src/main.rs

@@ -1,305 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2026 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-use std::sync::{Arc, OnceLock};
-
-use darkfi::{
-    async_daemonize, cli_desc,
-    event_graph::{proto::ProtocolEventGraph, EventGraph, EventGraphPtr, NULL_ID},
-    net::{session::SESSION_DEFAULT, settings::SettingsOpt, P2p},
-    rpc::{
-        jsonrpc::JsonSubscriber,
-        server::{listen_and_serve, RequestHandler},
-        settings::RpcSettingsOpt,
-    },
-    system::{sleep, StoppableTask},
-    util::path::expand_path,
-    Error, Result,
-};
-use sled_overlay::sled;
-use smol::{fs, lock::RwLock, stream::StreamExt};
-use structopt_toml::{serde::Deserialize, structopt::StructOpt, StructOptToml};
-use tracing::{debug, error, info};
-
-mod rpc;
-use rpc::JsonRpcInterface;
-
-const CONFIG_FILE: &str = "genev_config.toml";
-const CONFIG_FILE_CONTENTS: &str = include_str!("../genev_config.toml");
-
-#[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
-#[serde(default)]
-#[structopt(name = "genev", about = cli_desc!())]
-struct Args {
-    #[structopt(short, long)]
-    /// Configuration file to use
-    config: Option<String>,
-
-    #[structopt(flatten)]
-    /// JSON-RPC settings
-    rpc: RpcSettingsOpt,
-
-    #[structopt(flatten)]
-    /// P2P network settings
-    net: SettingsOpt,
-
-    #[structopt(long, default_value = "~/.local/share/darkfi/genev_db")]
-    /// Sets Datastore Path
-    datastore: String,
-
-    #[structopt(short, long, default_value = "~/.local/share/darkfi/replayed_genev_db")]
-    /// Replay logs (DB) path
-    replay_datastore: String,
-
-    #[structopt(long)]
-    /// Flag to store Sled DB instructions
-    replay_mode: bool,
-
-    #[structopt(short, long)]
-    /// Set log file to ouput into
-    log: Option<String>,
-
-    #[structopt(long)]
-    /// Flag to skip syncing the DAG (no history)
-    skip_dag_sync: bool,
-
-    #[structopt(long)]
-    // Whether to sync headers only or full sync
-    pub fast_mode: bool,
-
-    #[structopt(short, parse(from_occurrences))]
-    /// Increase verbosity (-vvv supported)
-    verbose: u8,
-}
-
-async fn start_sync_loop(
-    event_graph: EventGraphPtr,
-    last_sent: RwLock<blake3::Hash>,
-    seen: OnceLock<sled::Tree>,
-) -> Result<()> {
-    let incoming = event_graph.event_pub.clone().subscribe().await;
-    let seen_events = seen.get().unwrap();
-    loop {
-        let event = incoming.receive().await;
-        let event_id = event.header.id();
-        if *last_sent.read().await == event_id {
-            continue
-        }
-
-        if seen_events.contains_key(event_id.as_bytes()).unwrap() {
-            continue
-        }
-
-        debug!("new event: {event:?}");
-    }
-}
-
-async_daemonize!(realmain);
-async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Result<()> {
-    ////////////////////
-    // Initialize the base structures
-    ////////////////////
-    info!("Instantiating event DAG");
-    // Create datastore path if not there already.
-    let datastore_path = expand_path(&settings.datastore)?;
-    fs::create_dir_all(&datastore_path).await?;
-
-    let replay_datastore = expand_path(&settings.replay_datastore)?;
-    let replay_mode = settings.replay_mode;
-    let fast_mode = settings.fast_mode;
-
-    let sled_db = sled::open(datastore_path.clone())?;
-    let p2p_settings: darkfi::net::Settings =
-        (env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), settings.net).try_into()?;
-    let p2p = P2p::new(p2p_settings, executor.clone()).await?;
-    let event_graph = EventGraph::new(
-        p2p.clone(),
-        sled_db.clone(),
-        replay_datastore,
-        replay_mode,
-        fast_mode,
-        1,
-        executor.clone(),
-    )
-    .await?;
-
-    info!("Registering EventGraph P2P protocol");
-    let event_graph_ = Arc::clone(&event_graph);
-    let registry = p2p.protocol_registry();
-    registry
-        .register(SESSION_DEFAULT, move |channel, _| {
-            let event_graph_ = event_graph_.clone();
-            async move { ProtocolEventGraph::init(event_graph_, channel).await.unwrap() }
-        })
-        .await;
-
-    // Run
-    info!(target: "genevd", "Starting P2P network");
-    p2p.clone().start().await?;
-
-    info!(target: "genevd", "Waiting for some P2P connections...");
-    sleep(5).await;
-
-    match event_graph.static_sync().await {
-        Ok(()) => {
-            info!("static synced successfully")
-        }
-        Err(e) => {
-            error!("failed syncing static graph: {e}");
-            p2p.stop().await;
-            return Err(Error::DagSyncFailed)
-        }
-    }
-
-    // We'll attempt to sync 5 times
-    if !settings.skip_dag_sync {
-        for i in 1..=6 {
-            info!("Syncing event DAG (attempt #{i})");
-            match event_graph.sync_selected(1, settings.fast_mode).await {
-                Ok(()) => break,
-                Err(e) => {
-                    if i == 6 {
-                        error!("Failed syncing DAG. Exiting.");
-                        p2p.stop().await;
-                        return Err(Error::DagSyncFailed)
-                    } else {
-                        // TODO: Maybe at this point we should prune or something?
-                        // TODO: Or maybe just tell the user to delete the DAG from FS.
-                        error!("Failed syncing DAG ({e}), retrying in 10s...");
-                        sleep(10).await;
-                    }
-                }
-            }
-        }
-    } else {
-        *event_graph.synced.write().await = true;
-    }
-
-    ////////////////////
-    // Listner
-    ////////////////////
-    let last_sent = RwLock::new(NULL_ID);
-    let seen = OnceLock::new();
-    seen.set(sled_db.open_tree("genevdb").unwrap()).unwrap();
-
-    info!(target: "genevd", "Starting sync loop task");
-    let sync_loop_task = StoppableTask::new();
-    sync_loop_task.clone().start(
-        start_sync_loop(event_graph.clone(), last_sent, seen.clone()),
-        |res| async {
-            match res {
-                Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => error!(target: "genevd", "Failed starting sync loop task: {e}"),
-            }
-        },
-        Error::DetachedTaskStopped,
-        executor.clone(),
-    );
-
-    info!("Starting dnet subs task");
-    let dnet_sub = JsonSubscriber::new("dnet.subscribe_events");
-    let dnet_sub_ = dnet_sub.clone();
-    let p2p_ = p2p.clone();
-    let dnet_task = StoppableTask::new();
-    dnet_task.clone().start(
-        async move {
-            let dnet_sub = p2p_.dnet_subscribe().await;
-            loop {
-                let event = dnet_sub.receive().await;
-                debug!("Got dnet event: {event:?}");
-                dnet_sub_.notify(vec![event.into()].into()).await;
-            }
-        },
-        |res| async {
-            match res {
-                Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => panic!("{e}"),
-            }
-        },
-        Error::DetachedTaskStopped,
-        executor.clone(),
-    );
-
-    info!("Starting deg subs task");
-    let deg_sub = JsonSubscriber::new("deg.subscribe_events");
-    let deg_sub_ = deg_sub.clone();
-    let event_graph_ = event_graph.clone();
-    let deg_task = StoppableTask::new();
-    deg_task.clone().start(
-        async move {
-            let deg_sub = event_graph_.deg_subscribe().await;
-            loop {
-                let event = deg_sub.receive().await;
-                debug!("Got deg event: {event:?}");
-                deg_sub_.notify(vec![event.into()].into()).await;
-            }
-        },
-        |res| async {
-            match res {
-                Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
-                Err(e) => panic!("{e}"),
-            }
-        },
-        Error::DetachedTaskStopped,
-        executor.clone(),
-    );
-
-    //
-    // RPC interface
-    //
-    let rpc_interface = Arc::new(JsonRpcInterface::new(
-        "Alolymous".to_string(),
-        event_graph.clone(),
-        p2p.clone(),
-        dnet_sub,
-        deg_sub,
-    ));
-    let rpc_task = StoppableTask::new();
-    let rpc_interface_ = rpc_interface.clone();
-    rpc_task.clone().start(
-        listen_and_serve(settings.rpc.into(), rpc_interface, None, executor.clone()),
-        |res| async move {
-            match res {
-                Ok(()) | Err(Error::RpcServerStopped) => rpc_interface_.stop_connections().await,
-                Err(e) => error!(target: "genevd", "Failed starting JSON-RPC server: {e}"),
-            }
-        },
-        Error::RpcServerStopped,
-        executor.clone(),
-    );
-
-    // Signal handling for graceful termination.
-    let (signals_handler, signals_task) = SignalHandler::new(executor)?;
-    signals_handler.wait_termination(signals_task).await?;
-    info!("Caught termination signal, cleaning up and exiting...");
-
-    info!(target: "genevd", "Stopping JSON-RPC server...");
-    rpc_task.stop().await;
-
-    info!(target: "genevd", "Stopping Debugging tasks...");
-    dnet_task.stop().await;
-    deg_task.stop().await;
-
-    info!(target: "genevd", "Stopping sync loop task...");
-    sync_loop_task.stop().await;
-
-    // stop p2p
-    p2p.stop().await;
-
-    Ok(())
-}

+ 0 - 258
bin/genev/genevd/src/rpc.rs

@@ -1,258 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2026 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-use std::{collections::HashSet, slice};
-
-use async_trait::async_trait;
-use smol::lock::{Mutex, MutexGuard};
-use tinyjson::JsonValue;
-use tracing::{debug, error};
-
-use darkfi::{
-    event_graph::{proto::EventPut, Event, EventGraphPtr},
-    net,
-    rpc::{
-        jsonrpc::{ErrorCode, JsonError, JsonRequest, JsonResponse, JsonResult, JsonSubscriber},
-        p2p_method::HandlerP2p,
-        server::RequestHandler,
-    },
-    system::StoppableTaskPtr,
-    util::encoding::base64,
-};
-
-use darkfi_serial::{deserialize, deserialize_async_partial, serialize_async};
-use genevd::GenEvent;
-
-pub struct JsonRpcInterface {
-    _nickname: String,
-    event_graph: EventGraphPtr,
-    p2p: net::P2pPtr,
-    rpc_connections: Mutex<HashSet<StoppableTaskPtr>>,
-    dnet_sub: JsonSubscriber,
-    deg_sub: JsonSubscriber,
-}
-
-#[async_trait]
-impl RequestHandler<()> for JsonRpcInterface {
-    async fn handle_request(&self, req: JsonRequest) -> JsonResult {
-        match req.method.as_str() {
-            "add" => self.add(req.id, req.params).await,
-            "list" => self.list(req.id, req.params).await,
-
-            "ping" => self.pong(req.id, req.params).await,
-            "dnet.subscribe_events" => self.dnet_subscribe_events(req.id, req.params).await,
-            "dnet.switch" => self.dnet_switch(req.id, req.params).await,
-            "p2p.get_info" => self.p2p_get_info(req.id, req.params).await,
-
-            "deg.switch" => self.deg_switch(req.id, req.params).await,
-            "deg.subscribe_events" => self.deg_subscribe_events(req.id, req.params).await,
-
-            "eventgraph.get_info" => self.eg_get_info(req.id, req.params).await,
-
-            _ => return JsonError::new(ErrorCode::MethodNotFound, None, req.id).into(),
-        }
-    }
-
-    async fn connections_mut(&self) -> MutexGuard<'life0, HashSet<StoppableTaskPtr>> {
-        self.rpc_connections.lock().await
-    }
-}
-
-impl HandlerP2p for JsonRpcInterface {
-    fn p2p(&self) -> net::P2pPtr {
-        self.p2p.clone()
-    }
-}
-
-impl JsonRpcInterface {
-    pub fn new(
-        _nickname: String,
-        event_graph: EventGraphPtr,
-        p2p: net::P2pPtr,
-        dnet_sub: JsonSubscriber,
-        deg_sub: JsonSubscriber,
-    ) -> Self {
-        Self {
-            _nickname,
-            event_graph,
-            p2p,
-            rpc_connections: Mutex::new(HashSet::new()),
-            dnet_sub,
-            deg_sub,
-        }
-    }
-
-    // RPCAPI:
-    // Initializes a subscription to p2p dnet events.
-    // Once a subscription is established, `darkirc` will send JSON-RPC notifications of
-    // new network events to the subscriber.
-    //
-    // --> {"jsonrpc": "2.0", "method": "dnet.subscribe_events", "params": [], "id": 1}
-    // <-- {"jsonrpc": "2.0", "method": "dnet.subscribe_events", "params": [`event`]}
-    pub async fn dnet_subscribe_events(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params = params.get::<Vec<JsonValue>>().unwrap();
-        if !params.is_empty() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        self.dnet_sub.clone().into()
-    }
-
-    // RPCAPI:
-    // Activate or deactivate dnet in the P2P stack.
-    // By sending `true`, dnet will be activated, and by sending `false` dnet
-    // will be deactivated. Returns `true` on success.
-    //
-    // --> {"jsonrpc": "2.0", "method": "dnet_switch", "params": [true], "id": 42}
-    // <-- {"jsonrpc": "2.0", "result": true, "id": 42}
-    async fn dnet_switch(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params = params.get::<Vec<JsonValue>>().unwrap();
-        if params.len() != 1 || !params[0].is_bool() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        let switch = params[0].get::<bool>().unwrap();
-
-        if *switch {
-            self.p2p.dnet_enable();
-        } else {
-            self.p2p.dnet_disable();
-        }
-
-        JsonResponse::new(JsonValue::Boolean(true), id).into()
-    }
-
-    // RPCAPI:
-    // Initializes a subscription to deg events.
-    // Once a subscription is established, apps using eventgraph will send JSON-RPC notifications of
-    // new eventgraph events to the subscriber.
-    //
-    // --> {"jsonrpc": "2.0", "method": "deg.subscribe_events", "params": [], "id": 1}
-    // <-- {"jsonrpc": "2.0", "method": "deg.subscribe_events", "params": [`event`]}
-    pub async fn deg_subscribe_events(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params = params.get::<Vec<JsonValue>>().unwrap();
-        if !params.is_empty() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        self.deg_sub.clone().into()
-    }
-
-    // RPCAPI:
-    // Activate or deactivate deg in the EVENTGRAPH.
-    // By sending `true`, deg will be activated, and by sending `false` deg
-    // will be deactivated. Returns `true` on success.
-    //
-    // --> {"jsonrpc": "2.0", "method": "deg.switch", "params": [true], "id": 42}
-    // <-- {"jsonrpc": "2.0", "result": true, "id": 42}
-    async fn deg_switch(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params = params.get::<Vec<JsonValue>>().unwrap();
-        if params.len() != 1 || !params[0].is_bool() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        let switch = params[0].get::<bool>().unwrap();
-
-        if *switch {
-            self.event_graph.deg_enable().await;
-        } else {
-            self.event_graph.deg_disable().await;
-        }
-
-        JsonResponse::new(JsonValue::Boolean(true), id).into()
-    }
-
-    // RPCAPI:
-    // Get EVENTGRAPH info.
-    //
-    // --> {"jsonrpc": "2.0", "method": "deg.switch", "params": [true], "id": 42}
-    // <-- {"jsonrpc": "2.0", "result": true, "id": 42}
-    async fn eg_get_info(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params_ = params.get::<Vec<JsonValue>>().unwrap();
-        if !params_.is_empty() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        self.event_graph.eventgraph_info(id, params).await
-    }
-
-    // RPCAPI:
-    // Add a new event
-    // --> {"jsonrpc": "2.0", "method": "add", "params": [], "id": 1}
-    // <-- {"jsonrpc": "2.0", "result": [nickname, ...], "id": 1}
-    async fn add(&self, id: i64, params: JsonValue) -> JsonResult {
-        let params = params.get::<Vec<JsonValue>>().unwrap();
-        if params.len() != 1 || !params[0].is_string() {
-            return JsonError::new(ErrorCode::InvalidParams, None, id).into()
-        }
-
-        let b64 = params[0].get::<String>().unwrap();
-        let dec = base64::decode(b64).unwrap();
-        let genevent: GenEvent = deserialize(&dec).unwrap();
-
-        // Build a DAG event and return it.
-        let event = Event::new(serialize_async(&genevent).await, &self.event_graph).await;
-
-        let current_genesis = self.event_graph.current_genesis.read().await;
-        let dag_name = current_genesis.header.timestamp.to_string();
-        if let Err(e) =
-            self.event_graph.header_dag_insert(vec![event.header.clone()], &dag_name).await
-        {
-            error!("Failed inserting new header to Header DAG: {}", e);
-        }
-        if let Err(e) = self.event_graph.dag_insert(slice::from_ref(&event), &dag_name).await {
-            error!("Failed inserting new event to DAG: {e}");
-        } else {
-            // Otherwise, broadcast it
-            self.p2p.broadcast(&EventPut(event, vec![])).await;
-        }
-
-        let json = JsonValue::Boolean(true);
-        JsonResponse::new(json, id).into()
-    }
-
-    // RPCAPI:
-    // List events
-    // --> {"jsonrpc": "2.0", "method": "list", "params": [], "id": 1}
-    // <-- {"jsonrpc": "2.0", "result": [task_id, ...], "id": 1}
-    async fn list(&self, id: i64, _params: JsonValue) -> JsonResult {
-        debug!("Fetching all events");
-        let mut seen_events = vec![];
-        let dag_events = self.event_graph.order_events().await;
-
-        for event in dag_events.iter() {
-            let event_id = event.header.id();
-            // Try to deserialize it. (Here we skip errors)
-            let genevent: GenEvent = match deserialize_async_partial(event.content()).await {
-                Ok((v, _)) => v,
-                Err(e) => {
-                    error!("Failed deserializing incoming event: {e}");
-                    continue
-                }
-            };
-
-            debug!("Marking event {event_id} as seen");
-            seen_events.push(genevent);
-        }
-
-        let ser = darkfi_serial::serialize(&seen_events);
-        let enc = JsonValue::String(base64::encode(&ser));
-
-        JsonResponse::new(enc, id).into()
-    }
-}

+ 0 - 37
bin/genev/script/genevd_a.toml

@@ -1,37 +0,0 @@
-## Sets Datastore Path
-datastore = "/tmp/genev_test/datastore/node1"
-
-## Current display name
-#nickname="NICKNAME"
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28870"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-outbound_connections = 4
-
-## Inbound connection slots
-inbound_connections = 4
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp"]
-
-[net.profiles."tcp"]
-## P2P accept addresses
-inbound = ["tcp://127.0.0.1:28882"]
-
-## P2P external addresses
-external_addrs = ["tcp://127.0.0.1:28882"]
-
-## Peers to connect to
-#peers = ["tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-seeds = ["tcp://127.0.0.1:28881"]

+ 0 - 37
bin/genev/script/genevd_b.toml

@@ -1,37 +0,0 @@
-## Sets Datastore Path
-datastore = "/tmp/genev_test/datastore/node2"
-
-## Current display name
-#nickname="NICKNAME"
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28871"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-outbound_connections = 4
-
-## Inbound connection slots
-inbound_connections = 4
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp"]
-
-[net.profiles."tcp"]
-## P2P accept addresses
-inbound = ["tcp://127.0.0.1:28883"]
-
-## P2P external addresses
-external_addrs = ["tcp://127.0.0.1:28883"]
-
-## Peers to connect to
-#peers = ["tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-seeds = ["tcp://127.0.0.1:28881"]

+ 0 - 37
bin/genev/script/genevd_c.toml

@@ -1,37 +0,0 @@
-## Sets Datastore Path
-datastore = "/tmp/genev_test/datastore/node3"
-
-## Current display name
-#nickname="NICKNAME"
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28872"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-outbound_connections = 4
-
-## Inbound connection slots
-# inbound_connections = 4
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp"]
-
-[net.profiles."tcp"]
-## P2P accept addresses
-inbound = ["tcp://127.0.0.1:28884"]
-
-## P2P external addresses
-external_addrs = ["tcp://127.0.0.1:28884"]
-
-## Peers to connect to
-#peers = ["tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-seeds = ["tcp://127.0.0.1:28881"]

+ 0 - 37
bin/genev/script/genevd_d.toml

@@ -1,37 +0,0 @@
-## Sets Datastore Path
-datastore = "/tmp/genev_test/datastore/node4"
-
-## Current display name
-#nickname="NICKNAME"
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28873"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-outbound_connections = 4
-
-## Inbound connection slots
-# inbound_connections = 4
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp"]
-
-[net.profiles."tcp"]
-## P2P accept addresses
-inbound = ["tcp://127.0.0.1:28885"]
-
-## P2P external addresses
-external_addrs = ["tcp://127.0.0.1:28885"]
-
-## Peers to connect to
-#peers = ["tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-seeds = ["tcp://127.0.0.1:28881"]

+ 0 - 37
bin/genev/script/genevd_seed.toml

@@ -1,37 +0,0 @@
-## Sets Datastore Path
-datastore = "/tmp/genev_test/datastore/seed"
-
-## Current display name
-#nickname="NICKNAME"
-
-## JSON-RPC settings
-[rpc]
-## JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:28880"
-
-## Disabled RPC methods
-rpc_disabled_methods = ["p2p.get_info"]
-
-## net settings
-[net]
-## Connection slots
-# outbound_connections=8
-
-## Inbound connection slots
-inbound_connections = 4
-
-# Prefered transports for outbound connections
-active_profiles = ["tcp"]
-
-[net.profiles."tcp"]
-## P2P accept addresses
-inbound = ["tcp://127.0.0.1:28881"]
-
-## P2P external addresses
-# external_addr = ["tls://127.0.0.1:28881"]
-
-## Peers to connect to
-#peers = ["tls://127.0.0.1:28881"]
-
-## Seed nodes to connect to
-# seeds=["tls://lilith0.dark.fi:28881", "tls://lilith1.dark.fi:28881"]

+ 0 - 32
bin/genev/script/tmux_sessions.sh

@@ -1,32 +0,0 @@
-#!/bin/sh
-# Start a tmux session of 4 genev daemons, and 4 genev clis.
-set -e
-
-tmux new-session -s "genevd" -n "genevd" -d
-tmux send-keys "../../../genevd --localnet --config genevd_seed.toml --skip-dag-sync" Enter && sleep 1
-tmux split-window -h
-tmux send-keys "../../../genevd --localnet --config genevd_a.toml --skip-dag-sync" Enter && sleep 1
-tmux split-window -h
-tmux send-keys "../../../genevd --localnet --config genevd_b.toml --skip-dag-sync" Enter
-tmux select-pane -t 0
-tmux split-window -v
-tmux send-keys "../../../genevd --localnet --config genevd_c.toml" Enter
-tmux select-pane -t 2
-tmux split-window -v
-tmux send-keys "../../../genevd --localnet --config genevd_d.toml" Enter
-
-
-tmux new-window -t "genevd:1" -n "genev"
-sleep 5
-tmux send-keys "../../../genev -e tcp://127.0.0.1:28870 add alolymous \"pay bills\" \"gonna pay some bills in the morning\" " Enter
-tmux split-window -v
-sleep 1
-tmux send-keys "../../../genev -e tcp://127.0.0.1:28871 list" Enter
-tmux split-window -h
-tmux send-keys "../../../genev -e tcp://127.0.0.1:28872 list" Enter
-tmux select-pane -t 0
-tmux split-window -h
-tmux send-keys "../../../genev -e tcp://127.0.0.1:28873 list" Enter
-
-
-tmux attach

+ 2 - 2
bin/tau/taud/src/jsonrpc.rs

@@ -207,9 +207,9 @@ impl JsonRpcInterface {
         let switch = params[0].get::<bool>().unwrap();
         let switch = params[0].get::<bool>().unwrap();
 
 
         if *switch {
         if *switch {
-            self.event_graph.deg_enable().await;
+            self.event_graph.deg_enable();
         } else {
         } else {
-            self.event_graph.deg_disable().await;
+            self.event_graph.deg_disable();
         }
         }
 
 
         Ok(JsonValue::Boolean(true))
         Ok(JsonValue::Boolean(true))

+ 55 - 12
bin/tau/taud/src/main.rs

@@ -24,7 +24,7 @@ use std::{
     io::{stdin, Write},
     io::{stdin, Write},
     slice,
     slice,
     str::FromStr,
     str::FromStr,
-    sync::{Arc, OnceLock},
+    sync::{atomic::Ordering, Arc, OnceLock},
 };
 };
 
 
 use crypto_box::{
 use crypto_box::{
@@ -48,7 +48,7 @@ use darkfi::{
     async_daemonize,
     async_daemonize,
     event_graph::{
     event_graph::{
         proto::{EventPut, ProtocolEventGraph},
         proto::{EventPut, ProtocolEventGraph},
-        Event, EventGraph, EventGraphPtr,
+        Event, EventGraph, EventGraphConfig, EventGraphPtr,
     },
     },
     net::{session::SESSION_DEFAULT, P2p, P2pPtr},
     net::{session::SESSION_DEFAULT, P2p, P2pPtr},
     rpc::{
     rpc::{
@@ -65,6 +65,31 @@ use darkfi_sdk::crypto::{
     Keypair, PublicKey,
     Keypair, PublicKey,
 };
 };
 
 
+// =====================================================================
+// Taud consensus parameters.
+//
+// These define the EventGraph configuration that EVERY Taud node
+// in the network must agree on. Changing any of them is a hard fork.
+// They are passed verbatim to `EventGraph::new` at startup.
+// =====================================================================
+
+/// Epoch origin for DAG rotation (UTC midnight, 1 March 2025).
+/// Rotation boundaries are computed as offsets from this point.
+const TAUD_INITIAL_GENESIS: u64 = 1_740_787_200_000;
+
+/// DAG rotation period, in hours.
+const TAUD_HOURS_ROTATION: u64 = 0;
+
+/// Genesis payload. Two protocols MUST use distinct values; this
+/// also feeds into `RlnAppId::from_genesis` so RLN signals from one
+/// deployment never appear valid on another.
+const TAUD_GENESIS_CONTENTS: &[u8] = b"taud-v1";
+
+/// How many rotation periods to keep in the rolling DAG window.
+/// With `hours_rotation = 1` and `max_dags = 24`, this gives a
+/// 24-hour history window. Older events are evicted from sled.
+const TAUD_MAX_DAGS: usize = 1;
+
 mod jsonrpc;
 mod jsonrpc;
 mod settings;
 mod settings;
 
 
@@ -522,7 +547,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
 
 
     let replay_datastore = expand_path(&settings.replay_datastore)?;
     let replay_datastore = expand_path(&settings.replay_datastore)?;
     let replay_mode = settings.replay_mode;
     let replay_mode = settings.replay_mode;
-    let fast_mode = settings.fast_mode;
+    // let fast_mode = settings.fast_mode;
 
 
     info!(target: "taud", "Instantiating event DAG");
     info!(target: "taud", "Instantiating event DAG");
     let sled_db = sled::open(datastore)?;
     let sled_db = sled::open(datastore)?;
@@ -530,18 +555,36 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
     let p2p_settings: darkfi::net::Settings =
     let p2p_settings: darkfi::net::Settings =
         (env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), settings.net.clone()).try_into()?;
         (env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), settings.net.clone()).try_into()?;
     let comms_timeout = p2p_settings.outbound_connect_timeout_max();
     let comms_timeout = p2p_settings.outbound_connect_timeout_max();
-
-    let p2p = P2p::new(p2p_settings, executor.clone()).await?;
-    let event_graph = EventGraph::new(
+    let p2p = match P2p::new(p2p_settings, executor.clone()).await {
+        Ok(p2p) => p2p,
+        Err(e) => {
+            error!("Unable to create P2P network: {e}");
+            return Err(e);
+        }
+    };
+    // Consensus config. Every node must use exactly these values.
+    let eg_config = EventGraphConfig {
+        initial_genesis: TAUD_INITIAL_GENESIS,
+        hours_rotation: TAUD_HOURS_ROTATION,
+        genesis_contents: TAUD_GENESIS_CONTENTS.to_vec(),
+        max_dags: Some(TAUD_MAX_DAGS),
+    };
+    let event_graph = match EventGraph::new(
         p2p.clone(),
         p2p.clone(),
         sled_db.clone(),
         sled_db.clone(),
-        replay_datastore,
+        replay_datastore.clone(),
         replay_mode,
         replay_mode,
-        fast_mode,
-        0,
+        eg_config,
         executor.clone(),
         executor.clone(),
     )
     )
-    .await?;
+    .await
+    {
+        Ok(v) => v,
+        Err(e) => {
+            error!("Event graph failed to start: {e}");
+            return Err(e);
+        }
+    };
 
 
     info!(target: "taud", "Registering EventGraph P2P protocol");
     info!(target: "taud", "Registering EventGraph P2P protocol");
     let event_graph_ = Arc::clone(&event_graph);
     let event_graph_ = Arc::clone(&event_graph);
@@ -564,7 +607,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
             // We'll attempt to sync for ever
             // We'll attempt to sync for ever
             if !settings.skip_dag_sync {
             if !settings.skip_dag_sync {
                 info!(target: "taud", "Syncing event DAG");
                 info!(target: "taud", "Syncing event DAG");
-                match event_graph.sync_selected(1, settings.fast_mode).await {
+                match event_graph.sync_selected(1).await {
                     Ok(()) => break,
                     Ok(()) => break,
                     Err(e) => {
                     Err(e) => {
                         // TODO: Maybe at this point we should prune or something?
                         // TODO: Maybe at this point we should prune or something?
@@ -574,7 +617,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
                     }
                     }
                 }
                 }
             } else {
             } else {
-                *event_graph.synced.write().await = true;
+                event_graph.synced.store(true, Ordering::Release);
                 break
                 break
             }
             }
         } else {
         } else {

+ 20 - 20
bin/tau/taud/taud_config.toml

@@ -46,7 +46,7 @@ write_public_key = "7iHFdGxe1DYyBtPLVFb7fXL3Kk495WtwRWaNxhYQTU9x"
 # JSON-RPC settings
 # JSON-RPC settings
 [rpc]
 [rpc]
 # JSON-RPC listen URL
 # JSON-RPC listen URL
-rpc_listen = "tcp://127.0.0.1:23330"
+rpc_listen = "tcp://127.0.0.1:9805"
 
 
 # Disabled RPC methods
 # Disabled RPC methods
 rpc_disabled_methods = ["p2p.get_info"]
 rpc_disabled_methods = ["p2p.get_info"]
@@ -78,7 +78,7 @@ hostlist = "~/.local/share/darkfi/taud/hostlist.tsv"
 # format ["host", ["scheme", "scheme"], [port, port]].
 # format ["host", ["scheme", "scheme"], [port, port]].
 # If scheme is left empty it will default to "tcp+tls".
 # If scheme is left empty it will default to "tcp+tls".
 # If ports are left empty all ports from this peer will be blocked.
 # If ports are left empty all ports from this peer will be blocked.
-#blacklist = [["example.com", ["tcp"], [8551, 23331]]]
+#blacklist = [["example.com", ["tcp"], [8551, 9800]]]
 
 
 # Whitelisted transports for outbound connections
 # Whitelisted transports for outbound connections
 active_profiles = ["tor"]
 active_profiles = ["tor"]
@@ -101,32 +101,32 @@ active_profiles = ["tor"]
 [net.profiles."tcp+tls"]
 [net.profiles."tcp+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "tcp+tls://lilith0.dark.fi:23331",
-    "tcp+tls://lilith1.dark.fi:23331",
+    "tcp+tls://lilith0.dark.fi:9800",
+    "tcp+tls://lilith1.dark.fi:9800",
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp+tls://0.0.0.0:23331", "tcp+tls://[::]:23331"]
+#inbound = ["tcp+tls://0.0.0.0:9800", "tcp+tls://[::]:9800"]
 
 
 ## Addresses we want to advertise to peers (optional)
 ## Addresses we want to advertise to peers (optional)
 ## These should be reachable externally
 ## These should be reachable externally
-#external_addrs = ["tcp+tls://my.resolveable.address:23331"]
+#external_addrs = ["tcp+tls://my.resolveable.address:9800"]
 
 
 [net.profiles."tor"]
 [net.profiles."tor"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:23332",
-    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:23332",
+    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:9801",
+    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:9801",
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tor://127.0.0.1:23331"]
+#inbound = ["tor://127.0.0.1:9801"]
 
 
 [net.profiles."i2p"]
 [net.profiles."i2p"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
@@ -136,16 +136,16 @@ seeds = [
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp://127.0.0.1:23331"]
+#inbound = ["tcp://127.0.0.1:9801"]
 
 
 ## Addresses we want to advertise to peers
 ## Addresses we want to advertise to peers
-#external_addrs = ["i2p://youraddress.b32.i2p:23331"]
+#external_addrs = ["i2p://youraddress.b32.i2p:9801"]
 
 
 [net.profiles."socks5"]
 [net.profiles."socks5"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "socks5://127.0.0.1:9050/g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:23332",
-    "socks5://127.0.0.1:9050/yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:23332",
+    "socks5://127.0.0.1:9050/g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:9801",
+    "socks5://127.0.0.1:9050/yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:9801",
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -154,8 +154,8 @@ seeds = [
 [net.profiles."socks5+tls"]
 [net.profiles."socks5+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    #"socks5+tls://127.0.0.1:9050/lilith0.dark.fi:23331",
-    #"socks5+tls://127.0.0.1:1080/lilith1.dark.fi:23331"
+    #"socks5+tls://127.0.0.1:9050/lilith0.dark.fi:9801",
+    #"socks5+tls://127.0.0.1:1080/lilith1.dark.fi:9801"
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -164,8 +164,8 @@ seeds = [
 [net.profiles."tor+tls"]
 [net.profiles."tor+tls"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
 seeds = [
 seeds = [
-    "tor+tls://lilith0.dark.fi:23331",
-    "tor+tls://lilith1.dark.fi:23331"
+    "tor+tls://lilith0.dark.fi:9801",
+    "tor+tls://lilith1.dark.fi:9801"
 ]
 ]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
@@ -173,13 +173,13 @@ seeds = [
 
 
 [net.profiles."tcp"]
 [net.profiles."tcp"]
 ## Seed nodes to connect to
 ## Seed nodes to connect to
-#seeds = ["tcp://127.0.0.1:23332"]
+#seeds = ["tcp://127.0.0.1:9800"]
 
 
 ## Manual peers to connect to
 ## Manual peers to connect to
 #peers = []
 #peers = []
 
 
 ## P2P accept addresses
 ## P2P accept addresses
-#inbound = ["tcp://127.0.0.1:23331"]
+#inbound = ["tcp://127.0.0.1:9800"]
 
 
 ## Addresses we want to advertise to peers
 ## Addresses we want to advertise to peers
-#external_addrs = ["tcp://127.0.0.1:23331"]
+#external_addrs = ["tcp://127.0.0.1:9800"]

+ 5 - 5
doc/src/misc/darkirc/darkirc.md

@@ -207,7 +207,7 @@ You must specify an inbound accept address in your config file to configure a se
 
 
 ```toml
 ```toml
 ## P2P accept addresses
 ## P2P accept addresses
-inbound=["127.0.0.1:11001"]
+inbound=["127.0.0.1:9600"]
 ```
 ```
 
 
 Note that the above config doesn't specify an external address since
 Note that the above config doesn't specify an external address since
@@ -228,13 +228,13 @@ info:
 		
 		
 ```toml
 ```toml
 ## P2P accept addresses
 ## P2P accept addresses
-inbound=["127.0.0.1:11002"]
+inbound=["127.0.0.1:9600"]
 
 
 ## P2P external addresses
 ## P2P external addresses
-external_addr=["127.0.0.1:11002"]
+external_addr=["127.0.0.1:9600"]
 
 
 ## Seed nodes to connect to 
 ## Seed nodes to connect to 
-seeds=["127.0.0.1:11001"]
+seeds=["127.0.0.1:9601"]
 ```
 ```
 ### Outbound Node
 ### Outbound Node
 
 
@@ -249,7 +249,7 @@ In your config file:
 outbound_connections=8
 outbound_connections=8
 
 
 ## Seed nodes to connect to 
 ## Seed nodes to connect to 
-seeds=["127.0.0.1:11001"]
+seeds=["127.0.0.1:9601"]
 ```
 ```
 
 
 ### Attaching the IRC Frontend
 ### Attaching the IRC Frontend

+ 4 - 4
doc/src/misc/tau.md

@@ -163,7 +163,7 @@ connects to a seed node and runs `protocol_seed`, which requests a list of
 addresses from the seed node and disconnects straight after receiving them.
 addresses from the seed node and disconnects straight after receiving them.
 
 
     # P2P accept addresses
     # P2P accept addresses
-    inbound=["127.0.0.1:11001"] 
+    inbound=["127.0.0.1:9800"] 
 
 
 Note that the above config doesn't specify an external address since the
 Note that the above config doesn't specify an external address since the
 seed node shouldn't be advertised in the list of connectable nodes. The seed
 seed node shouldn't be advertised in the list of connectable nodes. The seed
@@ -178,13 +178,13 @@ making any outbound connections.
 The external addresses are important and must be correct.
 The external addresses are important and must be correct.
 
 
     # P2P accept addresses
     # P2P accept addresses
-    inbound=["127.0.0.1:11002"]
+    inbound=["127.0.0.1:9800"]
     
     
     # P2P external addresses
     # P2P external addresses
-    external_addr=["127.0.0.1:11002"]
+    external_addr=["127.0.0.1:9800"]
 
 
     # Seed nodes to connect to 
     # Seed nodes to connect to 
-    seeds=["127.0.0.1:11001"]
+    seeds=["127.0.0.1:9801"]
 
 
 ### Outbound Node
 ### Outbound Node
 
 

+ 9 - 5
src/event_graph/mod.rs

@@ -554,7 +554,9 @@ impl EventGraph {
         });
         });
 
 
         // Init genesis registration events
         // Init genesis registration events
-        self_.bootstrap_genesis_identities().await?;
+        if config.hours_rotation > 0 {
+            self_.bootstrap_genesis_identities().await?;
+        }
 
 
         if need_prune {
         if need_prune {
             info!(
             info!(
@@ -2266,8 +2268,8 @@ impl EventGraph {
         blob: &[u8],
         blob: &[u8],
         event_timestamp: u64,
         event_timestamp: u64,
     ) -> rln::StaticEventCheck {
     ) -> rln::StaticEventCheck {
-        use darkfi_sdk::{crypto::poseidon_hash, pasta::pallas};
-        use rln::{RLNNode, RegistrationBlob, SlashBlob, StaticEventCheck, MAX_MSG_LIMIT};
+        use darkfi_sdk::crypto::poseidon_hash;
+        use rln::{RLNNode, SlashBlob, StaticEventCheck};
 
 
         match rln_node {
         match rln_node {
             RLNNode::Registration(commitment) => {
             RLNNode::Registration(commitment) => {
@@ -2287,9 +2289,10 @@ impl EventGraph {
                     }
                     }
                 }
                 }
 
 
-                // Rejecting every account
+                // Accepting only genesis registeration, reject every
+                // other account.
                 return StaticEventCheck::Rejected;
                 return StaticEventCheck::Rejected;
-
+                /*
                 #[allow(unreachable_code)]
                 #[allow(unreachable_code)]
                 let reg: RegistrationBlob = match deserialize_async_partial(blob).await {
                 let reg: RegistrationBlob = match deserialize_async_partial(blob).await {
                     Ok((v, _)) => v,
                     Ok((v, _)) => v,
@@ -2329,6 +2332,7 @@ impl EventGraph {
                 }
                 }
 
 
                 StaticEventCheck::AcceptedRegistration(*commitment)
                 StaticEventCheck::AcceptedRegistration(*commitment)
+                */
             }
             }
             RLNNode::Slashing(commitment) => {
             RLNNode::Slashing(commitment) => {
                 let sl: SlashBlob = match deserialize_async_partial(blob).await {
                 let sl: SlashBlob = match deserialize_async_partial(blob).await {