Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make launchpad work with development #3777

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4446da0
[wip] chore: update launchpad for dibbler
philipr-za Jan 27, 2022
79a6d53
Fix launchpad configs and FE for dibbler
CjS77 Jan 28, 2022
8c6539e
Fix clippy
CjS77 Jan 28, 2022
5bcf311
Define versioning better
CjS77 Jan 28, 2022
147ebfc
Merge branch 'development' into philipr-za-philip-launchpad-todo
Jan 28, 2022
c6dcb14
Pull tor configuration out into helper method
CjS77 Jan 30, 2022
a0ba44f
Mining node configuration
CjS77 Jan 30, 2022
d055abe
Remove mining_node config variables from global
CjS77 Jan 30, 2022
beb10c2
Use auto-merge config for Tari Merge Mining Proxy
CjS77 Jan 30, 2022
216bb20
Merge remote-tracking branch 'origin/philipr-za-philip-launchpad-todo…
CjS77 Jan 30, 2022
92e86dc
Update configs and formatting
CjS77 Jan 31, 2022
22ef52e
Convert most printlkns to log messages
CjS77 Jan 31, 2022
f441125
Allow arb network strings & optimise dockerfiles
CjS77 Jan 31, 2022
713bb38
Fix up tests
CjS77 Feb 1, 2022
b3eef8b
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Feb 2, 2022
0ff4f2b
merge fixes
stringhandler Feb 3, 2022
e68f5bd
default mm proxy config
stringhandler Feb 4, 2022
43cc8bb
fix for windows defaults
stringhandler Feb 7, 2022
33bc050
remove data folder
stringhandler Feb 9, 2022
80caabc
add back .gitkeep
stringhandler Feb 9, 2022
a3a781d
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Feb 9, 2022
a16ba81
add back .gitkeep
stringhandler Feb 9, 2022
534b9ef
fix clippy
stringhandler Feb 9, 2022
7b5e19d
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Feb 9, 2022
48827a6
fix cucumber
stringhandler Feb 10, 2022
187161c
wip
stringhandler Feb 17, 2022
d2da8cf
wip
stringhandler Feb 17, 2022
f2d52af
wip
stringhandler Feb 21, 2022
1994c9c
wip
stringhandler Feb 21, 2022
6083baa
compiling
stringhandler Mar 14, 2022
9fca9f3
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Mar 14, 2022
aa28c3d
compiling
stringhandler Mar 14, 2022
a54e6e3
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Mar 15, 2022
ce18042
common cli
stringhandler Mar 16, 2022
39e154d
merge mining config
stringhandler Mar 17, 2022
da7f9bb
add config overrides
stringhandler Mar 18, 2022
427543c
tor basics
stringhandler Mar 24, 2022
0cfef17
base node starting
stringhandler Mar 28, 2022
3148e94
wallet starting
stringhandler Mar 29, 2022
4e36ad4
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Mar 29, 2022
e05f6d7
after merge
stringhandler Mar 29, 2022
a32bafe
fix clippies
stringhandler Mar 29, 2022
43bc90e
more fixes
stringhandler Mar 30, 2022
f6212e6
Merge branch 'development' into philipr-za-philip-launchpad-todo
stringhandler Mar 30, 2022
c401d3c
more fixes
stringhandler Mar 30, 2022
49551b1
working except stack overflow
stringhandler Mar 30, 2022
f551870
cucumber
stringhandler Mar 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,9 @@ And then depending on if you are using solo mining or self-select mining you wil

###### Solo mining

