Skip to content

Instantly share code, notes, and snippets.

@s-ben
Created September 5, 2019 03:28
Show Gist options
  • Save s-ben/40fca92ca237232daaa2adffcb53ddc1 to your computer and use it in GitHub Desktop.
Save s-ben/40fca92ca237232daaa2adffcb53ddc1 to your computer and use it in GitHub Desktop.
Bug fixed in cpuminer in which logic incrementing the extra nonce field could enter an infinite loop. This bug has never been triggered in practice because the code in question has never been used with difficulties where a solution exists within the regular nonce space.
https://github.com/decred/dcrd/pull/1865
Typo fixes, improved error messages, code cleanup (e.g. remove unused error return value,
https://github.com/decred/dcrd/pull/1859
gcs: Correct zero hash filter matches.
https://github.com/decred/dcrd/pull/1857
This ensures filters properly match search items which happen to hash to zero and adds a test for the condition. While here, it also rewrites the MatchAny function to make it easier to reason about.
This was discovered by the new tests which intentionally added tests with a high false positive rate and random keys.
gcs: Add tests for bit reader/writer.
https://github.com/decred/dcrd/pull/1855
gcs: Standardize serialization on a single format
API for working with filters simplified by standardizing on a single serialization format for all filter versions.
gcs: Optimize Hash
https://github.com/decred/dcrd/pull/1853
The Hash method of bus filters was optimized by making use of the new zero-alloc function available in crypto/blake256. A benchmark function was added to measure performance of the BenchmarkHash function.
gcs: Support independent fp rate and bin size
https://github.com/decred/dcrd/pull/1854
Modifications made to support independent false positive rate and Golomb coding bin size. Among other things, this permits more optimal parameters for minimizing the filter size to be specified. This capability will be used in the upcoming version 2 filters that will ultimately be included in header commitments. {SB: PR also has benchmark results if we want to mention them}
https://github.com/decred/dcrd/pull/1849
connmgr: add TorLookupIPContext, deprecate TorLookupIP
no description….seems like a privacy enhancement…
gcs: Add filter version support.
https://github.com/decred/dcrd/pull/1848
“This refactors the primary gcs filter logic into an internal struct with a version parameter in in order to pave the way for supporting v2 filters which will have a different serialization that makes them incompatible with v1 filters while still retaining the ability to work with v1 filters in the interim.
The exported type is renamed to FilterV1 and the new internal struct is embedded so its methods are externally available.”
gcs: Make error consistent with rest of codebase
https://github.com/decred/dcrd/pull/1846
“This updates the error handling in the gcs package to be consistent with the rest of the code base to provide a proper error type and error codes that can be programmatically detected.
This is part of the ongoing process to cleanup and improve the gcs module to the quality level required by consensus code for ultimate inclusion in header commitments.”
blockchain/standalone: Implement a new module
https://github.com/decred/dcrd/pull/1808
“This implements a new module named blockchain/standalone which aims to provide several of the standalone functions currently available in blockchain and ultimately replace them in the next major version.
The primary goal of offering these functions via a separate module is to reduce the required dependencies to a minimum as compared to the blockchain module. It will be ideal for applications such as lightweight clients that need to ensure basic security properties hold and calculate appropriate vote subsidies and block explorers.
For example, some things an SPV wallet needs to prove are that the block headers all connect together, that they satisfy the proof of work requirements, and that a given transaction tree is valid for a given header.
The new module currently only provides functions related to proof of work, however, future commits will provide functions for merkle root calculation, subsidy calculation, and coinbase transaction identification. It is being done in stages to help ease review since it is consensus critical code.
It will not be released until the remaining functions have been implemented.
Finally, it also includes comprehensive tests, full package documentation, and basic usage examples.”
blockchain/standalone: Add merkle root calc funcs.
https://github.com/decred/dcrd/pull/1809
“This adds functions to calculate a merkle root to the blockchain/standalone module. Rather than copying the existing functions from blockchain, it introduces new optimized functions that have simpler code and are also generally easier to use.
The new functions simply return the calculated root instead of all of the intermediate hashes which no known callers were actually using anyway.
It also adds a basic usage example, benchmarks, updates the documentation and includes comprehensive tests.
As can be seen by the benchmarks below, the new code isn't significantly faster in terms of execution speed since it is still dominated by the actual hashing, however, it does significantly reduce the number of allocations which reduces pressure on the GC, particularly during bursty situations such as IBD. It also scales much better to larger numbers of transactions.”
crypto/blake256: Add module with zero alloc funcs
https://github.com/decred/dcrd/pull/1811
“Copy the Blake256 implementation at github.com/teknico/blake256 (fork of github.com/dchest/blake256) into the crypto/blake256 module, so that dcrd does not have an external dependency anymore for Blake256.”
chaincfg/chainhash: avoid allocations in calls to blake256
https://github.com/decred/dcrd/issues/1810
related to above: “change the dcrd chainhash package to use such an API, similarly to what btcsuite already does.”
blockchain/standalone: Add subsidy calc funcs
https://github.com/decred/dcrd/pull/1812
new standalone module use..“This adds a subsidy cache with funcs to calculate subsidies for proof-of-work, votes, and the treasury to the blockchain/standalone module. Since the existing functions in blockchain are easy to use improperly and have poor performance under certain access patterns, rather than copying them over, this provide new implementations of better optimized functions with less potential cases for misuse…….”
chaincfg: Add subsidy params accessor funcs.
https://github.com/decred/dcrd/pull/1813
“This defines several new functions on the Params struct which return some subsidy-related parameters…
This will allow the parameters to be used directly as input to an interface in the future.
The new functions are:…..”
blockchain/standalone: Add IsCoinBaseTx.
https://github.com/decred/dcrd/pull/1815
“The copies the standalone IsCoinBaseTx function from the blockchain module to the blockchain/standalone module.
It also updates the documentation and includes comprehensive tests.”
blockchain: Use standalone module.
https://github.com/decred/dcrd/pull/1816
“This updates blockchain to make use of the new blockchain/standalone module. It consists of four commits split into related updates to ease the review process since this is consensus critical code.”
multi: Use crypto/blake256
https://github.com/decred/dcrd/pull/1818
“Use the local crypto/blake256 module instead of github.com/dchest/blake256:”
stake: Check minimum req outputs for votes earlier. (optimization)
https://github.com/decred/dcrd/pull/1819
optimization reported by aarcamp, fixed by davecgh “There is no reason to perform a bunch of additional checks when there is no possible way a transaction can be vote due to not having at least the minimum required number of outputs for it to possibly be one.”
blockchain v1.2.0 refers to release of a major version of the blockchain module…
main: Consume latest module minors and patches.
https://github.com/decred/dcrd/pull/1822
“This updates the main module to use the latest available minor and patch versions of all modules and reverts the recent change that incorrectly removed all of the blake256 references from the various go.sum files.”
database: Separate dbs for concurrent db tests.
https://github.com/decred/dcrd/pull/1824
“This updates v2 test database names to avoid conflicts when multiple database modules are being tested concurrently, continues the work started by #1806.”
blockchain: Implement stricter bounds checking. (optimization)
https://github.com/decred/dcrd/pull/1825
updates deserialization logic in a function….another optimization by aarcamp
mining: Prepare v1.1.1.
https://github.com/decred/dcrd/pull/1826
“This updates the mining module dependencies and serves as a base for mining/v1.1.1.”
connmgr: Prepare v1.1.0.
https://github.com/decred/dcrd/pull/1828
“This updates the mining module dependencies and serves as a base for connmgr/v1.1.0.”
peer: Prepare v1.2.0
https://github.com/decred/dcrd/pull/1830
“This updates the peer module dependencies and serves as a base for peer/v1.2.0.”
mining: Introduce v2 module.
https://github.com/decred/dcrd/pull/1831
“In order to make use of blockchain/v2, blockchain/stake/v2, and dcrutil/v2, a new major version of the mining module is required because mining/v1 accepts and returns types from all of them in its API.
Consequently, this introduces mining/v2. A series of ”
mempool: Prepare v2.1.0
https://github.com/decred/dcrd/pull/1832
This updates the mempool module dependencies and serves as a base for mempool/v2.1.0.”
connmgr: Introduce v2 module.
https://github.com/decred/dcrd/pull/1833
“In order to make use of chaincfg/v2, a new major version of the connmgr module is required because connmgr/v1 accepts and returns types from chaincfg/v1 in its API.
Since a new major version is required, this also takes the opportunity to remove the tight coupling to chaincfg, by removing the sole reference to *chaincfg.Params in its API.”
peer: Introduce v2 module.
https://github.com/decred/dcrd/pull/1834
“In order to make use of chaincfg/v2 and blockchain/v2, a new major version of the peer module is required because peer/v1 accepts and returns types from both chaincfg/v1 and blockchain/v1 in its API.
Since a new major version is required, this also takes the opportunity to remove the tight coupling to both chaincfg and blockchain as follows:”
mempool: Introduce v3 module.
https://github.com/decred/dcrd/pull/1835
“In order to make use of blockchain/stake/v2, blockchain/standalone, blockchain/v2, chaincfg/v2, dcrutil/v2, mining/v2, and txscript/v2 a new major version of the mempool module is required because mempool/v2 accepts and returns types from all of them in its API.
Consequently, this introduces mempool/v3. A series of”
blockchain: Prepare v2.0.1.
https://github.com/decred/dcrd/pull/1836
“This removes the examples that rely on removed code in the blockchain/v2 module and serves as a base for blockchain/v2.0.1.”
main: Update to use all new major module versions.
https://github.com/decred/dcrd/pull/1837
“This updates all code in the main module to use the latest major modules versions to pull in the latest updates.”
gcs: Start v2 module dev cycle
https://github.com/decred/dcrd/pull/1843
“This removes the unused and undesired FromPBytes and FromNPBytes functions and associated tests from the gcs module in preparation for upcoming changes aimed to support new version filters for use in header commitments.”
gcs: Support empty filters
https://github.com/decred/dcrd/pull/1844
“This adds support for empty filters versus being an error along with a full set of tests to ensure the empty filter works as intended.
It is part of the onging process to cleanup and improve the gcs module to the quality level required by consensus code for ultimate inclusion in header commitments.”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment