Commit graph

10132 commits

Author SHA1 Message Date
Christoph Atteneder
fa39258d71
Add max allowed message option to Popup and increase window size for Monero to improve readability 2019-11-14 15:21:30 +01:00
Christoph Atteneder
7e08d66a5d
Merge pull request #3575 from beingindot/account_validation
Account validation
2019-11-14 14:49:54 +01:00
beingindot
4432d80061
Added empty check validation for popmoney/revolut/uphold/zelle 2019-11-14 12:31:07 +05:30
Devin Bileck
21572eae61
Add testCompile dependency to core
This is necessary because bisq.network.p2p.MockNode imports
bisq.core.network.p2p.seed.DefaultSeedNodeRepository.
2019-11-13 12:35:46 -08:00
Christoph Atteneder
459646ad68
Merge pull request #3573 from beingindot/account_validate_mg_nationalbank
Added check for empty validation
2019-11-13 17:40:47 +01:00
beingindot
755ca19ef6
Added check for empty validation
This commit is for github issue #3458 and #3459
check added for moneybeam and national bank transfer
2019-11-13 21:18:02 +05:30
Devin Bileck
b45765feb5
Add PeerManagerTest
The old PeerManagerTest was located under network/p2p/routing, which is
no longer the correct location. Additionally, it was outdated so I
just removed it and added a new file under network/p2p/peers containing
tests for checkMaxConnections.
2019-11-12 23:30:31 -08:00
Devin Bileck
6f80b8a964
Add MockNode that allows for simulating connections 2019-11-12 23:15:57 -08:00
Julian Knutsen
c81f8a6da3
[TESTS] Rename P2PDataStoreTest
File name now reflects the actual tests run after everything
was split up.
2019-11-12 18:06:47 -08:00
Julian Knutsen
14c78c1c85
[TESTS] Add missing license text to test files 2019-11-12 18:05:25 -08:00
Julian Knutsen
fc553121bf
[TESTS] Make SavedTestState ctor private to TestState
All test callers now just ask the TestState for a SavedTestState instead
of SavedTestState ctor. This makes more sense with the object
relationship since SavedTestState is only used internally to TestState.
2019-11-12 18:05:25 -08:00
Julian Knutsen
fa82c177f1
[TESTS] Clean up TestState static methods
All users pass in an instance of TestState, just make it an instance
method instead of static.
2019-11-12 18:05:25 -08:00
Julian Knutsen
10384acdcc
[TESTS] Split monolithic P2PDataStoreTest into separate files
One monolithic test was useful when it was under development to reduce
code churn, but now that the tests are complete it is easier to find
and run a specific test when separated into separate test files.

This also fixes a downside of Enclosed.class that didn't allow individual
tests to be run in intellij.
2019-11-12 18:05:20 -08:00
Julian Knutsen
eb2f8f315e
[TESTS] Add JavaDocs for test objects
Add JavaDocs for the various Stub and Fake objects that are used
in the P2PDataStore test so future developers can understand why they
exist.
2019-11-12 17:59:16 -08:00
Julian Knutsen
c652528ca1
[DEAD CODE] Remove obsolete tests 2019-11-12 17:47:34 -08:00
Julian Knutsen
d980932748
[DEAD CODE] Remove unused functions and imports 2019-11-12 17:47:33 -08:00
Julian Knutsen
26afd11bbf
[TESTS] Remove dead tests and code
Purge all the superseded tests and helper functions now that everything
can be unit tested.
2019-11-12 17:47:30 -08:00
Julian Knutsen
285214803e
[TESTS] Start deprecating integrations tests
Now that the unit tests cover all of the per-Entry validation,
the tests that create specific configuration of ProtectedStorageEntry
and ProtectedMailboxStorageEntry objects can be removed in favor
of mockable Entrys.

Using mocks prior to this patch was impossible due to the relationship
between the Entry objects and the P2PDataStorage helper functions. Now
that the objects are properly abstracted and tested, real unit tests
can be written for the P2PDataStore module.

