Commit Graph

3693 Commits

Author SHA1 Message Date
Chris Beams
6c1ef5921c
Remove BisqException parser calls for options already moved to Config
Set OptionParser.allowsUnrecognizedOptions(true) to make sure
BisqEnvironment doesn't fail while options are still being transferred
one-by-one to Config.
2020-01-20 16:39:29 +01:00
Chris Beams
f029fea386
Move 'useDevPrivilegeKeys' option handling from BisqEnvironment to Config 2020-01-20 16:39:29 +01:00
Chris Beams
f3e0b853db
Move 'btcNetworkDir' and co from BisqEnvironment to Config 2020-01-20 16:37:56 +01:00
Chris Beams
70bdccb258
Move 'useDevMode' option handling from BisqEnvironment to Config 2020-01-20 16:37:55 +01:00
Chris Beams
cdaa901a29
Move 'referralId' option handling from BisqEnvironment to Config 2020-01-20 16:37:55 +01:00
Chris Beams
b34d59c0a9
Introduce Config as replacement for BisqEnvironment
Prior to this commit, BisqExecutable has been responsible for parsing
command line and config file options and BisqEnvironment has been
responsible for assigning default values to those options and providing
access to option values to callers throughout the codebase.

This approach has worked, but at considerable costs in complexity,
verbosity, and lack of any type-safety in option values. BisqEnvironment
is based on the Spring Framework's Environment abstraction, which
provides a great deal of flexibility in handling command line options,
environment variables, and more, but also operates on the assumption
that such inputs have String-based values.

After having this infrastructure in place for years now, it has become
evident that using Spring's Environment abstraction was both overkill
for what we needed and limited us from getting the kind of concision and
type saftey that we want. The Environment abstraction is by default
actually too flexible. For example, Bisq does not want or need to have
environment variables potentially overriding configuration file values,
as this increases our attack surface and makes our threat model more
complex. This is why we explicitly removed support for handling
environment variables quite some time ago.

The BisqEnvironment class has also organically evolved toward becoming a
kind of "God object", responsible for more than just option handling. It
is also, for example, responsible for tracking the status of the user's
local Bitcoin node, if any. It is also responsible for writing values to
the bisq.properties config file when certain ban filters arrive via the
p2p network. In the commits that follow, these unrelated functions will
be factored out appropriately in order to separate concerns.

As a solution to these problems, this commit begins the process of
eliminating BisqEnvironment in favor of a new, bespoke Config class
custom-tailored to Bisq's needs. Config removes the responsibility for
option parsing from BisqExecutable, and in the end provides "one-stop
shopping" for all option parsing and access needs.

The changes included in this commit represent a proof of concept for the
Config class, where handling of a number of options has been moved from
BisqEnvironment and BisqExecutable over to Config. Because the migration
is only partial, both Config and BisqEnvironment are injected
side-by-side into calling code that needs access to options. As the
migration is completed, BisqEnvironment will be removed entirely, and
only the Config object will remain.

An additional benefit of the elimination of BisqEnvironment is that it
will allow us to remove our dependency on the Spring Framework (with the
exception of the standalone pricenode application, which is Spring-based
by design).

Note that while this change and those that follow it are principally a
refactoring effort, certain functional changes have been introduced. For
example, Bisq now supports a `--configFile` argument at the command line
that functions very similarly to Bitcoin Core's `-conf` option.
2020-01-20 16:37:54 +01:00
sqrrm
92466f96eb
Merge pull request #3888 from cbeams/grpc-poc
Introduce gRPC API proof of concept
2020-01-20 16:19:40 +01:00
Chris Beams
1e8633b03b
Organize io.grpc imports correctly
And remove entry for the no longer used io.bisq.generated package.
2020-01-20 12:16:57 +01:00
Chris Beams
9fceba63e2
Remove duplicate attempt to start BisqGrpcServer
Problem: a stack trace was being thrown during daemon startup from
BisqDaemonMain.onSetupComplete when it attempted to start a
second BisqGrpcServer and failed to bind to the already-bound port.
The first BisqGrpcServer is started in
BisqDaemonMain.onApplicationStarted much earlier in the startup process.

