534 Commits

Author SHA1 Message Date
jholdstock
ddd7fd5bee Use tagged client v4.0.1 2024-10-23 12:19:34 +01:00
jholdstock
6335ad4f96 client: Send empty maps instead of nil. 2024-10-16 16:43:38 +01:00
jholdstock
caf02de645 Update golangci-lint to 1.61.0. 2024-10-16 16:36:51 +01:00
jholdstock
19572593b1 Update dependencies.
Not gaining any new features here but some minor bug fixes.

gorilla/sessions v1.4.0 and bbolt v1.3.11 are available but not taking
them at this time because they will force this project to bump its
minimum required go version.
2024-10-16 16:36:51 +01:00
jholdstock
690b06412a ci: Update tested go versions to 1.22 and 1.23. 2024-09-05 10:31:37 +01:00
jholdstock
caca0b45d0 ci: Update GitHub Actions and linter. 2024-09-05 10:31:37 +01:00
jholdstock
85e992e520 main: Use tagged client/v4. 2024-07-24 16:46:47 +01:00
jholdstock
a80e40d650 v3tool: Continue if a ticket already has paid fee.
v3tool will now attempt to register all tickets with the VSP rather
than immediately exiting if one of the tickets already has a paid fee.
2024-07-17 10:20:35 +01:00
Jamie Holdstock
63b2a6117d
Use latest golangci-lint release and update linter list. (#484)
* ci: Update linter to 1.59.1.

Also remove deprecated linter "vetshadow", its functionality is now
included in the "govet" linter.

* ci: Add new linters.

- fatcontext - Detects nested contexts in loops.
- mirror - Reports wrong mirror patterns of bytes/strings usage.
- nilnil - Checks that there is no simultaneous return of nil error and
  an invalid value.
- usestdlibvars - detect the possibility to use variables/constants from
  the Go standard library.
2024-07-08 09:52:43 -04:00
Jamie Holdstock
aa8d2a34ea
Use tagged types/v3 and update some other dependencies. (#483)
* client: Use tagged types/v3.

* main: Use tagged types/v3.

* client: Update to txscript 4.1.1.

* multi: Update transitive deps.
2024-07-08 09:52:13 -04:00
jholdstock
906ffc9e88 multi: Consider DCP0012 in VSP fee calculations.
Upgrade the dcrwallet dependency to pick up the new version of
txrules.StakePoolTicketFee which considers the status of DCP0012 in its
fee calculation.
2024-06-30 09:22:21 +01:00
jholdstock
fef56a24a0 vote-validator: Use stdlib built-in "POST" const. 2024-06-30 09:16:31 +01:00
jholdstock
cab4058710 vspadmin: Add retirexpub command.
The new command opens an existing vspd database and replaces the
currently used xpub with a new one.
2024-06-27 09:20:32 +01:00
jholdstock
c23095444f webapi: Add xpub ID to ticket details page. 2024-06-27 09:20:32 +01:00
jholdstock
844d2ce1ba webapi: List xpubs on admin page.
A new tab is added to the admin page to display current and historic
xpub keys used by vspd.
2024-06-27 09:20:32 +01:00
jholdstock
4e4121335a database: Store xpub keys in a bucket.
**Warning: This commit contains a database upgrade.**

In order to add future support for retiring xpub keys, the database is
upgraded such that the keys are now stored in a dedicated bucket which
can hold multiple values rather than storing a single key as individual
values in the root bucket.

A new ID field is added to distinguish between keys. This ID is added to
every ticket record in the database in order to track which pubkey was
used for each ticket.

A new field named "Retired" has also been added to pubkeys. It is a unix
timestamp representing the moment the key was retired, or zero for the
currently active key.
2024-06-27 09:20:32 +01:00
jholdstock
1fa81d3697 vspadmin: Reject private keys in fee xpub config.
The provided key should always be a public key, enforcing this in
software provides an extra safety net for users.
2024-06-19 09:56:29 +01:00
jholdstock
4e5fec8f3b vspadmin: Write default config file.
A new command in vspadmin writes the default config file for a new vspd
deployment. The behaviour is removed from vspd and documentation has
been updated to reflect the change.
2024-06-19 09:35:41 +01:00
jholdstock
997205ed95 vspadmin: New binary to create empty databases.
vspadmin is a new binary which implements one-off admin tasks which are
necessarily interactive and thus do not fit neatly into the long-lived
vspd binary.

The first behaviour added to vspadmin is the ability to create a new
vspd database. This behaviour is removed from vspd with the associated
config option deprecated. Documentation and scripts updated to reflect
the change.
2024-06-19 09:35:41 +01:00
Jamie Holdstock
0633260a3c
database: Combine xpub and index concepts.
Fee xpub key and last used address index are now wrapped into a struct,
with both fields being set and retrieved together rather than
individually.

The underlying format for storing these values in the database does not
change. The only change is the interface between the database code and
the caller.
2024-06-11 11:26:12 +01:00
jholdstock
be31d54dac database: Don't run unnecessary upgrades.
New databases are now created at the latest version by default, rather
than being version 1 and immediately requiring all upgrades to be
executed.
2024-06-07 13:10:17 +01:00
jholdstock
1a2b02466c vspd: Wrap RPC connection details in a struct.
Returning a single struct which contains multiple named fields reduces
the chance of a mistake in the calling code, as compared to returning
multiple unnamed values which are all of the same type.
2024-05-30 08:41:10 +01:00
jholdstock
086143fed2 vspd: Move config to internal package.
This enables the config to be reused in multiple binaries - eg. the
upcoming vsp admin binary which will be responsible for writing a
default config file for new vspd deployments.
2024-05-30 08:41:10 +01:00
jholdstock
10457e6110 vspd: Accessors for derived config values.
This enables the derived config values, which are not exported, to still
be accessed after config.go is moved to the internal vspd package.
2024-05-30 08:41:10 +01:00
jholdstock
ba5b1b2990 types: Remove Revoked from VSP info response.
This was marked as deprecated in the previous release and is now being
removed.
2024-05-29 11:02:50 +01:00
jholdstock
ecf2baa193 Begin module dev cycles.
Upcoming changes constitute breaking public API changes to both the
client and types modules, therefore this bumps the version numbers of
both modules and adds local replacements to go.mod files such that the
new versions can be used before they are publicly tagged.
2024-05-29 11:02:50 +01:00
jholdstock
1720fd2062 ci: Simplify run_test.sh script.
Run tests and linters against a hard-coded set of local submodules
instead of attempting to find submodules dynamically.

While this has the obvious drawback of needing to manually update the
list of submodules, it greatly simplifies the script by removing a bunch
of regexes and string manipulation. This trade-off seems worthwhile
because the list of submodules in this repo will not be something which
changes often.

This change makes the script less brittle because it is hard-coded to
always run against the local code, regardless of any changes to module
versionining or project dependencies.
2024-05-29 11:02:29 +01:00
jholdstock
6e558fb283 vspd: Decouple config loading & log initialization
Loading config and preparing loggers are two separate concepts which
should be handled individually. Nesting one inside the other makes
little sense and complicates reusing the code.
2024-05-23 08:39:24 +01:00
jholdstock
64ad28e19b database: Remove log param from CreateNew.
This logger did not write any useful information and all errors
generated by the func are already returned to the caller for logging.
2024-05-23 08:39:24 +01:00
jholdstock
17f993ae83 config: Initialize default config struct directly.
There is no need to declare a dozen different "default..." vars only to
immediately insert them into a default config struct when the struct
itself could just be initialized with the default values instead.
2024-05-23 08:28:42 +01:00
jholdstock
8b6b2e4fef config: Deprecate --configfile.
This removes the --configfile option from vspd. It introduced quite a
few weird edge cases (and a fair bit of code to deal with them) but
afaik nobody actually used it. Note that the --homedir option stays, so
it is still possible to run vspd with config in a non-default location
if required.
2024-05-21 08:44:59 +01:00
jholdstock
2bd340ba08 multi: Explicitly handle help requests.
Checking for --help as an explicit step before parsing any other configs
makes the code more intuitive by removing a convoluted bit of error
handling, which happened to be unnecessarily duplicated in three places.

Moving it to a function in the internal package makes it reusable by
multiple binaries.

This also enables the IgnoreUnknown option to be used whilst parsing for
help, which ensures the presence of --help will always result in the
help message being printed. This fixes a minor inconsistency where the
help message would be printed if the flag was placed before an invalid
config, but placing it after would cause an invalid config error to be
written instead. For example, `vspd --help --fakeflag` vs `vspd
--fakeflag --help`.
2024-05-18 08:42:06 +01:00
jholdstock
ea6f5e8d7e config: Introduce NetworkFromName.
This moves the mapping logic to a more obvious home and enables it to be
reused later.
2024-05-16 08:23:24 +01:00
jholdstock
92a0eb7d4a webapi: Remove unnecessary err check.
err has already been checked and is known to be nil at this point.
2024-05-16 08:22:36 +01:00
jholdstock
15590a6dda ci: Update GitHub actions. 2024-05-14 09:19:17 +01:00
jholdstock
2fef5d29eb ci: Update linter to 1.58.1. 2024-05-14 09:19:17 +01:00
jholdstock
ab5e564867 build: Update to bbolt 1.3.9.
Just bugfixes, no significant new features or API changes.
2024-05-14 07:28:09 +01:00
jholdstock
90e4d96f5b build: Update to gin-gonic 1.10.0.
Picking up some bug fixes and performance improvements. No significant
API changes or new features we can take advantage of.
2024-05-14 07:28:09 +01:00
jholdstock
17e97384e5 v3tool: Remove unnecessary err check.
err has already been checked and is known to be nil at this point.
2024-05-14 07:27:56 +01:00
Jamie Holdstock
cdd02dbd2e database: Use bytes.Clone instead of manual copy.
bytes.Clone was introduced in go 1.20 and removes the need to manually
copy byte slices.
2024-02-16 08:47:03 +08:00
Jamie Holdstock
6a72321ddb build: Update build to go 1.22. 2024-02-16 08:47:03 +08:00
Jamie Holdstock
cf8f791684 multi: Underscore unused func params. 2024-02-16 08:47:03 +08:00
jholdstock
1b9587c000 build: Use latest GitHub Actions 2024-01-12 08:51:54 +00:00
jholdstock
4ef193d63c build: Update gorilla/sessions to 1.2.2 2024-01-12 08:51:54 +00:00
jholdstock
0245d0f7c8 webapi: Update year to 2024 2024-01-12 08:51:54 +00:00
jholdstock
1650e97b41 LICENSE: Update year to 2024 2024-01-12 08:51:54 +00:00
Jamie Holdstock
4f892711fc
Add docs for listing on decred.org 2023-12-06 08:47:25 +00:00
David Hill
40673270fb build: bump bbolt dep 2023-11-22 12:04:37 +00:00
jholdstock
b50d91ae5b docs: Add 1.3.2 release note 2023-11-15 08:46:30 +00:00
jholdstock
1e66b6ff59 Downgrade dcrwallet dep to v3.
This downgrade changes StakePoolTicketFee back to the version which does
not consider DCP-0012 activation.

This resolves an issue where Decrediton sometimes fails to pay VSP fees,
caused by Decrediton and vspd independently calculating the fee amount
using different versions of the algorithm.

Releasing the new algorithm will need to be more carefully coordinated,
potentially requiring both client and server sides to be updated in
sync.
2023-11-08 09:01:36 +00:00