This patch leaves the tests and adds an @Ignore so the reviewer can see
which unit test now supersedes the integration test.
2019-11-12 17:44:33 -08:00
Julian Knutsen
5d35d08b00
[PR COMMENTS] Logging format and function rename
Use a more compact version of string formatting
in log messages

Rename isMetadataEquals to matchesRelevantPubKey
which is more descriptive of the actual check
2019-11-12 16:36:35 -08:00
Julian Knutsen
5ae9dd1e17
Combine remove() and removeMailboxData()
Now that all the code is abstracted and tested, the remove()
and removeMailboxData() functions are identical. Combine them and update
callers appropriately.

Now, any caller don't need to know the difference and it removes the
sharp edge originally found in #3556
2019-11-12 16:22:03 -08:00
Julian Knutsen
53b5feb7a0
[TESTS] Update remove validation with BroadcastMessage type
Make the remove validation more robust by asserting that the
correct remove message is broadcast. This will provide a better
safety net when combining the remove functions.
2019-11-12 16:19:58 -08:00
Julian Knutsen
289788e374
Introduce isMetadataEquals and use it
Let the objects compare their metadata instead of doing it for them. This
allows for actual unit testing and paves the way for deduplicating the
remove code paths.

This patch also removes an unnecessary check around comparing the hash
of the stored data to the new data's hash. That check can't fail since
the hash was a requirement for the map lookup in the first place.
2019-11-12 16:19:44 -08:00
Julian Knutsen
0c07883c17
Remove duplicate check in refreshTTL
The current check verifies that the stored Payload.ownerPubKey == stored Entry.ownerPubKey.

This is the same check that was done when the item was originally added
and there is no reason to do it again.
2019-11-12 16:18:02 -08:00
Julian Knutsen
28a7bc887c
[REFACTOR] Move receiversPubKey check behind isValidForRemoveOperation()
This mailbox-only check can now exist inside the object for which it
belongs. This makes it easier to test and moves closer to allowing
the deduplication of the remove() methods.
2019-11-12 16:18:02 -08:00
Julian Knutsen
f915a03ff9
[REFACTOR] Move signature validation behind isValidForRemoveOperation()
Move the signature checks into the objects to clean up the calling code
and make it more testable.
2019-11-12 16:18:01 -08:00
Julian Knutsen
9c7dc0c1ad
[REFACTOR] Move signature validation behind isValidForAddOperation()
Move the signature checks into the objects to clean up the calling code
and make it more testable.

The testing now has to take real hashes so some work was done in the fixtures
to create valid hashable objects.
2019-11-12 16:18:01 -08:00
Julian Knutsen
40337ff1b8
Clean up toString() methods
Add toString() for ProtectedStorageEntry so log messages have useful
information and clean up the formatting.
2019-11-12 16:18:01 -08:00
Julian Knutsen
217a321bbe
[REFACTOR] Remove checkPublicKeys()
Now that the objects can answer questions about valid conditions
for add/remove, ask them directly.

This also pushes the logging down into the ProtectedStorageEntry and
ProtectedMailboxStorageEntry and cleans up the message.
2019-11-12 16:18:00 -08:00
Julian Knutsen
a6317779ed
[REFACTOR] ProtectedStorageEntry::isValidForRemoveOperation()
Extract code from P2PDataStore, test it, and use new methods.
2019-11-12 16:18:00 -08:00
Julian Knutsen
ebf33e2ff1
[REFACTOR] ProtectedStorageEntry::validForAddOperation()
Method bodies are copied from P2PDataStore to separate refactoring
efforts and behavior changes.

Identified a bug where a ProtectedMailboxStorageEntry mailbox entry
could be added, but never removed.
2019-11-12 16:18:00 -08:00
Julian Knutsen
54b4b4df15
[TESTS] Add more tests around mis-wrapped ProtectedStorageEntrys
The code around validating MailboxStoragePayloads is subtle when
a MailboxStoragePayload is wrapped in a ProtectedStorageEntry. Add tests
to document the current behavior.
2019-11-12 16:17:59 -08:00
Julian Knutsen
2c2a57ef9d
[REFACTOR] Remove duplicated code in refreshTTL
The custom code to verify the refreshTTLMessage's signature and update
an entry isn't necessary. Just have the code construct an updated
ProtectedStorageEntry from the existing and new data, verify it,
and add it to the map.

This also allows the removal of the ProtectedStorageEntry APIs
that modify internal state.
2019-11-12 16:13:47 -08:00
Julian Knutsen
454b2d79e1
[TESTS] Lower entries required for purge in tests
The original test would take over 5 seconds. Allow tests to set the number
of required entries before purge to a lower value so the tests
can run faster with the same confidence.
2019-11-12 15:59:57 -08:00
Julian Knutsen
898d7fcd4a
[TESTS] Test onBootstrapComplete()
Add tests for removing expired entries and optionally purging
the sequence number map. Now possible since these tests have
control over time with the ClockFake.

The remove validation needed to be improved since deletes through
the expire path don't signal HashMap listeners or write sequence numbers.
2019-11-12 15:59:48 -08:00
Julian Knutsen
89ad234c43
[TESTS] Use ClockFake in tests to control time
Reduces non-deterministic failures of the refreshTTL tests that resulted
from the uncontrollable System.currentTimeMillis().

Now, all tests have extremely fine control over the elapsed time between
calls which makes the current and future tests much better.
2019-11-12 15:58:36 -08:00
Julian Knutsen
10eb9c0d01
Use Clock in ProtectedStorageEntry
Switch from System.currentTimeMills() to
Clock.millis() so dependency injection can
be used for tests that need finer control of time.

This involves attaching a Clock to the resolver
so all fromProto methods have one available when they
reconstruct a message. This uses the Injector for the APP
and a default Clock.systemDefaultZone is used in the manual
instantiations.

Work was already done in #3037 to make this possible.

All tests still use the default system clock for now.
2019-11-12 15:58:01 -08:00
Julian Knutsen
42680037bd
[REFACTOR] Clean up ProtectedStorageEntry ctor
Deduplicate some code in the ProtectedStorageEntry constructors in
preparation for passing in a Clock parameter.
2019-11-12 15:55:34 -08:00
Julian Knutsen
de72d3954d
Use dependency injected Clock in P2PDataStore
Use the DI Clock object already available in P2PDataStore, instead
of calling System.currentTimeMillis() directly. These two functions
have the same behavior and switching over allows finer control
of time in the tests.
2019-11-12 15:55:34 -08:00
Christoph Atteneder
d00179c924
Merge pull request #3600 from beingindot/moneygram_issue
Added padding for flowpane to resolve moneygram save issue.
2019-11-12 16:34:09 +01:00
beingindot
a132698520
Added padding for flowpane to resolve moneygram save issue. 2019-11-12 20:46:10 +05:30
Christoph Atteneder
cc2df91353
Merge pull request #3364 from lusarz/refactor-filter-window
Refactor FilterWindow
2019-11-12 15:59:39 +01:00
lukasz
d2f6702fe8
Refactor FilterWindow 2019-11-12 15:42:53 +01:00
Christoph Atteneder
ce20bb4231
Update MobileModel parseDescriptor to support iPhone 11 (#3277)
* Update MobileModel parseDescriptor to support iPhone 11

It was parsing only the first digit of the version and using that in a
comparison check to determine if the version is greater than 5.
This meant for the iPhone 11 it was comparing 1 > 5, returning an
incorrect result.

It now supports multi-digit version numbers (i.e. 11), including
support for a suffix in the version (i.e. 11S), just in case...

* Update to reflect isContentAvailable supports iPhone 6s and newer
2019-11-12 13:02:17 +01:00
Christoph Atteneder
3d5ba5b380
Merge pull request #3211 from stejbac/fix-info-pane-flicker
Prevent tooltip popover flicker upon mouseover
2019-11-12 12:05:01 +01:00
Devin Bileck
22e93d9ecd
Change access level for checkMaxConnections to be tested 2019-11-12 00:55:30 -08:00
Devin Bileck
6b22690578
Refactor checkMaxConnections
Fix connection limit checks so as to prevent the following warning:

> WARN  b.n.p2p.peers.PeerManager: No candidates found to remove (That
case should not be possible as we use in the last case all
connections).
2019-11-12 00:55:30 -08:00
rating89us
1d813c347c
Updating trading instructions for XMR (Monero)
Prove payments:
- clarifying that the official wallets (Monero GUI or CLI) are NOT required to send XMR, since user can use some alternative wallets (desktop: MyMonero, Exodus / mobile: Cake Wallet, MyMonero, Monerujo) that provide the information required to prove a payment (transaction key, transaction ID and destination address). This information is not provided by the remaining desktop and mobile wallets that currently support Monero, but since they could provide it in the future, I kept the warning about using other wallets different from the previously mentioned.
- listing Monero GUI as first option (for most users), and CLI as second option (for advanced users)
- renaming "transaction hash" to "transaction ID", which is used in official wallets
- renaming "tx private key" to "transaction key", which is used in official wallets
- adding "Secret key" as synonymous for "transaction key" (used in MyMonero wallet)
- adding "destination address" and keeping  "recipient's address" as synonymous
- renaming History tab to Transactions tab in Monero GUI
- adding "save recipient address" option must be enabled in Cake Wallet settings

Check payments:
- adding Monero GUI must be in Advanced mode
- adding Monero GUI verification must be done in Check Transaction section of Prove/check page
- adding parameters TXID TXKEY ADDRESS to the command check_tx_key in Monero CLI, as instructions in (https://www.getmonero.org/resources/user-guides/prove-payment.html)
- adding Explore Monero website (https://www.exploremonero.com/receipt) as alternative to verify payments
- removing payment ID instructions (it is being deprecated at the end of November in v0.15)

More info:
- directing to subreddit Monero support (https://www.reddit.com/r/monerosupport/), which is actively maintained, instead of Monero forum (https://forum.getmonero.org).
2019-11-11 20:57:35 +01:00
Julian Knutsen
e5f9261d97
Update behavior of P2PDataStorage::remove() & removeMailboxData() on duplicate sequence #s
Remove operations are now only processed if the sequence number
is greater than the last operation seen for a specific payload.

The only creator of new remove entrys is the P2PService layer that always increments
the sequence number. So, this is either left around from a time where
removes needed to work with non-incrementing sequence numbers or just
a longstanding bug.

With the completion of this patch, all operations now require increasing
sequence numbers so it should be easier to reason about the behavior in
future debugging.
2019-11-11 08:49:31 -08:00
Julian Knutsen
cbda653aba
Update behavior of P2PDataStorage::refreshTTL() on duplicates
Now returns false if the sequence number of the refresh matches
the last operation seen for the specified hash. This is a more expected
return value when no state change occurs.

The only callers are either P2PService users that always increment the
sequence number or the onMessage() handler which doesn't verify the return
so there will be no visible change other than the increased readability
of the code and deduplication of the code paths.
2019-11-11 08:49:31 -08:00
Julian Knutsen
c1ad6b408b
Update behavior of P2PDataStorage::addProtectedStorageEntry() on duplicates
Now returns false on duplicate sequence numbers. This matches more of
the expected behavior for an add() function when the element previously exists.

The only callers are either P2PService users that always increment the
sequence number or the onMessage() handler which doesn't verify the return
so there will be no visible change other than the increased readability
of the code and deduplication of the code paths.
2019-11-11 08:49:27 -08:00