Commit Graph

15955 Commits

Author SHA1 Message Date
Christoph Atteneder
0a31bf899e
Merge pull request #5858 from stejbac/add-asic-resistant-pow
Provide ASIC resistant PoW scheme for BSQ swaps
2021-12-07 09:34:50 +01:00
Steven Barclay
db6025a08d
Add separate ProofOfWork.solution proto field for Equihash
Avoid repurposing the 'ProofOfWork.payload' field for Equihash puzzle
solutions, as that may be of later use in interactive PoW schemes such
as P2P network DoS protection (where the challenge may be a random nonce
instead of derived from the offer ID). Instead, make the payload the
UTF-8 bytes of the offer ID, just as with Hashcash.

Also, make the puzzle seed the SHA-256 hash of the payload concatenated
with the challenge, instead of just the 256-bit challenge on its own, so
that the PoW is tied to a particular payload and cannot be reused for
other payloads in the case of future randomly chosen challenges.
2021-12-07 02:22:33 +00:00
Steven Barclay
24d2a7f222
Code cleanup: proto fields, duplicated expr & null char separator
1. Reorder the PoW fields in the 'Filter' proto by field index, instead
 of contextually.
2. Deduplicate expression for 'pow' & replace if-block with boolean op
 to simplify 'FilterManager::isProofOfWorkValid'.
3. Avoid slightly confusing use of null char as a separator to prevent
 hashing collisions in 'EquihashProofOfWorkService::getChallenge'. Use
 comma separator and escape the 'itemId' & 'ownerId' arguments instead.