Solution: remove the second attempt to start the server by removing
BisqDaemonMain's implementation of onSetupComplete, and in turn remove
the now-obsolete bisqGrpcServer field as well.

This change also eliminates the BisqGrpcServer.blockUntilShutdown
method, which in turn called the underlying grpc server's
awaitTermination method. As the comment there explained, this was
thought to be necessary because grpc "does not use daemon threads by
default", but this is actually incorrect. According to the grpc Javadoc
at [1], "Grpc uses non-daemon Threads by default and thus a Server will
continue to run even after the main thread has terminated."

[1]: https://git.io/JePjn
2020-01-20 12:14:33 +01:00
Chris Beams
aff760514b
Sever dependency from :desktop => :grpc
The :grpc module will soon be renamed to :daemon. These two modules
represent two separate and equal modes of running bisq, either as a
desktop GUI or as a daemon. They are both applications, and one should
not depend on the other as it would be illogical and confusing to model
things that way. The reason for the current dependency from :desktop to
:grpc is because :grpc is the home of BisqGrpcServer. This change moves
this class up to :core, in a new bisq.core.grpc package, such that both
the :desktop and :daemon applications can pull it in cleanly.

The CoreApi 'facade' that BisqGrpcServer uses to abstract away bisq
internals has been moved from bisq.core to bisq.core.grpc as well and
for the same reasons detailed in 8b30c22d6.

This change also renames the Java package for generated grpc types from
bisq.grpc.protobuf to bisq.core.grpc (the same new package that
BisqGrpcServer and CoreApi now live in). Again, this is for reasons of
cohesion: BisqGrpcServer is the only user of these grpc-generated types,
and they should logically live in the same package (even if they
physically live in separate source dirs at the build level).
2020-01-20 12:12:09 +01:00
Chris Beams
7a718f0ed5
Move grpc generation from :grpc to :core
Such that :grpc (soon to be renamed to :daemon), :cli and :desktop can
access these types.
2020-01-20 12:07:55 +01:00
Chris Beams
8b30c22d6e
Move bisq.core{=>.app}.CoreModule
There are two structural / organizational reasons for this move:

 1. References from one package to another should always be upward or
 lateral, never downward, as the latter causes package cycles (aka
 'tangles') which damage the suppleness and understandability of a large
 codebase. Prior to this change the high-level bisq.core.CoreModule
 class imported many classes from child packages like
 bisq.core.{btc,dao,user,util}, etc. By moving CoreModule down into the
 '.app' package, it can reference all these other packages as siblings
 instead of doing so as a parent.

 2. the bisq.core.desktop and bisq.core.app packages are the only
 locations that reference the CoreModule class. By moving the class
 into bisq.core.app, greater cohesion is acheived, again making the
 codebase that much easier to read and understand.
2020-01-20 12:07:43 +01:00
sqrrm
5233b85708
Merge pull request #3881 from bisq-network/release/v1.2.5
Release/v1.2.5
2020-01-15 13:09:15 +01:00
sqrrm
0ece6aa72b
Merge pull request #3895 from devinbileck/ignored-peers-and-btc-nodes
Validate ignored peers and BTC nodes
2020-01-14 15:18:47 +01:00
Christoph Atteneder
17c37db887
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.2.5
# Conflicts:
#	core/src/main/resources/i18n/displayStrings_el.properties
2020-01-13 15:20:15 +01:00
Devin Bileck
61d20268f2
Revert to using provided BTC nodes if custom nodes are invalid
If the user entered an invalid hostname for a custom BTC node, such as a
V3 onion address, after restarting Bisq they would be presented with an
error due to the node being unreachable and unable to continue nor
correct the config.

So now a warning message will be shown in this situation informing the
user of an invalid config and once they restart their client they will
connect to the provided BTC nodes.

