Commit Graph

104 Commits

Author SHA1 Message Date
Nadav Kohen
911541cf52 Made ScriptPubKey and ScriptSignature toStrings nicer (#859) 2019-11-18 11:12:38 -06:00
Nadav Kohen
fb2188b7d8 OP_NOTIF ScriptPubKey and Signing (#858)
* Implemented OP_NOTIF

* Responded to code review

* Fixed test bug for sampling
2019-11-18 10:45:33 -06:00
Nadav Kohen
fad72c66d5 Increase some Test Coverage (#866)
* Added ScriptTypeTest

* Added ScriptSignature coverage

* Added Signer test coverage

* Added test coverage for UTXOSpendingInfo

* Responded to code review
2019-11-15 12:21:52 -06:00
Nadav Kohen
609f7e6ad6 ScriptInterpreter Conditional Refactor (#855)
* Redid conditional interpreting without binary trees

* Fixed ControlOperationsInterpreterTest

* Implemented O(1) conditional handling as proposed here https://github.com/bitcoin/bitcoin/pull/16902 because Ben Carman pointed it out

* Added some docs

* Responded to code review
2019-11-08 13:19:53 -06:00
Nadav Kohen
f2081dfa46 OP_IF Signing (#827)
* Introduced ConditionalScriptPubKey

Some more progress

Added Conditional signing infrastracture, tests do not pass and there are no Conditional tests

Fixed tests!

* Redid calcLockTime and calcSequenceForInputs in TxBuilder (added Conditional support)

* Added ScriptGenerators for Conditional scripts, only one test to go!

* Fixed CLTV(Empty) tests

* Responded to code review

* responded to code review

* ScriptSignature only types Policy-compliant script signatures

* Fixed md doc
2019-11-05 18:48:50 -06:00
Nadav Kohen
4a3677c009 RawScriptPubKey (#843)
* Introduced RawScriptPubKey type

* Responded to code review
2019-10-31 18:34:48 -05:00
Nadav Kohen
40ebc8e53e Replace scriptPubKeyToSatisfy with spendingInfoToSatisfy in Signer (#842)
* Replace scriptPubKeyToSatisfy with spendingInfoToSatisfy and made UTXOSpendingInfo ADT nicer

Tightened up types on Signer with a type parameter

Factored out common functionality in Signer

Responded to code review

* More review
2019-10-31 12:17:30 -05:00
Nadav Kohen
0c2bdafdf0 GCSTest fix (#845)
* Raised the min p value in GCSTest to avoid large x/2^p values which cause long unary to happen

* Lowered upper bound to 50
2019-10-31 06:21:23 -05:00
Nadav Kohen
ec7bd7f51d Removed the ScriptProgram companion object (#811) 2019-10-23 10:12:41 -05:00
Ben Carman
92f8fd96a0 Refactor old test cases to use BitcoinSUnitTest (#814) 2019-10-20 02:35:03 -05:00
Chris Stewart
62bb36928e Update script_tests.json, fix bugs that were unveiled with that updat… (#799)
* Update script_tests.json, fix bugs that were unveiled with that update. Specifically around handling negative zero in Script, and cleanstack behavior for segwit scripts. We were not checking for equality at the byte level for negative zero. With cleanstack, we were failing the script, but not failing with the correct error. If you look at interpreter.cpp in bitcoin core, cleanstack check is done before checking if the stacktop is true or false

* Address code review
2019-10-15 09:57:47 -05:00
rorp
6d050602ce Increase test coverage (#810)
* Increase test coverage

* more coverage
2019-10-14 19:54:34 -05:00
Ben Carman
9d16d723ae Script Program apply method refactor part 5 (#760) (#801)
* Script Program apply method refactor part 5 (#760)

* Formatting
2019-10-13 13:20:03 -05:00
Ben Carman
f475808dbd Script Program apply method refactor part 7 (#760) (#804) 2019-10-13 09:17:28 -05:00
Ben Carman
e7ce9cd157 Script Program apply method refactor part 6 (#760) (#802) 2019-10-13 09:09:56 -05:00
Ben Carman
7641c2b73f Script Program apply method refactor part 3 (#760) (#795)
* Script Program apply method refactor part 3 (#760)

* Remove unsused method

* Documentation

* Fix test case
2019-10-12 11:09:37 -05:00
rorp
82e6c36493 Make ChainApi to scan the block filters in order to find matches (#786)
* Make ChainApi to scan the block filters in order to find matches

* performance improvements, unit test

* some parallelization

* addressed comments

* parallelism level

* fix parallelism computation

* Scala 2.11 compatibility

* increased test coverage

* cleanup

* more checks and cleanup

* change ChainApi.getMatchingBlocks signature

* some more changes
2019-10-11 14:19:42 -05:00
Nadav Kohen
8e40c0e9d0 2019 10 01 script program cleanup (#791)
* Tightened up types, only allowing ExecutionInProgressScriptPrograms to be executed in Script OPs and having output type that cannot be PreExecutionScriptProgram

* Fixed all tests!

* Replaced all calls to loop and loopOrComplete with a single one at the bottom to retain the tailrec property

* Added a couple docs
2019-10-08 12:28:58 -05:00
Chris Stewart
00eafd9970 Use the fact that network headers specify the number of bytes in the … (#783)
* Use the fact that network headers specify the number of bytes in the payload rather than just parsing from bytes.size, this should allow us to be more precise when parsing NetworkPayloads rather than _hoping_ that bytes.size does not land on pseudo-valid NetworkPayload. This hopefully resolves #782

* Add safety check around HeadersMessage.toString()

* Add invariant to NetworkMessage saying payloadSize in header must be the actual payload size
2019-10-06 09:48:53 -05:00
Chris Stewart
e819baf0dd Reduce GCSTest by more, remove unused warnings when using scala console from sbt (#779) 2019-10-03 09:46:43 -05:00
Chris Stewart
eefbc37a81 2019 09 28 common test trait (#767)
* Create base traits for async tests called BaseAsyncTest, and then create two subtypes, BitcoinSAsyncTest and BitcoinSAsyncFixtureTest to make it easier to manage resources related to test cases. Now it is easier to shutdown things like an actor system in a structured manner

* Remove two bitcoind tests that don't make sense, 'duration' in the parameter is _really_ an interval (bad naming by usTesting an interval does not make sense inside of TestRpcUtilTest

* Turn log off for ChainAppConfigTest we expect to fail

* Bump timeout for BitcoinSUnitTest, use builtint sbt scalafmtCheck

* Remove hardcoded scalafmt binary

* reduce generator size to attempt to fix #768
2019-09-30 14:55:25 -05:00
rorp
74a44d1c4d Initial BIP157 support (#695)
* WIP: Initial BIP157 support

* store block hash and hetgh along with its compact filter header

* download and parse block filters

* getcfilters/cfilter

* cfilter table

* rescan full filter chain

* improved rescan performance

* optimize compact headers download

* addressed the PR comments

* split SVP and Neutrino node implementations

* configurable filter batch sizes

* initial filter sync

* addressed comments

* chage filter table's primary key

* fix Golomb filter deserialization

* batch database inserts

* neutrino node test

* fixed node test

* addressed the PR comments

* serializers tests

* cleanup

* fix compilation errors

* fix unit tests

* increase test coverage

* enable NeutrinoNodeTest

* make scalafmt happy

* don't cache experimental binaries

* inclease test coverage

* fix unit tests

* more granular CI tests

* disable NeutrinoNodeTest

* refactor tests

* addressed comments

* test coveage

* fix formatting

* responded to the comments

* some more changes

* fix the build

* test coverage

* revert testnet3 config parameter

* minor changes

* cleanup
2019-09-25 13:18:51 -05:00
Chris Stewart
67ead0bc7e 2019 09 05 scalafmt update (#735)
* Update scalafmt to 2.0.1

* Scalafmt

In this commit we
1) Reconfigure the .scalafmt.conf file
2) Add a scalafmt binary (same version as specified in conf file)
3) Use said binary on CI to check that everything is formatted correctly

* Ran scalafmt

* Update scalafmt ignore

* Add scalafmt plugin to project/plugins.sbt, run it

* run scalafmt
2019-09-05 20:02:58 -05:00
Torkel Rogstad
5e9b26bbab Remove untyped CryptoUtil methods (#722)
Types are our friends:-)
2019-08-27 06:32:50 -05:00
Torkel Rogstad
c2f37335b8 Bump Scala versions (#697)
* Bump Scala versions

Support Scala 2.12.9
and 2.13.0.

To make this easier, we delete the `scripts` project. Everything
that was in here was covered by content on the website. We also
delete the `doc` folder, as that was a remnant from when `scripts`
was called `doc`.

* Crib uPickle akka-http support while we wait for publish

* Fix compiler warnings

* Add note on test logging to contribution guide

* Reduce duplication in Blockchain implementation

* Use Scala 2.12 for website

* Introduce compat package object for collections converters

* Fix Either compiler warnings

* Add sync-chain and create-wallet docs from deleted scripts

* Fix rebase goofup
2019-08-23 13:53:00 -05:00
Torkel Rogstad
2f5d4db1b2 Bump test coverage (#713)
* Bump test coverage

* Lower test coverage requirement for chain
2019-08-23 18:32:55 +02:00
Torkel Rogstad
a76f61f97c Add configurable logging to data directory (#640)
* Add logging to data directory

In this commit we add the ability for the node, chain
and wallet projects (+ the server) to log to the users
data directory instead of whatever directory the
binaries was launched from. This is inherently a bit
more complicated than our previous setup, because
we need to read the user directory before we can create
loggers. As a result of this, some files/methods were
moved around, so the relevant app config could be
found in scope.

We also  introduce several logging categories that can be
tuned individually through user configuration. These logggers
are exposed both as traits that give a field `logger`, or
as methods that return the required logger.

* Add datadir configuration to AppConfig

In this commit we add support for AppConfig to pick up
the data directory configuration file. We also add
a section to the contributing guide on how to tune
logging levels.

* Pass data directories explicitly for configuration
2019-08-01 06:01:56 -05:00
cwaldron97
7183296b6b Killing Joda Dependency (#643)
Remove Joda dependency
2019-07-29 12:22:25 +02:00
Torkel Rogstad
c64f143628 Fix merkle block parsing error 2019-07-19 10:49:34 +02:00
Torkel Rogstad
245a77b3db Merge pull request #637 from cwaldron97/2019-07-16-remove-bitcoinj-dep
Remove BitcoinJ from dependencies
2019-07-18 11:01:19 +02:00
cwaldron97
ab29c0cc8f more removal 2019-07-17 14:47:45 -05:00
cwaldron97
87f6300082 started to remove bitcoinj deps 2019-07-16 15:12:38 -05:00
Torkel Rogstad
6c2789135e Add more type identifiers
In this commit we add type identifers for P2P
messages we hadn't previously implemented. Note
that these aren't used anywhere yet.
2019-07-12 11:04:15 +02:00
Torkel Rogstad
a71aecec52 Process outgoing transactions (#555)
* Split wallet functionality into multiple traits

In this commit we refactor LockedWallet into multiple traits
that provide functionality related to a subset of total wallet
functionality. This has the benefit of making it clear which
methods are helper methods that are only intended to be used
in a very specific setting, and which methods are part of the
internal wallet API that other parts of the wallet can use.

* Rework TransactionOutput and TransactionOutPoint to case classes

* Add extension methods for flattening lists of assertions

* Segregate confirmed and unconfirmed balance methods

* Add test for FutureUtil.sequentially

* Add trace logging of balance fetching

* Process outgoing TXOs

Move TX processing into separate trait, add internal API method

Unify DB representation of TXOs

    Prior to this commit we stored TXO information
    across diferent tables, with joins and tuples
    needed a bunch of places to keep track of
    everything we needed. In this commit we unify
    the tables, leaving us with only one table for
    TXOs.
2019-07-09 06:25:24 -05:00
rorp
d74a0560b8 [WIP] New Eclair RPC client (#535)
* [WIP] New Eclair RPC client

* channel, close, connect, getinfo, open, peers

* allchannels, allnodes, allupdates

* audit, channels, findroutetonode, forceclose, updaterelayfee

* Initial version of createinvoice

* ShortChannelId: improved error handling and scaladoc

* addressed the PR comments

* parseinvoice, payinvoice, getsentinfo, getreceivedinfo, sendtonode, sendtoroute

* unit tests

* addressed the PR comments

* ws, usablebalances, channelstats, networkfees, getinvoice, listinvoices

* addressed PR comments

* change eclair URL

* cleanup

* addressed comments

* fidex compiler warnings

* Eclair 0.3.1

* scaladoc

* cleanup
2019-07-03 13:38:56 -05:00
Chris Stewart
243e6cb65b Add case for empty bloom filter (#561) 2019-07-02 10:39:22 -05:00
Torkel Rogstad
6ffd505946 Add sampleSome method to scalacheck.Gen 2019-06-27 15:29:21 +02:00
Torkel Rogstad
0f5669bac3 Rename HDCHain.toAddress 2019-06-27 15:28:08 +02:00
Torkel Rogstad
75bf52a431 Add toAddress on HDChain 2019-06-27 15:28:08 +02:00
Torkel Rogstad
db1987b36a Merge pull request #546 from torkelrogstad/2019-06-21-aes-cfb
Use key based encryption in AesCrypt
2019-06-27 12:16:53 +02:00
Torkel Rogstad
da9fa4d385 Move util function into test where it's used' 2019-06-27 11:22:02 +02:00
Torkel Rogstad
66524f8c43 Respond to code review from Chris 2019-06-26 17:24:50 +02:00
Torkel Rogstad
bac49ec1d8 Add more tests to AesCryptTest, fix doc string 2019-06-25 18:55:22 +02:00
Torkel Rogstad
161db9ff92 Add toBase64/fromBase64 to AesEncryptedData 2019-06-25 11:39:17 +02:00
cwaldron97
4345ddbb1e fixed compiler errors 2019-06-24 15:50:51 -05:00
cwaldron97
a457717eb4 scalafmt 2019-06-24 14:12:47 -05:00
Torkel Rogstad
77d056e5fa Add REPL.it link to AesCryptTest 2019-06-24 17:37:03 +02:00
Torkel Rogstad
d58f3dc715 Update AesCrypt to work with keys
In this commit we update our AesCrypt
functionality to work with AES keys rather
than passphrases that are extended to keys.
This makes it easier to integrate with other
languages, as the key stretching introduces
a bunch of additional parameters to the
actual AES encryption.

We also include tests that verify that we're
able to encrypt/decrypt using Bitcoin-S,
Crypto-JS (JavaScript), pycrypto (Python)
and OpenSSL CLI.
2019-06-24 17:21:41 +02:00
cwaldron97
5ccc025f2e added .map to have SipHashKey Constructor 2019-06-21 17:08:33 -05:00
cwaldron97
0e97ff6ed4 fixed GCSTest file 2019-06-21 16:53:41 -05:00