- For the Tari Merge Mining Proxy, under section **`merge_mining_proxy.weatherwax`**
- For the Tari Merge Mining Proxy, under section **`merge_mining_proxy`**
```
[merge_mining_proxy.weatherwax]
[merge_mining_proxy]
monerod_url = [ # stagenet
"http://stagenet.xmr-tw.org:38081",
"http://stagenet.community.xmr.to:38081",
Expand All @@ -635,7 +635,7 @@ And then depending on if you are using solo mining or self-select mining you wil
"http://singapore.node.xmr.pm:38081",
]

proxy_host_address = "127.0.0.1:7878"
proxy_host_address = "127.0.0.1:18081"
proxy_submit_to_origin = true
monerod_use_auth = false
monerod_username = ""
Expand All @@ -644,9 +644,9 @@ And then depending on if you are using solo mining or self-select mining you wil

###### Self-Select mining

- For the Tari Merge Mining Proxy, under section **`merge_mining_proxy.weatherwax`**
- For the Tari Merge Mining Proxy, under section **`merge_mining_proxy`**
```
[merge_mining_proxy.weatherwax]
[merge_mining_proxy]
monerod_url = [ # stagenet
"http://stagenet.xmr-tw.org:38081",
"http://stagenet.community.xmr.to:38081",
Expand All @@ -655,14 +655,14 @@ And then depending on if you are using solo mining or self-select mining you wil
"http://singapore.node.xmr.pm:38081",
]

proxy_host_address = "127.0.0.1:7878"
proxy_host_address = "127.0.0.1:18081"
proxy_submit_to_origin = false
monerod_use_auth = false
monerod_username = ""
monerod_password = ""
```

**Note:** The ports `7878`, `18142` and `18143` shown in the example above should not be in use by other processes. If
**Note:** The ports `18081`, `18142` and `18143` shown in the example above should not be in use by other processes. If
they are, choose different ports. You will need to update the ports in the steps below as well.

The `monerod_url` set must contain valid addresses (`host:port`) for `monerod` that is running Monero mainnet (e.g.
Expand Down Expand Up @@ -738,7 +738,7 @@ Using the public stagenet wallet address above the resulting configuration file
"pools": [
{
"coin": "monero",
"url": "127.0.0.1:7878",
"url": "127.0.0.1:18081",
"user": "55LTR8KniP4LQGJSPtbYDacR7dz8RBFnsfAKMaMuwUNYX6aQbBcovzDPyrQF9KXF9tVU6Xk3K8no1BywnJX6GvZX8yJsXvt",
"tls": false,
"daemon": true
Expand Down Expand Up @@ -774,7 +774,7 @@ be augmented with Tari specific settings. Using the wizard, create the following

- Result -> With `Config file`, copy or download, than save as `config.json`.

- Add custom entries for `"self-select": "127.0.0.1:7878"` and `"submit-to-origin": true` in the `"pools"` section.
- Add custom entries for `"self-select": "127.0.0.1:18081"` and `"submit-to-origin": true` in the `"pools"` section.

Mining pool `cryptonote.social` requires you to add a personalized handle to the wallet address so that you can
query your own pool statistics, separated by a full stop, i.e. `<YOUR WALLET ADDRESS>.<pool specific user name>`. For
Expand All @@ -798,7 +798,7 @@ activity for that address. The configuration file used for this exercise is show
"tls": false,
"keepalive": true,
"nicehash": false,
"self-select": "127.0.0.1:7878",
"self-select": "127.0.0.1:18081",
"submit-to-origin": true
}
]
Expand Down Expand Up @@ -881,14 +881,14 @@ Look out for the following outputs in the XMRig console to confirm that it is co
and accepting jobs:

```
* POOL #1 127.0.0.1:7878 coin monero
* POOL #1 127.0.0.1:18081 coin monero
```

```
[2021-01-21 12:10:18.960] net use daemon 127.0.0.1:7878 127.0.0.1
[2021-01-21 12:10:18.960] net new job from 127.0.0.1:7878 diff 286811 algo rx/0 height 756669
[2021-01-21 12:10:18.960] net use daemon 127.0.0.1:18081 127.0.0.1
[2021-01-21 12:10:18.960] net new job from 127.0.0.1:18081 diff 286811 algo rx/0 height 756669
[2021-01-21 12:10:56.730] cpu rejected (0/1) diff 286811 "Block not accepted" (656 ms)
[2021-01-21 12:10:57.398] net new job from 127.0.0.1:7878 diff 293330 algo rx/0 height 756670
[2021-01-21 12:10:57.398] net new job from 127.0.0.1:18081 diff 293330 algo rx/0 height 756670
[2021-01-21 12:12:23.695] miner speed 10s/60s/15m 4089.0 4140.2 n/a H/s max 4390.9 H/s
[2021-01-21 12:12:57.983] cpu accepted (1/1) diff 293330 (594 ms)
```
Expand Down Expand Up @@ -933,7 +933,7 @@ Look out for the following outputs in the XMRig console to confirm that it is co
Mining Proxy and accepting jobs:

```
* POOL #1 cryptonote.social:5555 coin monero self-select 127.0.0.1:7878 submit-to-origin
* POOL #1 cryptonote.social:5555 coin monero self-select 127.0.0.1:18081 submit-to-origin
```

```
Expand Down
1 change: 1 addition & 0 deletions applications/launchpad/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tor-hash-passwd = "1.0.1"
thiserror = "1.0.30"
tokio = { version = "1.9", features= ["sync"] }
futures = "0.3"
regex= "1.5.4"

