Commit graph

10243 commits

Author SHA1 Message Date
Christoph Atteneder
26291eb0ee
Not allow bitcoinj to auto connect to localhost when localhost was not detected by client
This fixes the problem if the local bitcoin core node is not detected by our client,
but bitcoinj is able to connect to it because of the auto connect to localhost behavior.
In that case the minimum required nodes to broadcast a transaction will be 4 (provided nodes settings),
but bitcoinj will only connect to one node. The requirement of 4 nodes will be never fulfilled and
the transaction never broadcasted.
2019-12-12 17:27:15 +01:00
Christoph Atteneder
14bec2ff4b
Merge pull request #3757 from wiz/add-seednode-jaronly-archive-script
Add script to create seednode jar archive without jar deps
2019-12-10 10:20:42 +01:00
Christoph Atteneder
3fe84975ad
Merge pull request #3747 from julianknutsen/clean-up-pse-objs
(6/6) Clean up technical debt in P2PDataStorage and ProtectedStorageEntry objects
2019-12-09 20:34:26 +01:00
Julian Knutsen
e8c8225635
[PR COMMENTS] Fix comment typo
s/change/chance/
2019-12-09 09:12:57 -08:00
Florian Reimair
30f96643b2
Merge pull request #3771 from ripcurlx/fix-dark-mode-switch-plus-cleanup
Fixes dark mode switch after restart
2019-12-09 17:43:39 +01:00
Christoph Atteneder
b2c006d4a3
Update css theme property when read from data store 2019-12-09 15:44:52 +01:00
Christoph Atteneder
f398117147
Remove unnecessary indirection for setting custom withdrawal fees 2019-12-09 15:35:15 +01:00
Florian Reimair
a29ba3d4e5
Merge pull request #3769 from ripcurlx/mark-prs-stake-after-30-days-inactivity
Close PRs that are inactive for more than 30 days
2019-12-09 14:06:59 +01:00
Christoph Atteneder
af46a7f697
Merge pull request #3760 from wiz/ef5qnzx6znifo3df-transfer
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy
2019-12-09 12:21:45 +01:00
Christoph Atteneder
2707d56ac8
Close PRs that are inactive for more than 30 days 2019-12-09 12:08:22 +01:00
sqrrm
b2ea064b93
Merge pull request #3745 from dmos62/master
Rename "Spread" tab to a more general "Details"
2019-12-07 14:44:01 +01:00
wiz
a34610ed98
Transfer seednode ef5qnzx6znifo3df.onion to @wiz and @emzy 2019-12-07 02:19:13 +09:00
Christoph Atteneder
7d8b6c2794
Merge pull request #3713 from beingindot/beingindot-daosetup-change
Update dao-setup doc to include bloom filter for newer bitcoincore v0.19.0.1
2019-12-06 16:24:26 +01:00
sqrrm
2e196ec722
Merge pull request #3743 from ripcurlx/fix-refundagents-supported-language-warning
Display warning based on supported languages by mediators and refund agents
2019-12-06 15:34:32 +01:00
Christoph Atteneder
b3e73b1318
Merge pull request #3718 from cbeams/make-localnet
* Add Makefile for automating localnet setup

Problem: contributors old and new must read and follow many manual steps
spread across three documents (docs/{build,dev-setup,dao-setup}.md) in
order to get up and running with a local regtest Bisq network deployment
suitable for isolated development and end-to-end testing. This process
is not only manual, but requires considerable trial and error for most
contributors, and can amount to hours of effort. Perhaps most
detrimental is that this friction makes it much less likely that we get
"all hands on deck" to cover test scenarios at release time. Getting up
and running with what this change refers to as a "localnet" should be
among the very first things a new contributor does. It should be fast
and easy, maximizing the contributor's ability to get productive right
away.

Solution: this commit introduces a simple and well-documented makefile
to the root of the source tree. It instructs the user to issue a series
of simple `make` commands, at the end of which they'll have a fully
functional localnet deployment.

