Squashed commit of the following:

commit 976dd7aae2
Author: 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>

commit 0d21f4e937
Merge: e84af4f6 1403449a
Author: 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

commit 1403449ad5
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 14 16:00:21 2021 +0100

    enable bonding

commit e84af4f601
Author: 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>

commit 26b032c15c
Merge: e1ddaff0 cba36253
Author: 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

commit cba3625394
Author: 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

commit e1ddaff04d
Merge: 0b9c03ca 66ab5de4
Author: 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

commit 66ab5de442
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 16:16:58 2021 +0100

    add app alert

commit 0b9c03ca90
Author: 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)

commit c9dce0c1da
Author: 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

commit e00e77db15
Author: 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

commit 1074449f91
Merge: 08276e6e 9a3d824a
Author: 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

commit 08276e6e42
Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
Date:   Tue Sep 7 16:33:30 2021 +0200

    Remove migration code (#759)

commit 9a3d824a4a
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 6 20:39:24 2021 +0100

    remove alert

commit 2789ee8f18
Author: 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

commit a7ba643c35
Merge: 28be53ee c42f3c68
Author: 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

commit 28be53eefb
Author: 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)

commit 219c45a352
Author: 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

commit 1a3b83752e
Author: 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>

commit c42f3c6844
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 12:29:47 2021 +0100

    add app alert banner

commit a5d3ba3900
Merge: 92e13a5d cdf0d443
Author: 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

commit cdf0d44341
Author: Mark Sinclair <mmsinclair@gmail.com>
Date:   Tue Aug 31 14:37:28 2021 +0100

    explorer-api: turned down logging from `error` to `warn`

commit 92f976a45d
Author: 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

commit 2bc858cde3
Author: 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

commit 92e13a5d00
Author: 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

commit 122f5d9f2e
Author: 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

commit 982ee0266c
Author: 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

commit 5f42a9bd05
Author: 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

commit 1811df9ddb
Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
Date:   Fri Aug 27 13:52:10 2021 +0100

    Enabled validators api argument (#753)

commit 6bdfe7f895
Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
Date:   Thu Aug 26 11:21:01 2021 +0100

    Correctly bounding nominator of uptime calculation (#752)

commit c6b286a1db
Author: 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)

commit b3568a26f5
Author: 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 commit 38d868bcce.

commit 15ae0f521e
Author: 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

commit 2923d4b872
Author: 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:
Drazen Urch
2021-09-16 17:36:24 +02:00
parent 424230c3bb
commit f33defc645
2 changed files with 25 additions and 25 deletions
+24 -24
View File
@@ -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"));
}
}
}
+1 -1
View File
@@ -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;