[features]
default = [ "custom-protocol" ]
Expand Down
73 changes: 43 additions & 30 deletions applications/launchpad/backend/assets/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Config for launchpad v0.0.2
[common]
network = "dibbler"
config = "dibbler"
message_cache_size = 10
message_cache_ttl = 1440
denylist_ban_period = 1440
Expand All @@ -9,19 +9,20 @@ dedup_cache_capacity = 25000
rpc_max_simultaneous_sessions = 1000

[common.igor]
network = "igor"
peer_seeds = [
# igor
"8e7eb81e512f3d6347bf9b1ca9cd67d2c8e29f2836fc5bd608206505cc72af34::/onion3/l4wouomx42nezhzexjdzfh7pcou5l7df24ggmwgekuih7tkv2rsaokqd:18141",
"00b35047a341401bcd336b2a3d564280a72f6dc72ec4c739d30c502acce4e803::/onion3/ojhxd7z6ga7qrvjlr3px66u7eiwasmffnuklscbh5o7g6wrbysj45vid:18141",
"40a9d8573745072534bce7d0ecafe882b1c79570375a69841c08a98dee9ecb5f::/onion3/io37fylc2pupg4cte4siqlsmuszkeythgjsxs2i3prm6jyz2dtophaad:18141",
"126c7ee64f71aca36398b977dd31fbbe9f9dad615df96473fb655bef5709c540::/onion3/6ilmgndocop7ybgmcvivbdsetzr5ggj4hhsivievoa2dx2b43wqlrlid:18141",
]

dns_seeds =["seeds.igor.tari.com"]
dns_seeds = ["seeds.igor.tari.com"]
dns_seeds_use_dnssec = false

