Commit Graph

28 Commits

Author SHA1 Message Date
Jędrzej Stuczyński afcefa9432 Dealt with typescript validator client 2022-03-25 14:20:09 +00:00
Jędrzej Stuczyński c1e809fd99 Feature/ts client update (#956)
* Made client compile again + set auto fees

* Simplified client construction by allowing only a single URL

* wip

* Simplified signing assertion

* Initial implementation of queries

* Implemented all basic nymd queries

* Validator API queries

* Signing related queries

* Using default arguments

* Removed redundant else branches

* `eslint` and `prettier` formatting on Typescript validator client

* Removed cyclic import on Coin type

* Missing direct dependencies

* Ingoring cyclic imports

* Removed unused argument

Co-authored-by: Mark Sinclair <mmsinclair@gmail.com>
2021-12-16 15:35:30 +00:00
Jędrzej Stuczyński 668325a4ce Feature/active sets (#764)
* Added separate gateway active set size

* Grabbing contract state

* Defined PartialOrd on MixnodeBond and GatewayBond

* Some initial stub for active set

* Unit tests for mixnode and gateway bond partialord implementation

* Obtaining active sets

* Active nodes routes

* Additional methods on validator client

* Added state migration

* Feature locking unused import

* Fixed State test fixture

* Included block height for partial_ord

* Missing post-merge imports

* api on the client for active nodes

* Native/socks5/wasm clients using active nodes

* Rewarding only active nodes

* Updated validator client StateParams definition

* Gateway active set size

* Contract migration update

* Cargo fmt

* Updated TauriStateParams

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-09-28 09:38:22 +01:00
Bogdan-Ștefan Neacşu bed09bf8a4 Add stake reward rates and bump version of client (#738)
* Tiny PR to add stake reward rates and bump version

This is needed so that we can publish the 0.17 version.

* Add the changes to contracts as well

On second thought, update the contract together with the client, and
leave the wallet changes for another PR.

* Rename _stake_ to _delegation_
2021-08-16 11:43:24 +03:00
Jędrzej Stuczyński 389d1ba3b9 Cleaned up dependencies of our typescript client (#699)
* Cleaned up dependencies of our typescript client

* Explicitly added stargate dependency and not rely on it being in node_modules
2021-07-26 10:58:58 +01:00
Dave Hrycyszyn 68f2d8b925 Version bump 2021-07-09 11:52:59 +01:00
Bogdan-Ștefan Neacşu 973c30592f Use cached topology for clients (#674)
* Add validator-api common client

* Call validator-api from different clients for gateway topology

* Call validator-api from different clients for mixnode topology

* Use consts for the validator-api queries

* Rename the new query_validator function to query_validator_api

* Add mut to mixnode validator client

* Add refreshValidatorAPIGateways as a way to get the gateways...

... from validator-api

* Add refreshValidatorAPIGateways as a way to get the mixnodes...

... from validator-api

* Add yet another mut

* Change the port to validator-api service when querying the topology

* Add parsing check on the config phase...

... to make sure the validator URLs are in the correct format.

* Fix another clippy error

* Use all provided validators instead of just the first one

* The mutable reference was not actually needed, so remove it

* Use global variable for validator-api port

* Use url crate for checking the format and changing the port

* Use URL for parsing and move constants of validator-api to index.ts...

... until we find a way to link to the values from the validator-api
crate.

* Change global variables naming and have the API version into each API query

* Revert the changes to the index on connect...

... as they were working correctly before.

* Use all provided validators for mixnodes as well

* Remove location and layer
2021-07-09 11:50:41 +01:00
Dave Hrycyszyn 929775c517 Bumping version number for release 2021-07-06 16:10:38 +01:00
Dave Hrycyszyn 427893efef Feature/validator client upgrade (#675)
* Upgrading cosmos client to v0.25.5

* Formatting

* Renamed stakeDenom to prefix

* Added a denom field to the client

* New version needs a denom in the static methods

* ibid

* Formatting

* Renaming bech32prefix to prefix

* Adding a weird 'u' in the nymGasPrice

* Changing to use denom instead of prefix in nymGasPrice

* Alphabetizing fields

* Renaming method to something a bit more sane

* Using prefix, not denom, to build gas price

* Hardcoding an unavoidable and ugly manual conversion into the stargate helper

* denom is correct, for use in getBalance
2021-07-06 13:50:26 +02:00
Jędrzej Stuczyński 3412a0b7bd Increased validator client version 2021-06-24 15:51:05 +01:00
Jędrzej Stuczyński 3d2654923a Bugfix/delegation type fixes (#649)
* Extended no delegation found errors with address information

* Error now use Display implementation rather than Debug

* Delegation correctly contains owner address

* Updated js delegation type

* Bumped validator client version number

* Delegation::owner returns owned type

* cargo fmt
2021-06-17 10:51:50 +01:00
Jędrzej Stuczyński 97ec416b3e TypeScript client v0.12.0 (#641) 2021-06-15 10:46:42 +01:00
Dave Hrycyszyn 7b02026476 Bumped to 0.11.1 2021-06-11 10:51:54 +01:00
Jędrzej Stuczyński 94a52aa2db Updated all js related dependencies (#629) 2021-06-07 12:00:12 +01:00
Jędrzej Stuczyński 528eba2faa Changed default mixnode query page limit (#592)
* Changed default mixnode query page limit

* Fixed the tests

* 0.11.0 validator client
2021-04-29 13:58:28 -04:00
Jędrzej Stuczyński e8e966b67a Feature/multiple validator endpoints (#583)
* Rust half done

* Removed the temporary 'test'

* Using multiple validator endpoints in the javascript client

* Dont attempt any switches with a single validator endpoint

* Removed the unused temporary function

* Updated validator-client version
2021-04-23 16:41:39 +01:00
Jędrzej Stuczyński 0a3cffa1a1 Validator client patch version increase 2021-04-16 10:17:01 +01:00
Jędrzej Stuczyński 8b12a31f73 Version 0.10.0 of the validator client 2021-04-15 09:41:14 +01:00
Jędrzej Stuczyński 809c3f3607 Updated version number on the validator client (#565) 2021-04-09 15:34:20 +01:00
Jędrzej Stuczyński bcf25135a1 Feature/validator client address getter (#554)
* Added address getter for the client

* Might as well bump the version number
2021-04-01 12:08:16 +01:00
Jędrzej Stuczyński 087efbe553 Feature/validator client rc3 (#552)
* Bumped the version number

* Additional currency helper
2021-04-01 12:08:16 +01:00
Dave Hrycyszyn f07ac48a33 Feature/validator client rc2 (#546)
* Fixing publish instructions

* Bumped version number
2021-03-25 12:44:12 +00:00
Dave Hrycyszyn 52d4ddb714 RC1 published (#543) 2021-03-24 11:49:58 +00:00
Dave Hrycyszyn ca60b8671c Feature/prep for publish (#542)
* Adding Apache license

* Getting package.json ready to roll
2021-03-24 11:04:05 +00:00
Dave Hrycyszyn 51d2213819 Feature/convert to uhal (#537)
* Exporting Coin struct, needed for wallet

* Passing the url through instead of using local options.

This gives us the ability to hook up to the new validator

* Removing examples

* Simplifying dependencies a bit

* Setting all contract denominations to uhal

* Making stakeDenom configurable throughout
2021-03-23 12:18:08 +00:00
Dave Hrycyszyn d301694404 Feature/upgrade cosm client (#534)
* Exporting Coin struct, needed for wallet

* Upgrading cosmwasm client to 0.24.1
2021-03-18 14:40:55 +00:00
Dave Hrycyszyn d3570df968 Feature/add currency helpers (#531)
* Exporting Coin struct, needed for wallet

* Adding currency helpers
2021-03-16 14:31:13 +00:00
Dave Hrycyszyn 4ca40fd3bc Feature/initial mixnet contract (#515)
* Starting on cosmwasm smart contracts

* Mixnet contract now builds

* Removing license and notice files, the monorepo already has these.

* Removing generated README content

* Simplified development instructions a bit.

* Converted some network monitor files to use SPDX license headers

* Renamed packaget to mixnet-contracts

* Depending on the Nym topology crate

* Renaming contract package in usage

* Renamed "announce" to "register_node" in the defined messages

* Fixed package name for mixnet contracts in defined release annotations

* Added the mixnet contracts to the Cargo lock file

* Renamed some fields in our contract topology

* Using the stringy mixnode from the validator client.

* Removing mix nodes count from state, we can infer that

* Saving generated code in comment as it's a useful example for now

* Renamed "count" to "get_topology"

* Adding the beginnings of a validator client (in Typescript)

* Starting to integrate example code. WIP.

* Ignoring generated accounts

* Making a few less mixnodes :)

* Adding shebang to start script

* Cranking up the Nym-related gas limits, as otherwise contract upload fails.

* Simplest mixnode example is now working

* Removing the external client code, it messed up wasm compilation. Will copy/paste for now.

* Contract now wants to add a MixNode rather than an IP string

* Adding mixnodes via contract now works (!)

* Simplified mixnode registration example

* Further mixnode-adding simplification.

* Adding author name

* Fixed description

* Sent funds are now required to bond a mixnode

* Ensuring that we send correct coin denomination

* Unbonding now works (!). Quite primitivist.

* Checking that unbonding works from the client.

* Setting up a thief account to play with

* Checking to see whether thief can unbond a node (it fails, happily)

* Adding a more specific error for when an account attempts to unbond but owns no bonds

* Figured out how to test contract balances

* Set the console messages to explain things a little more nicely

* Tests for insufficient funds result

* Using more async in driver example

* Added a bit more explanation of the actions taken by the driver example

* Locking down wasm instantiate a bit more

* Docs clarifications on how to run example

* README clarification

* Corrected the commit hash in the wasmd build command, it was still set for 0.14.0

* Moved models from types into state

* Starting work on range queries

* whitespace

* Going back to slow but reliabel node uploads and disabling new contract upload

* Cranking gas fees temporarily

* Mixnode key retrieval working and tested

* Range retrievals now working well

* Removing unused clone

* Compressing tests a bit

* Testing node retrieval on large numbers of nodes.

Not sure whether MockStorage has the same space limitations as
production storage does.

* Getting rid of spelling warning

* Removing unused responses

* Minor cleanup

* Starting to map my way out of the tuples

* Slightly more meaningful variable names

* Returning a StdResult from nodes query

* Fighting through the unwraps :)

* Unfucking a bit more

* Starting to use ranged nodes in contract

* Testing node retrieval from range store

* Ditching generated tests

* Adding works, still need to test removing mixnodes

* Attempting to remove a mixnode returns an error when no nodes exist

* Un-registering when no accounts exist (edit)

* un-registering someone else's mixnode fails

* Ensuring proper ownership

* Testing for only 1 mixnode getting deleted

* Testing single-node retrieval

* Removing mixnode working

* Removed unused imports and unused variable warnings

* Made handler functions private

* Tested for error response on mixnode removal

* Ensured proper post-state on mixnode removal

* Using Vec<Coin> for currency equality comparisons

* Removed todo, this amount is only for logging purposes anyway

* Refactoring tests a bit

* Adding a few storytelling comments

* Putting helper methods into alphabetical order

* Drying up mixnode adding in tests

* Using the new add_mixnode helper

* Checking full object equality in test

* Removing the GetNodes handler

* Taking a more "storytelling" approach to the contract tests

* We need a few more methods to run our example driver

* We now need to make a new address for each node we want to have,

as each sending account can only have one node

* HumanAddr not needed

* Making call sequence a little more readable

* Added the results of today's experiments with the REST API to the validator client readme

* Corrected console.log message

* Adding a note about how to run tests

* More contract exercising fun

* Updating mocha

* Whitespace

* Adding a note about running tests

* Adding typed rest client

* Starting to mess with typescript paging client

* Removing the rest client, we'll use the cosmjs one for this

* Noting a few more contract requirements

* Starting client restructuring

* Importing cosmjs stargate client

* Starting to work on the chain cache

* Cleanup

* Removing type annotations which hilariously worked, confusing the compiler

* Might as well do each cache individually

* Renaming chaincache so that it handles only mixnodes

* Renaming chaincache

* Setting dynamic per-page value to ease testing

* Using perPage in tests

* Moving tests back into their own special home so they don't bloat our package

* Ignoring generated docs

* Adding TypeDoc documentation generator

* Removing unused NetClient import

* Added docs generation

* Noting existence of docs generation

* Starting to test paged responses

* Working paging tests

* Clarified test names a bit

* Removed console.logs

* Added a test for two full pages.

* Formatting

* Starting to query for mix nodes

* Removed the topology in preparation for paging

* Removing unused struct

* Getting ready for series-based paging

* We're now setting page size limits on list retrievals

* Pagination starting to work, needs more testing

* Moved test support stuff into its own home

* Removing duplicate testy code

* Testing all paging stuff in the contract

* Removed useless method duplicate

* Moving queries into their own file

* Removing redundant tests

* Testing default paging limit

* Testing max paging limit

* We don't need to c/p pagination stuff from the cw-plus contracts, removing

* Testing pagination

* Making next key calculation explict via a function

* Removing temporary variable

* Commenting final state

* Incorporating the PagedResponse

* On the road to a working TypeScript client

* Adding some logging utilities

* Paged retrieval working but needs improvement - it's very brittle

* Getting the loop right

* Removing unused logger

* Setting up a request count

* Documenting the ins and outs of the client network interface

* Removing requestCount as we're not using it yet

* Success! Making paginated requests for mixnodes!

* Differentiating between MixNode and MixNodeBond

* Checking that Fred can upload a mixnode

* Fixing export

* Adding the ability for client to get balances

* Docs fix

* Converting interfaces to types

* Changing `mixNodes()` to `getMixNodes()` on client

* We might as well return the nodes we've just retrieved when we refresh

* Starting work on unbonding

* Fixed a caching bug which was causing multiple result sets to be cached

* Using the sender address as the key for removal

* Importing some result stuff so we can find out what happened on execution

* Minor messing around to prove that the sequence fully works

* Displaying a nicer message on mixnode unbond

* Renamed announce to bond in validator client

* Fixed unstable clippy warnings

* Removing commented fields

* Comment spacing

* Changed announce to bond in example code

* Making the test accounts directory configurable

* Rebuilt

* Loading keys from the local ./accounts directory

* Ignoring contract lockfile

* Saving out a contract lockfile so things continue working after contract upload

* Splitting the driver example into smaller self-contained examples

* Deleting the example that Andrew hates so much

* Making dependabot happy

* Stricter equals

* Removing unused import
2021-03-09 11:32:51 +00:00