Commit Graph

33 Commits

Author SHA1 Message Date
David Hill
5fc31ca578 multi: fix misspell linter warnings 2018-02-18 12:26:52 -06:00
David Hill
a261760b9b travis: test in docker container 2018-02-18 10:27:18 -06:00
David Hill
3a78a1086d travis: drop docker 2018-02-16 22:06:22 -06:00
Donald Adu-Poku
2be3bf6639 sec256k1: update func signatures.
funcs implicitly use the sec256k1 curve instead of passing it as a
param.
2017-12-21 19:38:42 -06:00
David Hill
fc31a0b39e multi: remove unused funcs and vars 2017-12-07 21:46:25 -06:00
David Hill
b13f5dfbda travis: add ineffassign linter 2017-12-01 09:14:04 -05:00
David Hill
20686cd775 travis: add gosimple linter 2017-11-20 18:49:55 -06:00
Donald Adu-Poku
3b65c66d21 dcrec: remove testify dependency. 2017-08-30 22:11:21 +00:00
Donald Adu-Poku
093a098da5 dcrec: use hardcoded datasets in tests. 2017-08-21 13:35:52 -05:00
Josh Rickmar
d4f245afdf Fix and regenerate precomputed secp256k1 curve.
This regenerates the precomputed secp256k1 byte points used to
optimize scalar multiplication. This should have been done as part of
the normalization correction.

Additionally, the generator has been updated for Decred's package
layout and should resolve any issues vendoring dcrd through dep.
2017-08-18 14:09:28 -04:00
Dave Collins
1d3c6008d5
secp256k1: Add regression tests for field.go.
This contains upstream commits:
- a52eb04aaa
  - This has already been previously applied so is a NOOP other than a
    couple of comment updates.
- 294b5d46da
2017-08-01 23:22:13 -05:00
David Hill
a9234850e7 remove deadcode 2017-07-17 15:06:47 -05:00
Dave Collins
e2b74d501c
multi: Update markdown files for GFM changes.
The github markdown interpreter has been changed such that it no longer
allows spaces in between the brackets and parenthesis of links and now
requires a newline in between anchors and other formatting.  This
updates all of the markdown files accordingly.

While here, it also corrects a couple of inconsistencies in some of the
README.md files and correct some previous merge conflicts.
2017-07-16 15:33:12 -05:00
David Hill
2ffbad1e88 chainstate only needs the previous block hash
... not the entire block header.
2017-06-21 12:13:30 -04:00
Jimmy Song
4bb55eb338 secp256k1: Slightly optimize NAF and add several tests.
This slightly optimizes the NAF function by avoiding returning the
unused bit when there is not a carry.

It also adds a bunch of additional unit tests which I made while
debugging.
2017-06-09 14:00:17 -05:00
Dave Collins
2145f8e57b
secp256k1: Optimize and correct normalize.
This modifies the normalize function of the internal field value to
both optimize it and address an issue where the reduction could
lead to an incorrect result with a small range of values.  It also adds
tests to ensure the behavior is correct.

The following benchmark shows the relative speedups as a result of the
optimization on my system.  In particular, the changes result in
approximately a 14% speedup in Normalize, which ultimately translates to
a 2% speedup in signature verifies.

benchmark                        old ns/op     new ns/op     delta
--------------------------------------------------------------------
BenchmarkAddJacobian             1364          1289          -5.50%
BenchmarkAddJacobianNotZOne      3150          3091          -1.87%
BenchmarkScalarBaseMult          134117        132816        -0.97%
BenchmarkScalarBaseMultLarge     135067        132966        -1.56%
BenchmarkScalarMult              411218        402217        -2.19%
BenchmarkSigVerify               671585        657833        -2.05%
BenchmarkFieldNormalize          36.0          31.0          -13.89%
2017-06-08 23:55:26 -05:00
Dave Collins
ccf7a2b3a2
secp256k1: Add benchmark for field normalization. 2017-06-08 23:55:26 -05:00
Dave Collins
32ba1b00f9
secp256k1: Unexport idents that do not need to be.
This unexports various functions, structs, and constants that were
exported for some reason when porting this from the upstream project
when they really should not have been since they deal with package
internals.