[common.dibbler]
dns_seeds =["seeds.dibbler.tari.com"]
network = "dibbler"
dns_seeds = ["seeds.dibbler.tari.com"]
peer_seeds = [
"721e9da488302e69523bca1a9cdcbd2419dddda11698a1e8c6c7bd619659ff21::/onion3/qw4ymrzbanbcr3wwlesxbot72iayd7xdjcrtnacbwgk637vfon47hqad:18141",
# 333388d1cbe3e2bd17453d052f
Expand All @@ -39,72 +40,72 @@ peer_seeds = [
]

[base_node]
network = "dibbler"
config = "dibbler"
grpc_enabled = true
grpc_address = "/ip4/0.0.0.0/tcp/18142"
track_reorgs = true

[base_node.dibbler]
network = "dibbler"
db_type = "lmdb"
flood_ban_max_msg_count = 10000
allow_test_addresses = false
use_libtor = false
base_node_identity_file = "/var/tari/base_node/config/dibbler/tari_base_node_id.json"
base_node_tor_identity_file = "/var/tari/base_node/config/dibbler/tari_base_node_tor.json"

# -- These values are overridden by envars in the Tauri code for EVERY network
# -------------- Transport configuration --------------
transport = "tor"
tor_control_auth = "password=tari"
tor_forward_address = "/dns4/base_node/tcp/18189"
tcp_listener_address = "/dns4/base_node/tcp/18189"
tor_socks_address_override = "/dns4/tor/tcp/9050"
tor_control_address = "/ip4/tor/tcp/9051"
grpc_enabled = true
grpc_base_node_address = "0.0.0.0:18142"
tor_control_address = "/dns4/tor/tcp/9051"


[base_node.igor]
network = "igor"
db_type = "lmdb"
flood_ban_max_msg_count = 10000
allow_test_addresses = false
use_libtor = false
base_node_identity_file = "/var/tari/base_node/config/igor/base_node_id.json"
base_node_tor_identity_file = "/var/tari/base_node/config/igor/tari_base_node_tor.json"


[mempool.dibbler]

[mempool.igor]

[wallet]
config = "dibbler"
wallet_db_file = "wallet/wallet.dat"
console_wallet_db_file = "wallet/console-wallet.dat"
grpc_enabled = true
grpc_address = "/ip4/0.0.0.0/tcp/18143"
password = "tari"

[wallet.dibbler]
use_libtor = false
tor_onion_port = 18141

# Overidden in Tauri environment variables for ALL networks
# The following are overridden in Tauri environment variables for ALL networks - so just here for informational purposes
transport = "tor"
tor_control_auth = "password=tari"
tor_control_address = "/ip4/tor/tcp/9051"
tor_control_address = "/dns4/tor/tcp/9051"
tor_socks_address_override = ""
tor_forward_address = ""
tcp_listener_address= ""
tcp_listener_address = ""

[wallet.dibbler]
network = "dibbler"
use_libtor = false
tor_onion_port = 18141

[wallet.igor]
network = "igor"
use_libtor = false
tor_onion_port = 18141

[mining_node]
num_mining_threads=1
base_node_grpc_address = "/ip4/base_node/tcp/18142"
wallet_grpc_address = "/ip4/wallet/tcp/18143"
num_mining_threads = 1
base_node_grpc_address = "/dns4/base_node/tcp/18142"
wallet_grpc_address = "/dns4/wallet/tcp/18143"
base_node_addr = "/dns4/base_node/tcp/18142"
wallet_addr = "/dns4/wallet/tcp/18143"
mine_on_tip_only = true

[merge_mining_proxy]
config = "dibbler"

[merge_mining_proxy.dibbler]
monerod_url = [ # stagenet
"http://stagenet.xmr-tw.org:38081",
Expand All @@ -113,9 +114,21 @@ monerod_url = [ # stagenet
"http://xmr-lux.boldsuck.org:38081",
"http://singapore.node.xmr.pm:38081",
]
proxy_host_address = "/ip4/mm_proxy/tcp/7878"

[merge_mining_proxy]
grpc_base_node_address = "/dns4/base_node/tcp/18142"
grpc_console_wallet_address = "/dns4/wallet/tcp/18143"
proxy_host_address = "/dns4/mm_proxy/tcp/18081"
proxy_submit_to_origin = true
wait_for_initial_sync_at_startup = true
monerod_username = ""
monerod_password = ""
monerod_use_auth = false

[merge_mining_proxy.local]
grpc_base_node_address = "/ip4/127.0.0.1/tcp/18142"
grpc_console_wallet_address = "/ip4/127.0.0.1/tcp/18143"
proxy_host_address = "/ip4/127.0.0.1/tcp/18081"
proxy_submit_to_origin = false
wait_for_initial_sync_at_startup = true

[stratum_transcoder]
transcoder_host_address = "127.0.0.1:7879"
Expand Down
4 changes: 2 additions & 2 deletions applications/launchpad/backend/assets/log4rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ loggers:
- core
additive: false
tari_mining_node:
level: info
level: debug
appenders:
- core
additive: false
tari_mm_proxy:
level: info
level: debug
appenders:
- core
additive: false
Expand Down
23 changes: 16 additions & 7 deletions applications/launchpad/backend/src/commands/create_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

use std::path::Path;
use std::{
env,
path::{Path, PathBuf},
str::FromStr,
};

use log::*;
use tauri::{
Expand All @@ -38,14 +42,19 @@ use crate::{commands::AppState, docker::create_workspace_folders, error::Launche
/// Create a new workspace environment by creating a folder hierarchy (if required) at the `root_folder`, and copying
/// the default config files into it.
#[tauri::command]
pub fn create_new_workspace(app: AppHandle<Wry>, root_path: String) -> Result<(), String> {
pub fn create_new_workspace(app: AppHandle<Wry>, root_path: Option<String>) -> Result<(), String> {
let config = app.config();
let package_info = &app.state::<AppState>().package_info;
let _ = create_workspace_folders(root_path.as_str()).map_err(|e| e.chained_message());
let path = Path::new(&root_path);
copy_config_file(path, config.as_ref(), package_info, "log4rs.yml").map_err(|e| e.chained_message())?;
copy_config_file(path, config.as_ref(), package_info, "config.toml").map_err(|e| e.chained_message())?;
info!("Workspace at {} complete!", root_path);
let path = root_path
.as_ref()
.map(|r| PathBuf::from_str(r.as_str()).unwrap())
.unwrap_or_else(|| env::temp_dir().join("tari"));
debug!("Creating workspace at {:?}", path);
create_workspace_folders(&path).map_err(|e| e.chained_message())?;
dbg!("hello");
copy_config_file(path.as_path(), config.as_ref(), package_info, "log4rs.yml").map_err(|e| e.chained_message())?;
copy_config_file(path.as_path(), config.as_ref(), package_info, "config.toml").map_err(|e| e.chained_message())?;
info!("Workspace at {:?} complete!", path);
Ok(())
}

Expand Down
3 changes: 2 additions & 1 deletion applications/launchpad/backend/src/commands/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ async fn create_default_workspace_impl(app: AppHandle<Wry>, settings: ServiceSet
}; // drop read-only lock
if should_create_workspace {
let package_info = &state.package_info;
let _ = create_workspace_folders(&config.data_directory).map_err(|e| e.chained_message());
dbg!(&config);
create_workspace_folders(&config.data_directory)?;
copy_config_file(&config.data_directory, app_config.as_ref(), package_info, "log4rs.yml")?;
copy_config_file(&config.data_directory, app_config.as_ref(), package_info, "config.toml")?;
// Only get a write-lock if we need one
Expand Down
12 changes: 7 additions & 5 deletions applications/launchpad/backend/src/docker/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ use crate::docker::{DockerWrapperError, ImageType};
pub fn create_workspace_folders<P: AsRef<Path>>(root: P) -> Result<(), DockerWrapperError> {
if !root.as_ref().exists() {
info!("Creating new workspace at {}", root.as_ref().to_str().unwrap_or("???"));
fs::create_dir(&root)?
fs::create_dir_all(&root)?;
}
let make_subfolder = |folder: &str| -> Result<(), std::io::Error> {
let p = root.as_ref().join(folder);
let p_str = p.as_path().to_str().unwrap_or("???");
match p.exists() {
true => {
debug!("{} already exists", p_str);
info!("{} already exists", p_str);
Ok(())
},
false => {
info!("Creating new data folder, {}", p_str);
fs::create_dir(&p)?;
fs::create_dir_all(&p)?;
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
use std::os::unix::fs::PermissionsExt;
Expand All @@ -64,9 +64,11 @@ pub fn create_workspace_folders<P: AsRef<Path>>(root: P) -> Result<(), DockerWra
},
}
};
let _ = make_subfolder("config")?;
info!("Making config folder");
make_subfolder("config")?;
for image in ImageType::iter() {
let _ = make_subfolder(image.data_folder())?;
debug!("Making folder for image:{:?}", image);
make_subfolder(image.data_folder())?;
}
Ok(())
}
2 changes: 1 addition & 1 deletion applications/launchpad/backend/src/docker/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl TryFrom<&str> for TariNetwork {

//------------------------------------------- ImageType ----------------------------------------------

#[derive(Clone, Copy, EnumIter, PartialEq, Eq, Hash, Serialize)]
#[derive(Debug, Clone, Copy, EnumIter, PartialEq, Eq, Hash, Serialize)]
pub enum ImageType {
Tor,
BaseNode,
Expand Down
Loading