(based on PR #5858 review comments)
2021-12-06 22:55:14 +00:00
Christoph Atteneder
f5db85bc3d
Merge pull request #5894 from chimp1984/check-recipient-address-only-after-wallet-is-synced
Fix premature validation call
2021-12-06 20:29:27 +01:00
Christoph Atteneder
2cb238318f
Fix broken test 2021-12-06 12:05:34 +01:00
Christoph Atteneder
21f84bcd45
Fix broken test 2021-12-06 12:03:26 +01:00
chimp1984
60b3e1216a
Change max retries from 3 to 12
When doing a resync from genesis the number of blocks is limited to 6000
so that requires lots of requests and with that increases risk of broken
connections. Giving more tolerance for retries avoids that the user has
to restart the app.
2021-12-06 11:52:13 +01:00
chimp1984
c34a019a31
Fixes https://github.com/bisq-network/bisq/issues/5882
When syncing from genesis the number of blocks are limited so we get the
`onParseBlockCompleteAfterBatchProcessing` called each time when the received
 blocks are processed, and as we are not at wallet height we repeat requesting
 blocks. But the new check for the BTC recipient triggers a resync from resource call.
We add now a check that we do this check only once the wallet is synced and our
block height from dao state matches wallet blockheight.
2021-12-06 11:52:12 +01:00
Christoph Atteneder
f37a882c7c
Merge pull request #5892 from nutel65/patch-1
Fixed annoying semicolon colors.
2021-12-06 11:46:37 +01:00
Christoph Atteneder
6e1a805b22
Merge pull request #5875 from chimp1984/fix-incorrect-chainheight
Fix incorrect start height for block request
2021-12-06 11:36:00 +01:00
Christoph Atteneder
e5c70717f8
Merge pull request #5884 from MwithM/patch-1
Substitute Unconfirmed for Processing BSQ swap
2021-12-06 11:29:17 +01:00
chimp1984
e802e68506
Fix handling for genesis height and case when wallet sync is not completed yet.
- At genesis we use the genesis height for request (not height+1)
- If wallet is not synced yet we do not call onParseBlockChainComplete (as it was before)
2021-12-06 11:17:41 +01:00
chimp1984
84cd67f54d
Fix incorrect start height for block request
We added 1 as with the lite monitor mode we persist the most recent block,
thus we request with the start height for the next block.
But that cause a problem at a DAO full mode which has lite monitor mode set
as then the block parsing would not be triggered.

We refactor it so that we take the chainHeight from the dao state
directly and add 1 at the requests.
We add a check if we are at chain tip, and if so we skip requests
and call the onParseBlockChainComplete directly.
2021-12-06 11:17:33 +01:00
Christoph Atteneder
d85373adbb
Make Codacy happy 2021-12-06 11:12:17 +01:00
Christoph Atteneder
319a9d96a7
Improve BSQ swap success message 2021-12-06 11:04:48 +01:00
Christoph Atteneder
a1ecf35007
Apply suggestions and fix edge case when BSQ legacy payment account offer is duplicated 2021-12-06 11:04:01 +01:00
Christoph Atteneder
1a1dcf1d6f
Improve naming and remove unnecessary null check 2021-12-06 10:43:58 +01:00
Christoph Atteneder
ec5f217f2f
Improve warning when BSQ swap offer is removed 2021-12-06 10:43:58 +01:00
Bisq GitHub Admin
b06852be73
Merge pull request #5891 from ripcurlx/improve-remove-bsq-offer-warning
Improve warning when BSQ swap offer is removed
2021-12-06 10:43:26 +01:00
Christoph Atteneder
04fc0388db
Improve naming and remove unnecessary null check 2021-12-06 09:18:44 +01:00
Steven Barclay
981d6ff000
Validate input script types to prevent BSQ swap tx fee underpaying
Add a check of 'scriptTypeId' field, against the output of the spending
tx, to the 'RawTransactionInput::validate' method. Also make the seller
as well as the buyer validate each raw BSQ/BTC input received from the
peer. This prevents either peer from claiming that any of their
non-segwit inputs are segwit in order to underpay the tx fee.
2021-12-04 19:52:07 +01:00
Steven Barclay
efd590b9e7
Fix BSQ swap buyer tx fee theft vulnerability
Prevent the seller from stealing the combined tx fee as change by lying
about the value of one or more of his BTC inputs, which are passed to
the buyer as raw inputs in the 'BsqSwapFinalizeTxRequest' message.

To this end, add a 'RawTransactionInput::validate' method to check the
'value' field against the output value of the respective spending tx and
run it on every seller input in 'ProcessBsqSwapFinalizeTxRequest', so
that the buyer is no longer just trusting those numbers.

Additionally, check that the spending txIds from the raw BTC inputs
supplied by the seller actually match those of his signed inputs in the
accompanying partially signed tx, thus tying the raw input values to the
seller's tx.
2021-12-04 19:52:07 +01:00
Steven Barclay
acad642b53
Fix misleading comment: BSQ swap taker tx fee tolerance
(Actual tolerance by maker of agreed tx fee is 50%, not 10%.)
2021-12-04 19:52:06 +01:00
Christoph Atteneder
628ac27e25
Merge pull request #5889 from stejbac/fix-bsq-swap-tx-fee-theft-vulnerability
Fix BSQ swap buyer tx fee theft vulnerability
2021-12-04 19:50:50 +01:00
jmacxx
4b60be0ebb
Always use fresh address for MULTI_SIG context 2021-12-04 19:49:11 +01:00
Christoph Atteneder
e57682929b
Merge pull request #5885 from jmacxx/use_fresh_address_for_multi_sig
Always use fresh address for MULTI_SIG context
2021-12-04 19:48:43 +01:00
chimp1984
d7c9ce462b
Change max retries from 3 to 12
When doing a resync from genesis the number of blocks is limited to 6000
so that requires lots of requests and with that increases risk of broken
connections. Giving more tolerance for retries avoids that the user has
to restart the app.
2021-12-04 11:11:26 -05:00
chimp1984
747916ac2f
Fixes https://github.com/bisq-network/bisq/issues/5882
When syncing from genesis the number of blocks are limited so we get the
`onParseBlockCompleteAfterBatchProcessing` called each time when the received
 blocks are processed, and as we are not at wallet height we repeat requesting
 blocks. But the new check for the BTC recipient triggers a resync from resource call.
We add now a check that we do this check only once the wallet is synced and our
block height from dao state matches wallet blockheight.
2021-12-03 20:09:47 -05:00
chimp1984
c9e0265e13
Fix handling for genesis height and case when wallet sync is not completed yet.
- At genesis we use the genesis height for request (not height+1)
- If wallet is not synced yet we do not call onParseBlockChainComplete (as it was before)
2021-12-03 19:48:17 -05:00
ghubstan
98b41cb56c
Use string in BigDecimal ctor, and make codacy happy too 2021-12-03 13:33:20 -03:00
ghubstan
5f7fd6257b
Merge branch 'master' into 6-api-xmr-trading 2021-12-03 13:19:24 -03:00
ghubstan
0f32fe2fc3
Merge branch '5-api-bsqswap-simulation-n-docs-update' into 6-api-xmr-trading 2021-12-03 13:16:26 -03:00
ghubstan
f195b76637
Tell user bsqswap offer cannot be edited, but can be canceled at no charge
Resolves issue described in https://github.com/bisq-network/bisq/pull/5876#pullrequestreview-822692137
2021-12-03 12:47:03 -03:00
ghubstan
bb68605c69
Add missing --currency-code=bsq param to createoffer example
Resolves issue mentioned in https://github.com/bisq-network/bisq/pull/5876#pullrequestreview-822692137
2021-12-03 12:13:33 -03:00
Nutel
07ec6ec0d0
Fixed annoying semicolon colors.
That line is just command output, not a sh command.
2021-12-03 15:36:00 +01:00
Christoph Atteneder
ccda66d2c6
Improve warning when BSQ swap offer is removed 2021-12-03 12:21:03 +01:00
Christoph Atteneder
daf762f8fa
Add visual icon for duplicate offer functionality 2021-12-03 12:02:10 +01:00
Christoph Atteneder
6a384a7914
Add support to duplicate bsq swap offers also in History view 2021-12-03 11:25:24 +01:00
Christoph Atteneder
b9fa9d6347
Merge pull request #5888 from jmacxx/fix_npe_portfolio_history
Fix NPEs in Portfolio View wrt. BSQ swap
2021-12-03 10:47:10 +01:00
jmacxx
fc2bb6c8b9
Fix NPEs in Portfolio View wrt. BSQ swap 2021-12-03 10:33:25 +01:00
ghubstan
104f11acaa
Do not run 2x from gradle terminal cmd
Method tests are combined in scenario pkg tests to reduce test
harness startup/shutdown time.
2021-12-02 19:50:18 -03:00
ghubstan
e2647af6b5
Add a few more checks on editedOffer.getUseMarketBasedPrice() 2021-12-02 19:40:58 -03:00
ghubstan
f867f6beb3
Add new regtest apitest/scripts/trade-xmr-simulation.sh 2021-12-02 19:18:24 -03:00
ghubstan
65fb8e8225
Add CliMain.main(args) tests
There are no asserts, but helpful for looking at affects of CLI commands
from terminal because apitest cases use gRPC service stubs instead of terminal.
2021-12-02 19:17:03 -03:00
ghubstan
743ef93750
Test API XMR support 2021-12-02 19:11:29 -03:00
ghubstan
a45c5fa61f
Adjust CLI opts parsers & opt parsing test for XMR support 2021-12-02 19:09:54 -03:00
ghubstan
03b57916a5
Make altcoin offer sorting method names more generic 2021-12-02 19:07:49 -03:00
ghubstan
54f815eb4f
Adjust API cli-side CryptoCurrencyUtil & OffersServiceRequest for XMR support 2021-12-02 19:04:28 -03:00
ghubstan
742a6f441e
Allow mkt price lookup for any altcoin from API 2021-12-02 19:02:03 -03:00
ghubstan
ce8b6df9c5
Adjust API CorePaymentAccountsService for creating XMR accts 2021-12-02 19:00:22 -03:00