The requireMinimal flag for MakeScriptNum was removed in
84b65d049b but the description was left
in the comment for MakeScriptNum. This removes that part of the docs.
Also expand on range error and fix code reference. In
d8306ee602, the error for out-of-range
changed from ErrNumberTooBig to ErrNumOutOfRange.
This modifies the entire repository to use the new formatting of doc
comments in the upcoming Go 1.19 release.
The primary motivating factors for this are:
- Builds check that files are formatted per gofmt and that will no
longer be true as of Go 1.19 without these changes
- Separating all the updates into a single commit ensures these
documentation only formatting changes do not clutter up diffs that
actually change code
For the most part, the changes are just the automated changes suggested
by the Go 1.19 version of gofmt, but there are also a few cases where
the comments were reworded a bit to play nicely with the new formatting
requirements.
For example, the new version of gofmt reformats and collapses nested
lists where as the existing version does not. Thus, instances of nested
lists have been changed to either eliminate them or use mixed markers
which produce expect results.
This bumps the go directive for all of the modules provided by the
repository to 1.17 which will allow the new module graph pruning and
lazy loading capabilities introduced in Go 1.17 to be used once the
updated modules are released.
This means that, as described by the documentation, the go.mod files for
each module now include a separate require block that includes all of
the indirect dependencies
Profiling allocations during an initial chain sync shows that a large
portion of the allocations due to the CHECKMULTISIG opcode are the
result of generating the list of public keys and signatures.
This eliminates those allocations as follows:
- Use slices into fixed-size stack-based backing arrays for the typical
number of public keys and signatures
- Make the slice of signature info contiguous instead of pointers which
not only eliminates the associated allocations, but also provides
better cache locality
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 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 txscript module dependencies, the copyright year in the
files modified since the previous release, and serves as a base for
txscript/v4.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/chaincfg/v3@v3.1.0
- github.com/decred/dcrd/dcrec/edwards/v2@v2.0.2
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
The full list of updated direct dependencies since the previous
txscript/v3.0.0 release are as follows:
- github.com/dchest/siphash@v1.2.2
- github.com/decred/base58@v1.0.3
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/chaincfg/v3@v3.1.0
- github.com/decred/dcrd/crypto/blake256@v1.0.0
- github.com/decred/dcrd/dcrec/edwards/v2@v2.0.2
- github.com/decred/dcrd/dcrec/secp256k1/v4@v4.0.1
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
The following direct dependencies are no longer required as compared to
the previous txscript/v3.0.0 release:
- github.com/decred/dcrd/dcrutil/v3
Finally, all modules in the repository that depend on txscript are
tidied to ensure they are updated to use the latest versions hoisted
forward as a result.
This adds support for directly extracting the script hash from standard
version 0 stake-tagged pay-to-script-hash scripts along with full test
coverage.
While all of this data can be extracted from each individual type, it
can be more convenient for callers who treat all script hashes as the
same entity which is the case for many applications.
This adds support for directly extracting the public key hash from
standard version 0 stake-tagged pay-to-pubkey-hash scripts along with
full test coverage.
While all of this data can be extracted from each individual type, it
can be more convenient for callers who treat all public key hashes as
the same entity which is the case for many applications.
This modifies the code to use the opcode definitions in txscript now
that the previous cyclic dependency no longer applies since txscript no
longer depends on stdaddr.
This removes ErrTooMuchNullData and its associated stringer test since
it is no longer used by anything in the repository.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ErrTooManyRequiredSigs and its associated stringer test
since it is no longer used by anything in the repository.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ErrNotMultisigScript and its associated stringer test since
it is no longer used by anything in the repository.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ScriptClass and its associated tests since it is no longer
used by anything in the repository and is now available via
stdscript.ScriptType.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes MaxDataCarrierSize since it is no longer used by anything
in the repository and is now available via
stdscript.MaxDataCarrierSizeV0.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStandardAltSignatureType since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyHashAltDetails since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyHashAltScript along with its benchmark since it is
no longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractCompressedPubKey since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractUncompressedPubKey since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKey since it is no longer used by anything in the
package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyAltDetails since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyAltScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyHash since it is no longer used by anything in
the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isNullDataScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractStakePubKeyHash since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractStakeScriptHash since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeSubmissionScript along with its benchmark since it
is no longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeGenScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeRevocationScript along with its benchmark since it
is no longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyHashScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeChangeScript along with its benchmark since it is no
longer used by anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractMultisigScriptDetails since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isTreasuryAddScript since it is no longer used by anything
in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes pubKeyHashToAddrs since it is no longer used by anything in
the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes scriptHashToAddrs since it is no longer used by anything in
the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ExtractPkScriptAddrs and its associated tests, benchmarks,
and example since it is no longer used by anything in the repository
and is now available via stdscript.ExtractAddrs.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isMultisigScript since it is no longer used by anything in
the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isTreasurySpendScript since it is no longer used by
anything in the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes typeOfScript since it is no longer used by anything in
the package.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes GetScriptClass since it is no longer used by anything in
the repository and is also no longer needed since the relevant
information is now available via the more fine grained script types
of stdscript.DetermineScriptType.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes GetScriptClass and its associated tests and benchmarks
since it is no longer used by anything in the repository and is now
available via stdscript.DetermineScriptType.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ExtractPkScriptAltSigType and its associated benchmark
since it is no longer used by anything in the repository and is now
available via stdscript.ExtractPubKeyAltDetailsV0 or
stdscript.ExtractPubKeyHashAltDetailsV0 although it typically is no
longer needed since stdscript has more fine-grained script types.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes IsMultisigSigScript and its associated benchmarks since it
is no longer used by anything in the repository and is now available via
stdscript.IsMultiSigSigScript.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes IsMultisigScript and its associated benchmarks since it is
no longer used by anything in the repository and is now available via
stdscript.IsMultiSigScript.
This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes CalcMultiSigStats and its associated tests and benchmark
since it is no longer used by anything in the repository and is now
available via stdscript.ExtractMultiSigScriptDetailsV0.
This is part of a series of commits to remove all code related to
standard scripts from txscript.