Currently, the filters provide two different serialization formats per
version. The first is the raw filter bytes without the number of items
in its data set and is implemented by the Bytes and FromBytesV1
functions. The second includes that information and is implemented by
the NBytes and FromNBytesV1 functions.
In practice, the ability to serialize the filter independently from the
number of items in its data set is not very useful since that
information is required to be able to query the filter and, unlike the
other parameters which are fixed (e.g. false positive rate and key), the
number of items varies per filter. For this reason, all usage in
practice calls NBytes and FromNBytesV1.
Consequently, this simplifies the API for working with filters by
standardizing on a single serialization format per filter version which
includes the number of items in its data set.
In order to accomplish this, the current Bytes and FromBytesV1 functions
are removed and the NBytes and FromNBytesV1 functions are renamed to
take their place.
This also updates all tests and callers in the repo accordingly.
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.
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.
The tests and all callers in the repo have been updated accordingly.
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.
This rewrites the tests to make them more consistent with the rest of
the code base and significantly increases their coverage of the code.
It also reworks the benchmarks to actually benchmark what their names
claim, renames them for consistency, and make them more stable by
ensuring the same prng seed is used each run to eliminate variance
introduced by different values.
Finally, it removes an impossible to hit condition from the bit reader
and adds a couple of additional checks to harden the filters against
potential misuse.
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.
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.
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.
Since these changes, and several planned upcoming ones, constitute
breaking pubic API changes, this bumps the major version of the gcs
module, adds a replacement for gcs/v2 to the main module and updates all
other modules to make use of it.
It also bumps the rpcclient module to v5 since it makes use of the
gcs.Filter type in its API, adds a replacement for rpcclient/v5 to the
main module and updates all other modules to make use of it.
Note that this also marks the start of a new approach towards handling
module versioning between release cycles to reduce the maintenance
burden.
The new approach is as follows.
Whenever a new breaking change to a module's API is introduced, the
following will happen:
- Bump the major version in the go.mod of the affected module if not
already done since the last release tag
- Add a replacement to the go.mod in the main module if not already
done since the last release tag
- Update all imports in the repo to use the new major version as
necessary
- Make necessary modifications to allow all other modules to use the
new version in the same commit
- Repeat the process for any other modules the require a new major as a
result of consuming the new major(s)
Finally, once the repo is frozen for software release, all modules will
be tagged in dependency order to stabilize them and all module
replacements will be removed in order to ensure releases are only using
fully tagged and released code.
This discovers the network address(es) of the daemon
through connected outbound peers. The address(es)
discovered are advertised to subsequent connecting peers.
This updates all code in the main module to use the latest major modules
versions to pull in the latest updates.
A more general high level overview of the changes is provided below,
however, there is one semantic change worth calling out independently.
The verifymessage RPC will now return an error when provided with
an address that is not for the current active network and the RPC server
version has been bumped accordingly.
Previously, it would return false which indicated the signature is
invalid, even when the provided signature was actually valid for the
other network. Said behavior was not really incorrect since the
address, signature, and message combination is in fact invalid for the
current active network, however, that result could be somewhat
misleading since a false result could easily be interpreted to mean the
signature is actually invalid altogether which is distinct from the case
of the address being for a different network. Therefore, it is
preferable to explicitly return an error in the case of an address on
the wrong network to cleanly separate these cases.
The following is a high level overview of the changes:
- Replace all calls to removed blockchain merkle root, pow, subsidy, and
coinbase funcs with their standalone module equivalents
- Introduce a new local func named calcTxTreeMerkleRoot that accepts
dcrutil.Tx as before and defers to the new standalone func
- Update block locator handling to match the new signature required by
the peer/v2 module
- Introduce a new local func named chainBlockLocatorToHashes which
performs the necessary conversion
- Update all references to old v1 chaincfg params global instances to
use the new v2 functions
- Modify all cases that parse addresses to provide the now required
current network params
- Include address params with the wsClientFilter
- Replace removed v1 chaincfg constants with local constants
- Create subsidy cache during server init and pass it to the relevant
subsystems
- blockManagerConfig
- BlkTmplGenerator
- rpcServer
- VotingWallet
- Update mining code that creates the block one coinbase transaction to
create the output scripts as defined in the v2 params
- Replace old v2 dcrjson constant references with new types module
- Fix various comment typos
- Update fees module to use the latest major module versions and bump it v2
This udpates the mempool module to use the latest module major versions
as well as the new blockchain/standard module.
The updated direct dependencies are as follows:
- github.com/decred/dcrd/blockchain/stake/v2@v2.0.1
- github.com/decred/dcrd/blockchain/standalone@v1.0.0
- github.com/decred/dcrd/blockchain/v2@v2.0.2
- github.com/decred/dcrd/chaincfg/v2@v2.2.0
- github.com/decred/dcrd/dcrutil/v2@v2.0.0
- github.com/decred/dcrd/mining/v2@v2.0.0
- github.com/decred/dcrd/txscript/v2@v2.0.0
This freezes the root module usage of v2 of the mempool module by
removing the replacement and bumping the required version. This means
building the software will still produce binaries based on the v2 module
until the v3 module is fully released.
All future releases will be moving to version 3 of the module.
Consequently, it bumps the required module versions as follows:
- github.com/decred/dcrd/mempool/v2 v2.1.0
This udpates the peer module to use the latest module major versions.
The updated direct dependencies are as follows:
- github.com/decred/dcrd/txscript/v2@v2.0.0
This modifies the PushGetBlocksMsg and PushGetHeadersMsg functions to
accept a string of block loactors hashes instead of a concrete
blockchain.BlockLocator to remove the tight couping between the two
packages at the API boundary and allow callers to easily provide custom
values if desired.
It also removes the dependency on the blockchain module since it is no
longer required.
This removes the deprecated ChainParams field from the Config struct and
updates the tests accordingly.
It also removes the dependency on the chaincfg module since it is no
longer required.
This freezes the root module usage of the peer module by removing the
replacement and bumping the required version. This means building the
software will still produce binaries based on the v1 module until the v2
module is fully released.
All future releases will be moving to version 2 of the module.
Consequently, it bumps the required module versions as follows:
- github.com/decred/dcrd/peer@v1.2.0
This modifies the SeedFromDNS function to accept a string of the DNS
seeds as well as the default port instead of a concrete chaincfg.Params
to remove the tight coupling between the two packages at the API
boundary and allow callers to easily provide custom values if desired.
This freezes the root module usage of the connmgr module by removing the
replacement and bumping the required version. This means building the
software will still produce binaries based on the v1 module until the v2
module is fully released.
All future releases will be moving to version 2 of the module.
Consequently, it bumps the required module versions as follows:
- github.com/decred/dcrd/connmgr@v1.1.0
This updates the mempool` module dependencies and serves as a base for
mempool/v2.1.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/blockchain/stake@v1.2.1
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/dcrec/secp256k1@v1.0.2
- github.com/decred/dcrd/dcrutil@v1.4.0
- github.com/decred/dcrd/mining@v1.1.1
- github.com/decred/dcrd/txscript@v1.1.0
The full list of updated direct dependencies since the previous
mempool/v2.0.0 release are as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/blockchain/stake@v1.2.1
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/dcrec@v1.0.0
- github.com/decred/dcrd/dcrec/secp256k1@v1.0.2
- github.com/decred/dcrd/dcrutil@v1.4.0
- github.com/decred/dcrd/mining@v1.1.1
- github.com/decred/dcrd/txscript@v1.1.0
This udpates the mining module to use the lastest module major versions.
The updated direct dependencies are as follows:
- github.com/decred/dcrd/blockchain/stake/v2@v2.0.1
- github.com/decred/dcrd/blockchain/v2@v2.0.0
- github.com/decred/dcrd/dcrutil/v2@v2.0.0
This freezes the root module usage of the mining module by removing the
replacement and bumping the required version. This means building the
software will still produce binaries based on the v1 module until the v2
module is fully released.
All future releases will be moving to version 2 of the module.
Consequently, it bumps the required module versions as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/mining@v1.1.1
This updates the peer module dependencies and serves as a base for
peer/v1.2.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/txscript@v1.1.0
The full list of updated direct dependencies since the previous
peer/v1.1.0 release are as follows:
- github.com/davecgh/go-spew@v1.1.1
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.5.2
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/lru@v1.0.0
- github.com/decred/dcrd/txscript@v1.1.0
- github.com/decred/go-socks@v1.0.0
This updates the mining module dependencies and serves as a base for
connmgr/v1.1.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/chaincfg@v1.5.2
The full list of updated direct dependencies since the previous
connmgr/v1.0.2 release are as follows:
- github.com/decred/dcrd/chaincfg@v1.5.2
This modifies the blockchain Config to allow the caller to optionally
specify the subsidy cache to use rather than creating it internally and
forcing callers to query for it later.
This removes the deprecated functions along with the additional code and
tests which are no longer necessary as a result of removing the
functions.
The following is a list of exported types and functions removed along
with what they were replaced by when applicable:
- DisableLog -> UseLogger(slog.Disabled)
- BlockOneCoinbasePaysTokens -> no alternative, internal only
- IsCoinBase -> standalone.IsCoinBaseTx
- IsCoinBaseTx -> standalone.IsCoinBaseTx
- BuildMerkleTreeStore -> standalone.CalcTxTreeMerkleRoot
- BuildMsgTxMerkleTreeStore -> standalone.CalcTxTreeMerkleRoot
- SubsidyCache -> standalone.SubsidyCache
- NewSubsidyCache -> standalone.NewSubsidyCache
- CalcBlockWorkSubsidy -> standalone.SubsidyCache.CalcWorkSubsidy
- CalcStakeVoteSubsidy -> standalone.SubsidyCache.CalcStakeVoteSubsidy
- CalcBlockTaxSubsidy -> standalone.SubsidyCache.CalcTreasurySubsidy
- CoinbasePaysTax -> no alternative, internal only
- CalculateAddedSubsidy -> no alternative, internal only
- BestPrevHash -> BestSnapshot.PrevHash
- TotalSubsidy -> BestSnapshot.TotalSubsidy
- FetchSubsidyCache -> standalone.NewSubsidyCache passed to chain
- HashToBig -> standalone.HashToBig
- CompactToBig -> standalone.CompactToBig
- BigToCompact -> standalone.BigToCompact
- CalcWork -> standalone.CalcWork
- CheckProofOfWork -> standalone.CheckProofOfWork
This udpates the blockchain module to use the lastest module major
versions.
While here, it also corrects a few typos and updates some test function
names to more accurately reflect their purpose.
The updated direct dependencies are as follows:
- github.com/decred/dcrd/blockchain/stake/v2@v2.0.1
- github.com/decred/dcrd/chaincfg/v2@v2.2.0
- github.com/decred/dcrd/database/v2@v2.0.0
- github.com/decred/dcrd/dcrutil/v2@v2.0.0
- github.com/decred/dcrd/txscript/v2@v2.0.0
This freezes the root module usage of the blockchain module by removing
the replacement and bumping the required version. This means building
the software will still produce binaries based on the v1 module until
the v2 module is fully released.
All future releases will be moving to version 2 of the module.
Consequently, it bumps the required module versions as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
This updates the mining module dependencies and serves as a base for
mining/v1.1.1.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/blockchain/stake@v1.2.1
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/dcrutil@v1.4.0
The full list of updated direct dependencies since the previous
mining/v1.1.0 release are as follows:
- github.com/decred/dcrd/blockchain@v1.2.0
- github.com/decred/dcrd/blockchain/stake@v1.2.1
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.2
- github.com/decred/dcrd/dcrutil@v1.4.0