Commit Graph

246 Commits

Author SHA1 Message Date
Nadav Kohen
aacba1c077
Pulled down core diff from adaptor-dlc (#3038) 2021-05-05 09:26:09 -05:00
Chris Stewart
279b93f9e0 Rework P2SHScriptSignature.isStandardNonP2SH() (#2963)
* Take ben's suggestion for parsing the entire tx hex

* Add assertion that the secondSPK is NOT a P2SHScriptPubKey, revert the classification of P2SHScriptPubKey in P2SHScriptSignature.isStandardNonP2SH()

* Revert conditionalSPK match logic

* Fixed ConditionalScriptPubKeyTest.scala (#32)

Co-authored-by: Nadav Kohen <nadavk25@gmail.com>
2021-04-26 12:46:50 -05:00
Chris Stewart
9ecea9f710 2021 04 24 bitcoin s scripts (#2961)
* Add new app/scripts project which is meant to store useful bitcoin-s scripts

* Add ScanBitcoind with an example of counting segwit txs between a range

* Fix bug of creating a new actor system everytime BitcoindRpcClient.apply(instance) is called

* Add BitcoindRpcClient.fromVersionNoSystem()

* Take ben's suggestions

* Fix compile

* Rework P2SHScriptSignature.isStandardNonP2SH() to account for nesting p2sh script inside of it

* fix compile on java8

* Enable app packaging in scripts project
2021-04-25 14:03:22 -05:00
benthecarman
8b8d5dcc0e Fix conversion from sats/vb to sats/kw (#2895)
* Fix conversion from sats/vbytes to sats/kw

* Add another test
2021-04-12 19:50:18 -05:00
Chris Stewart
85fb931cba Implement BIP32Path.fromHardenedString(). (#2886)
* Implement BIP32Path.fromHardenedString(). This will throw exceptions a non hardened path in the string exists

* Do what ben says rather than re-implementing BIP32Path.fromString
2021-04-09 13:19:11 -05:00
Chris Stewart
c738f23e58 Fix build warnings that came with sbt 1.5.0 (#2857)
* Fix build warnings that came with sbt 1.5.0

* Fix more deprecation warnings

* Fix more warnings
2021-04-06 06:01:11 -05:00
benthecarman
fa80f36d2f Get all of Core working with JS (#2826)
* core-test-js-json

* Add SigPointComputer cross compile
Co-authored-by: Nadav Kohen <nadavk25@gmail.com>

* Fix java.time for scalajs

* InetAddress for scalajs

* Fix linking errors in coreTestJS

* Easy fixes

* InetAddress Tests

* Update micropickle, fix exact functions

* Get BigSizeUIntTest working with upickle

* Fix exact funcs

* Update Base58Test with upickle

* Update ScriptSignatureTest with upickle

* Update TransactionTest with upickle

* Update BlockFilterTest with upickle

* Update ScriptInterpreterTest with upickle

* Update MnemonicCodeTest with upickle

* Add InetAddress unit tests

* Fix compile errors

* Get core tests running, not passing

* Sign with js

* Fix PSBTUnitTest

* Fix PBKDF2 for JS

* Use bcrypto's secp256k1 instead of ecdsa

* Fix 2.12.12 compile

* Core tests passing :)

* Test corejs
2021-03-31 15:04:30 -05:00
Nadav Kohen
e6899b20b1 Made ECPrivateKey signing synchronous and got src compiling (#2652)
Fixed tests

De-futured tx buidling, finalizing and signing

Responded to review
2021-03-23 17:05:58 -05:00
benthecarman
50d4e1f969 Move hard coded test vectors from resource files into scala files (#2818)
* Remove sighash.json resource

* Remove trezor_bip39_vectors.json

* Hardcode transaction json test vectors

* Hardcode big size uint json test vectors

* Hardcode base58 json test vectors

* Hardcode script tests json test vectors

* Make BlockTest JVM only
2021-03-23 12:06:18 -05:00
rorp
911fca5825 Schnorr js (#2805)
* Schnorr sigs for Scala.js

* fix build

* put BIP340 test vectors in a shared space

* remove teskit dependency, fix point edge cases

* fix build

* add unit tests for point addition

* scaladoc

* cleanup

* respond to the comments

* Fix usage of BitcoinSLogger

Co-authored-by: christewart <stewart.chris1234@gmail.com>
2021-03-22 12:56:40 -05:00
benthecarman
c6c4e83e9e Remove logging from testkit core (#2813)
* Remove logging from testkit core

* Fixup deps
2021-03-22 11:48:27 -05:00
benthecarman
07514e2348 Remove logging from core (#2810)
* Remove logging from core

* Remove slf4j from testkit core

* Remove logback from coretest
2021-03-21 19:11:55 -05:00
benthecarman
b0f7d6f26b Implement bech32m (#2572)
* Implement bech32m

* Respond to review
2021-03-18 18:04:38 -05:00
benthecarman
8b6c0652a2 Completely remove range event descriptors (#2764) 2021-03-04 15:18:33 -06:00
Chris Stewart
e59057483f Resturcutre cryptoTest & coreTest to work with scalajs build (#2731)
* Get cryptoTest,coreTest projects working with scala-js

Get build working, now moving onto compile

Move jvm specific cryptoTest's into the .jvm sub project

Rework build definition names to be more concise

Fix missing cryptoTest refactor

Move logback-test.xml into jvm specific resource folder so it doesn't get ignored

Make coreTest a crossProject

Rework ci matrix to work with new project structure

Try to fix CI matrix

CI fix part 2

* Apply commonSettings to all cross projects

* Address part of roman's code review, make coreJS, make cryptoTest.dependOn(crypto)

* WIP to share with scala-js community

* Fix scalac compiler settings to be additive in CommonSettings.settings

* Remove BCryptoTest
2021-03-03 16:52:03 -06:00
Chris Stewart
1959495cec Add testkit-core module (#2726)
* Refactor AsyncUtil to just use an execution context rather than an actor system

* Create testkit-core, start moving data structures over to testkit-core

* WIP, getting rid of the hard dependency on BitcoinSAsyncTest and akka

* Rework test traits to not be dependnent on akka, move BaseAsyncTest into testkitCore, add a test trait that just uses the default scala executionContext

* Get everything compiling

* Move logback-test.xml to testkit-core so it applies to coreTest,cryptoTest as well

* Cleanup rebase issues

* Fix Deps.scala

* Address ben's code review

* Segregate jvm settings and compiler settings

* Filter out -Xfatal-warning for scalajs for now since there is a ton of errors

* Move maintainer settings into CommonSettings.settings
2021-03-02 07:05:21 -06:00
Chris Stewart
5ba7b553b0 2021 02 27 dersignatureutil mv (#2730)
* Move CryptoParams to shared crypto project, make BouncyCastleCryptoParams for bouncy castle specific things

* Rework build structure to work better with scalajs

* Add unit test to make sure CryptoParams & BouncyCastleCryptoParams are consistent
2021-02-28 07:09:22 -06:00
rorp
c90f318fd7 Refactor crypto module to be compatible with Scala.js part 1 (#2719)
* Refactor crypto module to be compatible with Scala.js

* more changes

* some more changes

* abstract out Schnorr stuff

* abstract out adapter stuff

* cleanup

* some more cleanup

* fix build

* Removed references to ECPoint outside of .jvm scope

* remove references to ECPoint from the shared code

* cleanup

* remove cirlular dependencies

* more cleanup

* cleanup

* move SipHash to CryptoContext

* scaladoc

* scalafmt

Co-authored-by: nkohen <nadavk25@gmail.com>
2021-02-27 05:58:20 -06:00
Chris Stewart
a0476e979a Decrease false positive rate to avoid spurious CI failures (#2698) 2021-02-20 13:50:05 -06:00
benthecarman
b30fdf88ca Fix normalized string comparison (#2695)
* Fix normalized string comparison

* Add test
2021-02-19 12:09:55 -06:00
saguywalker
d1cc5e0ade Refactor HDCoinType to be ADT (#2657) 2021-02-12 09:53:43 -06:00
Aris
f8694eb097 Fix/typos (#2633)
* Fix typos

* Collection minor fixes

Removes redundant .headOption on options
Replaces .exists(_ == ???) with .contains(???)
Replaces option == None with option.isEmpty
2021-02-07 15:00:25 -06:00
Chris Stewart
097fa24e58 Create ScriptFactory.isValidAsm() to standardize how check validity o… (#2629)
* Create ScriptFactory.isValidAsm() to standardize how check validity of a script

* Fix compile

* Fix docs
2021-02-06 08:43:17 -06:00
Chris Stewart
ea75d62571 Add number cache trait, use it in all number types (u8,u32,etc) and S… (#2627) 2021-02-05 17:59:48 -06:00
Nadav Kohen
e417ac94a4 Re-wrote CETCalculator.splitIntoRanges (#2621)
Added some docs

Responded to review
2021-02-05 13:24:24 -06:00
Chris Stewart
8f958bf5d9 Update scalafmt (#2619) 2021-02-03 16:37:12 -06:00
Chris Stewart
ae6c25e2b5 Fix compiler warning (#2609) 2021-02-02 11:45:11 -06:00
Nadav Kohen
93f33d26b6 Update dlc before release (#2543)
* Pulled down DLC data structure work

* Responded to Ben's review

* Gave Vector types names

* Pulled down Chris' work
2021-02-02 08:14:24 -06:00
benthecarman
33245b500e Bech32 address improvements (#2571)
* Bech32 address improvements

* Respond to review
2021-01-27 13:22:17 -06:00
rorp
05e21b1200 Bump Eclair version (#2405)
* Bump Eclair version

* cleanup

* Bump JVM version for CI

* Update docs

* Fix docs
2021-01-22 10:47:19 -06:00
benthecarman
523f1098fc Implement OracleAttestmentV0TLV, save outcome to db (#2516)
* Implement oracleAttestmentV0TLV, save outcome to db

* Update with tlv changes

* Update tlv to not have 2 list sizes

* small change

* Update OracleEvent.verifyAttestations

* Use correct pub key

* Verify correct outcomes
2021-01-22 09:45:45 -06:00
benthecarman
6b441631f3 Limit bech32 addresses to segwitv0 (#2471)
* Limit bech32 addresses to segwitv0

* extend ScriptFactory, make check exhuastive
2021-01-07 08:13:31 -06:00
Nadav Kohen
20af4a3cda OutcomePayoutPoint now has the correct types and deffers rounding due to extra_precision in serialized points (#2441) 2020-12-29 13:55:39 -06:00
Nadav Kohen
e1422ddbc2 Fixed Low R signing (#2408)
* Fixed Low R signing and added a test

* Made separate test for comparing bitcoin-s and bitcoind

* Fixed PSBTUnitTest
2020-12-21 14:50:34 -06:00
Chris Stewart
d204056ad8 2020 12 19 enable test compileropts (#2400)
* Fix bug where test compiler opts were not enabled

* Fix all exsting compiler warnings in test project

* Add scalaCollectionCompat dependency to bitcoindRpcTest so we can use @nowarn annotation on scala 2.12
2020-12-20 07:09:07 -06:00
Chris Stewart
5a67220738 Ignore DLCPayoutCurveTest until issue 2369 is resolved (#2388) 2020-12-17 16:10:05 -06:00
Nadav Kohen
f7fdca3e22 DLC Data Structures on Master Cleanup (#2375)
* Moved dlc data structures from commons to core

* Renamed DLC payout curve classes

* Split OutcomeValuePoint up into an ADT

* Added utility for computing Schnorr multiple-signature points

* Replaced tuples in RoundingIntervals with types

* Replaced tuples in DLCPayoutCurve with Indexed

* Fixed a compile bug
2020-12-17 09:09:57 -06:00
Ben Carman
3a7cded566 Require CJDNS starts with 0xFC (#2356) 2020-12-15 14:18:52 -06:00
Nadav Kohen
b7ffea2525 Pulled down work from adaptor-dlc onto master (#2339)
* Pulled down work from adaptor-dlc onto master

* Reverted some accidental deletions

* Removed unused import

* Added scaladocs

* Responded to Ben's review

* Added some scaladocs and invariants

* Responded to chris' review

* Responded to more review

* Added some comments
2020-12-11 17:32:35 -06:00
Ben Carman
8cdddfecde Implement BIP 155 addrv2 messages (#2321)
* Implement BIP 155 addrv2 messages

* Add unit tests
2020-12-06 08:07:57 -06:00
Chris Stewart
f586e25699 Get Scala 2.13.4 compiling (#2294)
* Get Scala 2.13.4 compiling

* Fix broken test case, in general use if() else() statements for Vectors rather than pattern match as I am unsure of how to correctly pattern match on Vector0,Vector1,...,Vector6()

* Bump CI to 2.13.4

* OVerride CurrencyUnit.equals() so that it works on Scala 2.13.4, not sure why there was a regression here between Scala versions 2.13.4/2.13.3

* Add explicit unit tests making sure bitcoin/satoshi currency units are equivalent
2020-11-28 07:36:07 -06:00
Chris Stewart
ad09d1a3df Move english word list to be represented by a Vector in memory (#2287)
* Move english word list to be represented by a Vector in memory

* rename to EnglishWordsBip39
2020-11-23 10:27:22 -06:00
Chris Stewart
a8b1945408 Add helper OracleEventTLVV0.maturation method (#2267) 2020-11-17 06:18:32 -06:00
Ben Carman
7ac9cd1525 Use New Oracle TLVs in DLCOracle (#2162)
* Update Oracle to use new TLVs

* Rename things to use new names, scaladoc, small clean ups

* Add descomposition tests, docs, sign numbers outside of range
2020-11-10 06:08:43 -06:00
Ben Carman
c167bc04a0 Analyze PSBT function (#2240)
* Analyze PSBT function

* Add to tests

* Add docs

* Add more functions

* Fix compile issues

* Fix compile issue
2020-11-09 15:15:32 -06:00
Ben Carman
fcf0c842ad Update Oracle TLVs (#2185)
* Update Oracle TLVs

* Change string size to be BigSizeUInt

* Move nonces to oracle event tlv

* Introduced EventDescriptor tests and NumericEventDescriptor methods to query possible outcome data

* Added contains function

* Added tests for containsToPrecision

* Remove EventDescriptor.outcomes and other related fields

* remove unused formatNum method

* Address code review from Ben

* Move oracle pub key to announcement

Co-authored-by: nkohen <nadavk25@gmail.com>
Co-authored-by: christewart <stewart.chris1234@gmail.com>
2020-11-07 16:26:21 -06:00
Ben Carman
685d5b0273 Let wallet sign PSBTs (#2236)
* Let wallet sign PSBTs

* Add example to docs

* Add logs and test case
2020-11-07 09:25:59 -06:00
Chris Stewart
581d46c2c8 2020 11 02 cleanup (#2233)
* Cleanup a bunch of imports in test

* Use @nowarn annotation for testing things that are deprecated

* Fix base58 test

* Cleanup crypto-test

* Use scala collection compat dependency to get access to the @nowarn annotation on scala 2.12.x

* Rework more scala 2.13.x compile failures in chain-test and key-manager-test

* Optimize imports for entire project

* Fix nits
2020-11-03 11:07:04 -06:00
Nadav Kohen
3cf6d3cb0a Fixed P2SH(Segwit) bug and brought down DLC-used PSBT functionality (#2140)
* Fixed P2SH(Segwit) bug and allowed redeem scripts when calling addFinalizedScriptWitnessToInput

* Add test

Co-authored-by: Ben Carman <benthecarman@live.com>
2020-10-24 18:06:46 -05:00
Ben Carman
913f705167 Add address descriptors (#2176) 2020-10-13 06:14:11 -05:00