Fixes #3137
2020-01-12 22:58:34 -08:00
Devin Bileck
9e33ca9e43
Capitalize connection failed string 2020-01-12 22:52:33 -08:00
Devin Bileck
5e52dc58a8
Add input validation for ignored peers and BTC nodes
Ignored peers and BTC nodes input fields will now only accept IPv4 and
V2 onion addresses, with multiple addresses separated using a comma.
2020-01-12 22:52:32 -08:00
Chris Beams
65175a7f4f
Remove --desktopWith{Grpc|Http}Api options for now
The previous commit introduces the BisqGrpcServer as a proof of concept,
but it is not yet ready for production use. This commit removes the
`--desktopWithGrpcApi` option that starts the gRPC server until such
time that it is production-ready.

This change also removes the `--desktopWithHttpApi` option for starting
an HTTP API server. The option has been in place for some time, but it
was 'false advertising' in the sense that nothing actually happened if
the user specified it, because there is in fact no HTTP API
implementation to be started.

Note that when the gRPC API option is reintroduced, it will be renamed
to `--rpcserver` or similar, following the convention in Bitcoin Core.
2020-01-10 19:48:26 +01:00
chimp1984
5c02ce5766
Introduce gRPC API proof of concept
This commit introduces a new `grpc` module including the following key
types:

 - BisqGrpcServer: The API implementation itself, along with generated
   gRPC Response/Reploy types defined in grpc/src/main/proto/grpc.proto.

 - BisqGrpcServerMain: A 'headless' / daemon-like entry point for
   running a Bisq node without the JavaFX desktop UI.

 - BisqGrpcClient: A simple, repl-style client for the API that allows
   the user to exercise the various endpoints as seen in the example
   below.

In the `desktop` module, the BisqAppMain class has been modified to
start a BisqGrpcServer instance if the `--desktopWithGrpcApi` option has
been set to `true`.

In the `core` module, a new `CoreApi` class has been introduced
providing a kind of comprehensive facade for all Bisq functionality to
be exposed via the RPC API.

How to explore the proof of concept:

 1. Run the main() method in BisqAppMain providing
 `--desktopWithGrpcApi=true` as a program argument or alternatively, run
 the main() method in BisqGrpcServerMain, where no special option is
 required. In either case, you'll notice the following entry in the log
 output:

    INFO  bisq.grpc.BisqGrpcServer: Server started, listening on 8888

 2. Now run the main() method in BisqGrpcClient. Once it has started up
 you are connected to the gRPC server started in step 1 above. To
 exercise the API, type `getVersion` via stdin and hit return. You
 should see the following response:

    INFO bisq.grpc.BisqGrpcClient - 1.2.4

 Likewise, you can type `getBalance` and you'll see the following
 response:

    INFO bisq.grpc.BisqGrpcClient - 0.00 BTC

 and so forth for each of the implemented endpoints. For a list of
 implemented endpoints, see BisqGrpcServer.start().

Note once again that the code here is merely a proof of concept and
should not be considered complete or production-ready in any way. In a
subsequent commit, the `--desktopWithGrpcApi` option will be disabled in
order to avoid any potential production use.

The content of this commit is the result of squashing a number of
commits originally authored by chimp1984 in the `chimp1984` fork's `grpc`
branch.

