author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
20,244
26.09.2019 08:28:38
14,400
188c73d6f190d371bb862c9ba9538d13d55f4096
Upgrade Mokito, arrayvec, and env_logger
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -183,7 +183,7 @@ name = \"althea_types\"\nversion = \"0.1.0\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n@@ -216,6 +216,13 @@ version = \"0.4.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n+[[package]]\n+name = \"arrayvec\"\n+version = \"0.5.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n\"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n@@ -745,7 +752,19 @@ version = \"0.6.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"regex 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n+[[package]]\n+name = \"env_logger\"\n+version = \"0.7.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"regex 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -1030,7 +1049,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"humantime\"\n-version = \"1.2.0\"\n+version = \"1.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -1340,7 +1359,7 @@ dependencies = [\n[[package]]\nname = \"mockito\"\n-version = \"0.20.0\"\n+version = \"0.21.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"assert-json-diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2020,7 +2039,7 @@ dependencies = [\n\"actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"althea_kernel_interface 0.1.0\",\n\"althea_types 0.1.0\",\n- \"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"auto-bridge 0.1.5 (git+https://github.com/althea-net/auto_bridge?tag=v0.1.5)\",\n\"babel_monitor 0.1.0\",\n\"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2031,7 +2050,7 @@ dependencies = [\n\"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"exit_db 0.1.0\",\n\"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2044,7 +2063,7 @@ dependencies = [\n\"lettre_email 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"minihttpse 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"mockito 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"mockito 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"mockstream 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num256 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2281,7 +2300,7 @@ version = \"0.1.0\"\ndependencies = [\n\"althea_kernel_interface 0.1.0\",\n\"althea_types 0.1.0\",\n- \"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n@@ -3037,6 +3056,7 @@ dependencies = [\n\"checksum arc-swap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1507f9b80b3ef096751728cf3f43bb0111ec906e44f5d8587e02c10643b9a2cd\"\n\"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee\"\n\"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba\"\n+\"checksum arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ead801bcb8843bc91ea0a028f95b786f39ce519b1738de4e74a2a393332c2a16\"\n\"checksum ascii 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"91e320562a8fa3286a481b7189f89578ace6b20df99e123c87f2f509c957c5d6\"\n\"checksum ascii_utils 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a\"\n\"checksum assert-json-diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"32946b6d31d50d0e35896c864907f9cb7e47b52bd875fa3c058618601cfdefb1\"\n@@ -3095,6 +3115,7 @@ dependencies = [\n\"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569\"\n\"checksum encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4155785c79f2f6701f185eb2e6b4caf0555ec03477cb4c70db67b465311620ed\"\n\"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3\"\n+\"checksum env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"39ecdb7dd54465526f0a56d666e3b2dd5f3a218665a030b6e4ad9e70fa95d8fa\"\n\"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc\"\n\"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3\"\n\"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46\"\n@@ -3127,7 +3148,7 @@ dependencies = [\n\"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e\"\n\"checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)\" = \"372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4\"\n\"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9\"\n-\"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114\"\n+\"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f\"\n\"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e\"\n\"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d\"\n\"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08\"\n@@ -3165,7 +3186,7 @@ dependencies = [\n\"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)\" = \"83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23\"\n\"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)\" = \"966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125\"\n\"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919\"\n-\"checksum mockito 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"fa3f481382a4d68c5f1d27fb567db27196630f729706003cb07a9b8330a30306\"\n+\"checksum mockito 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"aee38c301104cc75a6628a4360be706fbdf84290c15a120b7e54eca5881c3450\"\n\"checksum mockstream 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"35bbe0c0c9d254b463b13734bc361d1423289547e052b1e77e5a77292496ba2e\"\n\"checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e\"\n\"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)\" = \"42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88\"\n" }, { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -15,5 +15,5 @@ sodiumoxide = \"0.2\"\neui48 = { git = \"https://github.com/althea-mesh/eui48\", features = [\"serde\"] }\nactix = { version = \"0.7\", optional = true}\nclarity = \"0.1\"\n-arrayvec = {version= \"0.4\", features = [\"serde-1\"]}\n+arrayvec = {version= \"0.5\", features = [\"serde\"]}\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "@@ -34,7 +34,7 @@ config = \"0.9\"\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\ndocopt = \"1.1\"\ndotenv = \"0.14\"\n-env_logger = \"0.6\"\n+env_logger = \"0.7\"\nfailure = \"0.1\"\nfutures = \"0.1\"\nhandlebars = \"2.0\"\n@@ -42,7 +42,7 @@ ipnetwork = \"0.14\"\nlazy_static = \"1.4\"\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nminihttpse = \"0.1\"\n-mockito = \"0.20\"\n+mockito = \"0.21\"\nmockstream = \"0.0\"\nrand = \"0.7\"\nserde = \"1.0\"\n@@ -57,7 +57,7 @@ openssl-probe = \"0.1\"\nnum-traits=\"0.2\"\nclarity = \"0.1\"\neui48 = \"0.4\"\n-arrayvec = {version= \"0.4\", features = [\"serde-1\"]}\n+arrayvec = {version= \"0.5\", features = [\"serde\"]}\nlettre = \"0.9\"\nlettre_email = \"0.9\"\nphonenumber = \"0.2\"\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -19,4 +19,4 @@ failure = \"0.1\"\nowning_ref = \"0.4\"\nlazy_static = \"1.4\"\nclarity = \"0.1\"\n-arrayvec = {version= \"0.4\", features = [\"serde-1\"]}\n+arrayvec = {version= \"0.5\", features = [\"serde\"]}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgrade Mokito, arrayvec, and env_logger
20,244
26.09.2019 13:11:51
14,400
39484cf442d4f57779c025e3ab9225f74960fcd1
Add bridge functionality for eth This retrieves money from the xdai chain if you set your system blockchain to ETH.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -227,7 +227,6 @@ impl Handler<Tick> for TokenBridge {\nfn handle(&mut self, _msg: Tick, _ctx: &mut Context<Self>) -> Self::Result {\nlet payment_settings = SETTING.get_payment();\n- let our_address = payment_settings.eth_address.unwrap();\nlet system_chain = payment_settings.system_chain;\nif !payment_settings.bridge_enabled {\n@@ -235,13 +234,82 @@ impl Handler<Tick> for TokenBridge {\n}\ndrop(payment_settings);\n- let bridge = self.bridge.clone();\n- let reserve_amount = self.reserve_amount;\n- let minimum_to_exchange = self.minimum_to_exchange;\n- let minimum_stranded_dai_transfer = self.minimum_stranded_dai_transfer;\n+ match system_chain {\n+ SystemChain::Xdai => xdai_bridge(self.state.clone(), &self),\n+ SystemChain::Ethereum => eth_bridge(self.state.clone(), &self),\n+ SystemChain::Rinkeby => {}\n+ }\n+ }\n+}\n- if let SystemChain::Xdai = system_chain {\n- match self.state.clone() {\n+/// simplified logic for bringing xdai back over to Eth if the user has xdai and then\n+/// selects Eth as their blockchain it will brin gthe full balance back into Eth\n+fn eth_bridge(_state: State, bridge: &TokenBridge) {\n+ let bridge = bridge.bridge.clone();\n+ Arbiter::spawn(\n+ bridge\n+ .get_dai_balance(bridge.own_address)\n+ .join4(\n+ bridge.eth_web3.eth_get_balance(bridge.own_address),\n+ bridge.dai_to_eth_price(eth_to_wei(1u8.into())),\n+ bridge.xdai_web3.eth_get_balance(bridge.own_address),\n+ )\n+ .and_then(\n+ move |(our_dai_balance, our_eth_balance, wei_per_dollar, our_xdai_balance)| {\n+ trace!(\n+ \"xdai rescue state is {} dai {} eth {} wei per dollar\",\n+ our_dai_balance,\n+ our_eth_balance,\n+ wei_per_dollar\n+ );\n+ // Money has come over the bridge\n+ if our_xdai_balance > 0u32.into() {\n+ Box::new(bridge.xdai_to_dai_bridge(our_xdai_balance.clone()).then(\n+ move |res| {\n+ TokenBridge::from_registry().do_send(DetailedStateChange(\n+ DetailedBridgeState::XdaiToDai {\n+ amount: our_xdai_balance.clone(),\n+ },\n+ ));\n+ Ok(())\n+ },\n+ )) as Box<dyn Future<Item = (), Error = Error>>\n+ } else if our_dai_balance > 0u32.into() {\n+ TokenBridge::from_registry().do_send(DetailedStateChange(\n+ DetailedBridgeState::DaiToEth {\n+ amount_of_dai: our_dai_balance.clone(),\n+ wei_per_dollar: wei_per_dollar.clone(),\n+ },\n+ ));\n+ Box::new(\n+ bridge\n+ // Then it converts to eth\n+ .dai_to_eth_swap(our_dai_balance, UNISWAP_TIMEOUT)\n+ .and_then(|_| Ok(())),\n+ ) as Box<dyn Future<Item = (), Error = Error>>\n+ // all other steps are done and the eth is sitting and waiting\n+ } else {\n+ Box::new(futures::future::ok(()))\n+ as Box<dyn Future<Item = (), Error = Error>>\n+ }\n+ },\n+ )\n+ .then(|res| {\n+ if res.is_err() {\n+ error!(\"Error in Eth rescuing Tick handler: {:?}\", res);\n+ }\n+ Ok(())\n+ }),\n+ )\n+}\n+\n+/// The logic for the Eth -> Xdai bridge operation\n+fn xdai_bridge(state: State, bridge: &TokenBridge) {\n+ let minimum_stranded_dai_transfer = bridge.minimum_stranded_dai_transfer;\n+ let reserve_amount = bridge.reserve_amount;\n+ let minimum_to_exchange = bridge.minimum_to_exchange;\n+ let bridge = bridge.bridge.clone();\n+ match state {\nState::Ready { .. } => {\ntrace!(\n\"Ticking in State::Ready. Eth Address: {}\",\n@@ -250,17 +318,20 @@ impl Handler<Tick> for TokenBridge {\n// Go into State::Depositing right away to prevent multiple attempts\nTokenBridge::from_registry().do_send(StateChange(State::Depositing {}));\nArbiter::spawn(\n- rescue_dai(bridge.clone(), our_address, minimum_stranded_dai_transfer)\n+ rescue_dai(\n+ bridge.clone(),\n+ bridge.own_address,\n+ minimum_stranded_dai_transfer,\n+ )\n.and_then(move |_| {\ntrace!(\"rescued dai\");\nbridge\n.dai_to_eth_price(eth_to_wei(1u8.into()))\n- .join(bridge.eth_web3.eth_get_balance(our_address))\n+ .join(bridge.eth_web3.eth_get_balance(bridge.own_address))\n.and_then(move |(wei_per_dollar, eth_balance)| {\n// These statements convert the reserve_amount and minimum_to_exchange\n// into eth using the current price (units of wei)\n- let reserve =\n- wei_per_dollar.clone() * reserve_amount.into();\n+ let reserve = wei_per_dollar.clone() * reserve_amount.into();\nlet minimum_to_exchange =\nwei_per_dollar.clone() * minimum_to_exchange.into();\n@@ -270,23 +341,18 @@ impl Handler<Tick> for TokenBridge {\n// Leave a reserve in the account to use for gas in the future\nlet swap_amount = eth_balance - reserve;\n- TokenBridge::from_registry().do_send(\n- DetailedStateChange(\n+ TokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::EthToDai {\namount_of_eth: swap_amount.clone(),\nwei_per_dollar: wei_per_dollar.clone(),\n},\n- ),\n- );\n+ ));\ntrace!(\"Converting to Dai\");\nBox::new(\nbridge\n// Convert to Dai in Uniswap\n- .eth_to_dai_swap(\n- swap_amount,\n- ETH_TRANSFER_TIMEOUT,\n- )\n+ .eth_to_dai_swap(swap_amount, ETH_TRANSFER_TIMEOUT)\n.and_then(move |dai_bought| {\nTokenBridge::from_registry().do_send(\nDetailedStateChange(\n@@ -305,12 +371,12 @@ impl Handler<Tick> for TokenBridge {\n)\nas Box<dyn Future<Item = (), Error = Error>>\n} else {\n- TokenBridge::from_registry().do_send(\n- DetailedStateChange(DetailedBridgeState::NoOp {\n+ TokenBridge::from_registry().do_send(DetailedStateChange(\n+ DetailedBridgeState::NoOp {\neth_balance,\nwei_per_dollar,\n- }),\n- );\n+ },\n+ ));\n// we don't have a lot of eth, we shouldn't do anything\nBox::new(future::ok(()))\nas Box<dyn Future<Item = (), Error = Error>>\n@@ -359,8 +425,8 @@ impl Handler<Tick> for TokenBridge {\nlet amount_a = amount.clone();\nArbiter::spawn(\nbridge\n- .get_dai_balance(our_address)\n- .join5(bridge.eth_web3.eth_get_balance(our_address),\n+ .get_dai_balance(bridge.own_address)\n+ .join5(bridge.eth_web3.eth_get_balance(bridge.own_address),\nbridge.dai_to_eth_price(eth_to_wei(1u8.into())),\nbridge.dai_to_eth_price(DAI_WEI_CENT.into()),\nbridge.eth_web3.eth_gas_price())\n@@ -424,8 +490,6 @@ impl Handler<Tick> for TokenBridge {\n}\n}\n}\n- }\n-}\n/// Withdraw state struct for the bridge, if withdraw_all is true, the eth will be\n/// cleaned up on the way out as well\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -189,5 +189,4 @@ mod tests {\nfn test_exit_settings_example() {\nRitaExitSettingsStruct::new(\"example_exit.toml\").unwrap();\n}\n-\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add bridge functionality for eth This retrieves money from the xdai chain if you set your system blockchain to ETH.
20,244
26.09.2019 13:49:16
14,400
819e6f3b3255e46c1baf16ebffdf1e72f89984b7
Add identity to dashboard, fix neighbor metric logic
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/neighbors.rs", "new_path": "rita/src/rita_client/dashboard/neighbors.rs", "diff": "@@ -22,7 +22,9 @@ use std::collections::HashMap;\n#[derive(Serialize)]\npub struct NodeInfo {\npub nickname: String,\n+ // TODO: Remove this once the dashboard no longer depends on it.\npub ip: String,\n+ pub id: Identity,\npub route_metric_to_exit: u16,\npub route_metric: u16,\npub total_payments: Uint256,\n@@ -94,8 +96,9 @@ fn generate_neighbors_list(\nif maybe_route.is_err() {\noutput.push(nonviable_node_info(\nnickname,\n- 0,\n+ u16::max_value(),\nidentity.mesh_ip.to_string(),\n+ *identity,\n));\ncontinue;\n}\n@@ -114,6 +117,7 @@ fn generate_neighbors_list(\nnickname,\nneigh_route.metric,\nidentity.mesh_ip.to_string(),\n+ *identity,\n));\ncontinue;\n}\n@@ -122,7 +126,8 @@ fn generate_neighbors_list(\noutput.push(NodeInfo {\nnickname: nickname.to_string(),\n- ip: serde_json::to_string(&identity.mesh_ip).unwrap(),\n+ ip: identity.mesh_ip.to_string(),\n+ id: *identity,\nroute_metric_to_exit: exit_route.metric,\nroute_metric: neigh_route.metric,\ntotal_payments: debt_info.total_payment_received.clone(),\n@@ -133,8 +138,9 @@ fn generate_neighbors_list(\n} else {\noutput.push(nonviable_node_info(\nnickname,\n- 0,\n+ neigh_route.metric,\nidentity.mesh_ip.to_string(),\n+ *identity,\n));\n}\n}\n@@ -154,10 +160,16 @@ fn merge_debts_and_neighbors(\n}\n}\n-fn nonviable_node_info(nickname: ArrayString<[u8; 32]>, neigh_metric: u16, ip: String) -> NodeInfo {\n+fn nonviable_node_info(\n+ nickname: ArrayString<[u8; 32]>,\n+ neigh_metric: u16,\n+ ip: String,\n+ id: Identity,\n+) -> NodeInfo {\nNodeInfo {\nnickname: nickname.to_string(),\nip,\n+ id,\ntotal_payments: 0u32.into(),\ndebt: 0.into(),\nlink_cost: 0,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add identity to dashboard, fix neighbor metric logic
20,244
26.09.2019 13:50:26
14,400
4573318751d34f852592bb9e09200a7c385b8b14
Use if let universally
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/neighbors.rs", "new_path": "rita/src/rita_client/dashboard/neighbors.rs", "diff": "@@ -51,8 +51,7 @@ pub fn get_neighbor_info(\n.from_err()\n.and_then(|neighbors| {\nlet mut debts = debts.unwrap();\n- if neighbors.is_ok() {\n- let neighbors = neighbors.unwrap();\n+ if let Ok(neighbors) = neighbors {\nmerge_debts_and_neighbors(neighbors, &mut debts);\n}\n@@ -104,8 +103,8 @@ fn generate_neighbors_list(\n}\nlet neigh_route = maybe_route.unwrap();\n- if current_exit.is_some() {\n- let exit_ip = current_exit.unwrap().id.mesh_ip;\n+ if let Some(current_exit) = current_exit {\n+ let exit_ip = current_exit.id.mesh_ip;\nlet maybe_exit_route =\nget_route_via_neigh(identity.mesh_ip, exit_ip, &route_table_sample);\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/nickname.rs", "new_path": "rita/src/rita_common/dashboard/nickname.rs", "diff": "@@ -9,10 +9,10 @@ use failure::Error;\npub fn get_nickname(_req: HttpRequest) -> Result<HttpResponse, Error> {\nlet nick = SETTING.get_network().nickname;\n- if nick.is_none() {\n- bail!(\"Nickname not set!\")\n+ if let Some(nick) = nick {\n+ Ok(HttpResponse::Ok().json(nick.to_string()))\n} else {\n- Ok(HttpResponse::Ok().json(nick.unwrap().to_string()))\n+ bail!(\"Nickname not set!\")\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/wg_key.rs", "new_path": "rita/src/rita_common/dashboard/wg_key.rs", "diff": "@@ -6,9 +6,9 @@ use settings::RitaCommonSettings;\npub fn get_wg_public_key(_req: HttpRequest) -> Result<HttpResponse, Error> {\nlet wg_public_key = SETTING.get_network().wg_public_key;\n- if wg_public_key.is_none() {\n- bail!(\"wg_public_key not set!\")\n+ if let Some(wg_public_key) = wg_public_key {\n+ Ok(HttpResponse::Ok().json(wg_public_key.to_string()))\n} else {\n- Ok(HttpResponse::Ok().json(wg_public_key.unwrap().to_string()))\n+ bail!(\"wg_public_key not set!\")\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -265,7 +265,7 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\n// Money has come over the bridge\nif our_xdai_balance > 0u32.into() {\nBox::new(bridge.xdai_to_dai_bridge(our_xdai_balance.clone()).then(\n- move |res| {\n+ move |_res| {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::XdaiToDai {\namount: our_xdai_balance.clone(),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use if let universally
20,244
27.09.2019 11:22:43
14,400
e39bff53003f51c11c652f0bfc65c2bd402b24cc
Bump Rita version for Beta 9 RC1
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.15\",\n+ \"rita 0.5.16\",\n]\n[[package]]\n@@ -2031,7 +2031,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.15\"\n+version = \"0.5.16\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.15\"\n+version = \"0.5.16\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump Rita version for Beta 9 RC1
20,244
27.09.2019 14:35:11
14,400
d7c00a1f6c17f3c40e24428ca07a949e0e49fa40
Make five minute sample mod logic more explicit
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -103,7 +103,7 @@ impl RunningPacketLossStats {\nself.total_lost += u32::from(lost_packets);\nself.total_packets += u32::from(SAMPLE_PERIOD);\nself.five_minute_loss[self.front] = lost_packets;\n- self.front += 1 % SAMPLES_IN_FIVE_MINUTES;\n+ self.front = (self.front + 1) % SAMPLES_IN_FIVE_MINUTES;\n}\npub fn get_avg(&self) -> Option<f32> {\nif self.total_packets > 0 {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Make five minute sample mod logic more explicit
20,249
27.09.2019 09:07:40
25,200
04dbbcb14c5cee0a303424712153b96af80383e0
Add packet loss and latency stats to /neighbors endpoint
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/neighbors.rs", "new_path": "rita/src/rita_client/dashboard/neighbors.rs", "diff": "use crate::rita_common::debt_keeper::{DebtKeeper, Dump, NodeDebtData};\n+use crate::rita_common::network_monitor::{GetStats, IfaceStats, NetworkMonitor, Stats};\nuse crate::rita_common::tunnel_manager::{GetNeighbors, Neighbor, TunnelManager};\nuse crate::SETTING;\n-use ::actix::SystemService;\n-use ::actix_web::AsyncResponder;\n-use ::actix_web::{HttpRequest, Json};\n+use actix::SystemService;\n+use actix_web::AsyncResponder;\n+use actix_web::{HttpRequest, Json};\nuse althea_types::Identity;\nuse arrayvec::ArrayString;\nuse babel_monitor::get_installed_route;\n@@ -31,6 +32,7 @@ pub struct NodeInfo {\npub debt: Int256,\npub link_cost: u16,\npub price_to_exit: u32,\n+ pub stats: IfaceStats,\n}\n/// Gets info about neighbors, including interested data about what their route\n@@ -51,6 +53,7 @@ pub fn get_neighbor_info(\n.from_err()\n.and_then(|neighbors| {\nlet mut debts = debts.unwrap();\n+\nif let Ok(neighbors) = neighbors {\nmerge_debts_and_neighbors(neighbors, &mut debts);\n}\n@@ -62,12 +65,23 @@ pub fn get_neighbor_info(\n.and_then(move |stream| {\nstart_connection(stream).and_then(move |stream| {\nparse_routes(stream)\n- .and_then(move |routes| {\n- let route_table_sample = routes.1;\n- let output =\n- generate_neighbors_list(route_table_sample, debts);\n+ .and_then(|(_stream, routes)| {\n+ let route_table_sample = routes.clone();\n+\n+ NetworkMonitor::from_registry()\n+ .send(GetStats {})\n+ .from_err()\n+ .and_then(|stats| {\n+ let stats = stats.unwrap();\n+ let output = generate_neighbors_list(\n+ stats,\n+ route_table_sample,\n+ debts,\n+ );\n+\nOk(Json(output))\n})\n+ })\n.responder()\n})\n})\n@@ -78,6 +92,7 @@ pub fn get_neighbor_info(\n/// generates a list of neighbors coorelated with the quality of the route to the exit they provide\nfn generate_neighbors_list(\n+ stats: Stats,\nroute_table_sample: Vec<Route>,\ndebts: HashMap<Identity, NodeDebtData>,\n) -> Vec<NodeInfo> {\n@@ -103,7 +118,8 @@ fn generate_neighbors_list(\n}\nlet neigh_route = maybe_route.unwrap();\n- if let Some(current_exit) = current_exit {\n+ let tup = (current_exit, stats.get(&neigh_route.iface));\n+ if let (Some(current_exit), Some(stats_entry)) = tup {\nlet exit_ip = current_exit.id.mesh_ip;\nlet maybe_exit_route =\nget_route_via_neigh(identity.mesh_ip, exit_ip, &route_table_sample);\n@@ -133,6 +149,7 @@ fn generate_neighbors_list(\ndebt: debt_info.debt.clone(),\nlink_cost: exit_route.refmetric,\nprice_to_exit: exit_route.price,\n+ stats: *stats_entry,\n})\n} else {\noutput.push(nonviable_node_info(\n@@ -175,5 +192,6 @@ fn nonviable_node_info(\nprice_to_exit: 0,\nroute_metric_to_exit: u16::max_value(),\nroute_metric: neigh_metric,\n+ stats: IfaceStats::default(),\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -12,6 +12,7 @@ use actix::SystemService;\nuse althea_types::WgKey;\nuse babel_monitor::Neighbor as BabelNeighbor;\nuse babel_monitor::Route as BabelRoute;\n+use failure::Error;\nuse std::collections::HashMap;\nconst SAMPLE_PERIOD: u8 = FAST_LOOP_SPEED as u8;\n@@ -19,7 +20,8 @@ const SAMPLES_IN_FIVE_MINUTES: usize = 300 / SAMPLE_PERIOD as usize;\n/// Implements https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm\n/// to keep track of neighbor latency in an online fashion\n-struct RunningLatencyStats {\n+#[derive(Clone)]\n+pub struct RunningLatencyStats {\ncount: u32,\nmean: f32,\nm2: f32,\n@@ -76,7 +78,8 @@ impl RunningLatencyStats {\n/// more data processing to get correct values. 'Reach' is a 16 second bitvector of hello/IHU\n/// outcomes, but we're sampling every 5 seconds, in order to keep samples from interfering with\n/// each other we take the top 5 bits and use that to compute packet loss.\n-struct RunningPacketLossStats {\n+#[derive(Clone)]\n+pub struct RunningPacketLossStats {\n/// the number of packets lost during each 5 second sample period over the last five minutes\nfive_minute_loss: [u8; SAMPLES_IN_FIVE_MINUTES],\n/// the 'front' of the looping five minute sample queue\n@@ -144,6 +147,7 @@ fn has_packet_loss(sample: u16) -> bool {\nlost_packets > 0\n}\n+#[derive(Clone)]\npub struct NetworkMonitor {\nlatency_history: HashMap<String, RunningLatencyStats>,\npacket_loss_history: HashMap<String, RunningPacketLossStats>,\n@@ -180,6 +184,62 @@ impl Default for NetworkMonitor {\n}\n}\n+#[derive(Default, Serialize, Copy, Clone)]\n+pub struct LatencyStats {\n+ avg: Option<f32>,\n+ std_dev: Option<f32>,\n+}\n+\n+#[derive(Default, Serialize, Copy, Clone)]\n+pub struct PacketLossStats {\n+ avg: Option<f32>,\n+ five_min_avg: f32,\n+}\n+\n+pub struct GetStats {}\n+\n+#[derive(Serialize, Default, Copy, Clone)]\n+pub struct IfaceStats {\n+ latency: LatencyStats,\n+ packet_loss: PacketLossStats,\n+}\n+\n+impl Message for GetStats {\n+ type Result = Result<Stats, Error>;\n+}\n+\n+pub type Stats = HashMap<String, IfaceStats>;\n+\n+impl Handler<GetStats> for NetworkMonitor {\n+ type Result = Result<Stats, Error>;\n+\n+ fn handle(&mut self, _msg: GetStats, _ctx: &mut Context<Self>) -> Self::Result {\n+ let mut stats = Stats::new();\n+\n+ for (iface, latency_stats) in self.latency_history.iter() {\n+ if let Some(packet_loss_stats) = self.packet_loss_history.get(iface) {\n+ stats.insert(\n+ iface.clone(),\n+ IfaceStats {\n+ latency: LatencyStats {\n+ avg: latency_stats.get_avg(),\n+ std_dev: latency_stats.get_std_dev(),\n+ },\n+ packet_loss: PacketLossStats {\n+ avg: packet_loss_stats.get_avg(),\n+ five_min_avg: packet_loss_stats.get_five_min_average(),\n+ },\n+ },\n+ );\n+ } else {\n+ error!(\"Found entry in one that's not in the other \")\n+ }\n+ }\n+\n+ Ok(stats)\n+ }\n+}\n+\n#[derive(Message)]\npub struct Tick {\npub babel_neighbors: Vec<BabelNeighbor>,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add packet loss and latency stats to /neighbors endpoint
20,244
28.09.2019 09:46:04
14,400
3c4a41093198b03f93e3a3c5f30a3f66575d84a2
Use test oracle for Rinkeby now that oracles can modify the blockchain using the Eth oracle for Rinkeby causes you to instantly swap back
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/system_chain.rs", "new_path": "rita/src/rita_client/dashboard/system_chain.rs", "diff": "@@ -46,7 +46,7 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\npayment.net_version = Some(4);\npayment.system_chain = SystemChain::Rinkeby;\npayment.withdraw_chain = SystemChain::Rinkeby;\n- oracle_url = \"https://updates.altheamesh.com/prices\".to_string();\n+ oracle_url = \"https://updates.altheamesh.com/testprices\".to_string();\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\n} else {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use test oracle for Rinkeby now that oracles can modify the blockchain using the Eth oracle for Rinkeby causes you to instantly swap back
20,244
28.09.2019 09:46:54
14,400
9fb3ab728004098d728e63f456a41f9785b14d2b
Bump for Beta 9 RC2
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.16\",\n+ \"rita 0.5.17\",\n]\n[[package]]\n@@ -1996,7 +1996,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.16\"\n+version = \"0.5.17\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.16\"\n+version = \"0.5.17\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 8 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 9 RC2\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 9 RC2
20,244
01.10.2019 09:13:34
14,400
04006853b07099c1380ecbd8b8257a7ef9fb0bf1
Try a different bloat heuristic Checking for outliers using the std-dev wasn't really a great strategy the std-dev would increase very quickly and messages would get silenced. Hopfully a more average focused strategy works well
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -56,20 +56,15 @@ impl RunningLatencyStats {\nlet delta2 = sample - self.mean;\nself.m2 += delta * delta2;\n}\n- /// returns true if a variable is greater than two std-dev above the mean\n- pub fn is_outlier(&self, sample: f32) -> Option<bool> {\n- if self.count > 2 {\n- let std_dev = self.get_std_dev().unwrap();\n- let avg = self.get_avg().unwrap();\n- let two_deviations = std_dev + std_dev;\n- let two_deviations_above_mean = avg + two_deviations;\n- if sample > two_deviations_above_mean {\n- Some(true)\n- } else {\n- Some(false)\n- }\n- } else {\n- None\n+ /// A hand tuned heuristic used to determine if a connection is bloated\n+ pub fn is_bloated(&self) -> bool {\n+ let avg = self.get_avg();\n+ let std_dev = self.get_std_dev();\n+ match (avg, std_dev) {\n+ (Some(avg), Some(std_dev)) => std_dev > avg * 4f32,\n+ (Some(_avg), None) => false,\n+ (None, Some(_std_dev)) => false,\n+ (None, None) => false,\n}\n}\n}\n@@ -278,14 +273,24 @@ fn observe_network(\n}\nlet running_stats = latency_history.get_mut(iface).unwrap();\nmatch (\n- running_stats.is_outlier(neigh.rtt),\n+ running_stats.is_bloated(),\nget_wg_key_by_ifname(neigh, rita_neighbors),\n+ running_stats.get_avg(),\n+ running_stats.get_std_dev(),\n) {\n- (Some(true), Some(key)) => info!(\"Latency spike of {}ms to {}\", neigh.rtt, key),\n- (Some(true), None) => {\n- error!(\"We have a latency spike to {} but no Rita neighbor!\", iface)\n- }\n- (_, _) => {}\n+ (true, Some(key), Some(avg), Some(std_dev)) => info!(\n+ \"{} is now defined as bloated with AVG {} STDDEV {} and CV {}!\",\n+ key, avg, std_dev, neigh.rtt\n+ ),\n+ (false, Some(key), Some(avg), Some(std_dev)) => info!(\n+ \"Neighbor {} is ok with AVG {} STDDEV {} and CV {}\",\n+ key, avg, std_dev, neigh.rtt\n+ ),\n+ (true, None, _, _) => error!(\n+ \"We have a bloated connection to {} but no Rita neighbor!\",\n+ iface\n+ ),\n+ (_, _, _, _) => {}\n}\nrunning_stats.add_sample(neigh.rtt);\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Try a different bloat heuristic Checking for outliers using the std-dev wasn't really a great strategy the std-dev would increase very quickly and messages would get silenced. Hopfully a more average focused strategy works well
20,244
01.10.2019 17:49:40
14,400
2a8cd5865c0263017fc8081ec47316285523fc46
Update nicknames live This updates nicknames for already open tunnels. This doesn't provide any functionality beyond the cosmetic.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -792,6 +792,8 @@ impl TunnelManager {\ntunnel\n);\ntunnel.last_contact = Instant::now();\n+ // update the nickname in case they changed it live\n+ tunnel.neigh_id.global.nickname = their_localid.global.nickname;\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update nicknames live This updates nicknames for already open tunnels. This doesn't provide any functionality beyond the cosmetic.
20,244
01.10.2019 18:03:44
14,400
a38021475f7e257f6e2f0d2d02d90ad5152e1b61
Add noop state for eth bridge
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -289,6 +289,12 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\n) as Box<dyn Future<Item = (), Error = Error>>\n// all other steps are done and the eth is sitting and waiting\n} else {\n+ TokenBridge::from_registry().do_send(DetailedStateChange(\n+ DetailedBridgeState::NoOp {\n+ eth_balance: our_eth_balance,\n+ wei_per_dollar,\n+ },\n+ ));\nBox::new(futures::future::ok(()))\nas Box<dyn Future<Item = (), Error = Error>>\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add noop state for eth bridge
20,244
01.10.2019 11:05:37
14,400
7401dc2ddaaf778ae2f3af69d70579bb3c25e78d
Prototype automated latency shaping This is an early and very blunt version of an automated bufferbloat detecting bandwidth shaper.
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -103,15 +103,20 @@ impl dyn KernelInterface {\n/// This sets up latency protecting flow control, either cake on openwrt\n/// or fq_codel on older devices/kernels\n- pub fn set_codel_shaping(&self, iface_name: &str) -> Result<(), Error> {\n+ pub fn set_codel_shaping(&self, iface_name: &str, speed: Option<usize>) -> Result<(), Error> {\nif self.has_qdisc(iface_name)? {\nself.delete_qdisc(iface_name)?;\n}\n+ let bandwidth = match speed {\n+ Some(val) => format!(\"bandwidth {}mbps\", val),\n+ None => \"unlimited\".to_string(),\n+ };\nlet output = self.run_command(\n\"tc\",\n&[\n\"qdisc\", \"add\", \"dev\", iface_name, \"root\", \"handle\", \"1:\", \"cake\", \"metro\",\n+ &bandwidth,\n],\n)?;\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "//! it also monitors various network properties to display to the user and to log for later investigation\nuse crate::rita_common::rita_loop::fast_loop::FAST_LOOP_SPEED;\n+use crate::rita_common::tunnel_manager::GotBloat;\nuse crate::rita_common::tunnel_manager::Neighbor as RitaNeighbor;\n+use crate::rita_common::tunnel_manager::TunnelManager;\nuse actix::Actor;\nuse actix::Context;\nuse actix::Handler;\n@@ -278,10 +280,16 @@ fn observe_network(\nrunning_stats.get_avg(),\nrunning_stats.get_std_dev(),\n) {\n- (true, Some(key), Some(avg), Some(std_dev)) => info!(\n+ (true, Some(key), Some(avg), Some(std_dev)) => {\n+ info!(\n\"{} is now defined as bloated with AVG {} STDDEV {} and CV {}!\",\nkey, avg, std_dev, neigh.rtt\n- ),\n+ );\n+ // shape the misbehaving tunnel\n+ TunnelManager::from_registry().do_send(GotBloat {\n+ iface: iface.to_string(),\n+ });\n+ }\n(false, Some(key), Some(avg), Some(std_dev)) => info!(\n\"Neighbor {} is ok with AVG {} STDDEV {} and CV {}\",\nkey, avg, std_dev, neigh.rtt\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -130,6 +130,7 @@ pub struct Tunnel {\npub listen_port: u16, // the local port this tunnel is listening on\npub neigh_id: LocalIdentity, // the identity of the counterparty tunnel\npub last_contact: Instant, // When's the last we heard from the other end of this tunnel?\n+ pub speed_limit: Option<usize>, // banwidth limit in mbps, used for Codel shaping\nstate: TunnelState,\n}\n@@ -148,6 +149,7 @@ impl Tunnel {\nlisten_port: our_listen_port,\nneigh_id: their_id,\nlast_contact: Instant::now(),\n+ speed_limit: None,\n// By default new tunnels are in Registered state\nstate: TunnelState {\npayment_state: PaymentState::Paid,\n@@ -172,7 +174,7 @@ impl Tunnel {\nnetwork.external_nic.clone(),\n&mut SETTING.get_network_mut().default_route,\n)?;\n- KI.set_codel_shaping(&self.iface_name)\n+ KI.set_codel_shaping(&self.iface_name, None)\n}\n/// Register this tunnel into Babel monitor\n@@ -268,6 +270,71 @@ impl Default for TunnelManager {\n}\n}\n+/// Message sent by network monitor when it determines that an iface is bloated\n+pub struct GotBloat {\n+ pub iface: String,\n+}\n+\n+impl Message for GotBloat {\n+ type Result = ();\n+}\n+\n+impl Handler<GotBloat> for TunnelManager {\n+ type Result = ();\n+\n+ fn handle(&mut self, msg: GotBloat, _: &mut Context<Self>) -> Self::Result {\n+ let network_settings = SETTING.get_network();\n+ let minimum_bandwidth_limit = network_settings.minimum_bandwidth_limit;\n+ let starting_bandwidth_limit = network_settings.starting_bandwidth_limit;\n+ let bandwidth_limit_enabled = network_settings.bandwidth_limit_enabled;\n+ drop(network_settings);\n+ if !bandwidth_limit_enabled {\n+ return;\n+ }\n+\n+ let iface = msg.iface;\n+ for (id, tunnel_list) in self.tunnels.iter_mut() {\n+ for tunnel in tunnel_list {\n+ if tunnel.iface_name == iface {\n+ match tunnel.speed_limit {\n+ // start at the startin glimit\n+ None => {\n+ tunnel.speed_limit = Some(starting_bandwidth_limit);\n+ set_shaping_or_error(&iface, starting_bandwidth_limit)\n+ }\n+ // after that cut the value by 20% each time\n+ Some(val) => {\n+ let new_val = (val as f32 * 0.8f32) as usize;\n+ if new_val < minimum_bandwidth_limit {\n+ error!(\"Interface {} for peer {} is showing bloat but we can't reduce it's bandwidth any further. Current value {}\", iface, id.wg_public_key, val);\n+ } else {\n+ info!(\n+ \"Interface {} for peer {} is showing bloat new speed value {}\",\n+ iface, id.wg_public_key, new_val\n+ );\n+ set_shaping_or_error(&iface, new_val)\n+ }\n+ }\n+ }\n+\n+ return;\n+ }\n+ }\n+ }\n+ error!(\n+ \"Could not find tunnel for banwdith limit with iface {}\",\n+ iface\n+ );\n+ }\n+}\n+\n+/// tiny little helper function for GotBloat() limit is in mbps\n+fn set_shaping_or_error(iface: &str, limit: usize) {\n+ if let Err(e) = KI.set_codel_shaping(iface, Some(limit)) {\n+ error!(\"Failed to shape tunnel for bloat! {}\", e);\n+ }\n+}\n+\n/// When listening on a tunnel fails we need to try again\npub struct TunnelMonitorFailure {\npub tunnel_to_retry: Tunnel,\n@@ -1045,7 +1112,7 @@ fn tunnel_bw_limit_update(tunnels: &HashMap<Identity, Vec<Tunnel>>) -> Result<()\nif *payment_state == PaymentState::Overdue {\nKI.set_classless_limit(iface_name, bw_per_iface)?;\n} else if *payment_state == PaymentState::Paid && has_limit {\n- KI.set_codel_shaping(iface_name)?;\n+ KI.set_codel_shaping(iface_name, None)?;\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/network.rs", "new_path": "settings/src/network.rs", "diff": "@@ -22,6 +22,18 @@ fn default_usage_tracker_file() -> String {\n\"/etc/rita-usage-tracker.json\".to_string()\n}\n+fn default_bandwidth_limit_enabled() -> bool {\n+ true\n+}\n+\n+fn default_minimum_bandwidth_limit() -> usize {\n+ 50\n+}\n+\n+fn default_starting_bandwidth_limit() -> usize {\n+ 10_000\n+}\n+\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct NetworkSettings {\n/// How much non-financial metrics matter compared to a route's cost. By default a 2x more\n@@ -93,15 +105,28 @@ pub struct NetworkSettings {\n#[serde(default = \"default_usage_tracker_file\")]\npub usage_tracker_file: String,\n#[serde(skip_deserializing, default)]\n- // Set to true by the dashboard when the user indicates they've made a backup\n+ /// Set to true by the dashboard when the user indicates they've made a backup\npub backup_created: bool,\n+ /// Determines if this device will try and shape interface speeds\n+ #[serde(default = \"default_bandwidth_limit_enabled\")]\n+ pub bandwidth_limit_enabled: bool,\n+ /// The minimum to which this device will shape an interface\n+ #[serde(default = \"default_minimum_bandwidth_limit\")]\n+ pub minimum_bandwidth_limit: usize,\n+ /// The starting value for banwidth interface shaping, should be equal to or greater than\n+ /// the maximum bandwidth of the fastest interface of the device.\n+ #[serde(default = \"default_starting_bandwidth_limit\")]\n+ pub starting_bandwidth_limit: usize,\n}\nimpl Default for NetworkSettings {\nfn default() -> Self {\nNetworkSettings {\n+ bandwidth_limit_enabled: default_bandwidth_limit_enabled(),\n+ minimum_bandwidth_limit: default_minimum_bandwidth_limit(),\n+ starting_bandwidth_limit: default_starting_bandwidth_limit(),\nbackup_created: false,\n- metric_factor: 1900,\n+ metric_factor: default_metric_factor(),\nmesh_ip: None,\nbounty_ip: \"fd00::3\".parse().unwrap(),\ndiscovery_ip: default_discovery_ip(),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Prototype automated latency shaping This is an early and very blunt version of an automated bufferbloat detecting bandwidth shaper.
20,244
01.10.2019 11:17:02
14,400
eb6792a5acb5b788b708dd2f05243c1ee1a54e10
Backup created should default, but not skip deserializing The skip deserializing option is appropriate for the is_gateway var because it will change on every reboot anyways and storing to the disk is pointless. But for the backup parameter we actually expect to read this value and have it persist long term.
[ { "change_type": "MODIFY", "old_path": "settings/src/network.rs", "new_path": "settings/src/network.rs", "diff": "@@ -104,7 +104,7 @@ pub struct NetworkSettings {\n/// Full file path for usage tracker storage\n#[serde(default = \"default_usage_tracker_file\")]\npub usage_tracker_file: String,\n- #[serde(skip_deserializing, default)]\n+ #[serde(default)]\n/// Set to true by the dashboard when the user indicates they've made a backup\npub backup_created: bool,\n/// Determines if this device will try and shape interface speeds\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Backup created should default, but not skip deserializing The skip deserializing option is appropriate for the is_gateway var because it will change on every reboot anyways and storing to the disk is pointless. But for the backup parameter we actually expect to read this value and have it persist long term.
20,244
01.10.2019 14:33:17
14,400
4427dad50f8d4223a55a77838306e5cbb39a0c2d
Reset the latency stats when you change the shaper When we change the qdisc on an interface we expect it to behave differently after. So we should reset the history in order to get a new perspective.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -63,12 +63,17 @@ impl RunningLatencyStats {\nlet avg = self.get_avg();\nlet std_dev = self.get_std_dev();\nmatch (avg, std_dev) {\n- (Some(avg), Some(std_dev)) => std_dev > avg * 4f32,\n+ (Some(avg), Some(std_dev)) => std_dev > avg * 10f32,\n(Some(_avg), None) => false,\n(None, Some(_std_dev)) => false,\n(None, None) => false,\n}\n}\n+ pub fn reset(&mut self) {\n+ self.count = 0u32;\n+ self.mean = 0f32;\n+ self.m2 = 0f32;\n+ }\n}\n/// Due to the way babel communicates packet loss the fucntions here require slightly\n@@ -289,6 +294,9 @@ fn observe_network(\nTunnelManager::from_registry().do_send(GotBloat {\niface: iface.to_string(),\n});\n+ // reset the values for this entry because we have modified\n+ // the qdisc and it's no longer an accurate representation\n+ running_stats.reset();\n}\n(false, Some(key), Some(avg), Some(std_dev)) => info!(\n\"Neighbor {} is ok with AVG {} STDDEV {} and CV {}\",\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reset the latency stats when you change the shaper When we change the qdisc on an interface we expect it to behave differently after. So we should reset the history in order to get a new perspective.
20,244
02.10.2019 10:29:36
14,400
d0616c553d773921fb51a312e3661e6d0790150f
Fix cake bandwidth setting
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -107,18 +107,41 @@ impl dyn KernelInterface {\nif self.has_qdisc(iface_name)? {\nself.delete_qdisc(iface_name)?;\n}\n- let bandwidth = match speed {\n- Some(val) => format!(\"bandwidth {}mbps\", val),\n- None => \"unlimited\".to_string(),\n- };\n-\n- let output = self.run_command(\n+ // we need to duplicate most of this array because the borrow checker gets confused\n+ // by references to vecs with contents of &str\n+ let output = match speed {\n+ Some(val) => self.run_command(\n\"tc\",\n&[\n- \"qdisc\", \"add\", \"dev\", iface_name, \"root\", \"handle\", \"1:\", \"cake\", \"metro\",\n- &bandwidth,\n+ \"qdisc\",\n+ \"add\",\n+ \"dev\",\n+ iface_name,\n+ \"root\",\n+ \"handle\",\n+ \"1:\",\n+ \"cake\",\n+ \"bandwidth\",\n+ &format!(\"{}mbit\", val),\n+ \"metro\",\n],\n- )?;\n+ )?,\n+ None => self.run_command(\n+ \"tc\",\n+ &[\n+ \"qdisc\",\n+ \"add\",\n+ \"dev\",\n+ iface_name,\n+ \"root\",\n+ \"handle\",\n+ \"1:\",\n+ \"cake\",\n+ \"unlimited\",\n+ \"metro\",\n+ ],\n+ )?,\n+ };\nif !output.status.success() {\nwarn!(\"No support for the cake qdisc is detected, falling back to fq_codel\");\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix cake bandwidth setting
20,244
02.10.2019 11:39:28
14,400
fa2a0a335b7c0eacecc74cf0c4322bad525c5583
We should count only installed routes
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -368,12 +368,18 @@ fn network_stats(babel_routes: &[BabelRoute], babel_neighbors: &[BabelNeighbor])\n}\n}\n+/// Extracts the full path rtt for Neighbors\nfn extract_rtt(neighbors: &[BabelNeighbor]) -> Vec<f32> {\nneighbors.iter().map(|neigh| neigh.rtt).collect()\n}\n+/// Extracts the full path rtt for installed routes\nfn extract_fp_rtt(routes: &[BabelRoute]) -> Vec<f32> {\n- routes.iter().map(|route| route.full_path_rtt).collect()\n+ routes\n+ .iter()\n+ .filter(|route| route.installed)\n+ .map(|route| route.full_path_rtt)\n+ .collect()\n}\nfn mean(data: &[f32]) -> Option<f32> {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
We should count only installed routes
20,244
02.10.2019 12:39:00
14,400
695d28450b8f34da6031bfa0b8d5284caefbc7e9
Save reduced bandwidth value
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -312,7 +312,8 @@ impl Handler<GotBloat> for TunnelManager {\n\"Interface {} for peer {} is showing bloat new speed value {}\",\niface, id.wg_public_key, new_val\n);\n- set_shaping_or_error(&iface, new_val)\n+ set_shaping_or_error(&iface, new_val);\n+ tunnel.speed_limit = Some(new_val);\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Save reduced bandwidth value
20,244
03.10.2019 07:45:02
14,400
3f1a4b94b94dc6af196a4b47247a71d72e762e66
Remove existing shaping online
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -289,6 +289,15 @@ impl Handler<GotBloat> for TunnelManager {\nlet bandwidth_limit_enabled = network_settings.bandwidth_limit_enabled;\ndrop(network_settings);\nif !bandwidth_limit_enabled {\n+ // removes shaping without requiring a restart\n+ for (_id, tunnel_list) in self.tunnels.iter_mut() {\n+ for tunnel in tunnel_list {\n+ if tunnel.speed_limit != None {\n+ set_shaping_or_error(&tunnel.iface_name, None);\n+ tunnel.speed_limit = None;\n+ }\n+ }\n+ }\nreturn;\n}\n@@ -300,7 +309,7 @@ impl Handler<GotBloat> for TunnelManager {\n// start at the startin glimit\nNone => {\ntunnel.speed_limit = Some(starting_bandwidth_limit);\n- set_shaping_or_error(&iface, starting_bandwidth_limit)\n+ set_shaping_or_error(&iface, Some(starting_bandwidth_limit))\n}\n// after that cut the value by 20% each time\nSome(val) => {\n@@ -312,7 +321,7 @@ impl Handler<GotBloat> for TunnelManager {\n\"Interface {} for peer {} is showing bloat new speed value {}\",\niface, id.wg_public_key, new_val\n);\n- set_shaping_or_error(&iface, new_val);\n+ set_shaping_or_error(&iface, Some(new_val));\ntunnel.speed_limit = Some(new_val);\n}\n}\n@@ -330,8 +339,8 @@ impl Handler<GotBloat> for TunnelManager {\n}\n/// tiny little helper function for GotBloat() limit is in mbps\n-fn set_shaping_or_error(iface: &str, limit: usize) {\n- if let Err(e) = KI.set_codel_shaping(iface, Some(limit)) {\n+fn set_shaping_or_error(iface: &str, limit: Option<usize>) {\n+ if let Err(e) = KI.set_codel_shaping(iface, limit) {\nerror!(\"Failed to shape tunnel for bloat! {}\", e);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove existing shaping online
20,244
03.10.2019 07:53:48
14,400
440d970106fbd32202ad4c5aa3ad03929a1e2b8b
Reset speed limit when unenforcing
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -1058,6 +1058,9 @@ fn tunnel_state_change(\n);\ntunnel.state.payment_state = PaymentState::Paid;\ntunnel_bw_limits_need_change = true;\n+ // latency detector probably got confused while enforcement\n+ // occurred\n+ tunnel.speed_limit = None;\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reset speed limit when unenforcing
20,244
03.10.2019 11:11:20
14,400
503b3cfe2d6f72c786da649bc546714fe1cae8c4
Fix eth bridge withdraw logic
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -257,23 +257,27 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\n.and_then(\nmove |(our_dai_balance, our_eth_balance, wei_per_dollar, our_xdai_balance)| {\ntrace!(\n- \"xdai rescue state is {} dai {} eth {} wei per dollar\",\n+ \"xdai rescue state is {} dai {} eth {} xdai {} wei per dollar\",\nour_dai_balance,\nour_eth_balance,\n+ our_xdai_balance,\nwei_per_dollar\n);\n+ let tx_gas: Uint256 = 21000u32.into();\n+ // if you actually ask for the gas price you'll get an incorrect value\n+ let xdai_gas_price: Uint256 = 60_000_000_000u128.into();\n+ let xdai_tx_cost = xdai_gas_price * tx_gas;\n// Money has come over the bridge\n- if our_xdai_balance > 0u32.into() {\n- Box::new(bridge.xdai_to_dai_bridge(our_xdai_balance.clone()).then(\n- move |_res| {\n+ if our_xdai_balance > xdai_tx_cost {\n+ let amount = our_xdai_balance - xdai_tx_cost;\n+ Box::new(bridge.xdai_to_dai_bridge(amount.clone()).then(move |_res| {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::XdaiToDai {\n- amount: our_xdai_balance.clone(),\n+ amount: amount.clone(),\n},\n));\nOk(())\n- },\n- )) as Box<dyn Future<Item = (), Error = Error>>\n+ })) as Box<dyn Future<Item = (), Error = Error>>\n} else if our_dai_balance > 0u32.into() {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::DaiToEth {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix eth bridge withdraw logic
20,244
04.10.2019 10:56:36
14,400
72a34008761f4ead94f53845a80d1d4b1cd81f38
More permissive matching for iface names
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "@@ -343,7 +343,7 @@ fn observe_network(\nfn get_wg_key_by_ifname(neigh: &BabelNeighbor, rita_neighbors: &[RitaNeighbor]) -> Option<WgKey> {\nfor rita_neigh in rita_neighbors.iter() {\n- if neigh.iface == rita_neigh.iface_name {\n+ if rita_neigh.iface_name.contains(&neigh.iface) {\nreturn Some(rita_neigh.identity.global.wg_public_key);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
More permissive matching for iface names
20,244
04.10.2019 11:03:54
14,400
254244d5e0b22cdad8fee24e7e7d7df4a5606e60
Bump for Beta 9 RC3
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.17\",\n+ \"rita 0.5.18\",\n]\n[[package]]\n@@ -1996,7 +1996,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.17\"\n+version = \"0.5.18\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.17\"\n+version = \"0.5.18\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 9 RC2\";\n+pub static READABLE_VERSION: &str = \"Beta 9 RC3\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 9 RC3
20,244
04.10.2019 17:04:09
14,400
de4702a8fb40ed77ca3af06576caaba473fb63bc
Upgrade Dockerfile for postgres 12
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -5,8 +5,8 @@ RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netca\nRUN apt-get install -y -t unstable iperf3\nRUN curl https://sh.rustup.rs -sSf | sh -s -- -y\nENV POSTGRES_USER=postgres\n-ENV POSTGRES_BIN=/usr/lib/postgresql/11/bin/postgres\n-ENV INITDB_BIN=/usr/lib/postgresql/11/bin/initdb\n+ENV POSTGRES_BIN=/usr/lib/postgresql/12/bin/postgres\n+ENV INITDB_BIN=/usr/lib/postgresql/12/bin/initdb\nRUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\n# we pull in the git tar instead of the local folder becuase the raw code is much much smaller\n# note that changes have to be checked in to be pulled in and tested! we pull this in near\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgrade Dockerfile for postgres 12
20,244
07.10.2019 11:17:21
14,400
b3ddf799a22b8b234745b5d7aadf48765b6581a4
Re-enable cargo audit Caught up to this with recent deps updates
[ { "change_type": "MODIFY", "old_path": ".travis.yml", "new_path": ".travis.yml", "diff": "@@ -44,7 +44,7 @@ matrix:\n- cargo fmt --all -- --check\n# to stop opt level 3 from sneaking in\n- 'grep -q ''opt-level = \"z\"'' Cargo.toml'\n- #- \"cargo install cargo-audit --force && cargo audit\"\n+ - \"cargo install cargo-audit --force && cargo audit\"\n- \"cargo install cargo-geiger --force && cargo geiger\"\n- script: ./integration-tests/rita.sh\nenv: SPEEDTEST_THROUGHPUT=\"20\" SPEEDTEST_DURATION=\"15\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 POSTGRES_USER=postgres POSTGRES_BIN=/usr/lib/postgresql/9.6/bin/postgres POSTGRES_DATABASE=/var/ramfs/postgresql/9.6/main POSTGRES_CONFIG=/etc/postgresql/9.6/main/postgresql.conf\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Re-enable cargo audit Caught up to this with recent deps updates
20,244
07.10.2019 11:25:08
14,400
38b4eeca0690ec6c0577c9c9d4384ec74957d007
Add TODO to NetworkMonitor
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_monitor/mod.rs", "new_path": "rita/src/rita_common/network_monitor/mod.rs", "diff": "//! NetworkMonitor is an experimental system to apply traffic shaping to neighbors based on the neighbor rtt\n//! it also monitors various network properties to display to the user and to log for later investigation\n+//! TODO: NetworkMonitor curently has a couple of major deficiencies, we base our throttling choices off of\n+//! round trip time, but that means that if the other side has been rebooted and the latency spike is due to them\n+//! uploading we may further limit the connection from our side without any good reason. This can be solved by\n+//! communcating the current throttle value in the hello seqence. The other problem is that we will respond to latency\n+//! spikes that are not correlated with traffic. This could lead to limiting connection throughput for reasons as mundane\n+//! as a bird flying through the connection rather than actual bloat. The solution here would be to also collect stats\n+//! on traffic over every interface and base our action off of spikes in throughput as well as spikes in latency.\nuse crate::rita_common::rita_loop::fast_loop::FAST_LOOP_SPEED;\nuse crate::rita_common::tunnel_manager::GotBloat;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add TODO to NetworkMonitor
20,249
07.10.2019 16:15:15
25,200
2811c3d16fa5140cf68b1f29df7db883d077840d
Add is_gateway to /info endpoint
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "use crate::rita_common::oracle::low_balance;\nuse crate::SETTING;\n-use ::settings::RitaCommonSettings;\nuse actix_web::{HttpRequest, Json};\nuse clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n+use settings::RitaCommonSettings;\npub static READABLE_VERSION: &str = \"Beta 9 RC3\";\n@@ -20,6 +20,7 @@ pub struct OwnInfo {\npub device: Option<String>,\npub rita_version: String,\npub version: String,\n+ pub is_gateway: bool,\n}\npub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\n@@ -34,6 +35,7 @@ pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\nlet local_fee = SETTING.get_payment().local_fee;\nlet metric_factor = SETTING.get_network().metric_factor;\nlet device = network_settings.device.clone();\n+ let is_gateway = network_settings.is_gateway.clone();\nlet reply = OwnInfo {\naddress: eth_address,\n@@ -46,6 +48,7 @@ pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\ndevice,\nrita_version: env!(\"CARGO_PKG_VERSION\").to_string(),\nversion: READABLE_VERSION.to_string(),\n+ is_gateway,\n};\nOk(Json(reply))\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add is_gateway to /info endpoint
20,244
09.10.2019 16:40:24
14,400
fc338e53603d9c1e77e0e1db98946534b89bce59
Exit tunnel should be immediately deleted on reset
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/exits.rs", "new_path": "rita/src/rita_client/dashboard/exits.rs", "diff": "@@ -256,8 +256,16 @@ pub fn reset_exit(path: Path<String>) -> Box<dyn Future<Item = HttpResponse, Err\nlet mut ret = HashMap::new();\nif let Some(exit) = exits.get_mut(&exit_name) {\n- info!(\"Changing exit {:?} state to New\", exit_name);\n+ info!(\n+ \"Changing exit {:?} state to New, and deleting wg_exit tunnel\",\n+ exit_name\n+ );\nexit.info = ExitState::New;\n+\n+ if let Err(e) = KI.del_interface(\"wg_exit\") {\n+ error!(\"Failed to delete wg_exit {:?}\", e)\n+ };\n+\nBox::new(future::ok(HttpResponse::Ok().json(ret)))\n} else {\nerror!(\"Requested a reset on unknown exit {:?}\", exit_name);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Exit tunnel should be immediately deleted on reset
20,244
09.10.2019 17:10:57
14,400
287f3f2814032a226bcb8dc521c0b6775d9b9a81
10c xdai transactions again this didn't end up being meaningful to end users and causes problems with high speed tx's
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -232,7 +232,7 @@ fn update_gas_price(web3: &Web3, full_node: String) {\nlet mut payment_settings = SETTING.get_payment_mut();\nif payment_settings.system_chain == SystemChain::Xdai {\n- payment_settings.gas_price = 60_000_000_000u128.into();\n+ payment_settings.gas_price = 240_000_000_000u128.into();\n} else {\n// use 105% of the gas price provided by the full node, this is designed\n// to keep us above the median price provided by the full node.\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
10c xdai transactions again this didn't end up being meaningful to end users and causes problems with high speed tx's
20,244
09.10.2019 18:03:54
14,400
386bd7db651b860adeb57a482b0b7402f7f1a0c7
Reduce exit non-payment grace period 3 fast_loop rounds should be long enough. Otherwise enforcement kicks in if there are both high prices and high bandwidth usage. Testcase is $1/gb bandwidth price + 4k60fps video streaming
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/debt_keeper/mod.rs", "new_path": "rita/src/rita_common/debt_keeper/mod.rs", "diff": "@@ -510,7 +510,7 @@ impl DebtKeeper {\n) {\n(true, _) => {}\n(false, Some(val)) => {\n- if Instant::now() - val > Duration::from_secs(60) {\n+ if Instant::now() - val > Duration::from_secs(15) {\ndebt_data.debt = amount;\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reduce exit non-payment grace period 3 fast_loop rounds should be long enough. Otherwise enforcement kicks in if there are both high prices and high bandwidth usage. Testcase is $1/gb bandwidth price + 4k60fps video streaming
20,244
18.09.2019 18:26:05
14,400
145206831a12ff3abdf180b5fc01c0752c038368
Arbitrary node integration test Working pretty well at this point, needs a custom utility to solve routes so that we can keep from having many nearly-equal routes because we use the same price everywhere
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/node.py", "new_path": "integration-tests/integration-test-script/node.py", "diff": "@@ -13,6 +13,9 @@ import sys\nimport time\nimport toml\n+from utils import num_to_ip\n+from utils import num_to_linklocal_ip\n+\nclass Node:\ndef __init__(self, id, local_fee, COMPAT_LAYOUT, COMPAT_LAYOUTS):\n@@ -37,7 +40,7 @@ class Node:\ninterfaces.append(\"veth-{}-{}\".format(self.id, i))\nreturn interfaces\n- def has_route(self, dest, price, next_hop, backlog=10000, verbose=False):\n+ def has_route(self, dest, price, next_hop, backlog=100000, verbose=False):\n\"\"\"\nThis function takes :data:`self` and returns ``True`` if a specified\nroute is installed in the last :data:`backlog` characters of the node's\n@@ -68,12 +71,12 @@ class Node:\nreturn False\nlast_dump = last_dump_match.group(1)\n- route_pat = re.compile(r'fd00::{d}.*price {p}.*fee {f}.*neigh fe80::{nh}.*(installed)'\n+ route_pat = re.compile(r'{d}.*price {p}.*fee {f}.*neigh {nh}.*(installed)'\n.format(\n- d=dest.id,\n+ d=num_to_ip(dest.id),\np=price,\nf=self.local_fee,\n- nh=next_hop.id\n+ nh=num_to_linklocal_ip(next_hop.id)\n))\nif route_pat.search(last_dump) is None:\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -14,6 +14,9 @@ import subprocess\nimport sys\nimport time\nimport toml\n+import random\n+import networkx as nx\n+import matplotlib.pyplot as plt\nfrom connection import Connection\nfrom utils import exec_or_exit\n@@ -34,19 +37,11 @@ abspath = os.path.abspath(__file__)\ndname = os.path.dirname(os.path.dirname(abspath))\nos.chdir(dname)\n-EXIT_NAMESPACE = \"netlab-5\"\n-EXIT_ID = 5\n-\n-GATEWAY_NAMESPACE = \"netlab-7\"\n-GATEWAY_ID = 7\n-\nNETWORK_LAB = os.path.join(dname, 'deps/network-lab/network-lab.sh')\nBABELD = os.path.join(dname, 'deps/babeld/babeld')\n-RITA_DEFAULT = os.path.join(dname, '../target/debug/rita')\n-RITA_EXIT_DEFAULT = os.path.join(dname, '../target/debug/rita_exit')\n-BOUNTY_HUNTER_DEFAULT = os.path.join(\n- dname, '/tmp/bounty_hunter/target/debug/bounty_hunter')\n+RITA_DEFAULT = os.path.join(dname, '../target/release/rita')\n+RITA_EXIT_DEFAULT = os.path.join(dname, '../target/release/rita_exit')\n# Envs for controlling postgres\nPOSTGRES_USER = os.getenv('POSTGRES_USER')\n@@ -58,18 +53,15 @@ POSTGRES_DATABASE = os.getenv('POSTGRES_DATABASE')\n# Envs for controlling compat testing\nRITA_A = os.getenv('RITA_A', RITA_DEFAULT)\nRITA_EXIT_A = os.getenv('RITA_EXIT_A', RITA_EXIT_DEFAULT)\n-BOUNTY_HUNTER_A = os.getenv('BOUNTY_HUNTER_A', BOUNTY_HUNTER_DEFAULT)\nDIR_A = os.getenv('DIR_A', 'althea_rs_a')\nRITA_B = os.getenv('RITA_B', RITA_DEFAULT)\nRITA_EXIT_B = os.getenv('RITA_EXIT_B', RITA_EXIT_DEFAULT)\n-BOUNTY_HUNTER_B = os.getenv('BOUNTY_HUNTER_B', BOUNTY_HUNTER_DEFAULT)\nDIR_B = os.getenv('DIR_B', 'althea_rs_b')\n# Current binary paths (They change to *_A or *_B depending on which node is\n# going to be run at a given moment, according to the layout)\nRITA = RITA_DEFAULT\nRITA_EXIT = RITA_EXIT_DEFAULT\n-BOUNTY_HUNTER = BOUNTY_HUNTER_DEFAULT\n# COMPAT_LAYOUTS[None] sets everything to *_A\nCOMPAT_LAYOUT = os.getenv('COMPAT_LAYOUT', None)\n@@ -118,6 +110,100 @@ EXIT_SELECT = {\n}\n+def setup_arbitrary_node_config(nodes):\n+ \"\"\"Generates an arbitrarily sized test network\"\"\"\n+ COMPAT_LAYOUTS = {\n+ None: ['a'] * nodes\n+ }\n+ world = World()\n+ for n in range(nodes - 1):\n+ node = Node(n, 10, COMPAT_LAYOUT, COMPAT_LAYOUTS)\n+ world.add_node(node)\n+ node = Node((nodes - 1), random.randint(0, 500),\n+ COMPAT_LAYOUT, COMPAT_LAYOUTS)\n+ world.add_exit_node(node)\n+\n+ # generates graphs with small world properties, as such it simulates micropops well\n+ # https://en.wikipedia.org/wiki/Watts%E2%80%93Strogatz_model\n+ ws = nx.connected_watts_strogatz_graph(\n+ nodes, random.randint(2, int(nodes/4)), 0.1)\n+ nx.draw(ws)\n+ plt.savefig(\"graph.png\")\n+\n+ # associate the nodes list with it's generated prices with\n+ # the networkx graph and it's generated topolgoy\n+ for graph_node, rita_node in zip(ws.nodes, world.nodes):\n+ print(\"Associating {} with {}\".format(graph_node, rita_node))\n+ neighbors = get_neighbors(graph_node, ws.edges)\n+ if len(neighbors) is 0:\n+ print(\"Disconnected node!\")\n+ exit(1)\n+\n+ rita_node = world.nodes[rita_node]\n+ graph_node = ws[graph_node]\n+ graph_node = {\n+ \"weight\": rita_node.local_fee, \"id\": rita_node.id}\n+\n+ for neighbor in neighbors:\n+ world.add_connection(Connection(rita_node, world.nodes[neighbor]))\n+ neighbor = {\"weight\": rita_node.local_fee}\n+\n+ # generate the all_routes list of routes to use for testing\n+ all_routes = {}\n+ for rita_node in world.nodes:\n+ rita_node = world.nodes[rita_node]\n+ all_routes[rita_node] = []\n+ for n in world.nodes:\n+ (next_hop, cost) = next_hop_and_cost(ws, rita_node.id, n)\n+ next_hop = world.nodes[next_hop]\n+ n = world.nodes[n]\n+ all_routes[rita_node].append((n, cost, next_hop))\n+\n+ traffic_test_pairs = []\n+ for _ in range(10):\n+ index_a = random.randint(0, nodes - 1)\n+ index_b = random.randint(0, nodes - 1)\n+ if index_a == index_b:\n+ continue\n+ a = world.nodes[index_a]\n+ b = world.nodes[index_b]\n+ traffic_test_pairs.append((a, b))\n+\n+ EXIT_NAMESPACE = \"netlab-{}\".format(world.exit_id)\n+ EXIT_ID = world.exit_id\n+\n+ GATEWAY_NAMESPACE = \"netlab-7\"\n+ GATEWAY_ID = 7\n+\n+ return (COMPAT_LAYOUTS, all_routes, traffic_test_pairs, world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID)\n+\n+\n+def get_neighbors(node, ajacency_list):\n+ \"\"\"Networkx only provides the very large adjaceny list, this filters that down\"\"\"\n+ neighs = set()\n+ for (a, b) in ajacency_list:\n+ if a == node:\n+ neighs.add(b)\n+ elif b == node:\n+ neighs.add(a)\n+ return neighs\n+\n+\n+def next_hop_and_cost(graph, start, finish):\n+ \"\"\"Returns the path cost computed in the Althea style\"\"\"\n+ path = nx.dijkstra_path(graph, start, finish)\n+ cost = 0\n+ for node in path:\n+ if node == start or node == finish:\n+ continue\n+ cost += graph[node][\"weight\"]\n+ if len(path) is 1:\n+ return (path[0], 0)\n+ if len(path) >= 2:\n+ print(path)\n+ return (path[1], cost)\n+\n+\ndef setup_seven_node_config():\nCOMPAT_LAYOUTS = {\nNone: ['a'] * 7, # Use *_A binaries for every node\n@@ -230,8 +316,10 @@ def setup_seven_node_config():\ndef main():\n+ # (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n+ # world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(25)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n@@ -269,7 +357,7 @@ def main():\n(time.time() - start_time, CONVERGENCE_DELAY, interval))\nprint(\"Test reachabibility and optimum routes...\")\n- time.sleep(120)\n+ time.sleep(60)\nduration = time.time() - start_time\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -274,7 +274,7 @@ def start_rita(node, dname, RITA, EXIT_SETTINGS):\nEXIT_SETTINGS[\"reg_details\"][\"email\"] = \"{}@example.com\".format(id)\n- os.system(\"ip netns exec netlab-{id} curl -XPOST 127.0.0.1:4877/settings -H 'Content-Type: application/json' -i -d '{data}'\"\n+ os.system(\"ip netns exec netlab-{id} curl --retry 5 --retry-connrefused -m 60 -XPOST 127.0.0.1:4877/settings -H 'Content-Type: application/json' -i -d '{data}'\"\n.format(id=id, data=json.dumps({\"exit_client\": EXIT_SETTINGS})))\n@@ -300,13 +300,26 @@ def start_rita_exit(node, dname, RITA_EXIT):\ndef ip_to_num(ip):\n+ if ip is \"fd00::\":\n+ return 0\n+ else:\nreturn int(ip.replace(\"fd00::\", \"\"))\ndef num_to_ip(num):\n+ if num is 0:\n+ return \"fd00::\"\n+ else:\nreturn \"fd00::{}\".format(num)\n+def num_to_linklocal_ip(num):\n+ if num is 0:\n+ return \"fe80::\"\n+ else:\n+ return \"fe80::{}\".format(num)\n+\n+\ndef fuzzy_match(numA, numB):\n# ignore small debts\nif abs(numA) < 1000000 and abs(numB) < 1000000:\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -212,6 +212,8 @@ class World:\nfor node, routes in all_routes.items():\nfor route in routes:\n+ if node.id == route[0].id:\n+ continue\ndesc = (\"Optimal route from node {} ({}) \" +\n\"to {} ({}) with next-hop {} ({}) and price {}\").format(\nnode.id,\n@@ -229,6 +231,7 @@ class World:\nreturn result\ndef test_endpoints_all(self, VERBOSE):\n+ curl_args = \"curl -sfg6 --retry 5 --retry-connrefused -m 60 \"\nfor node in self.nodes.values():\n# We don't expect the exit to work the same as others\n@@ -243,7 +246,7 @@ class World:\nprint(colored(\"Hitting /neighbors:\", \"green\"))\nresult = subprocess.Popen(shlex.split(\"ip netns exec \"\n- + \"netlab-{} curl -sfg6 [::1]:4877/neighbors\".format(node.id)),\n+ + \"netlab-{} {} [::1]:4877/neighbors\".format(node.id, curl_args)),\nstdout=subprocess.PIPE)\nassert_test(not result.wait(), \"curl-ing /neighbors\")\nstdout = result.stdout.read().decode('utf-8')\n@@ -263,7 +266,7 @@ class World:\nprint(colored(\"Hitting /exits:\", \"green\"))\nresult = subprocess.Popen(shlex.split(\"ip netns exec \"\n- + \"netlab-{} curl -sfg6 [::1]:4877/exits\".format(node.id)),\n+ + \"netlab-{} {} [::1]:4877/exits\".format(node.id, curl_args)),\nstdout=subprocess.PIPE, stderr=subprocess.PIPE)\nassert_test(not result.wait(), \"curl-ing /exits\")\nstdout = result.stdout.read().decode('utf-8')\n@@ -283,7 +286,7 @@ class World:\nprint(colored(\"Hitting /info:\", \"green\"))\nresult = subprocess.Popen(shlex.split(\"ip netns exec \"\n- + \"netlab-{} curl -sfg6 [::1]:4877/info\".format(node.id)),\n+ + \"netlab-{} {} [::1]:4877/info\".format(node.id, curl_args)),\nstdout=subprocess.PIPE, stderr=subprocess.PIPE)\nassert_test(not result.wait(), \"curl-ing /info\")\nstdout = result.stdout.read().decode('utf-8')\n@@ -303,7 +306,7 @@ class World:\nprint(colored(\"Hitting /settings:\", \"green\"))\nresult = subprocess.Popen(shlex.split(\"ip netns exec \"\n- + \"netlab-{} curl -sfg6 [::1]:4877/settings\".format(node.id)),\n+ + \"netlab-{} {} [::1]:4877/settings\".format(node.id, curl_args)),\nstdout=subprocess.PIPE, stderr=subprocess.PIPE)\nassert_test(not result.wait(), \"curl-ing /settings\")\nstdout = result.stdout.read().decode('utf-8')\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/requirements.txt", "new_path": "integration-tests/requirements.txt", "diff": "termcolor==1.1.0\ntoml==0.9.4\n+networkx==2.3\n+matplotlib==3.0.3\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/rita.sh", "new_path": "integration-tests/rita.sh", "diff": "@@ -48,7 +48,8 @@ build_rev() {\npushd $dir\ngit checkout $revision\n- cargo build --all\n+ RUSTFLAGS=\"-C target-cpu=native\"\n+ cargo build --all --release\npopd\n}\n@@ -70,19 +71,20 @@ fi\n# Only care about revisions if a compat layout was picked\nif [ ! -z \"${COMPAT_LAYOUT-}\" ] ; then\nbuild_rev $REMOTE_A \"$REVISION_A\" $DIR_A $TARGET_DIR_A\n- export RITA_A=\"$target_dir/debug/rita\"\n- export RITA_EXIT_A=\"$target_dir/debug/rita_exit\"\n+ export RITA_A=\"$target_dir/release/rita\"\n+ export RITA_EXIT_A=\"$target_dir/release/rita_exit\"\nexport DIR_A=$DIR_A\ncp -r $DIR_A/target/* $target_dir\nbuild_rev $REMOTE_B \"$REVISION_B\" $DIR_B $TARGET_DIR_B\n- export RITA_B=\"$target_dir/debug/rita\"\n- export RITA_EXIT_B=\"$target_dir/debug/rita_exit\"\n+ export RITA_B=\"$target_dir/release/rita\"\n+ export RITA_EXIT_B=\"$target_dir/release/rita_exit\"\nexport DIR_B=$DIR_B\ncp -r $DIR_B/target/* $target_dir\nelse\npushd ..\n- cargo build --all\n+ RUSTFLAGS=\"-C target-cpu=native\"\n+ cargo build --all --release\npopd\nfi\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Arbitrary node integration test Working pretty well at this point, needs a custom utility to solve routes so that we can keep from having many nearly-equal routes because we use the same price everywhere
20,244
10.10.2019 12:16:43
14,400
e8026209e771a29d4d31b33a94dee4f933763a45
Fix world subscripting
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -146,7 +146,6 @@ def setup_arbitrary_node_config(nodes):\nfor neighbor in neighbors:\nworld.add_connection(Connection(rita_node, world.nodes[neighbor]))\n- neighbor = {\"weight\": rita_node.local_fee}\n# generate the all_routes list of routes to use for testing\nall_routes = {}\n@@ -154,7 +153,7 @@ def setup_arbitrary_node_config(nodes):\nrita_node = world.nodes[rita_node]\nall_routes[rita_node] = []\nfor n in world.nodes:\n- (next_hop, cost) = next_hop_and_cost(ws, rita_node.id, n)\n+ (next_hop, cost) = next_hop_and_cost(ws, rita_node.id, n, world)\nnext_hop = world.nodes[next_hop]\nn = world.nodes[n]\nall_routes[rita_node].append((n, cost, next_hop))\n@@ -189,14 +188,15 @@ def get_neighbors(node, ajacency_list):\nreturn neighs\n-def next_hop_and_cost(graph, start, finish):\n+def next_hop_and_cost(graph, start, finish, world):\n\"\"\"Returns the path cost computed in the Althea style\"\"\"\npath = nx.dijkstra_path(graph, start, finish)\ncost = 0\nfor node in path:\nif node == start or node == finish:\ncontinue\n- cost += graph[node][\"weight\"]\n+ print(world.nodes)\n+ cost += world.nodes[node].local_fee\nif len(path) is 1:\nreturn (path[0], 0)\nif len(path) >= 2:\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix world subscripting
20,244
10.10.2019 17:23:57
14,400
38d9888025d5a6cd25ad5f8130bf55cac5962aea
Allow feasible links in the integration tests otherwise same-cost paths will fail randomly
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/node.py", "new_path": "integration-tests/integration-test-script/node.py", "diff": "@@ -71,7 +71,7 @@ class Node:\nreturn False\nlast_dump = last_dump_match.group(1)\n- route_pat = re.compile(r'{d}.*price {p}.*fee {f}.*neigh {nh}.*(installed)'\n+ route_pat = re.compile(r'{d}.*price {p}.*fee {f}.*neigh {nh}.*(installed)|(feasible)'\n.format(\nd=num_to_ip(dest.id),\np=price,\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -116,12 +116,12 @@ def setup_arbitrary_node_config(nodes):\nNone: ['a'] * nodes\n}\nworld = World()\n- for n in range(nodes - 1):\n- node = Node(n, 10, COMPAT_LAYOUT, COMPAT_LAYOUTS)\n- world.add_node(node)\n- node = Node((nodes - 1), random.randint(0, 500),\n- COMPAT_LAYOUT, COMPAT_LAYOUTS)\n+ for n in range(nodes):\n+ node = Node(n, random.randint(0, 500), COMPAT_LAYOUT, COMPAT_LAYOUTS)\n+ if n == 5:\nworld.add_exit_node(node)\n+ else:\n+ world.add_node(node)\n# generates graphs with small world properties, as such it simulates micropops well\n# https://en.wikipedia.org/wiki/Watts%E2%80%93Strogatz_model\n@@ -171,8 +171,8 @@ def setup_arbitrary_node_config(nodes):\nEXIT_NAMESPACE = \"netlab-{}\".format(world.exit_id)\nEXIT_ID = world.exit_id\n- GATEWAY_NAMESPACE = \"netlab-7\"\n- GATEWAY_ID = 7\n+ GATEWAY_NAMESPACE = \"netlab-0\"\n+ GATEWAY_ID = 0\nreturn (COMPAT_LAYOUTS, all_routes, traffic_test_pairs, world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID)\n@@ -319,7 +319,7 @@ def main():\n# (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n# world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(25)\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(8)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n@@ -357,7 +357,7 @@ def main():\n(time.time() - start_time, CONVERGENCE_DELAY, interval))\nprint(\"Test reachabibility and optimum routes...\")\n- time.sleep(60)\n+ time.sleep(30)\nduration = time.time() - start_time\n@@ -371,7 +371,7 @@ def main():\nsys.exit(1)\nprint(\"Waiting for clients to get info from exits\")\n- time.sleep(5)\n+ time.sleep(15)\nfor k, v in world.nodes.items():\nif k != world.exit_id:\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -300,7 +300,8 @@ def start_rita_exit(node, dname, RITA_EXIT):\ndef ip_to_num(ip):\n- if ip is \"fd00::\":\n+ print(ip)\n+ if ip in \"fd00::\":\nreturn 0\nelse:\nreturn int(ip.replace(\"fd00::\", \"\"))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Allow feasible links in the integration tests otherwise same-cost paths will fail randomly
20,244
11.10.2019 09:52:59
14,400
f850480c03162dad25ba7e4aff439ff43b1e54fd
WIP: Fix debts tests for arbitrary scale
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -319,7 +319,7 @@ def main():\n# (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n# world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(8)\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(25)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -300,8 +300,7 @@ def start_rita_exit(node, dname, RITA_EXIT):\ndef ip_to_num(ip):\n- print(ip)\n- if ip in \"fd00::\":\n+ if ip in \"fd00::00\":\nreturn 0\nelse:\nreturn int(ip.replace(\"fd00::\", \"\"))\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -156,7 +156,7 @@ class World:\ndef test_reach(self, node_from, node_to, PING6):\nping = subprocess.Popen(\n[\"ip\", \"netns\", \"exec\", \"netlab-{}\".format(node_from.id), PING6,\n- \"fd00::{}\".format(node_to.id),\n+ num_to_ip(node_to.id),\n\"-c\", \"1\"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)\noutput = ping.stdout.read().decode(\"utf-8\")\nreturn \"1 packets transmitted, 1 received, 0% packet loss\" in output\n@@ -325,10 +325,11 @@ class World:\n\"\"\"Creates a nested dictionary of balances, for example balances[1][3] is the balance node 1 has for node 3\"\"\"\nstatus = True\nbalances = {}\n- n = 1\n+ n = 0\nwhile True:\nip = num_to_ip(n)\n+ print(\"Using ip {} to get debts\".format(ip))\nstatus = subprocess.Popen(\n[\"ip\", \"netns\", \"exec\", \"netlab-{}\".format(n), \"curl\", \"-s\", \"-g\", \"-6\",\n\"[::1]:4877/debts\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n@@ -338,6 +339,7 @@ class World:\nbreak\nstatus = json.loads(output)\nbalances[ip_to_num(ip)] = {}\n+ print(\"Storing debts for ip {} as {}\".format(ip, ip_to_num(ip)))\nfor i in status:\npeer_ip = i[\"identity\"][\"mesh_ip\"]\npeer_debt = int(i[\"payment_details\"][\"debt\"])\n@@ -467,7 +469,11 @@ class World:\nfor node in debts.keys():\nfor node_to_compare in debts[node].keys():\n- if node not in debts[node_to_compare]:\n+ if node_to_compare not in debts:\n+ print(\"{} is not in the debts list\".format(\n+ node_to_compare))\n+ continue\n+ elif node not in debts[node_to_compare]:\nprint(\"Node {} has a debt for Node {} but not the other way around!\".format(\nnode, node_to_compare))\ncontinue\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
WIP: Fix debts tests for arbitrary scale
20,244
11.10.2019 15:44:36
14,400
d397021e32a1efe0e5a63c5fd053edc7fa5beaec
Fix debts init
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -319,7 +319,7 @@ def main():\n# (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n# world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(25)\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(50)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -403,6 +403,8 @@ class World:\nif last_via.id == exit_id:\nexit = from_node\nclient = to_node\n+ self.init_pair(intended_debts, client, exit)\n+ self.init_pair(intended_debts, exit, client)\nintended_debts[exit][client] -= \\\nprice * expected_data_transfer\nintended_debts[client][exit] += \\\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix debts init
20,244
11.10.2019 17:21:59
14,400
1a78e2e24ce937f1d2965c987d433bb1f4e12528
Working 50 node test
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -17,6 +17,7 @@ import toml\nimport random\nimport networkx as nx\nimport matplotlib.pyplot as plt\n+import multiprocessing\nfrom connection import Connection\nfrom utils import exec_or_exit\n@@ -31,6 +32,8 @@ from utils import teardown\nfrom utils import check_log_contains\nfrom world import World\nfrom node import Node\n+from joblib import Parallel, delayed\n+\n# find our own file, then go up one level\nabspath = os.path.abspath(__file__)\n@@ -67,7 +70,7 @@ RITA_EXIT = RITA_EXIT_DEFAULT\nCOMPAT_LAYOUT = os.getenv('COMPAT_LAYOUT', None)\nBACKOFF_FACTOR = float(os.getenv('BACKOFF_FACTOR', 1))\n-CONVERGENCE_DELAY = float(os.getenv('CONVERGENCE_DELAY', 50))\n+CONVERGENCE_DELAY = float(os.getenv('CONVERGENCE_DELAY', 300))\nDEBUG = os.getenv('DEBUG') is not None\nINITIAL_POLL_INTERVAL = float(os.getenv('INITIAL_POLL_INTERVAL', 1))\nPING6 = os.getenv('PING6', 'ping6')\n@@ -319,7 +322,7 @@ def main():\n# (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n# world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(50)\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(100)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/requirements.txt", "new_path": "integration-tests/requirements.txt", "diff": "@@ -2,3 +2,4 @@ termcolor==1.1.0\ntoml==0.9.4\nnetworkx==2.3\nmatplotlib==3.0.3\n+joblib==0.14.0\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Working 50 node test
20,244
13.10.2019 19:07:23
14,400
45d37cd36708ec33fb6d12209c7cc4e092686661
Fix debt computation for fixed size config
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -319,10 +319,10 @@ def setup_seven_node_config():\ndef main():\n- # (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- # world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(100)\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n+ # (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n+ # world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(100)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -335,8 +335,13 @@ class World:\n\"[::1]:4877/debts\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nstatus.wait()\noutput = status.stdout.read().decode(\"utf-8\")\n- if output is \"\":\n+ # not zero is a hack to deal with the fact that the 7 node format is\n+ # one indexed and the arbitrary node one is zero indexed\n+ if output is \"\" and n is not 0:\nbreak\n+ elif output is \"\" and n is 0:\n+ n += 1\n+ continue\nstatus = json.loads(output)\nbalances[ip_to_num(ip)] = {}\nprint(\"Storing debts for ip {} as {}\".format(ip, ip_to_num(ip)))\n@@ -421,7 +426,7 @@ class World:\nfor node in intended_debts.keys():\nfor owed in intended_debts[node].keys():\nif node.id not in debts or owed.id not in debts[node.id]:\n- print(\"Debts map is incomplete! {} Has a predicted debt of {} for {} but not actual debt\".format(\n+ print(\"Debts map is incomplete! {} Has a predicted debt of {} for {} but no actual debt\".format(\nnode.id, intended_debts[node][owed], owed.id))\ncontinue\nif not fuzzy_match(debts[node.id][owed.id], intended_debts[node][owed]):\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix debt computation for fixed size config
20,244
14.10.2019 11:09:30
14,400
cc1ca9234d640f43d28c17ffc3c056df0b5387b8
We can't use the connrefused flag in Travis Curl version is too old
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -274,7 +274,7 @@ def start_rita(node, dname, RITA, EXIT_SETTINGS):\nEXIT_SETTINGS[\"reg_details\"][\"email\"] = \"{}@example.com\".format(id)\n- os.system(\"ip netns exec netlab-{id} curl --retry 5 --retry-connrefused -m 60 -XPOST 127.0.0.1:4877/settings -H 'Content-Type: application/json' -i -d '{data}'\"\n+ os.system(\"ip netns exec netlab-{id} curl --retry 5 -m 60 -XPOST 127.0.0.1:4877/settings -H 'Content-Type: application/json' -i -d '{data}'\"\n.format(id=id, data=json.dumps({\"exit_client\": EXIT_SETTINGS})))\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -231,7 +231,7 @@ class World:\nreturn result\ndef test_endpoints_all(self, VERBOSE):\n- curl_args = \"curl -sfg6 --retry 5 --retry-connrefused -m 60 \"\n+ curl_args = \"curl -sfg6 --retry 5 -m 60 \"\nfor node in self.nodes.values():\n# We don't expect the exit to work the same as others\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
We can't use the connrefused flag in Travis Curl version is too old
20,244
14.10.2019 11:18:31
14,400
cde0c1ea8b9d905a44b331190eabdf5f9eae2c3a
Upgrade libsodium to 2.5 Resolves a cve
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -192,7 +192,7 @@ dependencies = [\n\"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"sodiumoxide 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n[[package]]\n@@ -469,7 +469,7 @@ dependencies = [\n\"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"settings 0.1.0\",\n- \"sodiumoxide 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n[[package]]\n@@ -1172,7 +1172,7 @@ dependencies = [\n[[package]]\nname = \"libsodium-sys\"\n-version = \"0.2.4\"\n+version = \"0.2.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2055,7 +2055,7 @@ dependencies = [\n\"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"settings 0.1.0\",\n\"sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"sodiumoxide 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"syslog 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2363,11 +2363,11 @@ dependencies = [\n[[package]]\nname = \"sodiumoxide\"\n-version = \"0.2.4\"\n+version = \"0.2.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"libsodium-sys 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"libsodium-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n@@ -3150,7 +3150,7 @@ dependencies = [\n\"checksum lettre_email 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bbb68ca999042d965476e47bbdbacd52db0927348b6f8062c44dd04a3b1fd43b\"\n\"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)\" = \"34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba\"\n\"checksum libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd\"\n-\"checksum libsodium-sys 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"adecedd56966d117ef65b2d03aab14f1b56da9c8054a8e09bee5201c9937867e\"\n+\"checksum libsodium-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1c344ff12b90ef8fa1f0fffacd348c1fd041db331841fec9eab23fdb991f5e73\"\n\"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd\"\n\"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83\"\n\"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c\"\n@@ -3276,7 +3276,7 @@ dependencies = [\n\"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8\"\n\"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7\"\n\"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85\"\n-\"checksum sodiumoxide 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1c99301d6d59f205d2abc4f0bd168edb5cd8a42bdbe99539773a21360d2a8ff7\"\n+\"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b\"\n\"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8\"\n\"checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d\"\n\"checksum strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"032c03039aae92b350aad2e3779c352e104d919cb192ba2fabbd7b831ce4f0f6\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgrade libsodium to 2.5 Resolves a cve
20,244
16.10.2019 13:12:50
14,400
9dfff6d654cdcdc2936274a0e74287f00dba9d19
Wait until tunnels have been removed from babel before deleting them This resolves the issue described here Where babel will be uanble to free it's resources for the interface and run out of memory
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -242,6 +242,14 @@ impl Tunnel {\nOk(())\n});\nArbiter::spawn(fut);\n+ } else {\n+ // We must wait until we have flushed the interface before deleting it\n+ // otherwise we will experience this error\n+ // https://github.com/sudomesh/bugs/issues/24\n+ if let Err(e) = KI.del_interface(&tunnel.iface_name) {\n+ error!(\"Failed to delete wg interface! {:?}\", e);\n+ }\n+ TunnelManager::from_registry().do_send(PortCallback(tunnel.listen_port));\n}\nOk(())\n}),\n@@ -572,8 +580,6 @@ impl Handler<TriggerGC> for TunnelManager {\n// In the same spirit, we return the port to the free port pool only after tunnel\n// deletion goes well.\ntunnel.unmonitor(0);\n- KI.del_interface(&tunnel.iface_name)?;\n- self.free_ports.push(tunnel.listen_port);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Wait until tunnels have been removed from babel before deleting them This resolves the issue described here https://github.com/sudomesh/bugs/issues/24 Where babel will be uanble to free it's resources for the interface and run out of memory
20,244
17.10.2019 08:17:43
14,400
3fc74c0f56a6ba4109ee797a63dc1f65dee3b5a3
Update for Beta 9 RC4
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.18\",\n+ \"rita 0.5.19\",\n]\n[[package]]\n@@ -2009,7 +2009,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.18\"\n+version = \"0.5.19\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.18\"\n+version = \"0.5.19\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 9 RC3\";\n+pub static READABLE_VERSION: &str = \"Beta 9 RC4\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update for Beta 9 RC4
20,244
17.10.2019 12:35:12
14,400
58c42fbdded973ed39892488710280fe2e85a510
More verbose exit enforcement message
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/database/mod.rs", "new_path": "rita/src/rita_exit/database/mod.rs", "diff": "@@ -547,6 +547,7 @@ pub fn enforce_exit_clients(\nOk(list) => {\nlet mut clients_by_id = HashMap::new();\nlet free_tier_limit = SETTING.get_payment().free_tier_throughput;\n+ let close_threshold = SETTING.get_payment().close_threshold.clone();\nfor client in clients_list.iter() {\nif let Ok(id) = to_identity(client) {\nclients_by_id.insert(id, client);\n@@ -561,7 +562,7 @@ pub fn enforce_exit_clients(\nlet res = if debt_entry.payment_details.action\n== DebtAction::SuspendTunnel\n{\n- info!(\"Exit is enforcing on {}\", client.wg_pubkey);\n+ info!(\"Exit is enforcing on {} because their debt of {} is greater than the limit of {}\", client.wg_pubkey, debt_entry.payment_details.debt, close_threshold);\nKI.set_class_limit(\n\"wg_exit\",\nfree_tier_limit,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
More verbose exit enforcement message
20,244
17.10.2019 07:49:02
14,400
6647fd812d750ca59b168ac9e3ba78be7cc1ee58
Fail on exit ping failure
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -396,7 +396,8 @@ def main():\nif choice != 'y':\nsys.exit(0)\n- world.test_exit_reach_all()\n+ world.test_exit_reach_all(global_fail=True)\n+\nworld.test_traffic(traffic_test_pairs, TIME, SPEED)\n# wait a few seconds after traffic generation for all nodes to update their debts\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -182,15 +182,18 @@ class World:\ndef test_exit_reach_all(self, verbose=True, global_fail=True):\nexit_internal_ip = get_rita_settings(\nself.exit_id)[\"exit_network\"][\"own_internal_ip\"]\n+ ret = True\nfor node in self.nodes.values():\nif node.id == self.exit_id:\ncontinue\n- if not assert_test(self.test_exit_reach(node, exit_internal_ip), \"Exit Reachability \" +\n+ elif not assert_test(self.test_exit_reach(node, exit_internal_ip), \"Exit Reachability \" +\n\"from node {} ({})\".format(node.id,\nnode.revision),\nverbose=verbose, global_fail=global_fail):\n- return False\n- return True\n+ ret = False\n+ if global_fail and not ret:\n+ exit(1)\n+ return ret\ndef test_routes(self, all_routes, verbose=True, global_fail=True):\n\"\"\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fail on exit ping failure
20,244
17.10.2019 13:23:23
14,400
7990a56edc72882466b92fd445098cef170a0168
Give rita enough time to start for exit registration
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -270,7 +270,7 @@ def start_rita(node, dname, RITA, EXIT_SETTINGS):\n'grep -Ev \"<unknown>|mio|tokio_core|tokio_reactor|hyper\" > rita-n{id}.log &'.format(id=id, rita=RITA,\npwd=dname)\n)\n- time.sleep(1.5)\n+ time.sleep(5)\nEXIT_SETTINGS[\"reg_details\"][\"email\"] = \"{}@example.com\".format(id)\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Give rita enough time to start for exit registration
20,244
17.10.2019 17:21:56
14,400
368be0ce4913633efa918c8a2f2c274f0e3f0230
Use 120 second post-convergence wait This is somehow very important to getting stable test results
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -360,7 +360,7 @@ def main():\n(time.time() - start_time, CONVERGENCE_DELAY, interval))\nprint(\"Test reachabibility and optimum routes...\")\n- time.sleep(30)\n+ time.sleep(120)\nduration = time.time() - start_time\n@@ -374,19 +374,21 @@ def main():\nsys.exit(1)\nprint(\"Waiting for clients to get info from exits\")\n- time.sleep(15)\n+ time.sleep(5)\nfor k, v in world.nodes.items():\nif k != world.exit_id:\nregister_to_exit(v)\nprint(\"waiting for emails to be sent\")\n- time.sleep(16)\n+ time.sleep(15)\nfor k, v in world.nodes.items():\nif k != world.exit_id:\nemail_verif(v)\n+ time.sleep(15)\n+\nworld.test_endpoints_all(VERBOSE)\nif DEBUG:\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use 120 second post-convergence wait This is somehow very important to getting stable test results
20,244
17.10.2019 19:12:22
14,400
e49a269b5f0464a0c05003478aee94e5f1380103
Make scale test selectable using env var example NODES=50 bash scripts/test.sh
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -8,6 +8,8 @@ ENV POSTGRES_USER=postgres\nENV POSTGRES_BIN=/usr/lib/postgresql/12/bin/postgres\nENV INITDB_BIN=/usr/lib/postgresql/12/bin/initdb\nRUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\n+ARG NODES\n+ENV NODES=$NODES\n# we pull in the git tar instead of the local folder becuase the raw code is much much smaller\n# note that changes have to be checked in to be pulled in and tested! we pull this in near\n# the bottom to maximize caching of earlier containers\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -75,6 +75,7 @@ DEBUG = os.getenv('DEBUG') is not None\nINITIAL_POLL_INTERVAL = float(os.getenv('INITIAL_POLL_INTERVAL', 1))\nPING6 = os.getenv('PING6', 'ping6')\nVERBOSE = os.getenv('VERBOSE', None)\n+NODES = os.getenv('NODES', None)\n# bandwidth test vars\n# in seconds\n@@ -319,10 +320,14 @@ def setup_seven_node_config():\ndef main():\n+ if NODES is None or 'None' in NODES:\n+ nodes = 7\n(COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\nworld, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_seven_node_config()\n- # (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n- # world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(100)\n+ else:\n+ nodes = int(NODES)\n+ (COMPAT_LAYOUTS, all_routes, traffic_test_pairs,\n+ world, EXIT_NAMESPACE, EXIT_ID, GATEWAY_NAMESPACE, GATEWAY_ID) = setup_arbitrary_node_config(nodes)\nCOMPAT_LAYOUTS[\"random\"] = [\n'a' if random.randint(0, 1) else 'b' for _ in range(7)]\n" }, { "change_type": "MODIFY", "old_path": "scripts/test.sh", "new_path": "scripts/test.sh", "diff": "#!/bin/bash\nset -eux\n+NODES=${NODES:='None'}\n+\nRUST_TEST_THREADS=1 cargo test --all\nif ! modprobe wireguard ; then\n@@ -25,7 +27,7 @@ tar --exclude $REPOFOLDER/target \\\n--exclude $REPOFOLDER/integration-tests/container/rita.tar.gz \\\n--exclude $REPOFOLDER/scripts --dereference --hard-dereference -czf $DOCKERFOLDER/rita.tar.gz $REPOFOLDER\npushd $DOCKERFOLDER\n-time docker build -t rita-test .\n+time docker build -t rita-test --build-arg NODES=$NODES .\ntime docker run --privileged -it rita-test\nrm rita.tar.gz\npopd\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Make scale test selectable using env var example NODES=50 bash scripts/test.sh
20,244
18.10.2019 17:21:05
14,400
1e351b2b9e92b4ea516e2eceac60c73f7da9508a
Remove tests debts lookup logging No longer required
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -332,7 +332,6 @@ class World:\nwhile True:\nip = num_to_ip(n)\n- print(\"Using ip {} to get debts\".format(ip))\nstatus = subprocess.Popen(\n[\"ip\", \"netns\", \"exec\", \"netlab-{}\".format(n), \"curl\", \"-s\", \"-g\", \"-6\",\n\"[::1]:4877/debts\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n@@ -347,7 +346,6 @@ class World:\ncontinue\nstatus = json.loads(output)\nbalances[ip_to_num(ip)] = {}\n- print(\"Storing debts for ip {} as {}\".format(ip, ip_to_num(ip)))\nfor i in status:\npeer_ip = i[\"identity\"][\"mesh_ip\"]\npeer_debt = int(i[\"payment_details\"][\"debt\"])\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove tests debts lookup logging No longer required
20,244
21.10.2019 17:19:22
14,400
a4664038aabf1f6be2820d6f0e9e32a7ec1a328e
Log oracle/dao url now that we have more than one floating around it's becoming hard to keep track of.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -300,13 +300,13 @@ struct PriceUpdate {\n/// for the network to adjust bandwidth prices, that's not the case right now so the DAO suggested prices\n/// are taken at face value.\nfn update_oracle() {\n- trace!(\"Starting price update\");\n// if there's no url the user has not configured a DAO yet and\n// we simply move on\nlet url = match SETTING.get_dao().oracle_url.clone() {\nSome(url) => url,\nNone => return,\n};\n+ info!(\"Starting oracle updating using {}\", url);\nlet is_gateway = SETTING.get_network().is_gateway;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Log oracle/dao url now that we have more than one floating around it's becoming hard to keep track of.
20,244
21.10.2019 17:42:29
14,400
a55ebaac8248cbc00ce66f12cf9dbb1a044bd543
Bump for Beta 9 RC5
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.19\",\n+ \"rita 0.5.20\",\n]\n[[package]]\n@@ -2009,7 +2009,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.19\"\n+version = \"0.5.20\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.19\"\n+version = \"0.5.20\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 9 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 9 RC5\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 9 RC5
20,249
18.10.2019 21:51:09
25,200
3ca3c27c43f5d67c51c525234218f10b5fa15fd1
Add /routes endpoint
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -281,6 +281,7 @@ dependencies = [\n\"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"ipnetwork 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/Cargo.toml", "new_path": "babel_monitor/Cargo.toml", "diff": "@@ -12,3 +12,4 @@ ipnetwork = \"0.14\"\nlog = \"0.4\"\nfutures = \"0.1\"\ntokio = \"0.1\"\n+serde = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/src/lib.rs", "new_path": "babel_monitor/src/lib.rs", "diff": "@@ -14,6 +14,7 @@ use futures::future::result as future_result;\nuse futures::future::Either;\nuse futures::future::Future;\nuse ipnetwork::IpNetwork;\n+use serde::Serialize;\nuse std::iter::Iterator;\nuse std::net::IpAddr;\nuse std::net::SocketAddr;\n@@ -67,7 +68,7 @@ fn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\nreturn Err(VariableNotFound(String::from(val), String::from(line)).into());\n}\n-#[derive(Debug, Clone)]\n+#[derive(Debug, Clone, Serialize)]\npub struct Route {\npub id: String,\npub iface: String,\n" }, { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -76,6 +76,42 @@ This file documents the dashboard API found in Rita client.\n---\n+## /routes\n+\n+- URL: `<rita ip>:<rita_dashboard_port>/routes`\n+- Method: `GET`\n+- URL Params: `None`\n+- Data Params: `None`\n+- Success Response:\n+ - Code: 200 OK\n+ - Contents:\n+\n+```\n+[\n+ {\n+ \"id\": \"3b2340\",\n+ \"iface\": \"wg13\",\n+ \"xroute\": false,\n+ \"installed\": true,\n+ \"neigh_ip\": \"fe80::13ad:e310:196e:2adc\",\n+ \"prefix\": \"fd00::1337:e2f/128\",\n+ \"metric\": 96,\n+ \"refmetric\": 0,\n+ \"full_path_rtt\": 8.315,\n+ \"price\": 0,\n+ \"fee\": 277777\n+ }\n+]\n+```\n+\n+- Error Response: `500 Server Error`\n+\n+- Sample Call:\n+\n+`curl 127.0.0.1:4877/routes`\n+\n+---\n+\n## /exits\n- URL: `<rita ip>:<rita_dashboard_port>/exits'\n" }, { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -278,6 +278,7 @@ fn start_client_dashboard() {\n.route(\"/mesh_ip\", Method::GET, get_mesh_ip)\n.route(\"/mesh_ip\", Method::POST, set_mesh_ip)\n.route(\"/neighbors\", Method::GET, get_neighbor_info)\n+ .route(\"/routes\", Method::GET, get_routes)\n.route(\"/remote_logging/enabled\", Method::GET, get_remote_logging)\n.route(\n\"/remote_logging/enabled/{enabled}\",\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/neighbors.rs", "new_path": "rita/src/rita_client/dashboard/neighbors.rs", "diff": "@@ -36,6 +36,21 @@ pub struct NodeInfo {\npub stats: IfaceStats,\n}\n+pub fn get_routes(_req: HttpRequest) -> Box<dyn Future<Item = Json<Vec<Route>>, Error = Error>> {\n+ let babel_port = SETTING.get_network().babel_port;\n+ Box::new(\n+ open_babel_stream(babel_port)\n+ .from_err()\n+ .and_then(move |stream| {\n+ start_connection(stream).and_then(move |stream| {\n+ parse_routes(stream)\n+ .and_then(|(_stream, routes)| Ok(Json(routes)))\n+ .responder()\n+ })\n+ }),\n+ )\n+}\n+\n/// Gets info about neighbors, including interested data about what their route\n/// price is to the exit and how much we may owe them. The debt data is now legacy\n/// since the /debts endpoint was introduced, and should be removed when it can be\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add /routes endpoint
20,249
25.10.2019 11:41:44
25,200
870ef58b153128f82db4e90cb6b8cffa1ecb687b
Allow CORS requests from althea.net
[ { "change_type": "MODIFY", "old_path": "rita/src/middleware.rs", "new_path": "rita/src/middleware.rs", "diff": "@@ -18,16 +18,25 @@ impl<S> Middleware<S> for Headers {\n}\nfn response(&self, req: &HttpRequest<S>, mut resp: HttpResponse) -> Result<Response> {\n+ let origin = req.headers().get(\"origin\").unwrap();\n+ let url_no_port = if origin == &\"http://althea.net\" {\n+ \"althea.net\".to_string()\n+ } else {\nlet url = req.connection_info().host().to_owned();\nlet re = Regex::new(r\"^(.*):\").unwrap();\n- let url_no_port = re.captures(&url).unwrap()[1].to_string();\n+ re.captures(&url).unwrap()[1].to_string()\n+ };\n+\nif req.method() == Method::OPTIONS {\n*resp.status_mut() = StatusCode::OK;\n}\n+\n+ if url_no_port != \"\" {\nresp.headers_mut().insert(\nheader::HeaderName::try_from(\"Access-Control-Allow-Origin\").unwrap(),\nheader::HeaderValue::from_str(&format!(\"http://{}\", url_no_port)).unwrap(),\n);\n+ }\nresp.headers_mut().insert(\nheader::HeaderName::try_from(\"Access-Control-Allow-Headers\").unwrap(),\nheader::HeaderValue::from_static(\"authorization, content-type\"),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Allow CORS requests from althea.net
20,249
28.10.2019 13:47:47
25,200
9ecc9b0fc2dd0cd2a658b00731977a0387b90430
Handle case where no Origin header is provided Prevents unwrap from panicking when requests are made with curl or an agent that doesn't provide an Origin header
[ { "change_type": "MODIFY", "old_path": "rita/src/middleware.rs", "new_path": "rita/src/middleware.rs", "diff": "@@ -18,13 +18,21 @@ impl<S> Middleware<S> for Headers {\n}\nfn response(&self, req: &HttpRequest<S>, mut resp: HttpResponse) -> Result<Response> {\n- let origin = req.headers().get(\"origin\").unwrap();\n- let url_no_port = if origin == &\"http://althea.net\" {\n+ let url_no_port = match req.headers().get(\"origin\") {\n+ Some(origin) => {\n+ if origin == &\"http://althea.net\" {\n\"althea.net\".to_string()\n} else {\nlet url = req.connection_info().host().to_owned();\nlet re = Regex::new(r\"^(.*):\").unwrap();\nre.captures(&url).unwrap()[1].to_string()\n+ }\n+ }\n+ None => {\n+ let url = req.connection_info().host().to_owned();\n+ let re = Regex::new(r\"^(.*):\").unwrap();\n+ re.captures(&url).unwrap()[1].to_string()\n+ }\n};\nif req.method() == Method::OPTIONS {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Handle case where no Origin header is provided Prevents unwrap from panicking when requests are made with curl or an agent that doesn't provide an Origin header
20,249
28.10.2019 16:55:11
25,200
3ee6540e2d745b39a0eb8ba3e6c796531df43bbc
Limit oracle disabling feature to bandwidth price Disabling auto pricing should not prevent the oracle from updating other settings like the organizer fee and system blockchains.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "use crate::rita_common::rita_loop::get_web3_server;\nuse crate::SETTING;\n-use ::actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\n+use actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse actix_web::error::PayloadError;\nuse actix_web::{client, Either, HttpMessage, Result};\nuse althea_types::SystemChain;\n@@ -80,24 +80,17 @@ impl Handler<Update> for Oracle {\nfn handle(&mut self, _msg: Update, _ctx: &mut Context<Self>) -> Self::Result {\nlet payment_settings = SETTING.get_payment();\n- let dao_settings = SETTING.get_dao();\nlet full_node = get_web3_server();\nlet web3 = Web3::new(&full_node, ORACLE_TIMEOUT);\nlet our_address = payment_settings.eth_address.expect(\"No address!\");\n- let oracle_enabled = dao_settings.oracle_enabled;\ndrop(payment_settings);\n- drop(dao_settings);\ninfo!(\"About to make web3 requests to {}\", full_node);\nupdate_balance(our_address, &web3, full_node.clone(), self.zero_window);\nupdate_nonce(our_address, &web3, full_node.clone());\nupdate_gas_price(&web3, full_node.clone());\nget_net_version(&web3, full_node);\n- if oracle_enabled {\nupdate_oracle();\n- } else {\n- info!(\"User has disabled the Oracle!\");\n- }\n}\n}\n@@ -334,6 +327,11 @@ fn update_oracle() {\nmatch serde_json::from_slice::<PriceUpdate>(&new_prices) {\nOk(new_settings) => {\nlet mut payment = SETTING.get_payment_mut();\n+\n+ let dao_settings = SETTING.get_dao();\n+ let oracle_enabled = dao_settings.oracle_enabled;\n+ drop(dao_settings);\n+ if oracle_enabled {\n// This will be true on devices that have integrated switches\n// and a wan port configured. Mostly not a problem since we stopped\n// shipping wan ports by default\n@@ -342,6 +340,10 @@ fn update_oracle() {\n} else {\npayment.local_fee = new_settings.client;\n}\n+ } else {\n+ info!(\"User has disabled the Oracle!\");\n+ }\n+\npayment.max_fee = new_settings.max;\npayment.balance_warning_level =\nnew_settings.warning.into();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Limit oracle disabling feature to bandwidth price Disabling auto pricing should not prevent the oracle from updating other settings like the organizer fee and system blockchains.
20,244
10.09.2019 00:18:39
14,400
8fa8f44db85588b970f5b233e946d6d56026928f
fq_codel as leaf qdisc This adds codel as the leaf qdisc to the exit htb setup. I don't think this is actually doing much over pfifo-fast in it's current form though
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -262,11 +262,33 @@ impl dyn KernelInterface {\n],\n)?;\n+ if !output.status.success() {\n+ let res = String::from_utf8(output.stderr)?;\n+ bail!(\"Failed to update qdisc class limit! {:?}\", res);\n+ }\n+\n+ let output = self.run_command(\n+ \"tc\",\n+ &[\n+ \"qdisc\",\n+ modifier,\n+ \"dev\",\n+ iface_name,\n+ \"parent\",\n+ &format!(\"1:{}\", class_id),\n+ \"handle\",\n+ &format!(\"{}:\", class_id),\n+ \"fq_codel\",\n+ \"quantum\",\n+ \"1354\",\n+ ],\n+ )?;\n+\nif output.status.success() {\nOk(())\n} else {\nlet res = String::from_utf8(output.stderr)?;\n- bail!(\"Failed to update qdisc class limit! {:?}\", res);\n+ bail!(\"Failed to update qdisc codel leaf limit! {:?}\", res);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
fq_codel as leaf qdisc This adds codel as the leaf qdisc to the exit htb setup. I don't think this is actually doing much over pfifo-fast in it's current form though
20,244
29.10.2019 09:46:43
14,400
0658739e65128390b69d8ed79311198d36cef349
Use cake and not fq_codel as exit leaf qdisc This will function properly on Centos 8 systems or other systems with newer kernels and fail gracefully on Centos 7 or other systems with older kernels
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -278,18 +278,16 @@ impl dyn KernelInterface {\n&format!(\"1:{}\", class_id),\n\"handle\",\n&format!(\"{}:\", class_id),\n- \"fq_codel\",\n- \"quantum\",\n- \"1354\",\n+ \"cake\",\n+ \"metro\",\n],\n)?;\n- if output.status.success() {\n- Ok(())\n- } else {\n+ if !output.status.success() {\nlet res = String::from_utf8(output.stderr)?;\n- bail!(\"Failed to update qdisc codel leaf limit! {:?}\", res);\n+ warn!(\"Operating system does not support cake :( {:?}\", res);\n}\n+ Ok(())\n}\n/// Generates a unique traffic class id for a exit user, essentially a really dumb hashing function\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use cake and not fq_codel as exit leaf qdisc This will function properly on Centos 8 systems or other systems with newer kernels and fail gracefully on Centos 7 or other systems with older kernels
20,244
29.10.2019 14:06:25
14,400
a06d4f31911bad617d0ed427eb2b809aa2486d98
Bump for Beta 10 RC1 From here on out I'm doing this before the features get merged in order to properly 'gate' the last release
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.20\",\n+ \"rita 0.5.21\",\n]\n[[package]]\n@@ -2010,7 +2010,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.20\"\n+version = \"0.5.21\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.20\"\n+version = \"0.5.21\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 9 RC5\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC1\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 10 RC1 From here on out I'm doing this before the features get merged in order to properly 'gate' the last release
20,244
21.09.2019 08:17:57
14,400
f602e2674f4e0f3a03bb4e21a1c4215b0c7dda08
Use compressed log from Git can't update the package until crates.io ownership is updated
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -492,6 +492,7 @@ dependencies = [\n[[package]]\nname = \"compressed_log\"\nversion = \"0.2.2\"\n+source = \"git+https://github.com/althea-net/compressed_log?tag=v0.2.2#8bca9833402e6366446b36daa77003a85710be1b\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2037,7 +2038,7 @@ dependencies = [\n\"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clu 0.0.1\",\n- \"compressed_log 0.2.2\",\n+ \"compressed_log 0.2.2 (git+https://github.com/althea-net/compressed_log?tag=v0.2.2)\",\n\"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -3085,6 +3086,7 @@ dependencies = [\n\"checksum clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d1cb37bb4c73ac0c710e4f27cb8b378c4f369c4effb9792f9ecb4c57687aefad\"\n\"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f\"\n\"checksum colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6cdb90b60f2927f8d76139c72dbde7e10c3a2bc47c8594c9c7a66529f2687c03\"\n+\"checksum compressed_log 0.2.2 (git+https://github.com/althea-net/compressed_log?tag=v0.2.2)\" = \"<none>\"\n\"checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6\"\n\"checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0\"\n\"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d\"\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "@@ -65,7 +65,7 @@ r2d2 = \"0.8\"\nsha3 = \"0.8\"\nhex-literal = \"0.2\"\nsodiumoxide = \"0.2\"\n-compressed_log = { path = \"../../compressed_log\"}\n+compressed_log = {git = \"https://github.com/althea-net/compressed_log\", tag = \"v0.2.2\"}\n[dependencies.regex]\nversion = \"1.3\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use compressed log from Git can't update the package until crates.io ownership is updated
20,244
29.10.2019 14:16:06
14,400
1fd2a452e1594db5e2ec97e072f94a761b3c1e33
Use crates.io compressed_log
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -492,7 +492,7 @@ dependencies = [\n[[package]]\nname = \"compressed_log\"\nversion = \"0.2.2\"\n-source = \"git+https://github.com/althea-net/compressed_log?tag=v0.2.2#8bca9833402e6366446b36daa77003a85710be1b\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -786,14 +786,6 @@ dependencies = [\n\"backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"error-chain\"\n-version = \"0.11.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"eui48\"\nversion = \"0.4.0\"\n@@ -2038,7 +2030,7 @@ dependencies = [\n\"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clu 0.0.1\",\n- \"compressed_log 0.2.2 (git+https://github.com/althea-net/compressed_log?tag=v0.2.2)\",\n+ \"compressed_log 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2071,7 +2063,6 @@ dependencies = [\n\"settings 0.1.0\",\n\"sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"syslog 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2435,17 +2426,6 @@ dependencies = [\n\"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"syslog\"\n-version = \"4.0.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"take_mut\"\nversion = \"0.2.2\"\n@@ -3086,7 +3066,7 @@ dependencies = [\n\"checksum clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d1cb37bb4c73ac0c710e4f27cb8b378c4f369c4effb9792f9ecb4c57687aefad\"\n\"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f\"\n\"checksum colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6cdb90b60f2927f8d76139c72dbde7e10c3a2bc47c8594c9c7a66529f2687c03\"\n-\"checksum compressed_log 0.2.2 (git+https://github.com/althea-net/compressed_log?tag=v0.2.2)\" = \"<none>\"\n+\"checksum compressed_log 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9af3e5ff9d575755caa41a1e669c952345892f961aa0fd2e2f04e71c9f7fd278\"\n\"checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6\"\n\"checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0\"\n\"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d\"\n@@ -3117,7 +3097,6 @@ dependencies = [\n\"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3\"\n\"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36\"\n\"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc\"\n-\"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3\"\n\"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46\"\n\"checksum eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\" = \"<none>\"\n\"checksum eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"8c4cf866e4d3e5e773691f5f61615a224a7b0b72b7daf994fc56d1b82dab0b6b\"\n@@ -3299,7 +3278,6 @@ dependencies = [\n\"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5\"\n\"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf\"\n\"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203\"\n-\"checksum syslog 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a0641142b4081d3d44beffa4eefd7346a228cdf91ed70186db2ca2cef762d327\"\n\"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60\"\n\"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3\"\n\"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9\"\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "@@ -24,7 +24,6 @@ settings = { path = \"../settings\" }\nauto-bridge = {git = \"https://github.com/althea-net/auto_bridge\", tag = \"v0.1.5\"}\nweb30 = {git = \"https://github.com/althea-mesh/web30\", branch = \"master\"}\n-syslog = \"4\"\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nactix-web-httpauth = {git = \"https://github.com/althea-mesh/actix-web-httpauth\"}\n@@ -65,7 +64,7 @@ r2d2 = \"0.8\"\nsha3 = \"0.8\"\nhex-literal = \"0.2\"\nsodiumoxide = \"0.2\"\n-compressed_log = {git = \"https://github.com/althea-net/compressed_log\", tag = \"v0.2.2\"}\n+compressed_log = \"0.2\"\n[dependencies.regex]\nversion = \"1.3\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use crates.io compressed_log
20,244
29.10.2019 14:20:55
14,400
eac0fdae04c28163d9e87c3776eec052f7fd12cc
Remove old logging vars in exit_manager
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/exit_manager/mod.rs", "new_path": "rita/src/rita_client/exit_manager/mod.rs", "diff": "@@ -374,10 +374,6 @@ pub struct ExitManager {\nlast_exit: Option<ExitServer>,\n// the logging destination\ndest_url: String,\n- // used to store the logging state on startup so we don't double init logging\n- // as that would cause a panic\n- remote_logging_setting: bool,\n- remote_logging_already_started: bool,\n// if we are currently limiting our own connection speed due to a low balance.\nlocal_limiting: bool,\n}\n@@ -391,9 +387,7 @@ impl SystemService for ExitManager {\nfn service_started(&mut self, _ctx: &mut Context<Self>) {\ninfo!(\"Exit Manager started\");\nself.last_exit = None;\n- self.remote_logging_setting = SETTING.get_log().enabled;\nself.dest_url = SETTING.get_log().dest_url.clone();\n- self.remote_logging_already_started = false;\nself.local_limiting = false;\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove old logging vars in exit_manager
20,244
29.10.2019 14:26:42
14,400
8fdd9ef9dcb422650329e5e5ebc8ad135293fe4c
Fix comment typo in remote log init function
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/mod.rs", "new_path": "rita/src/rita_client/mod.rs", "diff": "@@ -19,7 +19,7 @@ pub fn enable_remote_logging() -> Result<(), Error> {\nlet key = SETTING\n.get_network()\n.wg_public_key\n- .expect(\"Tried to init remove logging without WgKey!\");\n+ .expect(\"Tried to init remote logging without WgKey!\");\nlet logging_url = &log.dest_url;\nlet level: LevelFilter = match log.level.parse() {\nOk(level) => level,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix comment typo in remote log init function
20,244
03.11.2019 14:53:27
18,000
003abb22a9ee892f05f7957c063ef7597db9d13d
Fix oracle deadlock The ordering of SETTINGS operations caused a deadlock in the previous Oracle patch
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -326,11 +326,11 @@ fn update_oracle() {\n// an explicit fashion\nmatch serde_json::from_slice::<PriceUpdate>(&new_prices) {\nOk(new_settings) => {\n- let mut payment = SETTING.get_payment_mut();\n-\nlet dao_settings = SETTING.get_dao();\nlet oracle_enabled = dao_settings.oracle_enabled;\ndrop(dao_settings);\n+ let mut payment = SETTING.get_payment_mut();\n+\nif oracle_enabled {\n// This will be true on devices that have integrated switches\n// and a wan port configured. Mostly not a problem since we stopped\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix oracle deadlock The ordering of SETTINGS operations caused a deadlock in the previous Oracle patch
20,244
03.09.2019 12:45:28
14,400
94d0fe9561b6b0dcb0efdbe58f28eb2af741b982
Use default functions It makes much more sense for Serde default and the Rust default trait to take the values from the same functions
[ { "change_type": "MODIFY", "old_path": "settings/src/logging.rs", "new_path": "settings/src/logging.rs", "diff": "@@ -27,9 +27,9 @@ pub struct LoggingSettings {\nimpl Default for LoggingSettings {\nfn default() -> Self {\nLoggingSettings {\n- enabled: true,\n- level: \"INFO\".to_string(),\n- dest_url: \"https://stats.altheamesh.com:9999/sink/\".to_string(),\n+ enabled: default_logging(),\n+ level: default_logging_level(),\n+ dest_url: default_logging_dest_url(),\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/network.rs", "new_path": "settings/src/network.rs", "diff": "@@ -44,8 +44,6 @@ pub struct NetworkSettings {\n/// The static IP used on mesh interfaces\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub mesh_ip: Option<IpAddr>,\n- /// Mesh IP of bounty hunter (in fd00::/8)\n- pub bounty_ip: IpAddr,\n/// Broadcast ip address used for peer discovery (in ff02::/8)\n#[serde(default = \"default_discovery_ip\")]\npub discovery_ip: Ipv6Addr,\n@@ -128,7 +126,6 @@ impl Default for NetworkSettings {\nbackup_created: false,\nmetric_factor: default_metric_factor(),\nmesh_ip: None,\n- bounty_ip: \"fd00::3\".parse().unwrap(),\ndiscovery_ip: default_discovery_ip(),\nbabel_port: 6872,\nrita_hello_port: 4876,\n" }, { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "@@ -130,28 +130,28 @@ pub struct PaymentSettings {\nimpl Default for PaymentSettings {\nfn default() -> Self {\nPaymentSettings {\n- local_fee: 3000000,\n- max_fee: 73333333,\n- dynamic_fee_multiplier: 20,\n- free_tier_throughput: 1000,\n+ local_fee: default_local_fee(),\n+ max_fee: default_max_fee(),\n+ dynamic_fee_multiplier: default_dynamic_fee_multiplier(),\n+ free_tier_throughput: default_free_tier_throughput(),\n// computed as 10x the standard transaction cost on 12/2/18\n- pay_threshold: 840_000_000_000_000i64.into(),\n+ pay_threshold: default_pay_threshold(),\n// computed as 10x the pay threshold\n- close_threshold: (-8_400_000_000_000_000i64).into(),\n- balance_warning_level: (10_000_000_000_000_000u64).into(),\n+ close_threshold: default_close_threshold(),\n+ balance_warning_level: default_balance_warning_level(),\neth_private_key: None,\neth_address: None,\nbalance: 0u64.into(),\nnonce: 0u64.into(),\n- gas_price: 10000000000u64.into(), // 10 gwei\n+ gas_price: 0u64.into(), // 10 gwei\nnet_version: None,\nnode_list: Vec::new(),\n- system_chain: SystemChain::Ethereum,\n- withdraw_chain: SystemChain::Ethereum,\n+ system_chain: default_system_chain(),\n+ withdraw_chain: default_system_chain(),\ndebts_file: default_debts_file(),\n- bridge_enabled: true,\n+ bridge_enabled: default_bridge_enabled(),\nfudge_factor: 0u8,\n- debt_limit_enabled: true,\n+ debt_limit_enabled: default_debt_limit_enabled(),\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use default functions It makes much more sense for Serde default and the Rust default trait to take the values from the same functions
20,244
03.09.2019 15:56:18
14,400
95369d55b12929e340f90d48510bc07cff578072
Toggle for user facing free tier This does not remove the free tier as a concept, it does allow the router to not forward packets from the LAN while the router has a low balance (which is technically independent of other nodes putting it on the free tier).
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "diff": "@@ -201,4 +201,49 @@ impl dyn KernelInterface {\nOk(())\n}\n+\n+ pub fn delete_client_nat_rules(&self, lan_nic: &str) -> Result<(), Error> {\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-t\",\n+ \"nat\",\n+ \"-D\",\n+ \"POSTROUTING\",\n+ \"-o\",\n+ \"wg_exit\",\n+ \"-j\",\n+ \"MASQUERADE\",\n+ ],\n+ )?;\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", &lan_nic, \"-o\", \"wg_exit\", \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", \"wg_exit\", \"-o\", &lan_nic, \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\",\n+ \"FORWARD\",\n+ \"-p\",\n+ \"tcp\",\n+ \"--tcp-flags\",\n+ \"SYN,RST\",\n+ \"SYN\",\n+ \"-j\",\n+ \"TCPMSS\",\n+ \"--clamp-mss-to-pmtu\", //should be the same as --set-mss 1300\n+ ],\n+ )?;\n+\n+ Ok(())\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/exit_manager/mod.rs", "new_path": "rita/src/rita_client/exit_manager/mod.rs", "diff": "@@ -370,10 +370,9 @@ fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\n/// An actor which pays the exit\n#[derive(Default)]\npub struct ExitManager {\n- // used to determine if we need to change the logging state\n+ // used to determine if we need to change the logging state and if we've changed exits\nlast_exit: Option<ExitServer>,\n- // the logging destination\n- dest_url: String,\n+ nat_setup: bool,\n// if we are currently limiting our own connection speed due to a low balance.\nlocal_limiting: bool,\n}\n@@ -387,7 +386,6 @@ impl SystemService for ExitManager {\nfn service_started(&mut self, _ctx: &mut Context<Self>) {\ninfo!(\"Exit Manager started\");\nself.last_exit = None;\n- self.dest_url = SETTING.get_log().dest_url.clone();\nself.local_limiting = false;\n}\n}\n@@ -396,8 +394,10 @@ impl Handler<Tick> for ExitManager {\ntype Result = ResponseFuture<(), Error>;\nfn handle(&mut self, _: Tick, _ctx: &mut Context<Self>) -> Self::Result {\n- // strange notication lets us scope our access to SETTING and prevent\n+ // scopes our access to SETTING and prevent\n// holding a readlock while exit tunnel setup requires a write lock\n+ // roughly the same as a drop(); inline\n+ let client_can_use_free_tier = { SETTING.get_payment().client_can_use_free_tier };\nlet exit_server = { SETTING.get_exit_client().get_current_exit().cloned() };\n// code that connects to the current exit server\n@@ -406,12 +406,17 @@ impl Handler<Tick> for ExitManager {\ntrace!(\"We have selected an exit!\");\nif let Some(general_details) = exit.info.clone().general_details() {\ntrace!(\"We have details for the selected exit!\");\n- // only run if we have our own details and we either have no setup exit or the chosen\n- // exit has changed, if all of that is good we check if the default route is still correct\n- // and change it again if it's not.\n- if exit.info.our_details().is_some()\n- && !(self.last_exit.is_some() && self.last_exit.clone().unwrap() == exit)\n- {\n+\n+ let signed_up_for_exit = exit.info.our_details().is_some();\n+ let exit_has_changed =\n+ !(self.last_exit.is_some() && self.last_exit.clone().unwrap() == exit);\n+ let correct_default_route = KI\n+ .get_default_route()\n+ .unwrap_or_default()\n+ .contains(&String::from(\"wg_exit\"));\n+\n+ match (signed_up_for_exit, exit_has_changed, correct_default_route) {\n+ (true, true, _) => {\ntrace!(\"Exit change, setting up exit tunnel\");\nlinux_setup_exit_tunnel(\n&exit,\n@@ -419,26 +424,47 @@ impl Handler<Tick> for ExitManager {\n&exit.info.our_details().unwrap(),\n)\n.expect(\"failure setting up exit tunnel\");\n-\n+ self.nat_setup = true;\nself.last_exit = Some(exit.clone());\n- } else if exit.info.our_details().is_some()\n- && !KI\n- .get_default_route()\n- .unwrap_or_default()\n- .contains(&String::from(\"wg_exit\"))\n- {\n+ }\n+ (true, false, false) => {\ntrace!(\"DHCP overwrite setup exit tunnel again\");\n- trace!(\"Exit change, setting up exit tunnel\");\nlinux_setup_exit_tunnel(\n&exit,\n&general_details.clone(),\n&exit.info.our_details().unwrap(),\n)\n.expect(\"failure setting up exit tunnel\");\n+ self.nat_setup = true;\n+ }\n+ _ => {}\n+ }\n+\n+ // Adds and removes the nat rules in low balance situations\n+ // this prevents the free tier from being confusing (partially working)\n+ // when deployments are not interested in having a sufficiently fast one\n+ let low_balance = low_balance();\n+ let nat_setup = self.nat_setup;\n+ match (low_balance, client_can_use_free_tier, nat_setup) {\n+ (true, false, true) => {\n+ let lan_nics = &SETTING.get_exit_client().lan_nics;\n+ for nic in lan_nics {\n+ KI.delete_client_nat_rules(&nic).unwrap();\n+ }\n+ self.nat_setup = false;\n+ }\n+ (false, _, false) => {\n+ let lan_nics = &SETTING.get_exit_client().lan_nics;\n+ for nic in lan_nics {\n+ KI.add_client_nat_rules(&nic).unwrap();\n+ }\n+ self.nat_setup = true;\n+ }\n+ _ => {}\n}\n// run billing at all times when an exit is setup\n- if self.last_exit.is_some() {\n+ if signed_up_for_exit {\nlet exit_price = general_details.exit_price;\nlet exit_internal_addr = general_details.server_internal_ip;\nlet exit_port = exit.registration_port;\n" }, { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "@@ -30,6 +30,10 @@ fn default_free_tier_throughput() -> u32 {\n1000\n}\n+fn default_client_can_use_free_tier() -> bool {\n+ true\n+}\n+\nfn default_bridge_enabled() -> bool {\ntrue\n}\n@@ -74,6 +78,10 @@ pub struct PaymentSettings {\n/// Throughput of the free tier that this node provides in kbit/s\n#[serde(default = \"default_free_tier_throughput\")]\npub free_tier_throughput: u32,\n+ /// If this is True the user may perform regular web browsing on the free tier, if it is\n+ /// false the NAT rule will be removed while the router is in the low balance state\n+ #[serde(default = \"default_client_can_use_free_tier\")]\n+ pub client_can_use_free_tier: bool,\n/// The threshold above which we will kick off a payment\n#[serde(default = \"default_pay_threshold\")]\npub pay_threshold: Int256,\n@@ -134,6 +142,7 @@ impl Default for PaymentSettings {\nmax_fee: default_max_fee(),\ndynamic_fee_multiplier: default_dynamic_fee_multiplier(),\nfree_tier_throughput: default_free_tier_throughput(),\n+ client_can_use_free_tier: default_client_can_use_free_tier(),\n// computed as 10x the standard transaction cost on 12/2/18\npay_threshold: default_pay_threshold(),\n// computed as 10x the pay threshold\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Toggle for user facing free tier This does not remove the free tier as a concept, it does allow the router to not forward packets from the LAN while the router has a low balance (which is technically independent of other nodes putting it on the free tier).
20,244
04.11.2019 19:03:59
21,600
e9d2a04b928b1302791900ff24743876bf701700
Remove unused references to local limiting These variables are unused. Left over from an investigation into how to add this feature that was dropped after realizing that limiting inbound traffic is actually rather difficult.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/exit_manager/mod.rs", "new_path": "rita/src/rita_client/exit_manager/mod.rs", "diff": "@@ -370,11 +370,9 @@ fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\n/// An actor which pays the exit\n#[derive(Default)]\npub struct ExitManager {\n- // used to determine if we need to change the logging state and if we've changed exits\n+ // used to determine if we've changed exits\nlast_exit: Option<ExitServer>,\nnat_setup: bool,\n- // if we are currently limiting our own connection speed due to a low balance.\n- local_limiting: bool,\n}\nimpl Actor for ExitManager {\n@@ -386,7 +384,6 @@ impl SystemService for ExitManager {\nfn service_started(&mut self, _ctx: &mut Context<Self>) {\ninfo!(\"Exit Manager started\");\nself.last_exit = None;\n- self.local_limiting = false;\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove unused references to local limiting These variables are unused. Left over from an investigation into how to add this feature that was dropped after realizing that limiting inbound traffic is actually rather difficult.
20,244
04.11.2019 19:37:12
21,600
50a012ae074078385bdfa92747a3bdadd178e0b2
Bump for Beta 10 RC2
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.21\",\n+ \"rita 0.5.22\",\n]\n[[package]]\n@@ -2015,7 +2015,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.21\"\n+version = \"0.5.22\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.21\"\n+version = \"0.5.22\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC1\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC2\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 10 RC2
20,244
05.11.2019 09:47:51
21,600
edbdfa04f557c30a79e4a0d998b7bc34d2264e4e
Seperate release handling functions
[ { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -351,8 +351,12 @@ fn start_client_dashboard() {\n.route(\"/router/reboot\", Method::POST, reboot_router)\n.route(\"/router/update\", Method::POST, update_router)\n.route(\"/router/password\", Method::POST, set_pass)\n- .route(\"/release_feed/get\", Method::GET, get_release_feed)\n- .route(\"/release_feed/set/{feed}\", Method::POST, set_release_feed)\n+ .route(\"/release_feed/get\", Method::GET, get_release_feed_http)\n+ .route(\n+ \"/release_feed/set/{feed}\",\n+ Method::POST,\n+ set_release_feed_http,\n+ )\n.route(\"/remote_access\", Method::GET, get_remote_access_status)\n.route(\n\"/remote_access/{status}\",\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/release_feed.rs", "new_path": "rita/src/rita_client/dashboard/release_feed.rs", "diff": "@@ -31,23 +31,27 @@ impl FromStr for ReleaseStatus {\n}\n}\n-pub fn get_release_feed(_req: HttpRequest) -> Result<HttpResponse, Error> {\n+pub fn get_release_feed_http(_req: HttpRequest) -> Result<HttpResponse, Error> {\nif !KI.is_openwrt() {\nreturn Ok(HttpResponse::new(StatusCode::BAD_REQUEST));\n}\n+ let res = get_release_feed()?;\n+ Ok(HttpResponse::Ok().json(res))\n+}\n+pub fn get_release_feed() -> Result<ReleaseStatus, Error> {\nlet lines = get_lines(CUSTOMFEEDS)?;\nfor line in lines.iter() {\nif line.contains(&\"/rc/\".to_string()) && line.contains(&FEED_NAME.to_string()) {\n- return Ok(HttpResponse::Ok().json(ReleaseStatus::ReleaseCandidate));\n+ return Ok(ReleaseStatus::ReleaseCandidate);\n} else if line.contains(&\"/pr/\".to_string()) && line.contains(&FEED_NAME.to_string()) {\n- return Ok(HttpResponse::Ok().json(ReleaseStatus::PreRelease));\n+ return Ok(ReleaseStatus::PreRelease);\n}\n}\n- Ok(HttpResponse::Ok().json(ReleaseStatus::GeneralAvailability))\n+ Ok(ReleaseStatus::GeneralAvailability)\n}\n-pub fn set_release_feed(path: Path<String>) -> Result<HttpResponse, Error> {\n+pub fn set_release_feed_http(path: Path<String>) -> Result<HttpResponse, Error> {\nif !KI.is_openwrt() {\nreturn Ok(HttpResponse::new(StatusCode::BAD_REQUEST));\n}\n@@ -62,7 +66,16 @@ pub fn set_release_feed(path: Path<String>) -> Result<HttpResponse, Error> {\n)));\n}\nlet val = val.unwrap();\n+ if let Err(e) = set_release_feed(val) {\n+ return Ok(HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR)\n+ .into_builder()\n+ .json(format!(\"Failed to write new release feed with {:?}\", e)));\n+ }\n+\n+ Ok(HttpResponse::Ok().json(()))\n+}\n+pub fn set_release_feed(val: ReleaseStatus) -> Result<(), Error> {\nlet mut lines = get_lines(CUSTOMFEEDS)?;\nfor line in lines.iter_mut() {\n@@ -86,8 +99,7 @@ pub fn set_release_feed(path: Path<String>) -> Result<HttpResponse, Error> {\n}\n}\nwrite_out(CUSTOMFEEDS, lines)?;\n-\n- Ok(HttpResponse::Ok().json(()))\n+ Ok(())\n}\nfn get_arch(line: &str) -> Result<String, Error> {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Seperate release handling functions
20,244
05.11.2019 11:45:20
21,600
d7106b669e724570f02d984fc688c7165765b10e
Add 'custom' release feeds This allows an arbitrary string to be a valid release feed. Opening up the possiblity of per network release feeds to reduce the need to roll a single release out to the entire fleet of active routers at once
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/release_feed.rs", "new_path": "rita/src/rita_client/dashboard/release_feed.rs", "diff": "@@ -12,21 +12,32 @@ use std::str::FromStr;\nstatic CUSTOMFEEDS: &str = \"/etc/opkg/customfeeds.conf\";\nstatic FEED_NAME: &str = \"openwrt_althea\";\n-#[derive(Serialize, Deserialize, Clone, Debug, Copy)]\n+#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]\npub enum ReleaseStatus {\n+ Custom(String),\nReleaseCandidate,\nPreRelease,\nGeneralAvailability,\n}\nimpl FromStr for ReleaseStatus {\n- type Err = ();\n- fn from_str(s: &str) -> Result<ReleaseStatus, ()> {\n+ type Err = Error;\n+ fn from_str(s: &str) -> Result<ReleaseStatus, Error> {\nmatch s {\n+ \"rc\" => Ok(ReleaseStatus::ReleaseCandidate),\n+ \"pr\" => Ok(ReleaseStatus::PreRelease),\n\"ReleaseCandidate\" => Ok(ReleaseStatus::ReleaseCandidate),\n\"PreRelease\" => Ok(ReleaseStatus::PreRelease),\n\"GeneralAvailability\" => Ok(ReleaseStatus::GeneralAvailability),\n- _ => Err(()),\n+ _ => {\n+ if !s.is_empty() {\n+ Ok(ReleaseStatus::Custom(s.to_string()))\n+ } else {\n+ Err(format_err!(\n+ \"Empty string can't possibly be a valid release!\"\n+ ))\n+ }\n+ }\n}\n}\n}\n@@ -42,13 +53,13 @@ pub fn get_release_feed_http(_req: HttpRequest) -> Result<HttpResponse, Error> {\npub fn get_release_feed() -> Result<ReleaseStatus, Error> {\nlet lines = get_lines(CUSTOMFEEDS)?;\nfor line in lines.iter() {\n- if line.contains(&\"/rc/\".to_string()) && line.contains(&FEED_NAME.to_string()) {\n- return Ok(ReleaseStatus::ReleaseCandidate);\n- } else if line.contains(&\"/pr/\".to_string()) && line.contains(&FEED_NAME.to_string()) {\n- return Ok(ReleaseStatus::PreRelease);\n+ // there may be other custom feeds configured, if it's not openwrt_althea skip it\n+ if !line.contains(&FEED_NAME.to_string()) {\n+ continue;\n}\n+ return get_feed(line);\n}\n- Ok(ReleaseStatus::GeneralAvailability)\n+ Err(format_err!(\"No feed openwrt_althea found!\"))\n}\npub fn set_release_feed_http(path: Path<String>) -> Result<HttpResponse, Error> {\n@@ -94,6 +105,10 @@ pub fn set_release_feed(val: ReleaseStatus) -> Result<(), Error> {\n\"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/{}/althea\",\narch\n),\n+ ReleaseStatus::Custom(ref s) => format!(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/{}/packages/{}/althea\",\n+ s, arch\n+ ),\n};\n*line = src_line;\n}\n@@ -115,6 +130,53 @@ fn get_arch(line: &str) -> Result<String, Error> {\nOk(arch)\n}\n+fn get_feed(line: &str) -> Result<ReleaseStatus, Error> {\n+ lazy_static! {\n+ static ref RE: Regex = Regex::new(r\"/(([A-Za-z0-9\\-_]+)/packages/)\")\n+ .expect(\"Unable to compile regular expression\");\n+ }\n+ if let Some(feed) = RE.captures(&line) {\n+ if let Some(val) = feed.get(0) {\n+ let a: Vec<&str> = val.as_str().split('/').collect();\n+ let feed = a[1];\n+ return Ok(feed.parse()?);\n+ }\n+ }\n+ Ok(ReleaseStatus::GeneralAvailability)\n+}\n+\n+#[test]\n+fn test_feed_feed_rc() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::ReleaseCandidate)\n+}\n+\n+#[test]\n+fn test_feed_feed_ga() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::GeneralAvailability)\n+}\n+\n+#[test]\n+fn test_feed_feed_pr() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/pr/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::PreRelease)\n+}\n+\n+#[test]\n+fn test_feed_feed_custom() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/customVal/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::Custom(\"customVal\".to_string()))\n+}\n+\n#[test]\nfn test_regex_com() {\nlet val = get_arch(\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add 'custom' release feeds This allows an arbitrary string to be a valid release feed. Opening up the possiblity of per network release feeds to reduce the need to roll a single release out to the entire fleet of active routers at once
20,244
05.11.2019 13:02:38
21,600
60d77d874820243e2e53f89c3255f0ea83a25ca9
Add Oracle update for release feeds
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -187,6 +187,7 @@ dependencies = [\n\"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n+ \"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num256 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "ADD", "old_path": null, "new_path": "althea_kernel_interface/src/file_io.rs", "diff": "+use failure::Error;\n+use std::fs::File;\n+use std::io::BufRead;\n+use std::io::BufReader;\n+use std::io::Write;\n+\n+pub fn get_lines(filename: &str) -> Result<Vec<String>, Error> {\n+ let f = File::open(filename)?;\n+ let file = BufReader::new(&f);\n+ let mut out_lines = Vec::new();\n+ for line in file.lines() {\n+ match line {\n+ Ok(val) => out_lines.push(val),\n+ Err(_) => break,\n+ }\n+ }\n+\n+ Ok(out_lines)\n+}\n+\n+pub fn write_out(filename: &str, content: Vec<String>) -> Result<(), Error> {\n+ // overwrite the old version\n+ let mut file = File::create(filename)?;\n+ let mut final_ouput = String::new();\n+ for item in content {\n+ final_ouput += &format!(\"{}\\n\", item);\n+ }\n+ file.write_all(final_ouput.as_bytes())?;\n+ Ok(())\n+}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/lib.rs", "new_path": "althea_kernel_interface/src/lib.rs", "diff": "@@ -20,6 +20,7 @@ mod delete_tunnel;\nmod dns;\nmod exit_client_tunnel;\nmod exit_server_tunnel;\n+pub mod file_io;\nmod fs_sync;\nmod get_neighbors;\nmod interface_tools;\n@@ -31,6 +32,7 @@ mod link_local_tools;\nmod manipulate_uci;\npub mod open_tunnel;\nmod openwrt_ubus;\n+pub mod opkg_feeds;\nmod ping_check;\nmod set_system_password;\nmod setup_wg_if;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "althea_kernel_interface/src/opkg_feeds.rs", "diff": "+use crate::file_io::get_lines;\n+use crate::file_io::write_out;\n+use althea_types::ReleaseStatus;\n+use failure::Error;\n+use regex::Regex;\n+\n+static CUSTOMFEEDS: &str = \"/etc/opkg/customfeeds.conf\";\n+static FEED_NAME: &str = \"openwrt_althea\";\n+\n+pub fn get_release_feed() -> Result<ReleaseStatus, Error> {\n+ let lines = get_lines(CUSTOMFEEDS)?;\n+ for line in lines.iter() {\n+ // there may be other custom feeds configured, if it's not openwrt_althea skip it\n+ if !line.contains(&FEED_NAME.to_string()) {\n+ continue;\n+ }\n+ return get_feed(line);\n+ }\n+ Err(format_err!(\"No feed openwrt_althea found!\"))\n+}\n+\n+pub fn set_release_feed(val: ReleaseStatus) -> Result<(), Error> {\n+ let mut lines = get_lines(CUSTOMFEEDS)?;\n+\n+ for line in lines.iter_mut() {\n+ if line.contains(&FEED_NAME.to_string()) {\n+ let arch = get_arch(line)?;\n+ let src_line = match val {\n+ ReleaseStatus::GeneralAvailability => format!(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/packages/{}/althea\",\n+ arch\n+ ),\n+ ReleaseStatus::PreRelease => format!(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/pr/packages/{}/althea\",\n+ arch\n+ ),\n+ ReleaseStatus::ReleaseCandidate => format!(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/{}/althea\",\n+ arch\n+ ),\n+ ReleaseStatus::Custom(ref s) => format!(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/{}/packages/{}/althea\",\n+ s, arch\n+ ),\n+ };\n+ *line = src_line;\n+ }\n+ }\n+ write_out(CUSTOMFEEDS, lines)?;\n+ Ok(())\n+}\n+\n+fn get_arch(line: &str) -> Result<String, Error> {\n+ lazy_static! {\n+ static ref RE: Regex = Regex::new(r\"(/packages/([A-Za-z0-9\\-_]+)/althea)\")\n+ .expect(\"Unable to compile regular expression\");\n+ }\n+ let cap = RE.captures(line).unwrap()[0].to_string();\n+ let arch = cap\n+ .replace(\"packages\", \"\")\n+ .replace(\"althea\", \"\")\n+ .replace(\"/\", \"\");\n+ Ok(arch)\n+}\n+\n+fn get_feed(line: &str) -> Result<ReleaseStatus, Error> {\n+ lazy_static! {\n+ static ref RE: Regex = Regex::new(r\"/(([A-Za-z0-9\\-_]+)/packages/)\")\n+ .expect(\"Unable to compile regular expression\");\n+ }\n+ if let Some(feed) = RE.captures(&line) {\n+ if let Some(val) = feed.get(0) {\n+ let a: Vec<&str> = val.as_str().split('/').collect();\n+ let feed = a[1];\n+ return Ok(feed.parse()?);\n+ }\n+ }\n+ Ok(ReleaseStatus::GeneralAvailability)\n+}\n+\n+#[test]\n+fn test_feed_feed_rc() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::ReleaseCandidate)\n+}\n+\n+#[test]\n+fn test_feed_feed_ga() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::GeneralAvailability)\n+}\n+\n+#[test]\n+fn test_feed_feed_pr() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/pr/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::PreRelease)\n+}\n+\n+#[test]\n+fn test_feed_feed_custom() {\n+ let val = get_feed(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/customVal/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(val.unwrap(), ReleaseStatus::Custom(\"customVal\".to_string()))\n+}\n+\n+#[test]\n+fn test_regex_com() {\n+ let val = get_arch(\n+ \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/mipsel_24kc/althea\",\n+ );\n+ assert_eq!(&val.unwrap(), \"mipsel_24kc\");\n+}\n+\n+#[test]\n+fn test_regex_net() {\n+ let val =\n+ get_arch(\"src/gz openwrt_althea https://updates.althea.net/packages/mipsel_24kc/althea\");\n+ assert_eq!(&val.unwrap(), \"mipsel_24kc\");\n+}\n" }, { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -16,4 +16,5 @@ eui48 = { git = \"https://github.com/althea-mesh/eui48\", features = [\"serde\"] }\nactix = { version = \"0.7\", optional = true}\nclarity = \"0.1\"\narrayvec = {version= \"0.5\", features = [\"serde\"]}\n+failure = \"0.1\"\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "use crate::wg_key::WgKey;\nuse arrayvec::ArrayString;\nuse clarity::Address;\n+use failure::Error;\nuse num256::Uint256;\nuse std::fmt;\nuse std::fmt::Display;\n@@ -277,3 +278,33 @@ pub struct PaymentTx {\n// populated when transaction is published\npub txid: Option<Uint256>,\n}\n+\n+#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]\n+pub enum ReleaseStatus {\n+ Custom(String),\n+ ReleaseCandidate,\n+ PreRelease,\n+ GeneralAvailability,\n+}\n+\n+impl FromStr for ReleaseStatus {\n+ type Err = Error;\n+ fn from_str(s: &str) -> Result<ReleaseStatus, Error> {\n+ match s {\n+ \"rc\" => Ok(ReleaseStatus::ReleaseCandidate),\n+ \"pr\" => Ok(ReleaseStatus::PreRelease),\n+ \"ReleaseCandidate\" => Ok(ReleaseStatus::ReleaseCandidate),\n+ \"PreRelease\" => Ok(ReleaseStatus::PreRelease),\n+ \"GeneralAvailability\" => Ok(ReleaseStatus::GeneralAvailability),\n+ _ => {\n+ if !s.is_empty() {\n+ Ok(ReleaseStatus::Custom(s.to_string()))\n+ } else {\n+ Err(format_err!(\n+ \"Empty string can't possibly be a valid release!\"\n+ ))\n+ }\n+ }\n+ }\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/lib.rs", "new_path": "althea_types/src/lib.rs", "diff": "#[macro_use]\nextern crate serde_derive;\n+#[macro_use]\n+extern crate failure;\nextern crate arrayvec;\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/mod.rs", "new_path": "rita/src/rita_client/dashboard/mod.rs", "diff": "@@ -18,34 +18,3 @@ pub mod router;\npub mod system_chain;\npub mod usage;\npub mod wifi;\n-\n-use failure::Error;\n-use std::fs::File;\n-use std::io::BufRead;\n-use std::io::BufReader;\n-use std::io::Write;\n-\n-fn get_lines(filename: &str) -> Result<Vec<String>, Error> {\n- let f = File::open(filename)?;\n- let file = BufReader::new(&f);\n- let mut out_lines = Vec::new();\n- for line in file.lines() {\n- match line {\n- Ok(val) => out_lines.push(val),\n- Err(_) => break,\n- }\n- }\n-\n- Ok(out_lines)\n-}\n-\n-fn write_out(filename: &str, content: Vec<String>) -> Result<(), Error> {\n- // overwrite the old version\n- let mut file = File::create(filename)?;\n- let mut final_ouput = String::new();\n- for item in content {\n- final_ouput += &format!(\"{}\\n\", item);\n- }\n- file.write_all(final_ouput.as_bytes())?;\n- Ok(())\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/release_feed.rs", "new_path": "rita/src/rita_client/dashboard/release_feed.rs", "diff": "-use crate::rita_client::dashboard::get_lines;\n-use crate::rita_client::dashboard::write_out;\nuse crate::KI;\nuse actix_web::http::StatusCode;\nuse actix_web::HttpRequest;\nuse actix_web::HttpResponse;\nuse actix_web::Path;\n+use althea_kernel_interface::opkg_feeds::get_release_feed;\n+use althea_kernel_interface::opkg_feeds::set_release_feed;\nuse failure::Error;\n-use regex::Regex;\n-use std::str::FromStr;\n-\n-static CUSTOMFEEDS: &str = \"/etc/opkg/customfeeds.conf\";\n-static FEED_NAME: &str = \"openwrt_althea\";\n-\n-#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]\n-pub enum ReleaseStatus {\n- Custom(String),\n- ReleaseCandidate,\n- PreRelease,\n- GeneralAvailability,\n-}\n-\n-impl FromStr for ReleaseStatus {\n- type Err = Error;\n- fn from_str(s: &str) -> Result<ReleaseStatus, Error> {\n- match s {\n- \"rc\" => Ok(ReleaseStatus::ReleaseCandidate),\n- \"pr\" => Ok(ReleaseStatus::PreRelease),\n- \"ReleaseCandidate\" => Ok(ReleaseStatus::ReleaseCandidate),\n- \"PreRelease\" => Ok(ReleaseStatus::PreRelease),\n- \"GeneralAvailability\" => Ok(ReleaseStatus::GeneralAvailability),\n- _ => {\n- if !s.is_empty() {\n- Ok(ReleaseStatus::Custom(s.to_string()))\n- } else {\n- Err(format_err!(\n- \"Empty string can't possibly be a valid release!\"\n- ))\n- }\n- }\n- }\n- }\n-}\npub fn get_release_feed_http(_req: HttpRequest) -> Result<HttpResponse, Error> {\nif !KI.is_openwrt() {\n@@ -50,18 +15,6 @@ pub fn get_release_feed_http(_req: HttpRequest) -> Result<HttpResponse, Error> {\nOk(HttpResponse::Ok().json(res))\n}\n-pub fn get_release_feed() -> Result<ReleaseStatus, Error> {\n- let lines = get_lines(CUSTOMFEEDS)?;\n- for line in lines.iter() {\n- // there may be other custom feeds configured, if it's not openwrt_althea skip it\n- if !line.contains(&FEED_NAME.to_string()) {\n- continue;\n- }\n- return get_feed(line);\n- }\n- Err(format_err!(\"No feed openwrt_althea found!\"))\n-}\n-\npub fn set_release_feed_http(path: Path<String>) -> Result<HttpResponse, Error> {\nif !KI.is_openwrt() {\nreturn Ok(HttpResponse::new(StatusCode::BAD_REQUEST));\n@@ -85,109 +38,3 @@ pub fn set_release_feed_http(path: Path<String>) -> Result<HttpResponse, Error>\nOk(HttpResponse::Ok().json(()))\n}\n-\n-pub fn set_release_feed(val: ReleaseStatus) -> Result<(), Error> {\n- let mut lines = get_lines(CUSTOMFEEDS)?;\n-\n- for line in lines.iter_mut() {\n- if line.contains(&FEED_NAME.to_string()) {\n- let arch = get_arch(line)?;\n- let src_line = match val {\n- ReleaseStatus::GeneralAvailability => format!(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/packages/{}/althea\",\n- arch\n- ),\n- ReleaseStatus::PreRelease => format!(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/pr/packages/{}/althea\",\n- arch\n- ),\n- ReleaseStatus::ReleaseCandidate => format!(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/{}/althea\",\n- arch\n- ),\n- ReleaseStatus::Custom(ref s) => format!(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/{}/packages/{}/althea\",\n- s, arch\n- ),\n- };\n- *line = src_line;\n- }\n- }\n- write_out(CUSTOMFEEDS, lines)?;\n- Ok(())\n-}\n-\n-fn get_arch(line: &str) -> Result<String, Error> {\n- lazy_static! {\n- static ref RE: Regex = Regex::new(r\"(/packages/([A-Za-z0-9\\-_]+)/althea)\")\n- .expect(\"Unable to compile regular expression\");\n- }\n- let cap = RE.captures(line).unwrap()[0].to_string();\n- let arch = cap\n- .replace(\"packages\", \"\")\n- .replace(\"althea\", \"\")\n- .replace(\"/\", \"\");\n- Ok(arch)\n-}\n-\n-fn get_feed(line: &str) -> Result<ReleaseStatus, Error> {\n- lazy_static! {\n- static ref RE: Regex = Regex::new(r\"/(([A-Za-z0-9\\-_]+)/packages/)\")\n- .expect(\"Unable to compile regular expression\");\n- }\n- if let Some(feed) = RE.captures(&line) {\n- if let Some(val) = feed.get(0) {\n- let a: Vec<&str> = val.as_str().split('/').collect();\n- let feed = a[1];\n- return Ok(feed.parse()?);\n- }\n- }\n- Ok(ReleaseStatus::GeneralAvailability)\n-}\n-\n-#[test]\n-fn test_feed_feed_rc() {\n- let val = get_feed(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/mipsel_24kc/althea\",\n- );\n- assert_eq!(val.unwrap(), ReleaseStatus::ReleaseCandidate)\n-}\n-\n-#[test]\n-fn test_feed_feed_ga() {\n- let val = get_feed(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/packages/mipsel_24kc/althea\",\n- );\n- assert_eq!(val.unwrap(), ReleaseStatus::GeneralAvailability)\n-}\n-\n-#[test]\n-fn test_feed_feed_pr() {\n- let val = get_feed(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/pr/packages/mipsel_24kc/althea\",\n- );\n- assert_eq!(val.unwrap(), ReleaseStatus::PreRelease)\n-}\n-\n-#[test]\n-fn test_feed_feed_custom() {\n- let val = get_feed(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/customVal/packages/mipsel_24kc/althea\",\n- );\n- assert_eq!(val.unwrap(), ReleaseStatus::Custom(\"customVal\".to_string()))\n-}\n-\n-#[test]\n-fn test_regex_com() {\n- let val = get_arch(\n- \"src/gz openwrt_althea https://updates.altheamesh.com/rc/packages/mipsel_24kc/althea\",\n- );\n- assert_eq!(&val.unwrap(), \"mipsel_24kc\");\n-}\n-\n-#[test]\n-fn test_regex_net() {\n- let val =\n- get_arch(\"src/gz openwrt_althea https://updates.althea.net/packages/mipsel_24kc/althea\");\n- assert_eq!(&val.unwrap(), \"mipsel_24kc\");\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/remote_access.rs", "new_path": "rita/src/rita_client/dashboard/remote_access.rs", "diff": "-use crate::rita_client::dashboard::get_lines;\n-use crate::rita_client::dashboard::write_out;\nuse crate::KI;\nuse crate::SETTING;\nuse actix_web::http::StatusCode;\nuse actix_web::HttpRequest;\nuse actix_web::HttpResponse;\nuse actix_web::Path;\n+use althea_kernel_interface::file_io::get_lines;\n+use althea_kernel_interface::file_io::write_out;\nuse failure::Error;\nuse settings::RitaCommonSettings;\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -12,6 +12,9 @@ use crate::SETTING;\nuse actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse actix_web::error::PayloadError;\nuse actix_web::{client, Either, HttpMessage, Result};\n+use althea_kernel_interface::opkg_feeds::get_release_feed;\n+use althea_kernel_interface::opkg_feeds::set_release_feed;\n+use althea_types::ReleaseStatus;\nuse althea_types::SystemChain;\nuse bytes::Bytes;\nuse clarity::Address;\n@@ -70,6 +73,8 @@ impl Handler<ZeroWindowStart> for Oracle {\n}\n/// How long we wait for a response from the full node\n+/// this value must be less than or equal to the FAST_LOOP_SPEED\n+/// in the rita_common fast loop\npub const ORACLE_TIMEOUT: Duration = Duration::from_secs(2);\n#[derive(Message)]\n@@ -272,7 +277,7 @@ fn update_gas_price(web3: &Web3, full_node: String) {\n}\n#[derive(Debug, Clone, Serialize, Deserialize)]\n-struct PriceUpdate {\n+struct OracleUpdate {\nclient: u32,\ngateway: u32,\nmax: u32,\n@@ -282,6 +287,9 @@ struct PriceUpdate {\nfudge_factor: u8,\nsystem_chain: SystemChain,\nwithdraw_chain: SystemChain,\n+ /// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n+ /// change the currently configured release feed\n+ release_feed: Option<ReleaseStatus>,\n/// A json payload to be merged into the existing settings\nmerge_json: serde_json::Value,\n}\n@@ -324,7 +332,7 @@ fn update_oracle() {\n// .json() only works on application/json content types unlike reqwest which handles bytes\n// transparently actix requests need to get the body and deserialize using serde_json in\n// an explicit fashion\n- match serde_json::from_slice::<PriceUpdate>(&new_prices) {\n+ match serde_json::from_slice::<OracleUpdate>(&new_prices) {\nOk(new_settings) => {\nlet dao_settings = SETTING.get_dao();\nlet oracle_enabled = dao_settings.oracle_enabled;\n@@ -372,6 +380,24 @@ fn update_oracle() {\n}\n}\n+ // update the release feed to the provided release\n+ match (new_settings.release_feed, get_release_feed()) {\n+ (None, _) => {}\n+ (Some(_new_feed), Err(e)) => {\n+ error!(\n+ \"Failed to read current release feed! {:?}\",\n+ e\n+ );\n+ }\n+ (Some(new_feed), Ok(old_feed)) => {\n+ if new_feed != old_feed {\n+ if let Err(e) = set_release_feed(new_feed) {\n+ error!(\"Failed to set new release feed! {:?}\", e);\n+ }\n+ }\n+ }\n+ }\n+\ntrace!(\"Successfully updated oracle\");\n}\nErr(e) => warn!(\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add Oracle update for release feeds
20,244
05.11.2019 13:04:02
21,600
4c5e7dfc35066b1cff8fc63c355caf0db3f18f21
Clippy nit in middleware
[ { "change_type": "MODIFY", "old_path": "rita/src/middleware.rs", "new_path": "rita/src/middleware.rs", "diff": "@@ -20,7 +20,7 @@ impl<S> Middleware<S> for Headers {\nfn response(&self, req: &HttpRequest<S>, mut resp: HttpResponse) -> Result<Response> {\nlet url_no_port = match req.headers().get(\"origin\") {\nSome(origin) => {\n- if origin == &\"http://althea.net\" {\n+ if origin == \"http://althea.net\" {\n\"althea.net\".to_string()\n} else {\nlet url = req.connection_info().host().to_owned();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Clippy nit in middleware
20,244
05.11.2019 13:05:40
21,600
745eed56c95271f7799a35e26f7f0ceab8565686
Remove oracle migration code from Beta 7 This block was used to migrate users from the old Oracle in payment settings to the independent Oracle. That's now been completed.
[ { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -26,7 +26,6 @@ extern crate arrayvec;\nuse actix_web::http::Method;\nuse actix_web::{http, server, App};\n-use althea_types::SystemChain;\nuse docopt::Docopt;\nuse env_logger;\nuse openssl_probe;\n@@ -178,30 +177,6 @@ fn main() {\ninfo!(\"logging status {:?}\", res);\n}\n- // remove in beta 9 where this info will be imported from the dao address oracle.\n- let payment_settings = SETTING.get_payment_mut();\n- let system_chain = payment_settings.system_chain;\n- drop(payment_settings);\n-\n- let mut dao_settings = SETTING.get_dao_mut();\n- if let Some(address) = dao_settings.dao_addresses.iter().last() {\n- dao_settings.oracle_url = Some(format!(\"https://updates.althea.net/{}\", address));\n- } else {\n- match system_chain {\n- SystemChain::Ethereum => {\n- dao_settings.oracle_url = Some(\"https://updates.altheamesh.com/prices\".to_string())\n- }\n- SystemChain::Xdai => {\n- dao_settings.oracle_url =\n- Some(\"https://updates.altheamesh.com/xdaiprices\".to_string())\n- }\n- SystemChain::Rinkeby => {\n- dao_settings.oracle_url = Some(\"https://updates.altheamesh.com/prices\".to_string())\n- }\n- }\n- }\n- drop(dao_settings);\n-\nif cfg!(feature = \"development\") {\nprintln!(\"Warning!\");\nprintln!(\"This build is meant only for development purposes.\");\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove oracle migration code from Beta 7 This block was used to migrate users from the old Oracle in payment settings to the independent Oracle. That's now been completed.
20,244
05.11.2019 13:42:29
21,600
be3432e16f1aacd671e470dcfbbb24d1af6a14fe
Parse ReleaseStatus from string in Oracle This fixes an edge case where Serde can't deserialize arbitrary Enums with variables automatically
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -293,6 +293,7 @@ impl FromStr for ReleaseStatus {\nmatch s {\n\"rc\" => Ok(ReleaseStatus::ReleaseCandidate),\n\"pr\" => Ok(ReleaseStatus::PreRelease),\n+ \"ga\" => Ok(ReleaseStatus::GeneralAvailability),\n\"ReleaseCandidate\" => Ok(ReleaseStatus::ReleaseCandidate),\n\"PreRelease\" => Ok(ReleaseStatus::PreRelease),\n\"GeneralAvailability\" => Ok(ReleaseStatus::GeneralAvailability),\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -14,7 +14,6 @@ use actix_web::error::PayloadError;\nuse actix_web::{client, Either, HttpMessage, Result};\nuse althea_kernel_interface::opkg_feeds::get_release_feed;\nuse althea_kernel_interface::opkg_feeds::set_release_feed;\n-use althea_types::ReleaseStatus;\nuse althea_types::SystemChain;\nuse bytes::Bytes;\nuse clarity::Address;\n@@ -289,7 +288,7 @@ struct OracleUpdate {\nwithdraw_chain: SystemChain,\n/// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n/// change the currently configured release feed\n- release_feed: Option<ReleaseStatus>,\n+ release_feed: Option<String>,\n/// A json payload to be merged into the existing settings\nmerge_json: serde_json::Value,\n}\n@@ -390,6 +389,11 @@ fn update_oracle() {\n);\n}\n(Some(new_feed), Ok(old_feed)) => {\n+ // we parse rather than just matching on a ReleaseState enum because\n+ // that's the easiest way to get the Custom(val) variant to deserialize\n+ // since from_str is implemented in althea types to work well with that\n+ // case, serde can't handle it well in the general case for various reasons\n+ if let Ok(new_feed) = new_feed.parse() {\nif new_feed != old_feed {\nif let Err(e) = set_release_feed(new_feed) {\nerror!(\"Failed to set new release feed! {:?}\", e);\n@@ -397,6 +401,7 @@ fn update_oracle() {\n}\n}\n}\n+ }\ntrace!(\"Successfully updated oracle\");\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Parse ReleaseStatus from string in Oracle This fixes an edge case where Serde can't deserialize arbitrary Enums with variables automatically
20,244
07.11.2019 10:10:44
21,600
cd1db7d13afd4486d314807fdec5c2f4ed73561d
Only one node list Originally we where considering the problem of having Aragon on one blockchain and our payments on the other. That's not going to be implemented ofr the forseeable future and for the time being I'd prefer to have the reduced complexity
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/system_chain.rs", "new_path": "rita/src/rita_client/dashboard/system_chain.rs", "diff": "@@ -21,7 +21,8 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\nlet oracle_url;\nlet mut payment = SETTING.get_payment_mut();\n- if id == SystemChain::Ethereum {\n+ match id {\n+ SystemChain::Ethereum => {\npayment.node_list = vec![\n\"https://eth.althea.org:443\".to_string(),\n\"https://mainnet.infura.io/v3/6b080f02d7004a8394444cdf232a7081\".to_string(),\n@@ -32,7 +33,8 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\noracle_url = \"https://updates.altheamesh.com/prices\".to_string();\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\n- } else if id == SystemChain::Xdai {\n+ }\n+ SystemChain::Xdai => {\npayment.node_list = vec![\"https://dai.althea.org/\".to_string()];\npayment.net_version = Some(100);\npayment.system_chain = SystemChain::Xdai;\n@@ -40,7 +42,8 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\noracle_url = \"https://updates.altheamesh.com/xdaiprices\".to_string();\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\n- } else if id == SystemChain::Rinkeby {\n+ }\n+ SystemChain::Rinkeby => {\npayment.node_list =\nvec![\"https://rinkeby.infura.io/v3/174d2ebf288a452fab8a8f90eab57be7\".to_string()];\npayment.net_version = Some(4);\n@@ -49,10 +52,7 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\noracle_url = \"https://updates.altheamesh.com/testprices\".to_string();\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\n- } else {\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(format!(\"No known chain by the identifier {:?}\", id)));\n+ }\n}\ndrop(payment);\n@@ -62,21 +62,6 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\nif !have_dao {\ndao.oracle_url = Some(oracle_url);\n}\n- if id == SystemChain::Ethereum {\n- dao.node_list = vec![\n- \"https://eth.althea.org:443\".to_string(),\n- \"https://mainnet.infura.io/v3/6b080f02d7004a8394444cdf232a7081\".to_string(),\n- ];\n- } else if id == SystemChain::Xdai {\n- dao.node_list = vec![\"https://dai.althea.org/\".to_string()];\n- } else if id == SystemChain::Rinkeby {\n- dao.node_list =\n- vec![\"https://rinkeby.infura.io/v3/174d2ebf288a452fab8a8f90eab57be7\".to_string()];\n- } else {\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(format!(\"No known chain by the identifier {:?}\", id)));\n- }\ndrop(dao);\n// try and save the config and fail if we can't\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dao_manager/mod.rs", "new_path": "rita/src/rita_common/dao_manager/mod.rs", "diff": "//! the DAO fee amount and preventing the router from drastically making a large payment\nuse crate::rita_common::payment_controller::TRANSACTION_SUBMISSON_TIMEOUT;\n+use crate::rita_common::rita_loop::get_web3_server;\nuse crate::rita_common::usage_tracker::UpdatePayments;\nuse crate::rita_common::usage_tracker::UsageTracker;\nuse crate::SETTING;\n@@ -16,8 +17,6 @@ use clarity::Transaction;\nuse futures::future::Future;\nuse num256::Int256;\nuse num_traits::Signed;\n-use rand::thread_rng;\n-use rand::Rng;\nuse settings::RitaCommonSettings;\nuse std::time::Instant;\nuse web30::client::Web3;\n@@ -153,17 +152,3 @@ impl Handler<Tick> for DAOManager {\n}\n}\n}\n-\n-/// Checks the list of full nodes, panics if none exist, if there exist\n-/// one or more a random entry from the list is returned in an attempt\n-/// to load balance across fullnodes\n-fn get_web3_server() -> String {\n- if SETTING.get_dao().node_list.is_empty() {\n- panic!(\"No full nodes available for DAO queries!\");\n- }\n- let node_list = SETTING.get_dao().node_list.clone();\n- let mut rng = thread_rng();\n- let val = rng.gen_range(0, node_list.len());\n-\n- node_list[val].clone()\n-}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/dao.rs", "new_path": "settings/src/dao.rs", "diff": "use clarity::Address;\nuse num256::Uint256;\n-fn default_node_list() -> Vec<String> {\n- vec![\n- \"https://eth.althea.org:443\".to_string(),\n- \"https://mainnet.infura.io/v3/6b080f02d7004a8394444cdf232a7081\".to_string(),\n- ]\n-}\n-\nfn default_dao_address() -> Vec<Address> {\nVec::new()\n}\n@@ -21,12 +14,6 @@ fn default_oracle_url() -> Option<String> {\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\npub struct SubnetDAOSettings {\n- /// A list of nodes to query for blockchain data\n- /// this is kept seperate from the version for payment settings node\n- /// list in order to allow for the DAO and payments to exist on different\n- /// chains, provided in name:port format\n- #[serde(default = \"default_node_list\")]\n- pub node_list: Vec<String>,\n/// List of subnet DAO's to which we are a member\n#[serde(default = \"default_dao_address\")]\npub dao_addresses: Vec<Address>,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Only one node list Originally we where considering the problem of having Aragon on one blockchain and our payments on the other. That's not going to be implemented ofr the forseeable future and for the time being I'd prefer to have the reduced complexity
20,244
07.11.2019 19:14:58
21,600
bd2b53435cb7f3b5db830a993a8f6cdc163f0587
Better logging debugging
[ { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -174,7 +174,7 @@ fn main() {\nenv_logger::init();\n} else {\nlet res = enable_remote_logging();\n- info!(\"logging status {:?}\", res);\n+ println!(\"logging status {:?}\", res);\n}\nif cfg!(feature = \"development\") {\n@@ -197,7 +197,6 @@ fn main() {\n// to get errors before lazy static\nRitaSettingsStruct::new(&settings_file).expect(\"Settings parse failure\");\n- trace!(\"Starting\");\ninfo!(\n\"crate ver {}, git hash {}\",\nenv!(\"CARGO_PKG_VERSION\"),\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/mod.rs", "new_path": "rita/src/rita_client/mod.rs", "diff": "@@ -48,6 +48,9 @@ pub fn enable_remote_logging() -> Result<(), Error> {\nlog::set_boxed_logger(Box::new(logger))?;\nlog::set_max_level(level);\n- info!(\"Remote compressed logging enabled\");\n+ println!(\n+ \"Remote compressed logging enabled with target {}\",\n+ logging_url\n+ );\nOk(())\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Better logging debugging
20,244
08.11.2019 18:39:37
21,600
d50da408670cd3e3e4623164bc11c0bf22f5a737
Bump for Beta 10 RC3
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.22\",\n+ \"rita 0.5.23\",\n]\n[[package]]\n@@ -2016,7 +2016,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.22\"\n+version = \"0.5.23\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.22\"\n+version = \"0.5.23\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC2\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC3\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 10 RC3
20,244
14.11.2019 08:11:20
18,000
bf7a89f0b4bbb336330368e0404d7ef2dee629e6
Demote some logging messages Hopefully to reduce exit logging load
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -285,7 +285,7 @@ impl dyn KernelInterface {\nif !output.status.success() {\nlet res = String::from_utf8(output.stderr)?;\n- warn!(\"Operating system does not support cake :( {:?}\", res);\n+ trace!(\"Operating system does not support cake :( {:?}\", res);\n}\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_endpoints/mod.rs", "new_path": "rita/src/rita_common/network_endpoints/mod.rs", "diff": "@@ -86,8 +86,8 @@ pub fn hello_response(\n.parse::<SocketAddr>()\n.unwrap();\n- info!(\"Got Hello from {:?}\", req.1.connection_info().remote());\n- info!(\"opening tunnel in hello_response for {:?}\", their_id);\n+ trace!(\"Got Hello from {:?}\", req.1.connection_info().remote());\n+ trace!(\"opening tunnel in hello_response for {:?}\", their_id);\nlet peer = Peer {\ncontact_socket: socket,\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/database/mod.rs", "new_path": "rita/src/rita_exit/database/mod.rs", "diff": "@@ -582,7 +582,9 @@ pub fn enforce_exit_clients(\n};\n}\nNone => {\n- warn!(\"Could not find {:?} to suspend!\", debt_entry.identity);\n+ // this can happen when clients are connected but not registered\n+ // to this specific exit\n+ trace!(\"Could not find {:?} to suspend!\", debt_entry.identity);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/traffic_watcher/mod.rs", "new_path": "rita/src/rita_exit/traffic_watcher/mod.rs", "diff": "@@ -169,7 +169,7 @@ fn counters_logging(\n}\nfn debts_logging(debts: &HashMap<Identity, i128>) {\n- info!(\"Collated total exit debts: {:?}\", debts);\n+ trace!(\"Collated total exit debts: {:?}\", debts);\ninfo!(\"Computed exit debts for {:?} clients\", debts.len());\nlet mut total_income = 0i128;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Demote some logging messages Hopefully to reduce exit logging load
20,244
14.11.2019 08:19:37
18,000
20d7fa9c69bd9d1fe36fb87fe08239492c1ebfec
Hello handler should not panic on a malformed packet
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_endpoints/mod.rs", "new_path": "rita/src/rita_common/network_endpoints/mod.rs", "diff": "@@ -78,13 +78,14 @@ pub fn hello_response(\n) -> Box<dyn Future<Item = Json<LocalIdentity>, Error = Error>> {\nlet their_id = *req.0;\n- let socket = req\n- .1\n- .connection_info()\n- .remote()\n- .unwrap()\n- .parse::<SocketAddr>()\n- .unwrap();\n+ let err_mesg = \"Malformed hello tcp packet!\";\n+ let socket = match req.1.connection_info().remote() {\n+ Some(val) => match val.parse::<SocketAddr>() {\n+ Ok(val) => val,\n+ Err(_e) => return Box::new(future::err(format_err!(\"{}\", err_mesg))),\n+ },\n+ None => return Box::new(future::err(format_err!(\"{}\", err_mesg))),\n+ };\ntrace!(\"Got Hello from {:?}\", req.1.connection_info().remote());\ntrace!(\"opening tunnel in hello_response for {:?}\", their_id);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Hello handler should not panic on a malformed packet
20,244
14.11.2019 08:51:12
18,000
5e6e9c22a0b0567d1f631d26b54295d64a2390d2
Add display for Tunnel This will make it easier to debug tunnel types as it will print the full wg key and other more searchable info rather than the byte content of the keys
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/tunnel_manager/mod.rs", "new_path": "rita/src/rita_common/tunnel_manager/mod.rs", "diff": "@@ -10,9 +10,9 @@ use crate::rita_common::peer_listener::Peer;\nuse crate::KI;\nuse crate::SETTING;\n#[cfg(test)]\n-use ::actix::actors::mocker::Mocker;\n-use ::actix::actors::resolver;\n-use ::actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\n+use actix::actors::mocker::Mocker;\n+use actix::actors::resolver;\n+use actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse althea_types::Identity;\nuse althea_types::LocalIdentity;\nuse babel_monitor::monitor;\n@@ -26,6 +26,7 @@ use rand::Rng;\nuse settings::RitaCommonSettings;\nuse std::collections::HashMap;\nuse std::fmt;\n+use std::fmt::Display;\nuse std::net::{IpAddr, SocketAddr};\nuse std::path::Path;\nuse std::time::{Duration, Instant};\n@@ -134,6 +135,22 @@ pub struct Tunnel {\nstate: TunnelState,\n}\n+impl Display for Tunnel {\n+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n+ write!(f, \"Tunnel: IP: {} IFACE_NAME: {} IFIDX: {}, PORT: {} WG: {} ETH: {} MESH_IP: {} LAST_SEEN {}, SPEED_LIMIT {:?}, STATE: {:?}\" ,\n+ self.ip,\n+ self.iface_name,\n+ self.listen_ifidx,\n+ self.listen_port,\n+ self.neigh_id.global.wg_public_key,\n+ self.neigh_id.global.eth_address,\n+ self.neigh_id.global.mesh_ip,\n+ (Instant::now() - self.last_contact).as_secs(),\n+ self.speed_limit,\n+ self.state)\n+ }\n+}\n+\nimpl Tunnel {\nfn new(\nip: IpAddr,\n@@ -876,9 +893,9 @@ impl TunnelManager {\nlet tunnels = self.tunnels.get_mut(&key).unwrap();\nfor tunnel in tunnels.iter_mut() {\nif tunnel.listen_ifidx == peer.ifidx && tunnel.ip == peer.contact_socket.ip() {\n- trace!(\"We already have a tunnel for {:?}\", tunnel);\n+ trace!(\"We already have a tunnel for {}\", tunnel);\ntrace!(\n- \"Bumping timestamp after {}s for tunnel: {:?}\",\n+ \"Bumping timestamp after {}s for tunnel: {}\",\ntunnel.last_contact.elapsed().as_secs(),\ntunnel\n);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add display for Tunnel This will make it easier to debug tunnel types as it will print the full wg key and other more searchable info rather than the byte content of the keys
20,244
14.11.2019 09:30:42
18,000
3fc4e6080129f616d10b221785f817e0c3663e1e
Hello response should not panic if id callback fails
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_endpoints/mod.rs", "new_path": "rita/src/rita_common/network_endpoints/mod.rs", "diff": "@@ -103,7 +103,11 @@ pub fn hello_response(\n.send(IdentityCallback::new(their_id, peer, None))\n.from_err()\n.and_then(|tunnel| {\n- let tunnel = tunnel.unwrap();\n+ let tunnel = match tunnel {\n+ Some(val) => val,\n+ None => return Err(format_err!(\"tunnel open failure!\"))\n+ };\n+\nOk(Json(LocalIdentity {\nglobal: match SETTING.get_identity() {\nSome(id) => id,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Hello response should not panic if id callback fails
20,244
14.11.2019 10:23:41
18,000
3887757bccb2526387e7ba7a7edf7d981b1f4f60
Remove unused tunnel function
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/open_tunnel.rs", "new_path": "althea_kernel_interface/src/open_tunnel.rs", "diff": "@@ -137,64 +137,6 @@ impl dyn KernelInterface {\nOk(())\n}\n- pub fn open_tunnel_listener(\n- &self,\n- interface: &String,\n- port: u16,\n- remote_pub_key: &String,\n- private_key_path: &Path,\n- own_ip: &IpAddr,\n- ) -> Result<(), Error> {\n- let output = self.run_command(\n- \"wg\",\n- &[\n- \"set\",\n- &interface,\n- \"listen-port\",\n- &format!(\"{}\", port),\n- \"private-key\",\n- &format!(\"{}\", private_key_path.to_str().unwrap()),\n- \"peer\",\n- &format!(\"{}\", remote_pub_key),\n- \"allowed-ips\",\n- \"::/0\",\n- \"persistent-keepalive\",\n- \"5\",\n- ],\n- )?;\n- if !output.stderr.is_empty() {\n- return Err(KernelInterfaceError::RuntimeError(format!(\n- \"received error from wg command: {}\",\n- String::from_utf8(output.stderr)?\n- ))\n- .into());\n- }\n- let _output = self.run_command(\n- \"ip\",\n- &[\"address\", \"add\", &format!(\"{}\", own_ip), \"dev\", &interface],\n- )?;\n-\n- self.run_command(\n- \"ip\",\n- &[\n- \"address\",\n- \"add\",\n- &format!(\"{}/64\", to_wg_local(own_ip)),\n- \"dev\",\n- &interface,\n- ],\n- )?;\n-\n- let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", &interface, \"up\"])?;\n- if !output.stderr.is_empty() {\n- return Err(KernelInterfaceError::RuntimeError(format!(\n- \"received error setting wg interface up: {}\",\n- String::from_utf8(output.stderr)?\n- ))\n- .into());\n- }\n- Ok(())\n- }\n}\n#[test]\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove unused tunnel function
20,244
14.11.2019 10:24:06
18,000
d526edcd1ac021ba4f4de49484de0a9562f201ad
Fix function description for find ifidx
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/link_local_tools.rs", "new_path": "althea_kernel_interface/src/link_local_tools.rs", "diff": "@@ -125,7 +125,7 @@ impl dyn KernelInterface {\n)\n}\n}\n- /// Returns all existing interfaces\n+ /// Returns the ifidx of the provided interface\npub fn get_iface_index(&self, name: &str) -> Result<u32, Error> {\nlet links = String::from_utf8(self.run_command(\"ip\", &[\"link\"])?.stdout)?;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix function description for find ifidx
20,249
15.11.2019 10:14:29
28,800
0222a44a33fb1d7b90f7dbf89c31bc43c642cde5
Accept althearouter.net as a request origin
[ { "change_type": "MODIFY", "old_path": "rita/src/middleware.rs", "new_path": "rita/src/middleware.rs", "diff": "@@ -18,31 +18,31 @@ impl<S> Middleware<S> for Headers {\n}\nfn response(&self, req: &HttpRequest<S>, mut resp: HttpResponse) -> Result<Response> {\n- let url_no_port = match req.headers().get(\"origin\") {\n+ let url = req.connection_info().host().to_owned();\n+ let re = Regex::new(r\"^(.*):\").unwrap();\n+ let url_no_port = re.captures(&url).unwrap()[1].to_string();\n+\n+ let origin = match req.headers().get(\"origin\") {\nSome(origin) => {\nif origin == \"http://althea.net\" {\n\"althea.net\".to_string()\n+ } else if origin == \"http://althearouter.net\" {\n+ \"althearouter.net\".to_string()\n} else {\n- let url = req.connection_info().host().to_owned();\n- let re = Regex::new(r\"^(.*):\").unwrap();\n- re.captures(&url).unwrap()[1].to_string()\n- }\n+ url_no_port\n}\n- None => {\n- let url = req.connection_info().host().to_owned();\n- let re = Regex::new(r\"^(.*):\").unwrap();\n- re.captures(&url).unwrap()[1].to_string()\n}\n+ None => url_no_port,\n};\nif req.method() == Method::OPTIONS {\n*resp.status_mut() = StatusCode::OK;\n}\n- if url_no_port != \"\" {\n+ if origin != \"\" {\nresp.headers_mut().insert(\nheader::HeaderName::try_from(\"Access-Control-Allow-Origin\").unwrap(),\n- header::HeaderValue::from_str(&format!(\"http://{}\", url_no_port)).unwrap(),\n+ header::HeaderValue::from_str(&format!(\"http://{}\", origin)).unwrap(),\n);\n}\nresp.headers_mut().insert(\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Accept althearouter.net as a request origin
20,244
18.11.2019 07:33:23
18,000
6ab5a64dc5b49560562a223a0e1334d816727ba4
Add proper enabled/disable for low balance notifications I've done this with a code patch a couple of times, so it's probably worth it to add it to the configuration state
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/database/mod.rs", "new_path": "rita/src/rita_exit/database/mod.rs", "diff": "@@ -299,6 +299,23 @@ fn low_balance_notification(\nconn: &PgConnection,\n) {\ntrace!(\"Checking low balance nofication\");\n+\n+ // maybe this needs a trait 'enabled'?\n+ if let Some(ref config) = config {\n+ match config {\n+ ExitVerifSettings::Phone(ref val) => {\n+ if !val.notify_low_balance {\n+ return;\n+ }\n+ }\n+ ExitVerifSettings::Email(ref val) => {\n+ if !val.notify_low_balance {\n+ return;\n+ }\n+ }\n+ }\n+ }\n+\nlet time_since_last_notification =\nsecs_since_unix_epoch() - their_record.last_balance_warning_time;\n@@ -343,7 +360,7 @@ fn low_balance_notification(\n}\n}\n(Some(_), false) => {}\n- (None, _) => error!(\"Client is registered but has no phone number!\"),\n+ (None, _) => error!(\"No notification method to notify of low balance!\"),\n},\n(_, _) => {}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -57,6 +57,7 @@ smtp_domain = \"mail.example.com\"\nsmtp_username = \"changeme\"\nsmtp_password = \"changeme\"\nbalance_notification_interval = 600\n+notify_low_balance = true\n[log]\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -133,6 +133,9 @@ pub struct EmailVerifSettings {\npub smtp_password: String,\n/// time in seconds between notifications\npub balance_notification_interval: u32,\n+\n+ /// True if the exit should notify clients when they have a low balance\n+ pub notify_low_balance: bool,\n}\nfn default_balance_notification_text_body() -> String {\n@@ -158,6 +161,8 @@ pub struct PhoneVerifSettings {\npub balance_notification_body: String,\n/// time in seconds between notifications\npub balance_notification_interval: u32,\n+ /// True if the exit should notify clients when they have a low balance\n+ pub notify_low_balance: bool,\n}\n/// Struct containing the different types of supported verification\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -57,6 +57,7 @@ email_cooldown=60\ntest_dir = \"mail\"\nfrom_address = \"email-verif@example.com\"\nbalance_notification_interval = 600\n+notify_low_balance = true\n[log]\nenabled = false\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add proper enabled/disable for low balance notifications I've done this with a code patch a couple of times, so it's probably worth it to add it to the configuration state
20,249
15.11.2019 13:27:59
28,800
3e83ba7d9f87b4b20aabe9578b2b0e96ae6dfea6
Get wyre_enabled boolean from oracle updates and expose it through the dashboard API
[ { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -1703,3 +1703,26 @@ Enables remote access for debugging and user use, only usable from the local mes\n- Sample Call:\n`curl http://192.168.10.1:4877/remote_access/true`\n+\n+## /localization\n+\n+Returns a struct of localization settings for the router\n+\n+- URL: `<rita ip>:<rita_dashboard_port>/localization`\n+- Method: `GET`\n+- URL Params: `None`\n+- Data Params: `None`\n+- Success Response:\n+ - Code: 200 OK\n+ - Contents:\n+ { \"wyre_enabled\": bool }\n+\n+```\n+()\n+```\n+\n+- Error Response: `500 Server Error`\n+\n+- Sample Call:\n+\n+`curl http://192.168.10.1:4877/localization`\n" }, { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -53,6 +53,7 @@ use crate::rita_client::dashboard::backup_created::*;\nuse crate::rita_client::dashboard::eth_private_key::*;\nuse crate::rita_client::dashboard::exits::*;\nuse crate::rita_client::dashboard::interfaces::*;\n+use crate::rita_client::dashboard::localization::*;\nuse crate::rita_client::dashboard::logging::*;\nuse crate::rita_client::dashboard::mesh_ip::*;\nuse crate::rita_client::dashboard::neighbors::*;\n@@ -339,6 +340,7 @@ fn start_client_dashboard() {\n)\n.route(\"/wipe\", Method::POST, wipe)\n.route(\"/crash_actors\", Method::POST, crash_actors)\n+ .route(\"/localization\", Method::GET, get_localization)\n})\n.workers(1)\n.bind(format!(\n" }, { "change_type": "ADD", "old_path": null, "new_path": "rita/src/rita_client/dashboard/localization.rs", "diff": "+use crate::SETTING;\n+use actix_web::{HttpRequest, HttpResponse, Result};\n+use failure::Error;\n+use settings::RitaCommonSettings;\n+use std::collections::HashMap;\n+\n+pub fn get_localization(_req: HttpRequest) -> Result<HttpResponse, Error> {\n+ debug!(\"/localization GET hit\");\n+ let mut ret = HashMap::new();\n+ let localization = SETTING.get_localization();\n+ ret.insert(\"wyre_enabled\", localization.wyre_enabled);\n+\n+ Ok(HttpResponse::Ok().json(ret))\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/mod.rs", "new_path": "rita/src/rita_client/dashboard/mod.rs", "diff": "@@ -8,6 +8,7 @@ pub mod backup_created;\npub mod eth_private_key;\npub mod exits;\npub mod interfaces;\n+pub mod localization;\npub mod logging;\npub mod mesh_ip;\npub mod neighbors;\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/dao.rs", "new_path": "rita/src/rita_common/dashboard/dao.rs", "diff": "use crate::ARGS;\nuse crate::SETTING;\n-use ::actix_web::Path;\n-use ::actix_web::{HttpRequest, HttpResponse, Json, Result};\n-use ::settings::FileWrite;\n-use ::settings::RitaCommonSettings;\n+use actix_web::Path;\n+use actix_web::{HttpRequest, HttpResponse, Json, Result};\nuse clarity::Address;\nuse failure::Error;\nuse num256::Uint256;\n+use settings::FileWrite;\n+use settings::RitaCommonSettings;\nuse std::collections::HashMap;\npub fn get_dao_list(_req: HttpRequest) -> Result<Json<Vec<Address>>, Error> {\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -289,6 +289,7 @@ struct OracleUpdate {\n/// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n/// change the currently configured release feed\nrelease_feed: Option<String>,\n+ wyre_enabled: Option<bool>,\n/// A json payload to be merged into the existing settings\nmerge_json: serde_json::Value,\n}\n@@ -338,9 +339,18 @@ fn update_oracle() {\n// an explicit fashion\nmatch serde_json::from_slice::<OracleUpdate>(&new_prices) {\nOk(new_settings) => {\n- let dao_settings = SETTING.get_dao();\n- let use_oracle_price = dao_settings.use_oracle_price;\n- drop(dao_settings);\n+ let dao = SETTING.get_dao();\n+ let use_oracle_price = dao.use_oracle_price;\n+ drop(dao);\n+\n+ let mut localization = SETTING.get_localization_mut();\n+ localization.wyre_enabled =\n+ match new_settings.wyre_enabled {\n+ Some(val) => val,\n+ None => false,\n+ };\n+ drop(localization);\n+\nlet mut payment = SETTING.get_payment_mut();\nif use_oracle_price {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -15,6 +15,7 @@ use failure::Error;\nuse crate::dao::SubnetDAOSettings;\nuse crate::json_merge;\n+use crate::localization::LocalizationSettings;\nuse crate::logging::LoggingSettings;\nuse crate::network::NetworkSettings;\nuse crate::payment::PaymentSettings;\n@@ -178,6 +179,8 @@ pub struct RitaSettingsStruct {\ndao: SubnetDAOSettings,\n#[serde(default)]\nlog: LoggingSettings,\n+ #[serde(default)]\n+ localization: LocalizationSettings,\nnetwork: NetworkSettings,\nexit_client: ExitClientSettings,\n#[serde(skip)]\n@@ -209,6 +212,18 @@ impl RitaCommonSettings<RitaSettingsStruct> for Arc<RwLock<RitaSettingsStruct>>\nRwLockWriteGuardRefMut::new(self.write().unwrap()).map_mut(|g| &mut g.dao)\n}\n+ fn get_localization<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockReadGuardRef<'ret, RitaSettingsStruct, LocalizationSettings> {\n+ RwLockReadGuardRef::new(self.read().unwrap()).map(|g| &g.localization)\n+ }\n+\n+ fn get_localization_mut<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockWriteGuardRefMut<'ret, RitaSettingsStruct, LocalizationSettings> {\n+ RwLockWriteGuardRefMut::new(self.write().unwrap()).map_mut(|g| &mut g.localization)\n+ }\n+\nfn get_network<'ret, 'me: 'ret>(\n&'me self,\n) -> RwLockReadGuardRef<'ret, RitaSettingsStruct, NetworkSettings> {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -18,6 +18,7 @@ use failure::Error;\nuse crate::dao::SubnetDAOSettings;\nuse crate::json_merge;\n+use crate::localization::LocalizationSettings;\nuse crate::network::NetworkSettings;\nuse crate::payment::PaymentSettings;\nuse crate::spawn_watch_thread;\n@@ -183,6 +184,8 @@ pub struct RitaExitSettingsStruct {\nworkers: u32,\ndescription: String,\npayment: PaymentSettings,\n+ #[serde(default)]\n+ localization: LocalizationSettings,\ndao: SubnetDAOSettings,\nnetwork: NetworkSettings,\nexit_network: ExitNetworkSettings,\n@@ -206,6 +209,7 @@ impl RitaExitSettingsStruct {\ndescription: \"\".to_string(),\npayment: PaymentSettings::default(),\ndao: SubnetDAOSettings::default(),\n+ localization: LocalizationSettings::default(),\nnetwork: NetworkSettings::default(),\nexit_network: ExitNetworkSettings::test_default(),\nallowed_countries: HashSet::new(),\n@@ -304,6 +308,23 @@ impl RitaCommonSettings<RitaExitSettingsStruct> for Arc<RwLock<RitaExitSettingsS\nRwLockReadGuardRef::new(self.read().expect(\"Failed to read DAO settings!\")).map(|g| &g.dao)\n}\n+ fn get_localization_mut<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockWriteGuardRefMut<'ret, RitaExitSettingsStruct, LocalizationSettings> {\n+ RwLockWriteGuardRefMut::new(\n+ self.write()\n+ .expect(\"Failed to write localization settings!\"),\n+ )\n+ .map_mut(|g| &mut g.localization)\n+ }\n+\n+ fn get_localization<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockReadGuardRef<'ret, RitaExitSettingsStruct, LocalizationSettings> {\n+ RwLockReadGuardRef::new(self.read().expect(\"Failed to read localization settings!\"))\n+ .map(|g| &g.localization)\n+ }\n+\nfn get_dao_mut<'ret, 'me: 'ret>(\n&'me self,\n) -> RwLockWriteGuardRefMut<'ret, RitaExitSettingsStruct, SubnetDAOSettings> {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -51,11 +51,13 @@ use failure::Error;\npub mod client;\npub mod dao;\npub mod exit;\n+pub mod localization;\npub mod logging;\npub mod network;\npub mod payment;\nuse crate::dao::SubnetDAOSettings;\n+use crate::localization::LocalizationSettings;\nuse crate::network::NetworkSettings;\nuse crate::payment::PaymentSettings;\n@@ -81,6 +83,13 @@ pub trait RitaCommonSettings<T: Serialize + Deserialize<'static>> {\n&'me self,\n) -> RwLockWriteGuardRefMut<'ret, T, PaymentSettings>;\n+ fn get_localization<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockReadGuardRef<'ret, T, LocalizationSettings>;\n+ fn get_localization_mut<'ret, 'me: 'ret>(\n+ &'me self,\n+ ) -> RwLockWriteGuardRefMut<'ret, T, LocalizationSettings>;\n+\nfn get_dao<'ret, 'me: 'ret>(&'me self) -> RwLockReadGuardRef<'ret, T, SubnetDAOSettings>;\nfn get_dao_mut<'ret, 'me: 'ret>(\n&'me self,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "settings/src/localization.rs", "diff": "+fn default_wyre_enabled() -> bool {\n+ false\n+}\n+\n+#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\n+pub struct LocalizationSettings {\n+ // A flag indicating whether or not the dashboard should give users the option to purchase\n+ // cryptocurrency through Wyre as part of the funding flow.\n+ #[serde(default = \"default_wyre_enabled\")]\n+ pub wyre_enabled: bool,\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Get wyre_enabled boolean from oracle updates and expose it through the dashboard API
20,244
19.11.2019 19:41:09
18,000
c62a502529a419a215015e11be38ff5e38f14ae9
Localization endpoint should send the entire struct
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/localization.rs", "new_path": "rita/src/rita_client/dashboard/localization.rs", "diff": "@@ -2,13 +2,9 @@ use crate::SETTING;\nuse actix_web::{HttpRequest, HttpResponse, Result};\nuse failure::Error;\nuse settings::RitaCommonSettings;\n-use std::collections::HashMap;\npub fn get_localization(_req: HttpRequest) -> Result<HttpResponse, Error> {\ndebug!(\"/localization GET hit\");\n- let mut ret = HashMap::new();\n- let localization = SETTING.get_localization();\n- ret.insert(\"wyre_enabled\", localization.wyre_enabled);\n-\n- Ok(HttpResponse::Ok().json(ret))\n+ let localization = SETTING.get_localization().clone();\n+ Ok(HttpResponse::Ok().json(localization))\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Localization endpoint should send the entire struct
20,244
20.11.2019 09:50:29
18,000
45d68fd65598808067a9a41b74864d46e3ee711d
Make TokenBridge addresses configurable
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -25,6 +25,8 @@ use settings::RitaCommonSettings;\nuse std::time::Duration;\nuse std::time::Instant;\nuse web30::client::Web3;\n+use crate::rita_common::token_bridge::TokenBridge;\n+use crate::rita_common::token_bridge::ReloadAddresses;\npub struct Oracle {\n/// An instant representing the start of a short period where the balance can\n@@ -352,6 +354,7 @@ fn update_oracle() {\ndrop(localization);\nlet mut payment = SETTING.get_payment_mut();\n+ let starting_token_bridge_core = payment.bridge_addresses.clone();\nif use_oracle_price {\n// This will be true on devices that have integrated switches\n@@ -403,6 +406,10 @@ fn update_oracle() {\nnew_settings.release_feed,\n);\n}\n+ // Sends a message to reload bridge addresses live if needed\n+ if SETTING.get_payment().bridge_addresses != starting_token_bridge_core {\n+ TokenBridge::from_registry().do_send(ReloadAddresses());\n+ }\ntrace!(\"Successfully updated oracle\");\n}\n@@ -439,6 +446,8 @@ pub fn low_balance() -> bool {\nbalance < balance_warning_level\n}\n+/// Allows for online updating of the release feed, note that this not run\n+/// on every device startup meaning just editing it the config is not sufficient\nfn handle_release_feed_update(val: Option<String>) {\nmatch (val, get_release_feed()) {\n(None, _) => {}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -69,7 +69,6 @@ use num_traits::identities::Zero;\nuse settings::RitaCommonSettings;\nuse std::fmt;\nuse std::fmt::Display;\n-use std::str::FromStr;\nuse std::time::Duration;\nuse std::time::Instant;\n@@ -162,19 +161,25 @@ impl SystemService for TokenBridge {\n}\n}\n+fn token_bridge_core_from_settings() -> TokenBridgeCore {\n+ let payment_settings = SETTING.get_payment();\n+ let addresses = payment_settings.bridge_addresses.clone();\n+ TokenBridgeCore::new(\n+ addresses.uniswap_address,\n+ addresses.xdai_foreign_bridge_address,\n+ addresses.xdai_home_bridge_address,\n+ addresses.foreign_dai_contract_address,\n+ payment_settings.eth_address.unwrap(),\n+ payment_settings.eth_private_key.unwrap(),\n+ addresses.eth_full_node_url,\n+ addresses.xdai_full_node_url,\n+ )\n+}\n+\nimpl Default for TokenBridge {\nfn default() -> TokenBridge {\nTokenBridge {\n- bridge: TokenBridgeCore::new(\n- Address::from_str(\"0x09cabEC1eAd1c0Ba254B09efb3EE13841712bE14\").unwrap(),\n- Address::from_str(\"0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6\").unwrap(),\n- Address::from_str(\"0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016\").unwrap(),\n- Address::from_str(\"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359\").unwrap(),\n- SETTING.get_payment().eth_address.unwrap(),\n- SETTING.get_payment().eth_private_key.unwrap(),\n- \"https://eth.althea.org\".into(),\n- \"https://dai.althea.net\".into(),\n- ),\n+ bridge: token_bridge_core_from_settings(),\nstate: State::Ready { former_state: None },\nminimum_to_exchange: 2,\nreserve_amount: 1,\n@@ -685,3 +690,18 @@ impl Handler<GetBridge> for TokenBridge {\nOk((bridge, reserve_amount))\n}\n}\n+\n+/// Used to indicate that the source addresses should be reloaded from the config\n+#[derive(Debug, Eq, PartialEq, Clone, Serialize, Copy)]\n+pub struct ReloadAddresses();\n+\n+impl Message for ReloadAddresses {\n+ type Result = ();\n+}\n+\n+impl Handler<ReloadAddresses> for TokenBridge {\n+ type Result = ();\n+ fn handle(&mut self, _msg: ReloadAddresses, _ctx: &mut Context<Self>) -> Self::Result {\n+ self.bridge = token_bridge_core_from_settings();\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "use althea_types::SystemChain;\nuse clarity::{Address, PrivateKey};\n-\nuse num256::{Int256, Uint256};\n+use std::str::FromStr;\nfn default_local_fee() -> u32 {\n300_000u32 // 300kWei per byte\n@@ -61,6 +61,34 @@ fn default_debts_file() -> String {\n\"/etc/rita-debts.json\".to_string()\n}\n+fn default_bridge_addresses() -> TokenBridgeAddresses {\n+ TokenBridgeAddresses {\n+ uniswap_address: Address::from_str(\"0x09cabEC1eAd1c0Ba254B09efb3EE13841712bE14\").unwrap(),\n+ xdai_foreign_bridge_address: Address::from_str(\n+ \"0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6\",\n+ )\n+ .unwrap(),\n+ xdai_home_bridge_address: Address::from_str(\"0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016\")\n+ .unwrap(),\n+ foreign_dai_contract_address: Address::from_str(\n+ \"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359\",\n+ )\n+ .unwrap(),\n+ eth_full_node_url: \"https://eth.althea.org\".into(),\n+ xdai_full_node_url: \"https://dai.althea.net\".into(),\n+ }\n+}\n+\n+#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n+pub struct TokenBridgeAddresses {\n+ pub uniswap_address: Address,\n+ pub xdai_home_bridge_address: Address,\n+ pub xdai_foreign_bridge_address: Address,\n+ pub foreign_dai_contract_address: Address,\n+ pub eth_full_node_url: String,\n+ pub xdai_full_node_url: String,\n+}\n+\n/// This struct is used by both rita and rita_exit to configure the dummy payment controller and\n/// debt keeper\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n@@ -133,6 +161,9 @@ pub struct PaymentSettings {\n/// on deposit\n#[serde(default = \"default_debt_limit_enabled\")]\npub debt_limit_enabled: bool,\n+ /// Token Bridge addresses\n+ #[serde(default = \"default_bridge_addresses\")]\n+ pub bridge_addresses: TokenBridgeAddresses,\n}\nimpl Default for PaymentSettings {\n@@ -161,6 +192,7 @@ impl Default for PaymentSettings {\nbridge_enabled: default_bridge_enabled(),\nfudge_factor: 0u8,\ndebt_limit_enabled: default_debt_limit_enabled(),\n+ bridge_addresses: default_bridge_addresses(),\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Make TokenBridge addresses configurable
20,244
20.11.2019 09:52:04
18,000
3cf5b8d43017d57928596f1dd1f31ae08e7e5dc4
Bump for Beta 10 RC4
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.23\",\n+ \"rita 0.5.24\",\n]\n[[package]]\n@@ -2016,7 +2016,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.23\"\n+version = \"0.5.24\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.23\"\n+version = \"0.5.24\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC3\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC4\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 10 RC4
20,249
20.11.2019 10:12:16
28,800
a1e9e1fad29fc3fa0a7ba2c45b56f58918d418f0
Read Wyre account_id from oracle updates
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "//! to match. More advanced pricing systems may be broken out into their own file some day\nuse crate::rita_common::rita_loop::get_web3_server;\n+use crate::rita_common::token_bridge::ReloadAddresses;\n+use crate::rita_common::token_bridge::TokenBridge;\nuse crate::SETTING;\nuse actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse actix_web::error::PayloadError;\n@@ -25,8 +27,6 @@ use settings::RitaCommonSettings;\nuse std::time::Duration;\nuse std::time::Instant;\nuse web30::client::Web3;\n-use crate::rita_common::token_bridge::TokenBridge;\n-use crate::rita_common::token_bridge::ReloadAddresses;\npub struct Oracle {\n/// An instant representing the start of a short period where the balance can\n@@ -291,7 +291,6 @@ struct OracleUpdate {\n/// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n/// change the currently configured release feed\nrelease_feed: Option<String>,\n- wyre_enabled: Option<bool>,\n/// A json payload to be merged into the existing settings\nmerge_json: serde_json::Value,\n}\n@@ -345,16 +344,9 @@ fn update_oracle() {\nlet use_oracle_price = dao.use_oracle_price;\ndrop(dao);\n- let mut localization = SETTING.get_localization_mut();\n- localization.wyre_enabled =\n- match new_settings.wyre_enabled {\n- Some(val) => val,\n- None => false,\n- };\n- drop(localization);\n-\nlet mut payment = SETTING.get_payment_mut();\n- let starting_token_bridge_core = payment.bridge_addresses.clone();\n+ let starting_token_bridge_core =\n+ payment.bridge_addresses.clone();\nif use_oracle_price {\n// This will be true on devices that have integrated switches\n@@ -407,8 +399,11 @@ fn update_oracle() {\n);\n}\n// Sends a message to reload bridge addresses live if needed\n- if SETTING.get_payment().bridge_addresses != starting_token_bridge_core {\n- TokenBridge::from_registry().do_send(ReloadAddresses());\n+ if SETTING.get_payment().bridge_addresses\n+ != starting_token_bridge_core\n+ {\n+ TokenBridge::from_registry()\n+ .do_send(ReloadAddresses());\n}\ntrace!(\"Successfully updated oracle\");\n" }, { "change_type": "MODIFY", "old_path": "settings/src/localization.rs", "new_path": "settings/src/localization.rs", "diff": "@@ -8,4 +8,7 @@ pub struct LocalizationSettings {\n// cryptocurrency through Wyre as part of the funding flow.\n#[serde(default = \"default_wyre_enabled\")]\npub wyre_enabled: bool,\n+ // Wyre account_id used to associate transactions with a specific Wyre account\n+ #[serde(default)]\n+ pub wyre_account_id: String,\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Read Wyre account_id from oracle updates
20,249
02.12.2019 09:55:44
28,800
ea5e070d069c8fda25fe72c9be27fb2cacb9acb8
Add UDP heartbeat monitor to fast loop
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/rita_loop/mod.rs", "new_path": "rita/src/rita_client/rita_loop/mod.rs", "diff": "@@ -18,6 +18,8 @@ use althea_types::ExitState;\nuse failure::Error;\nuse futures::future::Future;\nuse settings::client::RitaClientSettings;\n+use settings::RitaCommonSettings;\n+use std::net::UdpSocket;\nuse std::time::{Duration, Instant};\n#[derive(Default)]\n@@ -73,9 +75,12 @@ impl Handler<Tick> for RitaLoop {\ntrace!(\"Client Tick!\");\nExitManager::from_registry().do_send(Tick {});\n-\nArbiter::spawn(check_for_gateway_client_billing_corner_case());\n+ if SETTING.get_log().enabled {\n+ send_udp_heartbeat();\n+ }\n+\ninfo!(\n\"Rita Client loop completed in {}s {}ms\",\nstart.elapsed().as_secs(),\n@@ -90,6 +95,26 @@ pub fn check_rita_client_actors() {\nassert!(crate::rita_client::exit_manager::ExitManager::from_registry().connected());\n}\n+fn send_udp_heartbeat() {\n+ match UdpSocket::bind(\"0.0.0.0:33333\") {\n+ Ok(socket) => {\n+ match SETTING.get_network().wg_public_key.clone() {\n+ Some(key) => {\n+ match socket.send_to(\n+ &key.to_string().into_bytes(),\n+ &SETTING.get_log().heartbeat_url,\n+ ) {\n+ Ok(_) => info!(\"Successfully sent UDP heartbeat\"),\n+ Err(e) => error!(\"Error sending UDP heartbeat: {:?}\", e),\n+ }\n+ }\n+ None => (),\n+ };\n+ }\n+ Err(e) => error!(\"Couldn't bind to UDP heartbeat monitor socket: {:?}\", e),\n+ }\n+}\n+\n/// There is a complicated corner case where the gateway is a client and a relay to\n/// the same exit, this will produce incorrect billing data as we need to reconcile the\n/// relay bills (under the exit relay id) and the client bills (under the exit id) versus\n" }, { "change_type": "MODIFY", "old_path": "settings/src/logging.rs", "new_path": "settings/src/logging.rs", "diff": "@@ -10,6 +10,10 @@ fn default_logging_dest_url() -> String {\n\"https://stats.altheamesh.com:9999/compressed_sink\".to_string()\n}\n+fn default_heartbeat_url() -> String {\n+ \"althea.net:33333\".to_string()\n+}\n+\n/// Remote logging settings. Used to control remote logs being\n/// forwarded to the dest_url address, https is used to encrypt\n/// the logs as they travel over the internet so don't use non-https\n@@ -22,6 +26,9 @@ pub struct LoggingSettings {\npub level: String,\n#[serde(default = \"default_logging_dest_url\")]\npub dest_url: String,\n+ /// Address and port of UDP heartbeat monitoring server\n+ #[serde(default = \"default_heartbeat_url\")]\n+ pub heartbeat_url: String,\n}\nimpl Default for LoggingSettings {\n@@ -30,6 +37,7 @@ impl Default for LoggingSettings {\nenabled: default_logging(),\nlevel: default_logging_level(),\ndest_url: default_logging_dest_url(),\n+ heartbeat_url: default_heartbeat_url(),\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add UDP heartbeat monitor to fast loop
20,244
08.12.2019 11:34:39
21,600
ae9654c3db9d977d308aeb14587642af52ada882
Promote bridge logging messages
[ { "change_type": "MODIFY", "old_path": "rita/src/client.rs", "new_path": "rita/src/client.rs", "diff": "@@ -213,6 +213,7 @@ fn main() {\nstart_client_dashboard();\nsystem.run();\n+ info!(\"Started Rita Client!\");\n}\nfn start_client_dashboard() {\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -202,9 +202,9 @@ fn rescue_dai(\n) -> Box<dyn Future<Item = (), Error = Error>> {\nBox::new(bridge.get_dai_balance(our_address).and_then({\nmove |dai_balance| {\n- trace!(\"Our DAI balance is {}\", dai_balance);\n+ info!(\"Our DAI balance is {}\", dai_balance);\nif dai_balance > eth_to_wei(minimum_stranded_dai_transfer.into()) {\n- trace!(\"rescuing dais\");\n+ info!(\"rescuing dais\");\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::DaiToXdai {\namount: dai_balance.clone(),\n@@ -261,12 +261,9 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\n)\n.and_then(\nmove |(our_dai_balance, our_eth_balance, wei_per_dollar, our_xdai_balance)| {\n- trace!(\n+ info!(\n\"xdai rescue state is {} dai {} eth {} xdai {} wei per dollar\",\n- our_dai_balance,\n- our_eth_balance,\n- our_xdai_balance,\n- wei_per_dollar\n+ our_dai_balance, our_eth_balance, our_xdai_balance, wei_per_dollar\n);\nlet tx_gas: Uint256 = 21000u32.into();\n// if you actually ask for the gas price you'll get an incorrect value\n@@ -326,7 +323,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nlet bridge = bridge.bridge.clone();\nmatch state {\nState::Ready { .. } => {\n- trace!(\n+ info!(\n\"Ticking in State::Ready. Eth Address: {}\",\nbridge.own_address\n);\n@@ -363,7 +360,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\n},\n));\n- trace!(\"Converting to Dai\");\n+ info!(\"Converting to Dai\");\nBox::new(\nbridge\n// Convert to Dai in Uniswap\n@@ -446,7 +443,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nbridge.dai_to_eth_price(DAI_WEI_CENT.into()),\nbridge.eth_web3.eth_gas_price())\n.and_then(move |(our_dai_balance, our_eth_balance, wei_per_dollar, wei_per_cent, eth_gas_price)| {\n- trace!(\"withdraw state is {} dai {} eth {} wei per dollar\", our_dai_balance, our_eth_balance, wei_per_dollar);\n+ info!(\"withdraw state is {} dai {} eth {} wei per dollar\", our_dai_balance, our_eth_balance, wei_per_dollar);\nlet transferred_eth = eth_equal(amount_a.clone(), wei_per_cent);\n// Money has come over the bridge\nif our_dai_balance >= amount {\n@@ -462,7 +459,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nas Box<dyn Future<Item = (), Error = Error>>\n// all other steps are done and the eth is sitting and waiting\n} else if our_eth_balance >= transferred_eth {\n- trace!(\"Converted dai back to eth!\");\n+ info!(\"Converted dai back to eth!\");\nlet withdraw_amount = if withdraw_all {\n// this only works because the gas price is hardcoded in auto_bridge\n// that should be fixed someday and this should use dynamic gas\n@@ -483,7 +480,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nETH_TRANSFER_TIMEOUT,\n)\n.and_then(move |_| {\n- trace!(\"Issued an eth transfer for withdraw! Now complete!\");\n+ info!(\"Issued an eth transfer for withdraw! Now complete!\");\n// we only exit the withdraw state on success or timeout\nTokenBridge::from_registry().do_send(StateChange(State::Ready {former_state: Some(Box::new(State::Withdrawing{to, amount: amount_a, timestamp, withdraw_all}))}));\nOk(())}))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Promote bridge logging messages
20,244
09.12.2019 13:37:43
18,000
700eeae92a1e8379ed05d34dd09d963291a9f0a7
Bump for Beta 10 RC5 this is mostly an openwrt rebuild, but we may as well get the wyre stuff in
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.24\",\n+ \"rita 0.5.25\",\n]\n[[package]]\n@@ -2016,7 +2016,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.24\"\n+version = \"0.5.25\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.24\"\n+version = \"0.5.25\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC5\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 10 RC5 this is mostly an openwrt rebuild, but we may as well get the wyre stuff in
20,244
11.12.2019 12:55:56
18,000
7ce9a35e503296df15aa45652cd137635f3e2853
Update non-rita deps
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -184,7 +184,7 @@ version = \"0.1.0\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -201,6 +201,14 @@ name = \"arc-swap\"\nversion = \"0.4.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n+[[package]]\n+name = \"arrayvec\"\n+version = \"0.4.12\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n[[package]]\nname = \"arrayvec\"\nversion = \"0.5.1\"\n@@ -211,7 +219,7 @@ dependencies = [\n[[package]]\nname = \"ascii\"\n-version = \"0.9.3\"\n+version = \"1.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\n@@ -263,8 +271,8 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nname = \"babel_monitor\"\nversion = \"0.1.0\"\ndependencies = [\n- \"ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"ascii 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"ipnetwork 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -318,12 +326,16 @@ dependencies = [\n\"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"base64\"\n+version = \"0.11.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+\n[[package]]\nname = \"bincode\"\n-version = \"1.2.0\"\n+version = \"1.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n- \"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n@@ -443,7 +455,7 @@ dependencies = [\n\"althea_kernel_interface 0.1.0\",\n\"althea_types 0.1.0\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"ipgen 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -500,6 +512,21 @@ dependencies = [\n\"yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"config\"\n+version = \"0.10.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n[[package]]\nname = \"cookie\"\nversion = \"0.11.1\"\n@@ -644,6 +671,11 @@ dependencies = [\n\"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"dotenv\"\n+version = \"0.15.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+\n[[package]]\nname = \"dtoa\"\nversion = \"0.4.4\"\n@@ -733,18 +765,6 @@ dependencies = [\n\"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"env_logger\"\n-version = \"0.6.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"env_logger\"\nversion = \"0.7.1\"\n@@ -798,7 +818,7 @@ version = \"0.1.0\"\ndependencies = [\n\"althea_types 0.1.0\",\n\"diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -1264,6 +1284,18 @@ dependencies = [\n\"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"lexical-core\"\n+version = \"0.4.6\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n[[package]]\nname = \"libc\"\nversion = \"0.2.66\"\n@@ -1483,6 +1515,11 @@ dependencies = [\n\"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"nodrop\"\n+version = \"0.1.14\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+\n[[package]]\nname = \"nom\"\nversion = \"4.2.3\"\n@@ -1492,6 +1529,16 @@ dependencies = [\n\"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"nom\"\n+version = \"5.0.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"lexical-core 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n[[package]]\nname = \"num\"\nversion = \"0.2.0\"\n@@ -1768,7 +1815,7 @@ name = \"phonenumber\"\nversion = \"0.2.3+8.10.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n- \"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2330,6 +2377,18 @@ dependencies = [\n\"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n+[[package]]\n+name = \"serde-hjson\"\n+version = \"0.9.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+dependencies = [\n+ \"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n+]\n+\n[[package]]\nname = \"serde-rlp\"\nversion = \"0.1.4\"\n@@ -2396,7 +2455,7 @@ dependencies = [\n\"althea_types 0.1.0\",\n\"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2499,6 +2558,11 @@ name = \"stable_deref_trait\"\nversion = \"1.1.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n+[[package]]\n+name = \"static_assertions\"\n+version = \"0.3.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+\n[[package]]\nname = \"string\"\nversion = \"0.2.1\"\n@@ -3146,8 +3210,9 @@ dependencies = [\n\"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)\" = \"81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5\"\n\"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d\"\n\"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff\"\n+\"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9\"\n\"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8\"\n-\"checksum ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e\"\n+\"checksum ascii 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109\"\n\"checksum ascii_utils 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a\"\n\"checksum assert-json-diff 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9881d306dee755eccf052d652b774a6b2861e86b4772f555262130e58e4f81d2\"\n\"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90\"\n@@ -3157,8 +3222,9 @@ dependencies = [\n\"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)\" = \"924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea\"\n\"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491\"\n\"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e\"\n+\"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7\"\n\"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643\"\n-\"checksum bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b8ab639324e3ee8774d296864fbc0dbbb256cf1a41c490b94cba90c082915f92\"\n+\"checksum bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf\"\n\"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693\"\n\"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b\"\n\"checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5\"\n@@ -3175,6 +3241,7 @@ dependencies = [\n\"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f\"\n\"checksum colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"433e7ac7d511768127ed85b0c4947f47a254131e37864b2dc13f52aa32cd37e5\"\n\"checksum compressed_log 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9af3e5ff9d575755caa41a1e669c952345892f961aa0fd2e2f04e71c9f7fd278\"\n+\"checksum config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3\"\n\"checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6\"\n\"checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0\"\n\"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d\"\n@@ -3192,6 +3259,7 @@ dependencies = [\n\"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5\"\n\"checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969\"\n\"checksum dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4424bad868b0ffe6ae351ee463526ba625bbca817978293bbe6bb7dc1804a175\"\n+\"checksum dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f\"\n\"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e\"\n\"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3\"\n\"checksum email 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)\" = \"91549a51bb0241165f13d57fc4c72cef063b4088fb078b019ecbf464a45f22e4\"\n@@ -3203,7 +3271,6 @@ dependencies = [\n\"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18\"\n\"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569\"\n\"checksum encoding_rs 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)\" = \"87240518927716f79692c2ed85bfe6e98196d18c6401ec75355760233a7e12e9\"\n-\"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3\"\n\"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36\"\n\"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc\"\n\"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46\"\n@@ -3264,6 +3331,7 @@ dependencies = [\n\"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f\"\n\"checksum lettre 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c66afaa5dfadbb81d4e00fd1d1ab057c7cd4c799c5a44e0009386d553587e728\"\n\"checksum lettre_email 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bbb68ca999042d965476e47bbdbacd52db0927348b6f8062c44dd04a3b1fd43b\"\n+\"checksum lexical-core 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"2304bccb228c4b020f3a4835d247df0a02a7c4686098d4167762cfbbe4c5cb14\"\n\"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558\"\n\"checksum libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd\"\n\"checksum libsodium-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1c344ff12b90ef8fa1f0fffacd348c1fd041db331841fec9eab23fdb991f5e73\"\n@@ -3289,7 +3357,9 @@ dependencies = [\n\"checksum mockstream 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"35bbe0c0c9d254b463b13734bc361d1423289547e052b1e77e5a77292496ba2e\"\n\"checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e\"\n\"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)\" = \"42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88\"\n+\"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)\" = \"72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb\"\n\"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6\"\n+\"checksum nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c618b63422da4401283884e6668d39f819a106ef51f5f59b81add00075da35ca\"\n\"checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db\"\n\"checksum num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f9c3f34cdd24f334cb265d9bf8bfa8a241920d026916785747a92f0e55541a1a\"\n\"checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc\"\n@@ -3379,6 +3449,7 @@ dependencies = [\n\"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8\"\n\"checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702\"\n\"checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153\"\n+\"checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8\"\n\"checksum serde-rlp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"69472f967577700225f282233c0625f7b73c371c3953b72d6dcfb91bd0133ca9\"\n\"checksum serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"defbb8a83d7f34cc8380751eeb892b825944222888aff18996ea7901f24aec88\"\n\"checksum serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0\"\n@@ -3396,6 +3467,7 @@ dependencies = [\n\"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85\"\n\"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b\"\n\"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8\"\n+\"checksum static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3\"\n\"checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d\"\n\"checksum strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"032c03039aae92b350aad2e3779c352e104d919cb192ba2fabbd7b831ce4f0f6\"\n\"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5\"\n" }, { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ edition = \"2018\"\n[dependencies]\nnum256 = \"0.2\"\n-base64 = \"0.10\"\n+base64 = \"0.11\"\nserde_derive = \"1.0\"\nserde = \"1.0\"\nserde_json = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/Cargo.toml", "new_path": "babel_monitor/Cargo.toml", "diff": "@@ -5,8 +5,8 @@ version = \"0.1.0\"\nedition = \"2018\"\n[dependencies]\n-ascii = \"0.9\"\n-env_logger = \"0.6\"\n+ascii = \"1.0\"\n+env_logger = \"0.7\"\nfailure = \"0.1\"\nipnetwork = \"0.14\"\nlog = \"0.4\"\n" }, { "change_type": "MODIFY", "old_path": "clu/Cargo.toml", "new_path": "clu/Cargo.toml", "diff": "@@ -10,7 +10,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nalthea_types = { path = \"../althea_types\" }\nlazy_static = \"1.4\"\nlog = \"0.4\"\n-env_logger = \"0.6\"\n+env_logger = \"0.7\"\nfailure = \"0.1\"\nipgen = \"0.0.4\"\nrand = \"0.7\"\n" }, { "change_type": "MODIFY", "old_path": "exit_db/Cargo.toml", "new_path": "exit_db/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ edition = \"2018\"\n[dependencies]\ndiesel = { version = \"1.4\", features = [\"postgres\"] }\n-dotenv = \"0.14\"\n+dotenv = \"0.15\"\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nserde = \"1.0\"\nserde_derive = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -5,7 +5,7 @@ authors = [\"Ben <wangben3@gmail.com>\"]\nedition = \"2018\"\n[dependencies]\n-config = \"0.9\"\n+config = \"0.10\"\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\neui48 = {git=\"https://github.com/althea-mesh/eui48.git\"}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update non-rita deps
20,244
11.12.2019 12:58:28
18,000
459b002112de58e9ae0e3e0aa2278cff3c295e41
Bump version for Beta 10 RC6
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.25\",\n+ \"rita 0.5.26\",\n]\n[[package]]\n@@ -2016,7 +2016,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\n[[package]]\nname = \"rita\"\n-version = \"0.5.25\"\n+version = \"0.5.26\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.25\"\n+version = \"0.5.26\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC5\";\n+pub static READABLE_VERSION: &str = \"Beta 10 RC6\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump version for Beta 10 RC6
20,244
11.12.2019 13:15:51
18,000
ba326893bd6daa748b91d7db570322ada53b57e7
Generate the real Wyre id by default this is our account ID, may as well have it be the default value
[ { "change_type": "MODIFY", "old_path": "settings/src/localization.rs", "new_path": "settings/src/localization.rs", "diff": "@@ -2,6 +2,10 @@ fn default_wyre_enabled() -> bool {\nfalse\n}\n+fn default_wyre_account_id() -> String {\n+ \"AC_2J6LWQEGW8P\".to_string()\n+}\n+\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\npub struct LocalizationSettings {\n// A flag indicating whether or not the dashboard should give users the option to purchase\n@@ -9,6 +13,6 @@ pub struct LocalizationSettings {\n#[serde(default = \"default_wyre_enabled\")]\npub wyre_enabled: bool,\n// Wyre account_id used to associate transactions with a specific Wyre account\n- #[serde(default)]\n+ #[serde(default = \"default_wyre_account_id\")]\npub wyre_account_id: String,\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Generate the real Wyre id by default this is our account ID, may as well have it be the default value
20,249
09.12.2019 15:00:45
28,800
c51ef7e946309c2237947aa1d4ac0d559fc89a33
Send UDP heartbeat
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/rita_loop/mod.rs", "new_path": "rita/src/rita_client/rita_loop/mod.rs", "diff": "@@ -10,6 +10,7 @@ use crate::rita_client::traffic_watcher::WeAreGatewayClient;\nuse crate::rita_common::tunnel_manager::GetNeighbors;\nuse crate::rita_common::tunnel_manager::TunnelManager;\nuse crate::SETTING;\n+use actix::actors::resolver;\nuse actix::{\nActor, ActorContext, Addr, Arbiter, AsyncContext, Context, Handler, Message, Supervised,\nSystemService,\n@@ -18,7 +19,11 @@ use althea_types::ExitState;\nuse failure::Error;\nuse futures::future::Future;\nuse settings::client::RitaClientSettings;\n+use settings::RitaCommonSettings;\n+use std::net::SocketAddr;\n+use std::net::UdpSocket;\nuse std::time::{Duration, Instant};\n+type Resolver = resolver::Resolver;\n#[derive(Default)]\npub struct RitaLoop;\n@@ -76,6 +81,10 @@ impl Handler<Tick> for RitaLoop {\nArbiter::spawn(check_for_gateway_client_billing_corner_case());\n+ if SETTING.get_log().enabled {\n+ send_udp_heartbeat();\n+ }\n+\ninfo!(\n\"Rita Client loop completed in {}s {}ms\",\nstart.elapsed().as_secs(),\n@@ -85,6 +94,61 @@ impl Handler<Tick> for RitaLoop {\n}\n}\n+pub fn send_udp_heartbeat() {\n+ let res = Resolver::from_registry()\n+ .send(resolver::Resolve::host(\n+ SETTING.get_log().heartbeat_url.clone(),\n+ ))\n+ .timeout(Duration::from_secs(1))\n+ .then(move |res| match res {\n+ Ok(Ok(dnsresult)) => {\n+ if !dnsresult.is_empty() {\n+ for dns_socket in dnsresult {\n+ let local = SocketAddr::from(([0, 0, 0, 0], 33333));\n+ let socket =\n+ UdpSocket::bind(&local).expect(\"Couldn't bind to UDP heartbeat socket\");\n+\n+ let remote_ip = dns_socket.ip();\n+ let remote = SocketAddr::new(remote_ip, 33333);\n+\n+ trace!(\"Sending heartbeat to {:?}\", remote_ip);\n+\n+ let message = SETTING\n+ .get_network()\n+ .wg_public_key\n+ .clone()\n+ .expect(\"No key?\")\n+ .to_string()\n+ .into_bytes();\n+\n+ socket\n+ .set_write_timeout(Some(Duration::new(0, 100)))\n+ .expect(\"Couldn't set socket timeout\");\n+\n+ socket\n+ .send_to(&message, &remote)\n+ .expect(\"Couldn't send heartbeat\");\n+ }\n+ } else {\n+ trace!(\"Got zero length dns response: {:?}\", dnsresult);\n+ }\n+ Ok(())\n+ }\n+\n+ Err(e) => {\n+ warn!(\"Actor mailbox failure from DNS resolver! {:?}\", e);\n+ Ok(())\n+ }\n+\n+ Ok(Err(e)) => {\n+ warn!(\"DNS resolution failed with {:?}\", e);\n+ Ok(())\n+ }\n+ });\n+\n+ Arbiter::spawn(res);\n+}\n+\npub fn check_rita_client_actors() {\nassert!(crate::rita_client::rita_loop::RitaLoop::from_registry().connected());\nassert!(crate::rita_client::exit_manager::ExitManager::from_registry().connected());\n" }, { "change_type": "MODIFY", "old_path": "settings/src/logging.rs", "new_path": "settings/src/logging.rs", "diff": "@@ -10,6 +10,10 @@ fn default_logging_dest_url() -> String {\n\"https://stats.altheamesh.com:9999/compressed_sink\".to_string()\n}\n+fn default_heartbeat_url() -> String {\n+ \"althea.net:33333\".to_string()\n+}\n+\n/// Remote logging settings. Used to control remote logs being\n/// forwarded to the dest_url address, https is used to encrypt\n/// the logs as they travel over the internet so don't use non-https\n@@ -22,6 +26,9 @@ pub struct LoggingSettings {\npub level: String,\n#[serde(default = \"default_logging_dest_url\")]\npub dest_url: String,\n+ /// Address and port of UDP heartbeat monitoring server\n+ #[serde(default = \"default_heartbeat_url\")]\n+ pub heartbeat_url: String,\n}\nimpl Default for LoggingSettings {\n@@ -30,6 +37,7 @@ impl Default for LoggingSettings {\nenabled: default_logging(),\nlevel: default_logging_level(),\ndest_url: default_logging_dest_url(),\n+ heartbeat_url: default_heartbeat_url(),\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Send UDP heartbeat
20,244
20.12.2019 07:19:12
18,000
42e4bf4a3ecb6f53bf0eee066303a21f261aaa26
Fix new syntax warning This code has been this way for a very long time, but I guess the latest compiler now has a warning about it.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/dao.rs", "new_path": "rita/src/rita_common/dashboard/dao.rs", "diff": "@@ -14,7 +14,7 @@ pub fn get_dao_list(_req: HttpRequest) -> Result<Json<Vec<Address>>, Error> {\nOk(Json(SETTING.get_dao().dao_addresses.clone()))\n}\n-pub fn add_to_dao_list(path: Path<(Address)>) -> Result<Json<()>, Error> {\n+pub fn add_to_dao_list(path: Path<Address>) -> Result<Json<()>, Error> {\ntrace!(\"Add to dao list: Hit\");\nlet provided_address = path.into_inner();\nfor address in SETTING.get_dao().dao_addresses.iter() {\n@@ -40,7 +40,7 @@ pub fn add_to_dao_list(path: Path<(Address)>) -> Result<Json<()>, Error> {\nOk(Json(()))\n}\n-pub fn remove_from_dao_list(path: Path<(Address)>) -> Result<Json<()>, Error> {\n+pub fn remove_from_dao_list(path: Path<Address>) -> Result<Json<()>, Error> {\ntrace!(\"Remove from dao list: Hit\");\nlet provided_address = path.into_inner();\nlet mut iter = 0;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix new syntax warning This code has been this way for a very long time, but I guess the latest compiler now has a warning about it.
20,244
27.12.2019 07:37:52
18,000
5d16da94a9d92062639b546e26e5a184f2e364ba
Don't use the 'linux' prefix on top level function names If we do ever write non-linux functions we should disambiguate inside a function called generate_mesh_ip anyways.
[ { "change_type": "MODIFY", "old_path": "clu/src/lib.rs", "new_path": "clu/src/lib.rs", "diff": "@@ -31,7 +31,7 @@ pub enum CluError {\nRuntimeError(String),\n}\n-pub fn linux_generate_mesh_ip() -> Result<IpAddr, Error> {\n+pub fn generate_mesh_ip() -> Result<IpAddr, Error> {\nlet seed: String = thread_rng().sample_iter(&Alphanumeric).take(50).collect();\nlet mesh_ip = match ipgen::ip(&seed, \"fd00::/8\") {\nOk(ip) => ip,\n@@ -91,7 +91,7 @@ fn linux_init(config: Arc<RwLock<settings::client::RitaSettingsStruct>>) -> Resu\nexisting_mesh_ip\n);\nnetwork_settings.mesh_ip =\n- Some(linux_generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n+ Some(generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n} else {\ninfo!(\"Mesh IP is {}\", existing_mesh_ip);\n}\n@@ -99,7 +99,7 @@ fn linux_init(config: Arc<RwLock<settings::client::RitaSettingsStruct>>) -> Resu\nNone => {\ninfo!(\"There's no mesh IP configured, generating\");\nnetwork_settings.mesh_ip =\n- Some(linux_generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n+ Some(generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n}\n}\n@@ -208,7 +208,7 @@ fn linux_exit_init(\nexisting_mesh_ip\n);\nnetwork_settings.mesh_ip =\n- Some(linux_generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n+ Some(generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n} else {\ninfo!(\"Mesh IP is {}\", existing_mesh_ip);\n}\n@@ -217,7 +217,7 @@ fn linux_exit_init(\nNone => {\ninfo!(\"There's no mesh IP configured, generating\");\nnetwork_settings.mesh_ip =\n- Some(linux_generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n+ Some(generate_mesh_ip().expect(\"failed to generate a new mesh IP\"));\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Don't use the 'linux' prefix on top level function names If we do ever write non-linux functions we should disambiguate inside a function called generate_mesh_ip anyways.
20,244
27.12.2019 14:44:57
18,000
929d2cc842fa99859a05044b6ece63e8429f45c7
Bump for Beta 11 RC1 No phone client yet, but we need this for Abuja so let's just roll with it
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.26\",\n+ \"rita 0.5.27\",\n]\n[[package]]\n@@ -2170,7 +2170,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.26\"\n+version = \"0.5.27\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.26\"\n+version = \"0.5.27\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 10 RC6\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC1\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 11 RC1 No phone client yet, but we need this for Abuja so let's just roll with it
20,244
30.12.2019 18:29:16
18,000
5e807f7d8f6ea3b1bd9e6d24756db7ee2a7511e5
Remove newly redundant clones Not sure if this was a Clippy or a Rust improvement but it's always nice to have fewer clone statements.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/interfaces.rs", "new_path": "rita/src/rita_client/dashboard/interfaces.rs", "diff": "@@ -337,7 +337,7 @@ pub fn ethernet_transform_mode(\nSETTING\n.get_network_mut()\n.peer_interfaces\n- .insert(locally_owned_ifname.clone());\n+ .insert(locally_owned_ifname);\n}\nKI.uci_commit(&\"network\")?;\n@@ -473,7 +473,7 @@ pub fn wlan_transform_mode(ifname: &str, a: InterfaceMode, b: InterfaceMode) ->\nSETTING\n.get_network_mut()\n.peer_interfaces\n- .insert(locally_owned_ifname.clone());\n+ .insert(locally_owned_ifname);\n}\nKI.uci_commit(&\"wireless\")?;\n@@ -519,7 +519,7 @@ pub fn list_remove(list: &str, entry: &str) -> String {\n}\n}\n}\n- new_list.to_string()\n+ new_list\n} else {\n\"\".to_string()\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/neighbors.rs", "new_path": "rita/src/rita_client/dashboard/neighbors.rs", "diff": "@@ -81,7 +81,7 @@ pub fn get_neighbor_info(\nstart_connection(stream).and_then(move |stream| {\nparse_routes(stream)\n.and_then(|(_stream, routes)| {\n- let route_table_sample = routes.clone();\n+ let route_table_sample = routes;\nNetworkMonitor::from_registry()\n.send(GetStats {})\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/wifi.rs", "new_path": "rita/src/rita_client/dashboard/wifi.rs", "diff": "@@ -252,27 +252,27 @@ fn validate_channel(\n} else if new_is_two && !ALLOWED_TWO.contains(&new_val) {\nErr(ValidationError::BadChannel(\n\"20\".to_string(),\n- format!(\"{:?}\", ALLOWED_TWO).to_string(),\n+ format!(\"{:?}\", ALLOWED_TWO),\n))\n} else if new_is_five && channel_width_is_20 && !ALLOWED_FIVE_20.contains(&new_val) {\nErr(ValidationError::BadChannel(\n\"20\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_20).to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_20),\n))\n} else if new_is_five && channel_width_is_40 && !ALLOWED_FIVE_40.contains(&new_val) {\nErr(ValidationError::BadChannel(\n\"40\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_40).to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_40),\n))\n} else if new_is_five && channel_width_is_80 && !ALLOWED_FIVE_80.contains(&new_val) {\nErr(ValidationError::BadChannel(\n\"80\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_80).to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_80),\n))\n} else if new_is_five && channel_width_is_160 && !ALLOWED_FIVE_160.contains(&new_val) {\nErr(ValidationError::BadChannel(\n\"160\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_160).to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_160),\n))\n// model specific restrictions below this point\n} else if model.is_some()\n@@ -283,7 +283,7 @@ fn validate_channel(\n{\nErr(ValidationError::BadChannel(\n\"80\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_80_B1300).to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_80_B1300),\n))\n} else {\nOk(())\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_client/exit_manager/mod.rs", "new_path": "rita/src/rita_client/exit_manager/mod.rs", "diff": "@@ -304,7 +304,7 @@ pub fn exit_setup_request(\ncurrent_exit.info = exit_response.clone();\n- trace!(\"Got exit setup response {:?}\", exit_response.clone());\n+ trace!(\"Got exit setup response {:?}\", exit_response);\nOk(())\n}),\n@@ -360,7 +360,7 @@ fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\ncurrent_exit.info = exit_response.clone();\n- trace!(\"Got exit status response {:?}\", exit_response.clone());\n+ trace!(\"Got exit status response {:?}\", exit_response);\nOk(())\n});\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/network_endpoints/mod.rs", "new_path": "rita/src/rita_common/network_endpoints/mod.rs", "diff": "@@ -31,7 +31,7 @@ pub struct JsonStatusResponse {\nimpl JsonStatusResponse {\npub fn new(ret_val: Result<String, Error>) -> Result<Json<JsonStatusResponse>, Error> {\nlet res_string = match ret_val {\n- Ok(msg) => msg.clone(),\n+ Ok(msg) => msg,\nErr(e) => format!(\"{}\", e),\n};\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/oracle/mod.rs", "new_path": "rita/src/rita_common/oracle/mod.rs", "diff": "@@ -252,7 +252,7 @@ fn update_gas_price(web3: &Web3, full_node: String) {\n.ok_or_else(|| {\nformat_err!(\"gas price is too high to fit into 256 signed bit integer\")\n})?\n- * dynamic_fee_factor.clone();\n+ * dynamic_fee_factor;\ntrace!(\n\"Dynamically set pay threshold to {:?}\",\npayment_settings.pay_threshold\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/peer_listener/mod.rs", "new_path": "rita/src/rita_common/peer_listener/mod.rs", "diff": "//! off the queue. These are turned into Peer structs which are passed to TunnelManager to do\n//! whatever remaining work there may be.\n+mod message;\n+\nuse crate::rita_common::rita_loop::fast_loop::Tick;\nuse crate::KI;\nuse crate::SETTING;\n@@ -16,7 +18,6 @@ use failure::Error;\nuse settings::RitaCommonSettings;\nuse std::collections::HashMap;\nuse std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6, UdpSocket};\n-mod message;\nuse self::message::PeerMessage;\n#[derive(Debug)]\n@@ -140,7 +141,7 @@ impl Handler<Listen> for PeerListener {\n.get_network_mut()\n.peer_interfaces\n.insert(new_iface_name.clone());\n- self.interfaces.insert(new_iface_name.clone(), n);\n+ self.interfaces.insert(new_iface_name, n);\n}\nErr(e) => {\nerror!(\"Peer listener failed to listen on {:?}\", e);\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -275,7 +275,7 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\nBox::new(bridge.xdai_to_dai_bridge(amount.clone()).then(move |_res| {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::XdaiToDai {\n- amount: amount.clone(),\n+ amount,\n},\n));\nOk(())\n@@ -284,7 +284,7 @@ fn eth_bridge(_state: State, bridge: &TokenBridge) {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::DaiToEth {\namount_of_dai: our_dai_balance.clone(),\n- wei_per_dollar: wei_per_dollar.clone(),\n+ wei_per_dollar,\n},\n));\nBox::new(\n@@ -449,7 +449,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nif our_dai_balance >= amount {\nTokenBridge::from_registry().do_send(DetailedStateChange(DetailedBridgeState::DaiToEth{\namount_of_dai: amount_a.clone(),\n- wei_per_dollar: wei_per_dollar.clone()\n+ wei_per_dollar\n}));\nBox::new(\nbridge\n@@ -466,12 +466,12 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nlet gas_price = eth_gas_price;\nlet tx_gas: Uint256 = 21_000u32.into();\nlet tx_cost = gas_price * tx_gas;\n- our_eth_balance.clone() - tx_cost\n+ our_eth_balance - tx_cost\n} else { transferred_eth };\nTokenBridge::from_registry().do_send(DetailedStateChange(DetailedBridgeState::EthToDest{\namount_of_eth: withdraw_amount.clone(),\n- wei_per_dollar: wei_per_dollar.clone(),\n+ wei_per_dollar,\ndest_address: to\n}));\nBox::new(bridge.eth_transfer(\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/database/database_tools.rs", "new_path": "rita/src/rita_exit/database/database_tools.rs", "diff": "@@ -253,7 +253,7 @@ pub fn update_mail_sent_time(\n) -> Result<(), Error> {\nuse self::schema::clients::dsl::{clients, email, email_sent_time};\nlet mail_addr = match client.clone().reg_details.email {\n- Some(mail) => mail.clone(),\n+ Some(mail) => mail,\nNone => bail!(\"Cloud not find email for {:?}\", client.clone()),\n};\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove newly redundant clones Not sure if this was a Clippy or a Rust improvement but it's always nice to have fewer clone statements.
20,244
01.01.2020 13:49:26
18,000
a3b1b609f6516073c397d1c5d2b47fceddfec3d8
Bump for Beta 11 RC2
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.27\",\n+ \"rita 0.5.28\",\n]\n[[package]]\n@@ -2170,7 +2170,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.27\"\n+version = \"0.5.28\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "[package]\nname = \"rita\"\n-version = \"0.5.27\"\n+version = \"0.5.28\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/dashboard/own_info.rs", "new_path": "rita/src/rita_common/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC1\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC2\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 11 RC2
20,244
01.01.2020 13:50:41
18,000
e263b8d897071efa1cd45678eb5c90d3d300042b
Missed one redundant clone
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_common/token_bridge/mod.rs", "new_path": "rita/src/rita_common/token_bridge/mod.rs", "diff": "@@ -356,7 +356,7 @@ fn xdai_bridge(state: State, bridge: &TokenBridge) {\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::EthToDai {\namount_of_eth: swap_amount.clone(),\n- wei_per_dollar: wei_per_dollar.clone(),\n+ wei_per_dollar,\n},\n));\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Missed one redundant clone