Squashed commit of the following:
commit976dd7aae2Author: Drazen Urch <drazen@urch.eu> Date: Wed Sep 15 17:28:49 2021 +0200 Add block_height method to Delegation (#778) Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com> commit0d21f4e937Merge:e84af4f61403449aAuthor: Fouad <fmtabbara@hotmail.co.uk> Date: Wed Sep 15 12:41:29 2021 +0100 Merge pull request #776 from nymtech/update/re-enable-bonding re-enable bonding commit1403449ad5Author: fmtabbara <fmtabbara@hotmail.co.uk> Date: Tue Sep 14 16:00:21 2021 +0100 enable bonding commite84af4f601Author: Drazen Urch <drazen@urch.eu> Date: Tue Sep 14 15:15:26 2021 +0200 Migrate legacy delegation data (#771) * Skip ReadOnlyBucket deserialization errors * empty migration * clippy * cargo schema * Drop invalid delegation data * Dont drop old data * Add todo * Unify on type param * gateways are different * cargo fmt Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com> commit26b032c15cMerge:e1ddaff0cba36253Author: Mark Sinclair <mmsinclair@gmail.com> Date: Tue Sep 14 10:09:14 2021 +0100 Merge pull request #774 from nymtech/feature/explorer-api-delegations Explorer-api: add API resource to show the delegations for each mix node commitcba3625394Author: Mark Sinclair <mmsinclair@gmail.com> Date: Mon Sep 13 10:33:41 2021 +0100 explorer-api: add API resource to show the delegations for each mix node commite1ddaff04dMerge:0b9c03ca66ab5de4Author: Fouad <fmtabbara@hotmail.co.uk> Date: Fri Sep 10 17:17:14 2021 +0100 Merge pull request #772 from nymtech/update/disable-bonding add app alert commit66ab5de442Author: fmtabbara <fmtabbara@hotmail.co.uk> Date: Fri Sep 10 16:16:58 2021 +0100 add app alert commit0b9c03ca90Author: Dave Hrycyszyn <futurechimp@users.noreply.github.com> Date: Fri Sep 10 11:23:21 2021 +0300 Adding deps for building the Tauri wallet under Ubuntu (#770) commitc9dce0c1daAuthor: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Thu Sep 9 11:21:45 2021 +0200 Feature/consumable bandwidth (#766) * Set actual value for bandwidth Also put it as a public attribute, such that it can be actively used by the credential consumer * Switch from sending Attribute structs to sending the actual attribute bytes over the wire * Add atomic bandwidth value to gateway * Consume bandwidth based on the mix packet size * Use Bandwidth struct for specific functionality * Move bandwidth code outside the dependency path of wasm client * Use u64 instead of AtomicU64, as the handling is not parallel commite00e77db15Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Wed Sep 8 15:07:24 2021 +0200 Feature/bond blockstamp (#760) * Add block_height to MixNode/GatewayBond * Reward based on blockstamp of bonded node or of delegation * Add specific tests * Add migration code * Apply doc nit commit1074449f91Merge:08276e6e9a3d824aAuthor: Fouad <fmtabbara@hotmail.co.uk> Date: Tue Sep 7 23:45:10 2021 +0100 Merge pull request #767 from nymtech/update/remove-app-alert remove alert commit08276e6e42Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Tue Sep 7 16:33:30 2021 +0200 Remove migration code (#759) commit9a3d824a4aAuthor: fmtabbara <fmtabbara@hotmail.co.uk> Date: Mon Sep 6 20:39:24 2021 +0100 remove alert commit2789ee8f18Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Fri Sep 3 15:30:45 2021 +0300 Update coconut-rs and use hash_to_scalar from there (#765) Failed tests are due to some nightly issue, not related to this PR commita7ba643c35Merge:28be53eec42f3c68Author: Fouad <fmtabbara@hotmail.co.uk> Date: Fri Sep 3 09:14:50 2021 +0100 Merge pull request #762 from nymtech/feature/app-alert add app alert banner commit28be53eefbAuthor: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Thu Sep 2 18:26:40 2021 +0300 Add block_height in the Delegation structure as well (#757) commit219c45a352Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Thu Sep 2 15:48:29 2021 +0100 Updated cosmos-sdk (#761) * Updated cosmos-sdk * Re-exposing more things commit1a3b83752eAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu Sep 2 15:45:56 2021 +0100 Bump next from 11.1.0 to 11.1.1 in /wallet-web (#758) Bumps [next](https://github.com/vercel/next.js) from 11.1.0 to 11.1.1. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v11.1.0...v11.1.1) --- updated-dependencies: - dependency-name: next dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commitc42f3c6844Author: fmtabbara <fmtabbara@hotmail.co.uk> Date: Thu Sep 2 12:29:47 2021 +0100 add app alert banner commita5d3ba3900Merge:92e13a5dcdf0d443Author: Mark Sinclair <mmsinclair@gmail.com> Date: Tue Aug 31 15:59:11 2021 +0100 Merge pull request #755 from nymtech/bugfix/explorer-api-ping Explorer API: port test now split out address resolution and add units tests commitcdf0d44341Author: Mark Sinclair <mmsinclair@gmail.com> Date: Tue Aug 31 14:37:28 2021 +0100 explorer-api: turned down logging from `error` to `warn` commit92f976a45dAuthor: Mark Sinclair <mmsinclair@gmail.com> Date: Fri Aug 27 11:34:21 2021 +0100 explorer-api: sanitize hostname before running checks to avoid leading or trailing spaces that are known to exist in the current test net commit2bc858cde3Author: Mark Sinclair <mmsinclair@gmail.com> Date: Fri Aug 27 09:32:26 2021 +0100 explorer-api: port test: split out address resolution and add units tests commit92e13a5d00Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Tue Aug 31 14:51:15 2021 +0300 Feature/add blockstamp (#756) * Add RawDelegationData * Fix current tests for the new stored data * Added migration commit. Will be reverted after doing the migration * New tests for block height * Use current blockstamp instead of 24h old one * Put _alot_ of migration stuff in the migrate function scope commit122f5d9f2eAuthor: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Mon Aug 30 10:27:20 2021 +0300 Feature/cred after handshake (#745) * Call perform_initial_authentication instead of register in clients * Refactor the register/authenticate functions a bit * Introduce Bandwidth request type * Add encryption layer to cred * Remove cred pass and check from handshake * Replaced unreachable! with error * Changed decrypt_tagged signature to not take mutable ownership of data * Put handle_bandwidth work inside a function * Add check before unwrap * Remove unnecessary async * Decouple bandwidth credential from authentication * Use new_error for ServerResponse:Error * Send a fresh IV each time the BandwidthCredential request is sent * Remove unwrap of bincode::serialize * Add comment regarding Bandwidth response * Remove _mut from naming * Leave Debug trait alone, as the initial error doesn't reproduce anymore * Pass iv as Vec<u8> instead of base58 string * Renamed AuthenticationIV to IV, as it is now used for more the just authentication * Did some IV refactorization commit982ee0266cAuthor: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Fri Aug 27 16:02:34 2021 +0300 Feature/get own delegations (#748) * Introduce reverse delegation bucket * Add client command * Fix clippy error * Added tests in queries * Add tests in transactions * Migration code. Will be reverted after it's called on testnet * Replace unwrap with expect * Move some test code in the right file... ... to remove unnecessary auxiliary function. * Reduce the scope to migration auxiliary functions * Rename everything from [node]reverse to reverse[node] * Fix fmt commit5f42a9bd05Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Fri Aug 27 13:52:18 2021 +0100 NetworkMonitorBuilder - starting the monitor after rocket has launched (#754) * NetworkMonitorBuilder - starting the monitor after rocket has launched * Removed unused import commit1811df9ddbAuthor: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Fri Aug 27 13:52:10 2021 +0100 Enabled validators api argument (#753) commit6bdfe7f895Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Thu Aug 26 11:21:01 2021 +0100 Correctly bounding nominator of uptime calculation (#752) commitc6b286a1dbAuthor: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Wed Aug 25 14:50:57 2021 +0100 Fixed argument parsing for ipv6 'good' topology (#751) commitb3568a26f5Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Tue Aug 24 11:25:05 2021 +0300 Revert "Migration commit, will be reverted after the testnet contract is updated" (#749) This reverts commit38d868bcce. commit15ae0f521eAuthor: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Date: Mon Aug 23 10:26:51 2021 +0100 Feature/more reliable uptime calculation (#747) * New database table holding monitor run info * SQL interface for new table * Updated uptime calculation to instead rely on number of monitor test runs commit2923d4b872Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net> Date: Thu Aug 19 22:03:07 2021 +0300 Update template toml key (#746)
This commit is contained in:
@@ -11,7 +11,7 @@ use std::fmt;
|
||||
use std::ops::{Add, Sub};
|
||||
use std::str::FromStr;
|
||||
use ts_rs::TS;
|
||||
use validator_client::nymd::{GasPrice, CosmosCoin};
|
||||
use validator_client::nymd::{CosmosCoin, GasPrice};
|
||||
|
||||
use crate::format_err;
|
||||
|
||||
@@ -96,25 +96,25 @@ impl Add for Coin {
|
||||
|
||||
// Allows adding minor and major denominations, output will have the LHS denom.
|
||||
impl Sub for Coin {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
let denom = self.denom.clone();
|
||||
let lhs = self.to_minor();
|
||||
let rhs = rhs.to_minor();
|
||||
let lhs_amount = lhs.amount.parse::<i64>().unwrap();
|
||||
let rhs_amount = rhs.amount.parse::<i64>().unwrap();
|
||||
let amount = lhs_amount - rhs_amount;
|
||||
let coin = Coin {
|
||||
amount: amount.to_string(),
|
||||
denom: Denom::Minor,
|
||||
};
|
||||
match denom {
|
||||
Denom::Major => coin.to_major(),
|
||||
Denom::Minor => coin,
|
||||
}
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self {
|
||||
let denom = self.denom.clone();
|
||||
let lhs = self.to_minor();
|
||||
let rhs = rhs.to_minor();
|
||||
let lhs_amount = lhs.amount.parse::<i64>().unwrap();
|
||||
let rhs_amount = rhs.amount.parse::<i64>().unwrap();
|
||||
let amount = lhs_amount - rhs_amount;
|
||||
let coin = Coin {
|
||||
amount: amount.to_string(),
|
||||
denom: Denom::Minor,
|
||||
};
|
||||
match denom {
|
||||
Denom::Major => coin.to_major(),
|
||||
Denom::Minor => coin,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Coin {
|
||||
pub fn major<T: ToString>(amount: T) -> Coin {
|
||||
@@ -273,7 +273,7 @@ mod test {
|
||||
"1000000000000000",
|
||||
"10000000000000000",
|
||||
"100000000000000000",
|
||||
"1000000000000000000"
|
||||
"1000000000000000000",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -333,10 +333,10 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
assert_eq!(Coin::minor("1") + Coin::minor("1"), Coin::minor("2"));
|
||||
assert_eq!(Coin::major("1") + Coin::major("1"), Coin::major("2"));
|
||||
assert_eq!(Coin::minor("1") + Coin::major("1"), Coin::minor("1000001"));
|
||||
assert_eq!(Coin::major("1") + Coin::minor("1"), Coin::major("1.000001"));
|
||||
assert_eq!(Coin::minor("1") + Coin::minor("1"), Coin::minor("2"));
|
||||
assert_eq!(Coin::major("1") + Coin::major("1"), Coin::major("2"));
|
||||
assert_eq!(Coin::minor("1") + Coin::major("1"), Coin::minor("1000001"));
|
||||
assert_eq!(Coin::major("1") + Coin::minor("1"), Coin::major("1.000001"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -345,5 +345,5 @@ mod test {
|
||||
assert_eq!(Coin::major("1") - Coin::major("1"), Coin::major("0"));
|
||||
assert_eq!(Coin::minor("1") - Coin::major("1"), Coin::minor("-999999"));
|
||||
assert_eq!(Coin::major("1") - Coin::minor("1"), Coin::major("0.999999"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use tendermint_rpc::endpoint::broadcast::tx_commit::Response;
|
||||
use tokio::sync::RwLock;
|
||||
use ts_rs::{export, TS};
|
||||
use validator_client::nymd::fee_helpers::Operation;
|
||||
use validator_client::nymd::{NymdClient, SigningNymdClient, AccountId, CosmosCoin};
|
||||
use validator_client::nymd::{AccountId, CosmosCoin, NymdClient, SigningNymdClient};
|
||||
|
||||
mod coin;
|
||||
mod config;
|
||||
|
||||
Reference in New Issue
Block a user