This modifies the vote notification logic so that wallets will no longer
vote on mainnet blocks once height 635775 has been reached and the block
version is prior to 9.
This change is being made to make use of the staking system to force
proof-of-work miners to upgrade to the latest version in a timely
fashion so voting on the new consensus changes can commence.
This synchronizes sends and receives for peer handling channels by selecting
over the quit channel for the server when sending and closing it when the
peer handler terminates. The peer handler's channel draining block has been
removed as a result.
This modifies the public key parsing method to make it more strict by
rejecting public keys that are not exactly the required length as
opposed to silently truncating or padding them and adds tests
accordingly.
This helps prevent misuse by callers and makes it behave more
consistently with the secp256k1 public key parsing.
Note that this does not affect consensus code since the only place it is
called is during the signature verification opcode where the consensus
rules ensure the the key is the correct length before parsing it.
This modifies the mining code to produce blocks on the simulation
network with the same block version as other test networks as opposed to
the block version used on the main network.
seq is not portable (for example, the command is not provided by
OpenBSD and would need to be installed as a package).
Since the script already assumes bash, use the numeric builtins to
iterate NUM times instead of using seq.
Currently, timeouts when responding to a websocket ping control message
with a pong message cause the websocket client to be disconnected, but
these types of failures are nearly always temporary network errors due
to things such as congestion and thus should not result in
disconnection.
In order to make that the case, this modifies the websocket ping handler
to ignore timeout network errors when attempting to respond with a pong
and also takes this opportunity to increase the timeout to 5 seconds
from 1 second to support multi-continent communication.
This modifies the encoding logic for script numbers to support encoding
min int64s. This was previously not supported since the type was not
public and it is not possible to achieve a min int64 within the context
of the script system itself due to the strict limits it imposes.
However, now that script numbers are exported for external use and
callers are not bound by the aforementioned strictness, it should be
possible to encode the entire range for completeness.
In practice, callers should never realistically need to encode the value
since the purpose of the type is to create encoded numbers for scripts
and the value in question will be rejected upon any attempt to use it as
a number when verifying scripts given it is out of range.
This modifies DecodeWIF to reject any attempts to decode strings that
are larger than the max possible size early since there is no reason to
waste time and memory doing the base 58 decode when it is guaranteed to
be invalid anyway.
It also adds an associated test to ensure proper functionality.
This reworks the WIF tests to provide full coverage for both positive
and negative paths, to test for the explicit reason for the failure to
ensure that each test is actually testing the intended condition, and to
make them more consistent with modern practices in the code.
This modifies NewKeyFromString to reject any attempts to decode strings
that are larger than the max possible size early since there is no
reason to waste time and memory doing the base 58 decode when it is
guaranteed to be invalid anyway.
It also adds an associated test to ensure proper functionality.
This modifies DecodeAddressV0 to reject any attempts to decode strings
that are larger than the max possible size early since there is no
reason to waste time and memory doing the base 58 decode when it is
guaranteed to be invalid anyway.
It also adds an associated test to ensure proper functionality.
This modifies the MultiSigScriptV0 convenience func for creating a
multisig script to return an error if the caller improperly calls it
with a negative threshold.
This updates the block versions created by the mining code to produce
the latest versions needed to trigger the hard fork vote for DCP0007,
DCP0008, and DCP0009.
This updates the rpcclient module dependencies, the copyright year in
the files modified since the previous release, and serves as a base for
rpcclient/v7.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/gcs/v3@v3.0.0
- github.com/decred/dcrd/rpc/jsonrpc/types/v3@v3.0.0
The full list of updated direct dependencies since the previous
rpcclient/v6.0.2 release are as follows:
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/dcrjson/v4@v4.0.0
- github.com/decred/dcrd/dcrutil/v4@v4.0.0
- github.com/decred/dcrd/gcs/v3@v3.0.0
- github.com/decred/dcrd/rpc/jsonrpc/types/v3@v3.0.0
- github.com/decred/dcrd/txscript/v4@v4.0.0
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
Finally, all modules in the repository that depend on the module are
tidied to ensure they are updated to use the latest versions hoisted
forward as a result.
This updates the following to reflect the new module version:
* The rpcclient/README.md file
* The docs/README.md file
* The JSON-RPC API documentation
* The module hierarchy graphviz
* The module hierarchy diagram
This updates the blockchain module dependencies, the copyright year in
the files modified since the previous release, and serves as a base for
blockchain/v4.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/blockchain/stake/v4@v4.0.0
- github.com/decred/dcrd/blockchain/standalone/v2@v2.1.0
- github.com/decred/dcrd/database/v3@v3.0.0
- github.com/decred/dcrd/dcrutil/v4@v4.0.0
- github.com/decred/dcrd/gcs/v3@v3.0.0
- github.com/decred/dcrd/lru@v1.1.1
- github.com/syndtr/goleveldb@v1.0.1-0.20210819022825-2ae1ddf74ef7
The full list of updated direct dependencies since the previous
blockchain/v3.0.3 release are as follows:
- github.com/decred/dcrd/blockchain/stake/v4@v4.0.0
- github.com/decred/dcrd/blockchain/standalone/v2@v2.1.0
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/chaincfg/v3@v3.1.0
- github.com/decred/dcrd/database/v3@v3.0.0
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/decred/dcrd/dcrutil/v4@v4.0.0
- github.com/decred/dcrd/gcs/v3@v3.0.0
- github.com/decred/dcrd/lru@v1.1.1
- github.com/decred/dcrd/txscript/v4@v4.0.0
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
- github.com/syndtr/goleveldb@v1.0.1-0.20210819022825-2ae1ddf74ef7
Finally, all modules in the repository that depend on the module are
tidied to ensure they are updated to use the latest versions hoisted
forward as a result.
This updates the simnet environment documentation to account for the
different expected initial balances due to the subsidy split agenda
since it is always active on simnet.
This implements the agenda for voting on the modified subsidy split
defined in DCP0010 along with consensus tests.
In particular, once the vote has passed and is active, the PoW subsidy
will be 10% of the block reward and the PoS subsidy will be 80%. The
Treasury subsidy will remain at 10%.
In terms of the overall effects, this includes updates to:
- The validation logic for votes, coinbases, and overall block subsidy
- Enforcement when considering candidate votes for acceptance to the
mempool, relaying, and inclusion into block templates
- Mining template generation
- The output of the getblocksubsidy RPC
Also note that this does not implement the block version bump that will
ultimately be needed by the mining code since there are multiple
consensus votes gated behind it and will therefore be done separately.
The following is an overview of the changes:
- Introduce a convenience function for determining if the vote passed
and is now active
- Add new methods to blockchain/standalone for calculating the work and
stake vote subsidies according to either the original or modified
values per a provided flag
- Modify vote validation to enforce the new stake vote subsidy in
accordance with the state of the vote
- Modify coinbase validation to enforce the new work subsidy in
accordance with the state of the vote
- Modify block validation logic to enforce the total overall subsidy in
accordance with the state of the vote
- Add tests for determining if the agenda is active for both mainnet and
testnet
- Add tests for getblocksubsidy RPC
- Add tests to ensure proper behavior for the modified subsidy splits as
follows:
- Ensure new blockchain validation semantics are enforced once the
agenda is active
- Ensure mempool correctly accepts and rejects votes in accordance
with the state of the vote
This adds a new munger to the test chain generator named
ReplaceVoteSubsidies which modifies a block by replacing the subsidy of
all votes contained in the block to a given value.
This adds two new exported functions to the subsidy cache in
blockchain/standalone to calculate calculate the work and stake vote
subsidies according to either the original or modified values defined in
DCP0010 per a provided flag along with tests to ensure expected
behavior.
It should be noted that the values for the modified split are hard coded
as opposed to using the subsidy in order to avoid the need for a major
module bump that would be required if the subsidy params interface were
changed. The values are the same for all networks, so no additional
logic is necessary on a per-network basis.
This adds a new definition for the upcoming agenda vote to change the
subsidy split to 10% PoW, 80% PoS, and 10% Treasury defined in DCP0010
along with two new parameters for the modified values.
It does not include any code to make decisions based on the status of
the agenda or bump block versions. It only adds the definition for the
agenda.
This consolidates the logic for constructing the agenda flags to use for
checking transactions into a separate method versus building them inline
in multiple different places.
This makes it easier to add new agendas in the future while keeping the
flags consistent.
This creates a new ExtendedKey child derivation method, ChildBIP32Std,
which creates an ExtendedKey with leading zeroes retained for strict
compliance with BIP32. This is not intended for Decred wallet use.
This adds an assumevalid config option which allows for specifying a
hash of an assumed valid block or disabling assume valid.
The usage is as follows:
* (flag not specified): defaults to the hard-coded value in source
* --assumevalid=0: disable AssumeValid
* --assumevalid=[blockhash]: set AssumeValid to the specified block hash
This adds tests that validate that it is correctly determined whether or
not a node is an ancestor of an assumed valid node under a variety of
conditions.
This updates block validation to not run scripts if bulk import mode is
enabled. Bulk import mode is only enabled when importing blocks that
are already known to be valid.
This updates BlockChain to set the BFFastAdd flag if a block is both an
ancestor of the assumed valid block and an ancestor of the best header.
A helper function isAssumeValidAncestor is introduced that determines
whether the provided node is both an ancestor of the assumed valid node
and an ancestor of the best header. False is returned when the assume
valid node has not been discovered or when assume valid is disabled.
The assumed valid node is clamped back as needed to ensure that it is at
least 2 weeks worth of blocks behind the best header. This protects
against malicious actors trying to play games by tricking users into
using an assumed valid hash near the tip.
This adds tracking of the assumed valid node to BlockChain. The assumed
valid node will be used in place of checkpoints to set the BFFastAdd
flag in a subsequent commit.
This introduces an AssumeValid parameter that is the hash of a block
that has been externally verified to be valid. In a subsequent commit,
it will be used to allow several validation checks to be skipped for
blocks that are both an ancestor of the assumed valid block and an
ancestor of the best header.
Note that the AssumeValid block hash that is specified for mainnet and
testnet is for the same block that was used for MinKnownChainWork.
Using the same block for both of these slightly simplifies the process
for external verification of the values when they are updated
periodically with new releases.
While the original plan was to keep uint256 as a part of the primitives
module, there has been interest in using the uint256 code now and the
primitives module will not be complete and ready for release for quite
some time.
Also, after further discussion, the general preference is for a separate
module that lives at math/uint256 for this code since the primitives
module will ultimately be squarely aimed at Decred-specific things while
math/uint256 is more generally useful, including many projects outside
of Decred as well.
Thus, this moves the new uint256 package from the internal staging area
to math/uint256 where it will serve as a base for a new math/uint256
module release.
Finally, it updates all relevant paths and package README.md
accordingly.
The corrects a formatting issue where the base 10 output is not always
printing the expected results.
It also adds a test which triggers the condition as well as a new
randomized test to compare the output of random values against the big
int output for all of the supported bases.
This corrects the logic related to preventing unnecessary reorgs in the
function that sorts parents based the number of votes available for them
and the current tip block and adds tests to ensure proper functionality.
This modifies the adaptor that the RPC server uses for transaction
submission to process the transaction directly instead of piping through
the netsync package. There is no longer any reason to incur the extra
overhead since the mempool is concurrent safe the initial reasons for
piping it through netsync no longer apply. This can be seen by noting
that the net sync manager doesn't do anything except call the mempool
method.
This updates the wire error types to leverage go 1.13 errors.Is/As
functionality as well as confirm to the error infrastructure best
practices outlined in #2181.
This adds new functions for generating and verifying inclusion proofs
along with associated tests.
The functions are direct ports of the functions of the same names from
blockchain/standalone.
It also updates the documentation.