Caveats:

 - No support for Windows unless the user is running Git Bash, Cygwin or
   similar. In any case, the makefile serves as clear documentation
   about what a Windows user would need to do manually, i.e. without the
   benefit of `make` automating it all.

 - The aforementioned setup documents should be updated to point to this
   makefile instead of explaining everything in prose. The dev-setup.md
   and dao-setup.md documents may actually be candidates for deletion if
   this new approach proves successful.

 - These changes do not include passing the new -peerbloomfilters=1
   option to bitcoin versions 0.19 and above. Those who have already
   upgraded should take care to add that option.

Notes:

 - The introduction of this makefile has no impact on Bisq's use of
   Gradle as a build system. Everything there is as it has been. This
   makefile is a completely optional convenience being added into the
   mix. It has the added benefit of being a "friendly face" to those not
   familiar with the Java / JVM ecosystem. Developers from many
   different backgrounds are familiar with make and makefiles, and they
   may find this one a pleasant and inviting surprise.

* Use STATE_DIR := .localnet in makefile

* Make `make localnet` command idempotent

Sometimes when running setup something goes wrong and the ./dao-state
dir is still hanging around, requiring manual cleanup nad preventing from simply
re-running the command.

* Make build target phony (gradle doesn't remove the dir on clean)

* Partially revert "Make `make localnet` command idempotent"

This partially reverts commit e3a3fb5, removing the dependency from
the 'localnet' target to the 'clean-localnet' target. The reason for
this is that a number of higher level targets that deploy nodes, e.g.
the 'alice' and 'bob' targets depend on 'localnet' and, prior to this
reversion, therefore also depended on 'clean-localnet'. The effect was
that every time a node is deployed, the .localnet directory was removed
and re-created, destroying the state of any and all nodes that had been
deployed and modified thus far.

The change in the original commit that removes the temporary 'dao-setup'
directory in case of partial failures has been preserved.

This is a follow-up to cbeams/bisq#3.

* Review "Use STATE_DIR := .localnet in makefile"

This change follows up on commit 650c5894d, which:

  1. Renamed the 'localdir' directory to '.localdir' to better follow
  convention with how local data directories are often managed, e.g.
  .git and .gradle.

  2. Introduced the STATE_DIR variable to avoid duplication of the
  '.localdir' string throughout the Makefile, and at least in concept to
  allow this value to be customized via setting an environment variable.

The changes in (1) are preserved, while the changes in (2) have been
backed out. Rationale:

 - The STATE_DIR name introduces a new concept to the reader. They must
   reason about its meaning, and this works against the intention of the
   Makefile, which is to maximize understandability for the uninitiated.

 - The name, if we were to preserve the variable, probably should have
   been something like DATA_DIR_ROOT. 'STATE_DIR' is not conceptually
   incorrect, but industry convention is to refer to such directories as
   "data directories", e.g. Bitcoin Core's `datadir` option, LND's
   `datadir` option and Bisq's `userDataDir` and `appDataDir` options.

 - The variable, whatever its name, introduces a layer of indirection,
   which while convenient to the makefile maintainer, is a barrier to
   comprehension for the reader / contributor. For example, if a user
   wished to copy and paste the recipe for a target, say 'bob' from the
   makefile, with the varible in place, the user would have to figure
   out its correct value and replace it before they could paste and use
   the copied command. Like in the first note above, the idea with the
   makefile is to maximize understanding for the uninitiated, i.e.
   working code as executable documentation. It is reasonable given this
   goal to increase the burden on a few maintainers in order to ease the
   potentially many contributors.

Finally, this change follows up on the renaming of the 'localnet'
directory to '.localnet' by reflecting this change in the name of the
associated target as well. This is order to avoid dependent targets e.g.
'bitcoind', 'alice' or 'bob' constantly re-running the localnet target.
In turn it also adds an 'alias' target named 'localnet' (without the
leading dot) because targets with a leading dot are (I believe) treated
as "implicit targets". In any case, they do not show up in a tab
completion context, so introducing the normally-named alias fixes that.

This is a follow-up to cbeams/bisq#3.

* Update .editorconfig to use hard tabs in Makefile

Problem: we use soft 4-space tabs throughout the Bisq codebase, and the
new makefile is a break to this rule due to make's default requirement
for hard tabs in recipes.

Solution: This commit updates our Editorconfig settings to reflect this
exception.

For vim users, it is also recommended that you add the following entry
to your .vimrc:

     au FileType make set tw=72 noet cc=72

It will ensure that you wrap (documentation) lines at 72 chars. It also
sets noexpandtab explicitly. Even though .editorconfig should already be
doing this for you when working in Bisq, this more general vim
configuration will ensure you use tabs correctly in any makefile. The
`cc=72` setting adds a visual right margin at 72 characters.

This commit also updates the existing makefile, wrapping lines of
documentation that had exceeded the 72-char margin.

* Refine deploy target for better use of `screen`

Problem: Prior to this change, it was necessary to first create and
attach to a screen session and then to run `make deploy` within it. This
meant extra steps for the user and was generally error-prone.

Solution: Usage of screen has been refined such that a screen session
named 'localnet' is created on the users behalf without any need to
attach to it. Individual node deployment targets such as `make
bitcoind`, `make alice`, et al. are issued to new windows within the
localnet screen session, and the user is free to attach or not whenever
they choose. The result is that a new user can clone the repository and
type nothing more than `make deploy` to get up and running with their
localnet.

This also reverts the changes in commit 97dd342e5 ("Make build target
phony") for the following reasons:

 - As mentioned in that commit message, Gradle was not deleting the its
   'build' directory when running `gradle clean`, meaning that the
   'build' target was always up-to-date, even after running `make
   clean`. This made it impossible to get a correct rebuild workflow. On
   analysis, howewer, this situation was because of a badly behaving
   Kotlin plugin not cleaning up after itself, leaving a subdirectory at
   build/kotlin and preventing the build directory itself from being
   deleted altogether. To address this, the `make clean` target has been
   updated to `rm -rf build` instead of calling `build gradle`. While
   it's a workaround until we back out the Kotlin changes that caused
   this, it does have the added benefit of being faster than invoking
   `gradle clean`.

 - By making the 'build' target PHONY, this meant that `./gradlew build`
   was getting invoked every time a dependent target was called. For
   example, `make alice` depends on the 'setup' target, which in turn
   depends on the 'build' target. When calling such targets in
   isolation, this arrangement works out fine, because the phony 'build'
   target always runs, invoking `./gradle build`, and the Gradle build
   completes quickly assuming everything is up-to-date. The problem
   arises when calling a number of these targets in rapid succession, as
   we do when calling `make deploy` and running each individual node
   target in its own screen window. This causes contention in two ways.
   The first is that these multiple, simultaneous Gradle processes
   compete for access to an available Gradle daemon, and because each
   process needs its own, it ends up that as many Gradle daemons get
   created as Bisq nodes we need to deploy (5 in total). This is a big
   waste of time and resources. The second way it causes not only
   contention but outright failure is that each of these builds are
   operating in the same directory, and while most aspects of the build
   are in fact up-to-date and therefore not modified in any way, there
   are exceptions to this rule. The result is that build artifacts, e.g.
   jars are getting deleted and rebuilt from underneath competing Gradle
   processes, and all manner of chaos ensues, such as NoClassDefFound
   errors and much more. This change (reverting 'build' back to a
   normal, non-phony target) avoids these problems entirely. When
   running `make deploy`, we run the 'build' target once as a function
   of the 'deploy' target depending on it. At this point, the 'build'
   directory exists, and all subsequent node deployment targets, e.g.
   'alice', 'bob', etc do not re-run the build target because it is
   up-to-date. For workflows where the user definitely wants to rebuild
   prior to redeploying a given node, they can either run `make
   clean-build`, or drop down to issuing Gradle build commands directly,
   e.g. `./gradlew :desktop:build` followed by `make desktop`.

* Enable 'peerbloomfilters' option on localnet bitcoind

Problem: Bitcoind Core v0.90.0 changed the default value of its
'peerbloomfilters' option from 1 to 0, now disabling them by default.
Bisq requires bloom filters be enabled on the Bitcoin node(s) it
communicates with, so users who are running >= v0.90 would get errors
when attempting to run `make bitcoind` with that target's current
recipe.

Solution: This change explicitly sets the 'peerbloomfilters' option to
1, ensuring it is enabled in any case. Note that this option has existed
in Bitcoin Core since v0.12.0, so there is no real concern for this new
option breaking users that are still on 0.18.x or even much earlier.

* Make 'build' target phony once again

In commit 5fb4b21 ("Refine deploy target..."), the 'build' target was
made normal, i.e. non-phony, but on further review it does in fact make
sense to declare 'build' phony, such that it is run no matter the status
of the root-level 'build' directory, but for different reasons.

Previously, we had been considering the presence of 'build' directory as
a reasonable proxy for determining whether the `./gradlew build` had
been run. If the directory was present, we considered the 'build' target
up-to-date. If not, then we would re-run `./gradlew build`. This is all
sensible enough, except for the fact that the root-level 'build'
directory has almost nothing to do with the actual output of `./gradlew
build`. Gradle does output 'build' directories, but in the respective
subdirectory for each module of the project. After `./gradlew build` has
been run, we would see a 'desktop/build' directory, a 'seednode/build'
directory and so forth. It just so happens that a root-level 'build'
directory was getting created at all due to idiosyncracies of a
particular Kotlin plugin.

This commit updates the makefile to better respect this reality by:

 - preserving the 'build' target but marking it once again as PHONY

 - introducing new 'seednode/build' and 'desktop/build' targets that
   trigger './gradlew :seednode:build` and ./gradlew :desktop:build`
   commands respectively.

 - making 'build' depend on these two new targets

In light of this realization of flawed thinking about the root-level
build dir, this change also restores `make clean` to calling `./gradlew
clean` instead of `rm -rf build`.

* Avoid bash-specific syntax in makefile

This fixes the problem described at [1] by replacing bash-specific array
syntax with a simpler sh-friendly for loop.

[1]: https://github.com/bisq-network/bisq/pull/3718#pullrequestreview-325769916

* Add 'make undeploy' target to kill all running nodes

Problem: previously, in order to completely shut down a running
localnet, users had to attach to their 'localnet' screen and kill (^C)
each process, then quit and kill the entire screen session.

Solution: this change introduces an 'undeploy' target that automates
sending the ^C to each screen window followed by sending screen's 'kill'
command to any remaining windows, thus killing the entire 'localnet'
screen session.

The result is that users may now run the following two commands in
succession any number of times to bring their localnet up and down (to
'deploy' and 'undeploy' their localnet).

    # bring up localnet
    $ make deploy

    # use localnet to test, develop, etc...

    # bring down localnet
    $ make undeploy

* Update docs/README.md with link to new Makefile

The old dev-setup.md and dao-setup.md docs have been marked as
deprecated for now and may be removed after we've gotten sufficient
feedback on the Makefile-based approach.

ACKs for top commit:
  @ripcurlx:
    ACK 7d1689004a
  @julianknutsen:
    ACK ed40afb151
2019-12-06 15:16:48 +01:00
wiz
c1a9086f8e
Add script to create seednode jar archive without jar deps 2019-12-06 22:40:54 +09:00
Christoph Atteneder
19da79bba3
Hide avoid standby mode feature on *nux OS (#3563)
* Hide avoid standby mode feature on *nux OS

Displays standby mode button on only on Windows and OSX,
and hides it on Linux and Unix distributions.

TitledGroupBg num rows reduced to 7 when standby mode button
is not displayed.

Fixes #3223

Replaces PR #3322 -- rejected because source file reformat
rearanged class level field declarations, making review
more difficult.

* Set use standby mode to false on non Win, OSX desktops
2019-12-06 14:37:19 +01:00
sqrrm
87fb9c0c55
Validate wallet date when restoring from seed (#3749)
Prevent a date that is older than the oldest wallet date, or a date that
is newer than the current date.
2019-12-06 13:17:47 +01:00
Christoph Atteneder
0cfa7f6702
Merge pull request #3756 from bisq-network/release/v1.2.4
Release/v1.2.4
2019-12-06 12:28:03 +01:00
Christoph Atteneder
44b4f429da
Merge branch 'master' of github.com:bisq-network/bisq into release/v1.2.4
# Conflicts:
#	core/src/main/resources/i18n/displayStrings_zh-hant.properties
2019-12-06 11:30:10 +01:00
Chris Beams
7d1689004a
Update docs/README.md with link to new Makefile
The old dev-setup.md and dao-setup.md docs have been marked as
deprecated for now and may be removed after we've gotten sufficient
feedback on the Makefile-based approach.
2019-12-05 21:19:21 +01:00
Dominykas Mostauskis
7e5422f0ef
Rename "Spread" tab to a more general "Details"
Because spread is one of many columns in the table, calling the whole tab spread is not general enough.
2019-12-05 13:27:35 +01:00
Christoph Atteneder
24d36fc0c7
Revert to SNAPSHOT version 2019-12-05 12:23:57 +01:00
Devin Bileck
d1932fe213
Validate wallet date when restoring from seed
Prevent a date that is older than the oldest wallet date, or a date that
is newer than the current date.
2019-12-04 23:28:15 -08:00
Julian Knutsen
7b8d346aea
Remove filter for ExpirablePayload
ProtectedStorageEntry::backDate() already handles this
2019-12-04 17:28:17 -08:00
Julian Knutsen
b166009398
Remove expire optimization in onDisconnect
We already have a garbage collection thread that runs every minute
to clean up items. Doing it again during onDisconnect is an unnecessary
optimization that adds complexity and caused bugs.

For example, the original implementation did not handle the sequence
number map correctly and was removing entries during a stream iteration.

This also reduces the complexity of testing. There is one code path
responsible for reducing ttls and one code path responsible for
expiring entries. Much easier to reason about.
2019-12-04 17:25:39 -08:00
Julian Knutsen
df2e4cc013
Refactor P2PDataStorage::onDisconnect
1. Remove delete during stream iteration
2. Minimize branching w/ early returns for bad states
3. Use stream filter for readability
4. Implement additional checks that should be done when removing entries
2019-12-04 17:04:05 -08:00
Julian Knutsen
688405bc6d
[TESTS] Make onDisconnect tests more robust
Before refactoring the function ensure the tests cover all cases. This
fixes a bug where the payload ttl was too low in some instances causing
backDate to do no work when it should.
2019-12-04 16:55:41 -08:00
Julian Knutsen
c38ff9bf95
s/networkPayload/protectedStoragePayload
Helps readability when the variable name matches the type.
2019-12-04 16:01:52 -08:00
Julian Knutsen
01a7f79eec
Make CHECK_TTL_INTERVAL_SEC final
It is never changed
2019-12-04 16:00:11 -08:00
Christoph Atteneder
acd4350762
Update data stores, translations and bitcoinj checkpoints (#3748)
* Update bitcoinj checkpoint file

* Update translations

* Update data stores
2019-12-04 22:26:42 +01:00
Julian Knutsen
104984cc22
@NotNull MailboxStoragePayload::senderPubKeyForAddOperation
In proto3 this is intialized to an empty ByteString so there is no valid
use for it to be null.
2019-12-04 11:39:26 -08:00
Julian Knutsen
76e8c5736a
@NotNull ProtectedStorageEntry::protectedStoragePayload
The ProtectedStoragePayload.fromProto code will throw an exception if
this is null from the wire so there is no valid use for it to be null.
2019-12-04 11:39:25 -08:00
Julian Knutsen
0c676080b6
@NotNull ProtectedStorageEntry::ownerPubKey
In proto3 the initialized value is an empty ByteString and there are no
valid uses of passing in null here.
2019-12-04 11:39:25 -08:00
Julian Knutsen
24ecfc7055
Remove ProtectedStorageEntry::maybeAdjustCreationTimeStamp
There is only 1 caller can be replaced with Math.min()
2019-12-04 11:37:53 -08:00
Julian Knutsen
b6b00268af
Remove ProtectedStorageEntry::updateSignature
The only users were tests that can just pass a bad signature directly
into the constructor.
2019-12-04 11:20:24 -08:00
Christoph Atteneder
87670c1e5e
Display warning based on supported languages by mediators and refund agents 2019-12-04 12:32:25 +01:00
Florian Reimair
dbf621ab45
Fix memory leak
We had a small memory leak in the code base. Namely, there have been some
threadpools in use but not shutdown when they have been no longer needed.
Result was that the threads and the parent threads have been kept alive
which lead to hundreds of stale threads over the course of several days.
2019-12-04 10:21:08 +01:00
Christoph Atteneder
d0bed936bd
Merge pull request #3734 from freimair/fix_thread_leak
Fix resource leak caused by not cleaning up unused threads
2019-12-04 10:17:55 +01:00
beingindot
583b149120
Include bloom filter for newer bitcoin core v0.19.0.1 2019-12-04 14:46:54 +05:30
Julian Knutsen
17f4b7096e
[TESTS] Clean up mockito never() and eq(null) usages
never() and any() don't play well together for nullable types. Change
the broadcast mocks to user nullable() and fixup tests.
2019-12-03 12:38:02 -08:00
Julian Knutsen
1bd450b3bc
[REFACTOR] inline maybeAddToRemoveAddOncePayloads() private function
Now that there is only one user it can be inlined.
2019-12-03 12:35:07 -08:00
Julian Knutsen
5a174d546a
[REFACTOR] inline broadcastProtectedStorageEntry() private function
Now that it is identical the the broadcaster version it can be
inlined.
2019-12-03 12:35:06 -08:00
Julian Knutsen
6ff8756dd8
[REFACTOR] inline broadcast() private function
Now that it is identical the the broadcaster version it can be
inlined.
2019-12-03 12:35:06 -08:00
Julian Knutsen
4dc4532c91
Remove isDataOwner from P2PDataStorage
Remove all usages in code and tests now that the behavior is
internal to the BroadcastHandler
2019-12-03 12:33:29 -08:00
Julian Knutsen
bfdb8f5715
Make isDataOwner a private policy decision in BroadcastHandler
isDataOwner is used when deciding how many peer nodes should receive
a BroadcastMessage. If the BroadcastMessage originated
on the local node it is sent to ALL peer nodes with a small delay.

If the node is only relaying the message (it originated on a different
node) it is sent to MAX(peers.size(), 7) peers with a delay that is
twice as long.

All the information needed to determine whether or not the
BroadcastMessage originated on the local node is available at the final
broadcast site and there is no reason to have callers pass it in.

In the event that the sender address is not known during broadcast (which
is only a remote possibility due to how early the local node address
is set during startup) we can default to relay mode.

This first patch just removes the deep parameters. The next will remove
everything else. There is one real change in LiteNodeNetworkService.java
where it was using the local node when it should have been using the
peer node. This was updated to the correct behavior.
2019-12-03 12:33:29 -08:00
Julian Knutsen
9f69134568
[REFACTOR] Clean up ClientAPI for refreshTTL
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:07 -08:00
Julian Knutsen
77413c9671
[REFACTOR] Clean up ClientAPI for remove
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
0e6b1a2044
[REFACTOR] Clean up ClientAPI for addProtectedStorageEntry
Remove isDataOwner from the client API. All users pass in true. All test
users don't care.
2019-12-03 12:30:06 -08:00
Julian Knutsen
56a7661a02
[REFACTOR] Clean up ClientAPI for addPersistableNetworkPayload
Now that more callers have moved internal, the public facing API
can be cleaner and more simple. This should lead to a more maintainable
API and less sharp edges with future development work.
2019-12-03 12:30:06 -08:00