Commit Graph

58 Commits

Author SHA1 Message Date
benthecarman
1d1af1d52e
Add generate helper function for bitcoind (#4852) 2022-10-19 14:22:30 -05:00
Chris Stewart
62081a43ec
2022 10 05 Delete legacy DLCSerializationVersion.Alpha DLCs for a cleaner upgrade to v0 spec (#4817)
* Delete alpha DLCs

* Get alpha migration working
2022-10-07 07:13:32 -05:00
Chris Stewart
e8ebcf55cd
Fix bug where signatures were out of order from what was posted in the announcement (#4809) 2022-09-30 14:00:14 -05:00
Chris Stewart
34e023e93f
2022 09 29 handle unordered sigs (#4807)
* Get unit tests passing for unordered nonces/signatures

* Get v0 oracle announcements working again on listannouncements

* Add unit test to make sure we can still validate signatures for attestments with nonces out of order
2022-09-29 11:43:50 -05:00
Chris Stewart
8d91abd678
Add signature ordering to ClaimedDLCStatus.oracleSigs (#4804)
* Add signature ordering to ClaimedDLCStatus.oracleSigs

* fix bug
2022-09-27 09:43:37 -05:00
Chris Stewart
9c506b639f
Add OrderedSchnorrSignatures, use it in OracleAttestment (#4803)
* Add OrderedSchnorrSignatures, use it in OracleAttestment, propagate it threw the codebase

* Small cleanups

* Add SortedVecFactory

* Fix test case with out of order nonces
2022-09-26 19:35:04 -05:00
Chris Stewart
26595ab3ac
Fix bug where no exception was thrown if the acceptor did not have enough money (#4728)
* Fix bug where no exception was thrown if the acceptor did not have enough money

* Revert ContractInfo.max definition, fix bug in acceptDLCOffer

* Fix incorrect usages of ContractInfo.max

* Refactor ContractInfo.max -> ContractInfo.maxOfferorPayout

* Fix dlc.md
2022-09-07 19:08:27 -05:00
rorp
34c10c6c65
Fix WalletDLCSetupTest (#4623)
* Fix WalletDLCSetupTest

* scalafmt
2022-08-18 07:23:54 -05:00
Chris Stewart
46502496c1
Update DLCClientIntegrationTest to use the newest bitcoind (#4596) 2022-08-10 09:34:35 -05:00
Chris Stewart
2cd8c80f67
Refactor so we don't create multiple WalletAppConfig in testkit (#4548)
* Refactor so we don't create multiple WalletAppConfig in testkit

Fix buildBip39PasswordConfig

* Remove bip39Password argument from dlcWalletTest fixtures

* Fix allowExternalDLCAddresses config in tests

* Remove unnecessary overrides of BitcoinSWalletTest.getFreshConfig, fix docs

* Add DLCExecutionBackendTest.afterAll()

* Fix nodeTest bip39Password usage

* Fix bug where we weren't using correct config inside of getFreshConfig

* Fix DLCExecutionBitcoindBackendtest.afterAll()

* Fix RescanDLCTest
2022-07-30 17:20:18 -05:00
Chris Stewart
b69e487d04
Move MockChainQueryApi/MockNodeApi out of BaseWalletTest (#4542)
* Move MockChainQueryApi/NodeApi out of BaseWalletTest

* fix docs

* Move wallet configurations out of BaseWalletTest

* Move helper methods out of BitcoinSFixture trait into companion object to simplify the hierarchy

* Refactor usage of WalletWithBitcoind to allow parameterization of the BitcoindRpcClient type
2022-07-27 10:18:22 -05:00
benthecarman
64183568fe
Allow creation of TaprootTxSigComponent (#4445)
* Allow creation of TaprootTxSigComponent

* PreviousOutputMap using MapWrapper
2022-07-04 08:46:10 -05:00
rorp
fdf281b469
DLC <-> contact mapping (#4346)
* DLC <-> contact mapping

* updated docs

* populate dlc/contact mapping automatically

* typo

* respond to the PR comments

* rename `contact` to `peer`

* fix unit tests

* create a contact when an incoming offers gets created

* drop dlc_contact_mapping table

* fix build

* update the docs

* Revert "update the docs"

This reverts commit 2386adadcd.

* revert dlc-contact-* endpoints
t Please enter the commit message for your changes. Lines starting
2022-06-14 08:14:28 -05:00
Nadav Kohen
b80bf4649e
Add HashType to ECDigitalSignature API (#4320)
* HashType now uses Int instead of Int32

* Moved HashType from core to crypto

* Added HashType helper functions to ECDigitalSignature

* Added tests

* Fixed compile
2022-05-29 18:25:22 -05:00
rorp
f680ab8691
Persist whether wallet is rescanning in the database (#4326)
* Persist whether wallet is rescanning in the database

* fix cli

* fix build

* fix unit tests

* fix postgres tests

* remove wallet_state table

* fix rescan bug

* cleanup

* revert Cancellable's

* Cleanup

Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
2022-05-23 19:03:02 -05:00
Chris Stewart
37da24b94b
Add SignDbState to fix rescan exception (#4246)
* Add SignDbState to fix rescan exception

* Cleanup

* Add test, doesn't pass

* Add unit tests, add invariants

* Add unit test to appServerTest

* Fix handling so an exception is not thrown internally when a contractId does not exist
2022-04-11 08:06:53 -05:00
Chris Stewart
ddabc91294
2022 04 02 fix walletdlcsetup test (#4237)
* WIP

* Fix test case so it passes
2022-04-02 11:40:33 -05:00
Chris Stewart
b5bfcbc009
Increase amount so test fails more consistently (#4233) 2022-03-31 10:09:39 -05:00
Chris Stewart
f2fa56221d
2022 03 31 collateral invariant (#4232)
* DLCMessage.totalCollateral -> DLCMessage.collateral

* Fix bad names of {DLCOfferTLV,DLCAcceptTLV}.totalCollateralSatoshis, its not the total collateral, rather the collateral being contributed by the offerer and acceptor

* Fix rebase

* Fix appServerTest

* Fix docs
2022-03-31 09:48:08 -05:00
Chris Stewart
8081772b57
Allow acceptor to upsert same outpoint multiple times for different offers (#4230)
* Allow acceptor to upsert same outpoint multiple times for different offers

* Remove extra log

* Revert DLCOffer invariant

* Fix OP_RETURN tests
2022-03-31 07:47:10 -05:00
Chris Stewart
3f18f7b04c
Only allow executing a DLC if it is in the Broadcast or Confirmed state (#4185)
* Only allow executing a DLC if it is in the Broadcast or Confirmed state

* Only throw if DLC is setup, not if its already executed
2022-03-13 14:08:47 -05:00
rorp
ffd7d921a8
Database support for incoming offers (#4105)
* Database support for incoming offers

* fix tests
2022-02-18 14:03:05 -06:00
rorp
5777ec1c31
Add an ability to set custom payout and change addresses (#4101)
* Add an ability to set custom payout and change addresses

* config changes

* formatting

* respond to the comments
2022-02-18 09:29:00 -06:00
rorp
6cfbf67812
Prevent DB state corruption while accepting the same offer multiple times (#4067)
* Prevent db state corruption while accepting the same offer multiple times

* cleanup
2022-02-11 12:23:17 -06:00
rorp
bce58ba33d
Validate announcement signatures on create/accept offer (#4071)
* Validate announcement signatures on create/accept offer

* unit tests
2022-02-11 06:50:45 -06:00
Chris Stewart
9de4b0272a
2022 01 31 issue 4030 (#4066)
* WIP

* WIP

* Get basic unit test passing for new adaptor sig states

* Fix compile
2022-02-09 13:15:44 -06:00
Chris Stewart
590cd9c72e
2022 02 06 remoteclaimed refactor (#4054)
* Small refactors to make things more readable

* Add invariants to make sure things are defined when doing the RemoteClaimed flow

* Move where we update DLCDb state to RemoteClaimed so its atomic with the rest of the db updates

* Consoldiate uses of updatedDlcDb

* Add logs

* scalafmt
2022-02-06 16:31:13 -06:00
Chris Stewart
7a6f0430d6
2022 02 03 issue 4032 (#4042)
* get all dlcWalletTest/test passing

* Get dlcTest/test working with ignored test cases

* WIP

* Rework match oracleSignatures

* Refactor checkSingleContractInfoOracleSigs to use matchOracleSignatures

* Clean up checkOracleSignaturesAgainstContract for disjoint, still doesn't pass test cases

* Some DRY in numeric test cases

* Add test case for enum contracts

* Fix disjoint union contract bug

* Refactor matching of oracle announcements and oracle signatures into DLCUtil

* Fix compile on on 2.12.x

* Address parts of code review
2022-02-05 09:04:04 -06:00
Chris Stewart
bd5bcfef3a
2022 01 18 issue 3969 Add serialization_version to global_dlc_data (#3992)
* Get refactor working where we decouple CETSignatures and the partial refund signature

* WIP

* Implement migration to specify serialization_version on global_dlc_data table

* Fix migrations test

* WIP

* implement contractid computation

* Get migration working for wallet on testnet

* Add check to make sure we only try to migrate old wallets

* Refactor DLCDataManagement.getOfferAndAcceptWithoutSigs to not use DLCTxBuilder

* WIP

* Bubble up Option[] into DLCWallet, trivially assert on it and then use .get. We will have to do the refactor of DLCWallet sometime in the future

* Change global_dlc_data serializationVersion at database level to not have an Option

* Add DLCDbState, propogate it through the codebase

* Remove log

* Remove invariant for making sure all DLCs are defined on migraiton, add log for the case of issue 4001

* Add filter on ALPHA serialization DLCs. We dont need to migrate DLCs that are using the beta serialization

* Rebase onto 4004

* Refactor to use the refund signature in the accept/sign message

* Add output index to the return of DLCTxBuilder.buildFundingTransaction()

* Fix compile

* Remove log
2022-01-26 14:57:45 -06:00
Chris Stewart
e802254a20
2022 01 24 rm appconfig varargs (#4011)
* Get things compiling

* Get tests passing

* Fix docs
2022-01-25 07:25:05 -06:00
Chris Stewart
52dcf51e82
Automatically download binaries if they are used in test suite (#4005)
* Remove download binary scripts from CI, try to make binary downloads contingent on tests being run in a project

* Cleanup docs to remove unecessary downloadBitcoind
2022-01-23 17:43:30 -06:00
Chris Stewart
21de609ed8
2022 01 22 cetsignatures refactor (#4004)
* Get refactor working where we decouple CETSignatures and the partial refund signature

* Add DLCAcceptWithCetSigs() for the case where we have a refund sig, but no cet signatures

* Fix bugs

* Fix sighash parsing bugs
2022-01-23 16:13:36 -06:00
rorp
8a881b37f4
Add DLC callback for refunded DLC (#3989) 2022-01-18 12:29:19 -06:00
Chris Stewart
ee0d62c5b8
2022 01 14 DLCDataManagement refactor (#3982)
* WIP

* Finish refactor, get unit tests working

* Remove log
2022-01-18 08:12:27 -06:00
Chris Stewart
4ca586ca46
2021 12 19 dlc callbacks (#3923)
* Implement DLC wallet callbacks

Add callbacks and tests for Claimed/RemoteClaimed

Add unit test for confirmed state

* Add some docs

* Address ben's code review

* Fix scalafmt
2021-12-20 14:28:52 -06:00
Chris Stewart
8765c2f845
Disjoint union dlc (#3839)
* Implemented Disjoint Union DLC related data structures with dlcTest passing

Broke DLCClientTest up into multiple test files

Optimized DLC execution unit tests by checking all outcomes on a single setup DLC

Refactored DLCTest to allow for Disjoint Union DLC construction and validation, added tests

Responded to review

Fixed after cherry-pick

Fixed docs

* Fixed things after rebase

* Rebase

* Fix json serializer

* Finish fixing compile

* Start trying to make APIs better for multi oracle contract infos

* Clean things up in the GUI, try to make failures on disjoint union contracts as explicit as possible

* Use less numDigits as optimization for non secp CI test cases

* Fix compile

* Refactor BroadcastDLCDialog

* Fix test case optimization

* Clean up comment

Co-authored-by: nkohen <nadavk25@gmail.com>
2021-11-29 19:26:00 -06:00
Chris Stewart
31e8324522
Make sure exception is caught by Future inside of UtxoHandling.unmarkUTXOsAsReserved() (#3816) 2021-11-11 15:22:45 -06:00
Chris Stewart
aa748c012f
2021 11 03 protocol version (#3793)
* ProtocolVersion WIP

* Start incorporating protocol version into DLC Offer

* Fix doc
2021-11-03 15:13:19 -05:00
benthecarman
92ab9faa45
Decide which coin selection solution to use based on waste metric (#3646)
* Decide which coin selection solution to use based on waste metric

* Fix test

* Fix NeutrinoNodeWithWalletTest
2021-10-19 09:47:28 -05:00
Chris Stewart
9668358807
2021 10 04 issue 3715 (#3724)
* WIP

* Setup DLC fixtures to work with bitcoind

* Implement test case for issue 3715

* turn logging back down, add another assertion for making sure funding tx is still unconfirmed

* Make sure we are broadcasting from acceptor

* Cleanup
2021-10-10 07:51:00 -05:00
benthecarman
099e4469b4
Add ordering of funding inputs to DLC Wallet (#3647)
* Add ordering of funding inputs to DLC Wallet

* Fix tests
2021-09-11 08:25:24 -05:00
benthecarman
621e8e9033
Rescan DLC Tests (#3515) 2021-08-11 07:29:33 -05:00
benthecarman
c1ce9ca115
Disallow signing your own DLCAccept (#3453)
* Disallow signing your own DLCAccept

* Fix formatting
2021-07-27 10:47:31 -05:00
benthecarman
2597904019
Move DLCWalletApi to core module (#3438) 2021-07-21 15:25:18 -05:00
benthecarman
a295b363bd
Fix bug where we couldn't execute a DLC twice (#3426) 2021-07-20 10:43:27 -05:00
benthecarman
892096d790
Disallow calling addDLCSigs as Initiator (#3411) 2021-07-15 17:05:32 -05:00
benthecarman
e098aba680
Create and implement OrderedAnnouncements type (#3356)
* Create and implement OrderedAnnouncements type

* Fix docs

* Update scaladoc
2021-07-06 07:58:58 -05:00
benthecarman
cada6fdc63
Fix DLC not storing nSequence for funding inputs (#3342)
* Fix DLC wallet not storing nSequence for funding inputs

* Fix DLCTest
2021-06-29 09:36:30 -05:00
benthecarman
cfe0c2f0d8
Multi wallet support for DLC database (#3289)
* Multi wallet support for DLC database

* Fix for postgres
2021-06-22 12:56:26 -05:00
benthecarman
ca2ddbb7ec
Preserve noncedb outcomes when adding oracle (#3273) 2021-06-16 07:50:09 -05:00