While here, correct a few other minor differences that were introduced
between the package and the upstream code and correct a few comments
that appear to have had a blanket find/replace applied to them
incorrectly.
2017-06-08 11:34:52 -05:00
Dave Collins
e6e55b2af0
secp256k1: Consolidate tests into the main package.
Putting the test code in the same package makes it easier for forks
since they don't have to change the import paths as much and it also
gets rid of the need for internal_test.go to bridge.
2017-06-08 01:13:51 -05:00
David Hill
a3083e14ae glide: move to upstream agl/ed25519
set to the version decred/ed25519 had been synced with.
2017-05-31 23:54:37 -05:00
David Hill
6d9c4b360e gometalinter: use --vendor to skip ./vendor/
While here, clean up gosimple and unconvert rules, leaving gosimple
disabled due to API changes between go 1.7 and 1.8.
2017-03-18 14:22:53 -04:00
David Hill
caa57df468 travis: enable gometalinter (#603)
* Hook up gometalinter

* travis: enable unconvert

* travis: enable gosimple
2017-03-08 15:44:15 -05:00
Dave Collins
c162fbde71
multi: Upstream chainhash abstraction sync
Contains the following commits:

- 711f33450c
- b6b1e55d1e
  - Reverted because Travis is already at a more recent version
- bd4e64d1d4

Also, the merge commit contains the necessary decred-specific
alterations, converts all other references to sha to hash to keep with
the spirit of the merged commits, and various other cleanup intended to
bring the code bases more in line with one another.
2016-11-16 12:48:40 -06:00
cjepson
2ce2bddf40 Merge in btcd commit 'f893558d782396f10c2fe49a8bc73deff4a36d14'
Merges in btcd commit f893558d78.
2016-09-23 14:30:16 -04:00
cjepson
02bb5123d6 Merge in btcd commit '3b39edcaa1e867efc4223d95ca1496aaadf8eca3'
Merges in 3b39edcaa1 from btcd.
2016-09-22 15:52:37 -04:00
David Hill
717040c945 Replace fastsha256 with crypto/sha256 (#319) 2016-08-24 11:18:48 -05:00
Dave Collins
b6d426241d blockchain: Rework to use new db interface.
This commit is the first stage of several that are planned to convert
the blockchain package into a concurrent safe package that will
ultimately allow support for multi-peer download and concurrent chain
processing.  The goal is to update btcd proper after each step so it can
take advantage of the enhancements as they are developed.

In addition to the aforementioned benefit, this staged approach has been
chosen since it is absolutely critical to maintain consensus.
Separating the changes into several stages makes it easier for reviewers
to logically follow what is happening and therefore helps prevent
consensus bugs.  Naturally there are significant automated tests to help
prevent consensus issues as well.

The main focus of this stage is to convert the blockchain package to use
the new database interface and implement the chain-related functionality
which it no longer handles.  It also aims to improve efficiency in
various areas by making use of the new database and chain capabilities.

The following is an overview of the chain changes:

- Update to use the new database interface
- Add chain-related functionality that the old database used to handle
  - Main chain structure and state
  - Transaction spend tracking
- Implement a new pruned unspent transaction output (utxo) set
  - Provides efficient direct access to the unspent transaction outputs
  - Uses a domain specific compression algorithm that understands the
    standard transaction scripts in order to significantly compress them
  - Removes reliance on the transaction index and paves the way toward
    eventually enabling block pruning
- Modify the New function to accept a Config struct instead of
  inidividual parameters
- Replace the old TxStore type with a new UtxoViewpoint type that makes
  use of the new pruned utxo set
- Convert code to treat the new UtxoViewpoint as a rolling view that is
  used between connects and disconnects to improve efficiency
- Make best chain state always set when the chain instance is created
  - Remove now unnecessary logic for dealing with unset best state
- Make all exported functions concurrent safe
  - Currently using a single chain state lock as it provides a straight
    forward and easy to review path forward however this can be improved
    with more fine grained locking
- Optimize various cases where full blocks were being loaded when only
  the header is needed to help reduce the I/O load
- Add the ability for callers to get a snapshot of the current best
  chain stats in a concurrent safe fashion
  - Does not block callers while new blocks are being processed
- Make error messages that reference transaction outputs consistently
  use <transaction hash>:<output index>
- Introduce a new AssertError type an convert internal consistency
  checks to use it
- Update tests and examples to reflect the changes
- Add a full suite of tests to ensure correct functionality of the new
  code

The following is an overview of the btcd changes:

- Update to use the new database and chain interfaces
- Temporarily remove all code related to the transaction index
- Temporarily remove all code related to the address index
- Convert all code that uses transaction stores to use the new utxo
  view
- Rework several calls that required the block manager for safe
  concurrency to use the chain package directly now that it is
  concurrent safe
- Change all calls to obtain the best hash to use the new best state
  snapshot capability from the chain package
- Remove workaround for limits on fetching height ranges since the new
  database interface no longer imposes them
- Correct the gettxout RPC handler to return the best chain hash as
  opposed the hash the txout was found in
- Optimize various RPC handlers:
  - Change several of the RPC handlers to use the new chain snapshot
    capability to avoid needlessly loading data
  - Update several handlers to use new functionality to avoid accessing
    the block manager so they are able to return the data without
    blocking when the server is busy processing blocks
  - Update non-verbose getblock to avoid deserialization and
    serialization overhead
  - Update getblockheader to request the block height directly from
    chain and only load the header
  - Update getdifficulty to use the new cached data from chain
  - Update getmininginfo to use the new cached data from chain
  - Update non-verbose getrawtransaction to avoid deserialization and
    serialization overhead
  - Update gettxout to use the new utxo store versus loading
    full transactions using the transaction index

The following is an overview of the utility changes:
- Update addblock to use the new database and chain interfaces
- Update findcheckpoint to use the new database and chain interfaces
- Remove the dropafter utility which is no longer supported

NOTE: The transaction index and address index will be reimplemented in
another commit.
2016-08-18 15:42:18 -04:00
Dave Collins
d3ef588608 multi: Update with result of gofmt -s.
Contains the following upstream commits:
- d4852101d4
  - This commit has already been independently applied so it is mostly a
    NOOP
- f389742b39

In addition, gofmt -s has been run again to simplify the new additions
to Decred and and all simplifications are included in the merge commit.
2016-05-30 12:40:44 -05:00
Dave Collins
2030b4d057 multi: Fix several misspellings in the comments.
Contains the following upstream commits:
- ef9c50be57
- eb882f39f8

In addition to merging the fixes in the commits, this also fixes a few
more misspellings that were introduced in the new Decred code.
2016-05-30 12:24:21 -05:00
Dave Collins
40d778dd2d docs: Make various README.md files consistent.
Upstream commit 3942a116e4

This merge also includes a few Decred specific modifications and
corrects some old btcjson references that should have been updated to
dcrjson.
2016-05-20 16:00:12 -05:00
John C. Vernaleo
14769a741b Resolve all remaining issues caught by goclean.sh 2016-02-15 11:24:00 -05:00
John C. Vernaleo
1954bf24bb Work on improving the use of analysis tools in goclean.sh
Corrected or added many comments.

Update test code to follow format go vet wants.

The code doesn't pass the checks 100% yet.  That will come in a later
commit but these all seemed related so I'd rather get them in now.
2016-02-12 15:24:32 -05:00
John C. Vernaleo
5076a00512 Initial Decred Commit.
Includes work by cjepson, ay-p, jolan, and jcv.

Initial conceptual framework by tacotime.
2016-02-07 14:00:12 -05:00