Co-authored-by: Chris Beams <chris@beams.io>
2020-01-10 19:48:26 +01:00
wiz
4e30402d78
Dark mode isn't beta anymore 🎉 2020-01-09 20:56:21 +09:00
Christoph Atteneder
ffb346794a
Remove dead code 2020-01-08 21:39:28 +01:00
Christoph Atteneder
ce1e954236
Remove dead code 2020-01-08 21:23:02 +01:00
Christoph Atteneder
eada8d6a3d
Update bitcoinj checkpoints file 2020-01-08 09:13:52 +01:00
Christoph Atteneder
744173ce61
Merge pull request #3875 from wiz/disable-z33nukt7ngik3cpe-btcnode
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service c…
2020-01-08 09:08:55 +01:00
Christoph Atteneder
9523c04788
Merge pull request #3874 from wiz/tweak-wiz-btcnode-clearnet
Update clearnet hostnames / IPs for 2 btcnodes operated by @wiz
2020-01-08 09:08:35 +01:00
Christoph Atteneder
c960e6d3fc
Merge pull request #3873 from wiz/add-m52go-btcnode
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go
2020-01-08 09:08:13 +01:00
Christoph Atteneder
40a1527d6c
Update translations 2020-01-08 09:04:35 +01:00
Christoph Atteneder
653b59b798
Remove Greek from supported core languages 2020-01-08 09:04:17 +01:00
wiz
14d20aaf39
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service checks 2020-01-08 08:56:04 +01:00
wiz
f4a560bcbe
Migrated onions for my 2 btcnodes to new servers, only clearnet changed 2020-01-08 08:55:50 +01:00
wiz
87b6f080a0
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go 2020-01-08 08:55:34 +01:00
wiz
248ae1c63b
Add bsq.bisq.cc BSQ explorer operated by @m52go 2020-01-08 08:55:12 +01:00
wiz
b67f901f18
Temporarily disable z33nukt7ngik3cpe btcnode due to failing service checks 2020-01-08 07:57:41 +09:00
wiz
be59df4ff7
Migrated onions for my 2 btcnodes to new servers, only clearnet changed 2020-01-08 07:31:34 +09:00
wiz
e75bc14037
Add new 4nnuyxm5k5tlyjq3.onion:8333 btcnode operated by @m52go 2020-01-08 07:12:18 +09:00
wiz
5c6c5f77e8
Add bsq.bisq.cc BSQ explorer operated by @m52go 2020-01-08 06:47:33 +09:00
Christoph Atteneder
166d38f1e9
Use general "(required minimum)" label with BTC value if min value is used 2020-01-07 19:53:36 +01:00
Christoph Atteneder
4377a10007
Show minimum security deposit in create offer dialog when used
In the past we allowed the user to enter a percentage of the trade amount
although it wasn't used if the minimum security deposit was higher.
2020-01-07 19:53:14 +01:00
Christoph Atteneder
9ec10cf0e9
Add information if minimum trading fee or minimum security deposit is used 2020-01-07 19:53:07 +01:00
Christoph Atteneder
fe06e5888f
Use trading fee in BSQ fee comparison 2020-01-07 19:52:53 +01:00
Christoph Atteneder
e7c16a6fe7
Use general "(required minimum)" label with BTC value if min value is used 2020-01-07 18:20:33 +01:00
Christoph Atteneder
d904d1ee6a
Show minimum security deposit in create offer dialog when used
In the past we allowed the user to enter a percentage of the trade amount
although it wasn't used if the minimum security deposit was higher.
2020-01-07 17:30:00 +01:00
Christoph Atteneder
e6f491c8ac
Add information if minimum trading fee or minimum security deposit is used 2020-01-07 16:32:24 +01:00
Christoph Atteneder
02ac14e234
Use trading fee in BSQ fee comparison 2020-01-07 16:28:56 +01:00
wiz
7b5128652a Add BSQ explorers into v1.2.5 release (#3864)
* Add bsq.ninja BSQ explorer operated by @wiz

* Add bsq.bisq.services BSQ explorer

* Add bsq.sqrrm.net BSQ explorer operated by @sqrrm

* Add bsq.vante.me BSQ explorer operated by @mrosseel

* Add bsq.emzy.de BSQ explorer operated by @emzy

Co-authored-by: Devin Bileck <603793+devinbileck@users.noreply.github.com>
2020-01-07 14:30:24 +01:00
wiz
a4a5415a57
Add bsq.emzy.de BSQ explorer operated by @emzy 2020-01-06 22:27:50 +09:00
wiz
0c160d08ff
Add bsq.vante.me BSQ explorer operated by @mrosseel 2020-01-06 20:34:56 +09:00
wiz
44152fdb57
Add bsq.sqrrm.net BSQ explorer operated by @sqrrm 2020-01-06 19:44:25 +09:00
Devin Bileck
a55c3b5bc2
Add bsq.bisq.services BSQ explorer 2020-01-06 00:22:53 -08:00