Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump btcd to v0.23.2 #3

Merged
merged 471 commits into from Jun 16, 2023
Merged

Bump btcd to v0.23.2 #3

merged 471 commits into from Jun 16, 2023

Conversation

ygaberman-px
Copy link

@ygaberman-px ygaberman-px commented Jun 16, 2023

Release notes

Changes

  • Remove $GOPATH Caching
  • go fmt
  • Fix minRelayTxFee name in comment
  • release: add missing back tick in build docs
  • peer: fix small typo
  • Fix comment error
  • fix comment of database.Tx to match code
  • btcjson, rpclient: Fix typo
  • blockchain/indexers: Start a new line for long code
  • docs/json_rpc_api: update go examples
  • Add note about using gencerts when listening on specific interfaces
  • Refactor GetBlockCmd type and NewGetBlockCmd() function to follow the bitcoin json RPC verbosity format for getblock, which uses 0, 1, or 2 as parameters rather than a boolean true or false.
  • Refactor GetBlockVerboseResult into two separate types: one type for getblock "hash" verbosity=1, and a second type for getblock "hash" verbosity=2. This is necessary due to how getblock returns a block's transaction data based on the provided verbosity parameter.
  • Refactor FutureGetBlockVerboseResult into two types: FutureGetBlockVerboseResult, and FutureGetBlockVerboseTxResult.
  • All tests pass
  • rpcclient: Add net params to Client (rpcclient: Add net params to Client btcsuite/btcd#1467)
  • fix error message
  • server: Fix incorrect log message format
  • BUG:dynamicbanscore deadlock
  • btcjson: add RPC_IN_WARMUP error code
  • btcjson,rpcclient: use proper Deprecated comment format
  • update GetMempoolEntryResult to v0.19.0
  • Add generatetoaddress and estimatesmartfee RPCs
  • Implement 'getblockstats' JSON-RPC command
  • cmd/btcctl: use regexp.MustCompile for constant patterns
  • Try both TX serialization formats
  • Alphabetize --help output; add missing options to doc.go
  • config.go: remove extra quotes
  • readme: remove duplicate word
  • Improve error message about non-active segwit on simnet
  • btcctl: add regtest mode to btcctl
  • build: replace travis-ci with github actions.
  • build: update deps
  • build: clean linter warnings
  • btcjson: change getblock default verbosity to 1
  • rpcclient: send legacy GetBlock request for backwards compatibility
  • rpcclient: Add cookie auth
  • rpcclient: Refactor cookie caching
  • rpcclient: Try user+pass auth before cookie auth
  • rpcclient: Read first line of cookie instead of trimming space
  • rpcclient: serialize nil inputs to empty list
  • Improve chain state init efficiency
  • Add blockchain.NewUtxoEntry() to directly create entries for UtxoViewpoint
  • Add getchaintxstats JSON-RPC client command
  • Add fundrawtransaction RPC call
  • Add getbalances RPC client command
  • rpcclient: Add GetTransactionWatchOnly method
  • peer: knownInventory, sentNonces - use generic lru
  • btcec: Avoid panic in fieldVal.SetByteSlice for large inputs
  • config+service_windows: add flag to disable win service
  • updated docs for getblock-verbosity fixes
  • Update json_rpc_api.md
  • netsync: handle notfound messages from peers
  • release: update release script path
  • release: remove old scripts and update process doc
  • Update CHANGES file for 0.21.0 release
  • btcd: bump version to v0.21.0-beta
  • blockchain: remove unknown block version warning
  • Add rpclient implementation of getdescriptorinfo RPC
  • peer: prevent last block height going backwards
  • Fix monetary unit
  • rpcserver: add parity with bitcoind for validateaddress
  • Add getblockfilter JSON-RPC client command
  • Implement signmessagewithprivkey JSON-RPC command
  • rpcclient: Implement importmulti JSON-RPC client command
  • Add Dockerfile to build and run btcd on Docker.
  • btcd: fix conversion of int to string failing in Go 1.15
  • btcjson,wire: fix invalid use of string(x) to convert byte value
  • Major rework on documentation to make it compatible to readthedocs.org
  • Added symlink to index.md for github readme preview.
  • btcd+netsync: support witness tx and block in notfound msg
  • btcec: set curve name in CurveParams
  • btcec: add a comment indicating where curve name taken from
  • rpcclient: support listtransactions RPC with watchonly argument
  • blockchain: Remove unnecessary tx hash
  • btcjson: update ListTransactionsResult for Bitcoin 0.20.0
  • chaincfg: Add RegisterHDKeyID func to populate HD key ID pairs
  • Nullable optional JSON-RPC parameters
  • GitHub Actions: Enable Go Race detector and code coverage
  • rpc: Add getnodeaddresses JSON-RPC support
  • btcjson,rpcclient: add support for PSBT commands to rpcclient
  • Added ListSinceBlockMinConfWatchOnly method.
  • wire: add proper types for flag field and improve docs
  • removed unnecessary GOMAXPROCS function calls
  • rpcclient: add deriveaddresses RPC command
  • ci: add go 1.15 to tests
  • sample-btcd.conf: fix typo
  • btcjson: add test for null params in searchrawtransactions
  • GetBlockTemplate RPC client implementation (GetBlockTemplate RPC client implementation btcsuite/btcd#1629)
  • rpcclient: implement getaddressinfo command
  • Fix link to using bootstrap.dat
  • rpcclient: implement getwalletinfo command
  • rpcserver: add txid to getblocktemplate response
  • rpc: add signrawtransactionwithwallet interface
  • rpcclient: implement gettxoutsetinfo command
  • Unmarshal hashes/second as float in GetMiningInfoResult
  • rpcclient: add more wallet commands
  • btcjson: add new JSON-RPC errors and document them
  • rpcclient: implement createwallet with functional options
  • rpcclient: fix documentation typos
  • integration: allow setting custom btcd exe path
  • integration: allow overwriting address generator
  • integration: allow specifying connection behavior
  • integration/rpctest: randomizes port in rpctest.New to reduce collisions
  • btcjson+rpcserverhelp: restore bitcoind compatibility
  • simplify s[:] to s where s is a slice
  • rpcclient: add ExtraHeaders in ConnConfig
  • Add support for receiving sendaddrv2 message from a peer
  • fixed broken link
  • Add support for arm32v7 in Dockerfile
  • Fixes client.GetBlockVerboseTx returns GetBlockVerboseTxResult with empty Tx btcsuite/btcd#1653
  • btcjson: Update fields in GetBlockChainInfoResult
  • txscript: add benchmark for IsUnspendable
  • txscript/hashcache_test: always add inputs during getTxn
  • txscript/hashcache_test: call rand.Seed once in init
  • btcec: validate R and S signature components in RecoverCompact
  • Add Batch JSON-RPC support (rpc client & server)
  • Fix error message returned by EstimateFee
  • docs: update shields
  • rpcserver: Fix Error message returned by processRequest
  • peer: allow external testing of peer.Peer
  • addrmgr: Use RLock/RUnlock when possible
  • build: update btcutil dependency
  • rpcclient: fix documentation typo
  • btcjson: Updated TxRawResult.Version from int32 to uint32
  • wire+chaincfg: add signet params
  • config+params: add signet config option
  • rpcserver: add taproot deployment to getblockchaininfo
  • btcctl: add signet param
  • mining: extract witness commitment add into method
  • rpctest: add witness commitment when calling CreateBlock
  • Don't reference the readme that we don't produce
  • chaincfg: fix deployment bit numbers
  • mempool: add additional test case for inherited RBF replacement
  • Update CHANGES file for 0.22.0 release
  • btcd: bump version to v0.22.0-beta
  • Update release date for v0.22.0-beta in CHANGES file
  • btcjson: Update WalletCreateFundedPsbtOpts.FeeRate from *int64 to *float64
  • rpcserverhelp: Remove extra period for gettxout--synopsis
  • mempool: export isDust for use in other projects
  • Switch irc to libera.chat
  • rpcclient: Export symbols needed for custom commands (rpcclient: Export symbols needed for custom commands btcsuite/btcd#1457)
  • btcec: check if recovered pk is at point of infinity
  • btcec: added testcase for point at infinity
  • build: bump min Go version to 1.16.8 add Go 1.17.1
  • mempool: introduce GetDustThreshold to export dust limit calculation
  • Upgraded the docker version to 1.16
  • peer+server: add new config option to optionally disable stall detection
  • addrmgr: make KnownAddress methods thread-safe
  • fix typo
  • fix typos
  • Included permissions for GitHub action
  • Update connmanager_test.go
  • rpcclient: Add retry with backoffs to HTTP POST requests
  • txscript: Add benchmark for CalcSignatureHash
  • txscript: Add benchmark for CalcWitnessSigHash
  • txscript: Add benchmark for script parsing.
  • txscript: Introduce zero-alloc script tokenizer.
  • txscript: Add benchmark for DisasmString.
  • txscript: Optimize script disasm.
  • txscript: Introduce raw script sighash calc func.
  • txscript: Optimize CalcSignatureHash.
  • txscript/reference_test: Convert sighash calc test
  • txscript: Make isSmallInt accept raw opcode.
  • txscript: Make asSmallInt accept raw opcode.
  • txscript: Add benchmark for IsPayToPubKey
  • txscript: Optimize IsPayToPubKey
  • txscript: Add benchmark for IsPayToPubKeyHash
  • txscript: Optimize IsPayToPubKeyHash
  • txscript: Add benchmark for IsPayToScriptHash.
  • txscript: Optimize IsPayToScriptHash.
  • txscript: Add benchmarks for IsMutlsigScript.
  • txscript: Optimize IsMultisigScript.
  • txscript: Add benchmarks for IsMutlsigSigScript.
  • txscript: Optimize IsMultisigSigScript.
  • txscript: Add benchmark for IsPushOnlyScript.
  • txscript: Optimize IsPushOnlyScript.
  • txscript: Add benchmark IsPayToWitnessPubkeyHash
  • txscript: Optimize IsPayToWitnessPubKeyHash
  • txscript: Add benchmark for IsPayToWitnessScriptHash
  • txscript: Optimize IsPayToWitnessScriptHash
  • txscript: Add benchmark for IsNullData
  • txscript: Optimize IsNullData
  • txscript: Add benchmark for IsUnspendable.
  • txscript: Optimize IsUnspendable.
  • txscript/engine: Optimize new engine push only script
  • txscript/engine: Use optimized IsPushOnlyScript
  • txscript/engine: Use optimized isScriptHashScript
  • txscript/engine: Check ps2h push before parsing script
  • txscript: Add benchmark for GetSigOpCount.
  • txscript: Optimize GetSigOpCount.
  • txscript: Add benchmark for GetPreciseSigOpCount.
  • txscript: Optimize GetPreciseSigOpCount.
  • txscript: add GetWitnessSigOpCountBenchmarks
  • txscript: Optimize GetWitnessSigOpCount
  • txscript: Add benchmark for GetScriptClass.
  • txscript: Make typeOfScript accept raw script.
  • txscript: Optimize typeOfScript pay-to-script-hash.
  • txscript: Remove unused isScriptHash function.
  • txscript: Optimize typeOfScript multisig.
  • txscript: Remove unused isMultiSig function.
  • txscript: Optimze typeOfScript pay-to-pubkey
  • txscript: Remove unused isPubkey function.
  • txscript: Optimize typeOfScript pay-to-pubkey-hash.
  • txscript: Remove unused isPubkeyHash function.
  • txscript: Optimize typeOfScript for null data scripts
  • txscript: Remove unused isNullData function.
  • txscript: Optimize typeOfScript witness-pubkey-hash
  • txscript: Optimize typeOfScript for witness-script-hash
  • txscript: Remove unused isWitnessScriptHash
  • txscript: Convert CalcScriptInfo.
  • txscript: Remove unused isPushOnly function.
  • txscript: Remove unused getSigOpCount function.
  • txscript: Optimize CalcMultiSigStats.
  • txscript: Add benchmark for PushedData.
  • txscript: Optimize PushedData.
  • txscript: Make canonicalPush accept raw opcode.
  • txscript: Add ExtractAtomicSwapDataPushes benches.
  • txscript/scriptnum: add maxscriptnum and maxcltvlength
  • txscript: Optimize ExtractAtomicSwapDataPushes.
  • txscript: Add ExtractPkScriptAddrs benchmarks.
  • txscript: Optimize ExtractPkScriptAddrs scripthash.
  • txscript: Optimize ExtractPkScriptAddrs pubkeyhash.
  • txscript: Optimize ExtractPkScriptAddrs pubkey.
  • txscript: Optimize ExtractPkScriptAddrs multisig.
  • txscript: Optimize ExtractPkScriptAddrs nulldata.
  • txscript: Optimize ExtractPkScriptAddrs witness pubkey hash
  • txscript: Optimize ExtractPkScriptAddrs witness script hash
  • txscript: Optimize ExtractPkScriptAddr assume non-standard if no success
  • txscript: Optimize IsWitnessProgram
  • txscript: Return witness version and program in one pass
  • txscript: Use internal analysis methods for GetWitnessSigOpCount
  • txscript: Optimize ExtractWitnessProgramInfo
  • txscript: mergeMultiSig function def order cleanup.
  • txscript: Introduce calcWitnessSignatureHashRaw
  • txscript: Remove unused isWitnessPubKeyHash
  • txscript: Use optimized calcWitnessSignatureHashRaw w/o parsing
  • txscript: Use raw scripts in SignTxOutput.
  • txscript: Implement efficient opcode data removal.
  • txscript: Optimize removeOpcodeRaw
  • txscript: Remove unused removeOpcode
  • txscript: Use removeOpcodeRaw for CODESEP in calcSigHash
  • txscript: Make isDisabled accept raw opcode.
  • txscript: Make alwaysIllegal accept raw opcode.
  • txscript: Make isConditional accept raw opcode.
  • txscript: Make min push accept raw opcode and data.
  • txscript: Convert to use non-parsed opcode disasm.
  • txscript: Refactor engine to use raw scripts.
  • txscript: Remove unused calcSignatureHash
  • txscript: Remove unused isWitnessProgram
  • txscript: Remove unused removeOpcodeByData func.
  • txscript: Rename removeOpcodeByDataRaw func.
  • txscript: Rename calcSignatureHashRaw
  • txscript/sign: Use calcWitnessSigHashRaw for witness sigs
  • txscript/pkscript: Use finalOpcodeData to extract redeem script
  • txscript: Remove unused parseScript func.
  • txscript: Remove unused calcWitnessSignatureHash
  • txscript: Remove unused unparseScript func.
  • txscript: Remove unused parsedOpcode.bytes func.
  • txscript: Remove unused parseScriptTemplate func.
  • txscript: Make executeOpcode take opcode and data.
  • txscript: Make op callbacks take opcode and data.
  • go.mod, go.sum: Update goleveldb
  • reduce redundant memory allocatio - resolves connmgr/tor.go: TorLookupIP btcsuite/btcd#1699
  • rpcclient+rpcserver: Change getnetworkhashps return type to be a float to be in line with bitcoin core
  • integration: Add unit tests for all three GetNetworkHashPS client methods
  • btcutil: move btcutil into new sub-module
  • multi: update btcutil imports to point to new sub-module
  • build: adapt btcutil Makefile for usage in project
  • btcutil: update modules to replace to top-level btcd repo
  • chaincfg: create new abstract deployment starter/ender interfaces
  • chaincfg: use DeploymentStarter/DeploymentEnder instead of start/end times
  • blockchain: update version bits logic to use HasStarted/HasEnded for deployments
  • build: don't run the integration tests w/ -race
  • chainparams: add new DeploymentTestDummyMinActivation
  • blockchain+integration: add support for min activation height and custom thresholds
  • blockchain: refactor new thresholdState method, test BIP9 transitions
  • btcjson+rpc: add min activation height to soft fork RPC response
  • btcec: convert package into go module, alias to dcrec
  • multi: switch project over to using btcec/v2
  • build: don't run the integration tests w/ -race
  • btcec/v2: retain copyright notices from decred developers for all files
  • build: use sed to remove v2 path from btcec/coverage.txt
  • btcec/v2: create new ecdsa package
  • chaincfg: add BIP-340 tagged hash implementation
  • btcec/v2/schnorr: add initial BIP-340 schnorr sig implementation
  • build: run go mod tidy to refresh go.sum for btcutil
  • btcec/schnorr: add benchmarks for sign/verify
  • btcec+chaincfg: use pre-computed tag hash values
  • build: update to btcec v2.1.0
  • Revert "reduce redundant memory allocatio - resolves connmgr/tor.go: TorLookupIP btcsuite/btcd#1699"
  • build: retract bogus tags from btcd fork
  • mempool/estimatefee: Fix negative index bug
  • wire: netaddressv2 and tests
  • multi: update addrmgr, server to use NetAddressV2 instead of legacy
  • peer+wire: add addrv2 message, protocol negotiation
  • Replace github.com/btcsuite/goleveldb with github.com/syndtr/goleveldb
  • chainhash: make module
  • mod: use chaincfg/chainhash module
  • mod: add temporary replace
  • mod: bump btcec/v2 module version
  • mod: add TODOs for removing local replaces
  • build: update to btcec/v2.1.1 and chaincfg/chainhash/v1.00
  • Fixes coveralls coverage report
  • Update LICENSE
  • txscript: add taproot script type
  • txscript: add some txscript support for parsing taproot scripts
  • txscript: add taproot support to PayToAddrScript
  • txscript: move hash cache mid-state computation to hashcache.go file
  • wire: export WriteOutPoint to public module
  • txscript: add new IsPayToTaproot utility func
  • txscript: move sighash computations to new file
  • txscript: implement BIP 341+342 segwit v1 taproot+tapscript
  • txscript: update SigCache to cache both ECDSA and Schnorr signatures
  • txscript: introduce new signatureVerifier interface to abstract over schnorr/ecdsa
  • txscript: use new signature verifiers for existing CHECKSIG ops
  • txscript: add new functions for signing a top-level taproot output
  • txscript: add VM verification logic for top-level taproot keyspends
  • txscript: use keyBytes instead of ScriptHash for segwit utilities
  • txscript: add new ScriptHasOpSuccess utility method
  • txscript: introduce new ControlBlock struct along w/ parsing routine
  • txscript: add VerifyTaprootLeafCommitment function
  • txscript: add new RawTxInTapscriptSignature to generate tapsript sigs
  • txscript: add AssembleTaprootScriptTree func for creating input witnesses
  • txscript: implement script path verification
  • txscript: disable OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY for tapscript
  • txscript: always enforce MINIMAL_IF during tapscript execution
  • txscript: add new OpcodePosition method to tokenizer to save code sep position
  • txscript: implement OP_CHECKSIG semantics for tapscript validation
  • txscript: implement OP_CHECKSIGADD
  • txscript: add taproot JSON success/fail reference tests
  • chaincfg: add taproot BIP deployment parameters
  • blockchain: use taproot script flags for validation after activation
  • blockchain/indexers: add P2TR support to the addrindex
  • blockchain: fix IsSpeedy() bug, add more logging in BIP 9 state machine
  • txscript: add more detailed taproot errors
  • build: add temporary replace directives for btcec+chainhash
  • build: update to btcec/v2.1.3 and chaincfg/chainhash v1.0.1
  • blockchain: demote BIP 9 log statements
  • psbt: allow empty bip32 derivation path
  • mempool: export check Standardness func
  • Default to JSONRPC 1.0 if the rpcVersion empty
  • btcjson: Update the fields of GetNetworkInfoResult
  • harden btcd on OpenBSD
  • go mod tidy
  • rpctest: ensure rpclisten is set to an available port
  • btcjson: add addresstype arg to getnewaddress
  • btcjson: add addresstype arg to getrawchangeaddress
  • mempool: fix t.Fatal call with formatting directive
  • chaincfg: use lower custom activation threshold for regtest+simnet
  • rpcclient: add getzmqnotifications RPC
  • btcd: don't override explicitly set GOGC
  • Adds GH workflow to build docker images on version tags
  • Add LF to new files last line
  • Upgrade go docker builder image
  • psbt: always use non witness serialization format
  • rpcclient: add getnewaddresstype and revert breaking change
  • btcec/schnorr/musig2: add key musig2 key aggregation routines
  • btcec/schnorr/musig2: add nonce generation & aggregation funcs
  • btcec/schnorr/musig2: add partial sig generation, validation, and combination
  • btcec/schnorr/musig2: add test vectors from secp256k1-zkp
  • btcec/schnorr/musig2: add multi-party signing test case w/ 100 signers
  • btcec/schnorr/musig2: add benchmarks
  • btcec/schnorr/musig2: optimize signing+verification
  • btcec/schnorr/musig2: add safer signing API with Session+Context
  • btcec/schnorr/musig2: add support for tweaked aggregated keys
  • schnorr/musig2: add native support for taproot output key tweaking
  • btcec/schnorr/musig2: add explicit support for BIP 86 multi-signing
  • btcec/schnorr/musig2: update nonce generation to support optional inputs
  • btcec/schnorr/musig2: add new key tweak combination test vectors
  • btcec/schnorr/musig2: enable early nonce generation w/ a context
  • btcec/schnorr/musig2: pass in aux info during nonce generation
  • btcec/schnorr/musig2: add optional json dump command to gen test vectors
  • psbt: fix typo, remove TODO
  • psbt: rename receiver to match rest of code
  • psbt: remove invalid type from typo
  • psbt: add new input/output types and structs
  • psbt: add (de-)serialization for new types
  • psbt: add valid and invalid PSBTs for new types
  • psbt: make Taproot PSBT finalizable
  • fuzz: add ParsePubKey fuzzer
  • rpcclient: fix formatting
  • rpclient: fix masked error causing crash after max retries
  • rpcclient: fix backoff logic
  • rpcclient: save the last error when retrying
  • build: bump version to v0.23.0
  • rpcclient: fix missing return
  • build: bump version to v0.23.1
  • Bump btcd version in btcutil package
  • bump version to v0.23.0
  • go mod tidy in btcutil/
  • go mod tidy in btcetc/
  • btcec/schnorr/musig2: XOR rand with secret key
  • btcec/schnorr/musig2: Update to MuSig 0.3.0
  • btcec/schnorr/musig2: Add nonce generation testcases
  • btcec/schnorr/musig2: Add AggregateKeys testvectors
  • btcec/schnorr/musig2: Add AggregateNonce testvectors
  • btcec/schnorr/musig2: Add Sign test vectors
  • btcec/schnorr/musig2: Throw error on invalid partial sig
  • btcec/schnorr/musig2: Add PartialSigVerify testvectors
  • btcec/schnorr/musig2: Add CombineSig testvectors
  • btcec/schnorr/musig2: Allow infinity nonces
  • btcec/schnorr/musig2: add infinity testvectors
  • doc: fix Tor hidden service setup link
  • build: bump golang base image version to 1.17
  • wire: remove erroneous witness size check in wire parsing
  • build: bump version to v0.23.2
  • Fixed ban bug that doesn't print numTxns
  • btcec/schnorr/musig2: update musig2 impl to version 0.7.0
  • btcec/schnorr/musig2: update to musig 1.0.0
  • btcec/schnorr/musig: update nonce test vectors to musig2 1.0.0
  • btcec/schnorr/musig2: update key agg test vectors to musig2 1.0.0
  • btcec/schnorr/musig2: add key tweak sign test vectors
  • btcec/schnorr/musig2: add sig verify+sign test vectors
  • btcec/schnorr/musig2: add sig combine test vectors
  • btcec/musig2: remove old canned test vector code
  • btcec/schnorr/musig2: always pass in priv key for early nonce gen
  • wire: increase max witness items per input
  • build: bump version to v0.23.3

davecgh and others added 30 commits November 16, 2021 18:47
This continues the process of converting the typeOfScript function to
use a combination of raw script analysize and the tokenizer instead of
parsed opcode, with the intent of significanty optimizing the function.

In particular, it converts the detection of null data scripts to use raw
script analysis.
This continues the process of converting the typeOfScript function to
use a combination of raw script analysis and the new tokenizer instead
of the far less efficient parsed opcodes.

In particular, it converts the detection of witness pubkey hash scripts
to use raw script analysis and the new tokenizer.

The following is a before and after comparison of analyzing a large
script:

benchmark                          old ns/op     new ns/op     delta
BenchmarkIsWitnessPubKeyHash-8     61688         62839         +1.87%

benchmark                          old allocs     new allocs     delta
BenchmarkIsWitnessPubKeyHash-8     1              1              +0.00%

benchmark                          old bytes     new bytes     delta
BenchmarkIsWitnessPubKeyHash-8     311299        311299        +0.00%
This concludes the process of converting the typeOfScript function to
use a combination of raw script analysis and the new tokenizer instead
of the far less efficient parsed opcodes.

In particular, it converts the detection of witness script hash scripts
to use raw script analysis and the new tokenizer.

With all of the limbs now useing optimized variants, the following is a
before an after comparison of calling GetScriptClass on a large script:

benchmark                     old ns/op     new ns/op     delta
BenchmarkGetScriptClass-8     61515         15.3          -99.98%

benchmark                     old allocs     new allocs     delta
BenchmarkGetScriptClass-8     1              0              -100.00%

benchmark                     old bytes     new bytes     delta
BenchmarkGetScriptClass-8     311299        0             -100.00%
This converts CalcScriptInfo and dependent expectedInputs to make use of
the new script tokenizer as well as several of the other recently added
raw script analysis functions in order to remove the reliance on parsed
opcodes as a step towards utlimately removing them altogether.

It is worth noting that this has the side effect of significantly
optimizing the function as well, however, since it is deprecated, no
benchmarks are provided.
This converts the CalcMultiSigStats function to make use of the new
extractMultisigScriptDetails function instead of the far less efficient
parseScript thereby significantly optimizing the function.

The tests are also updated accordingly.

The following is a before and after comparison of analyzing a standard
multisig script:

benchmark                    old ns/op    new ns/op    delta
---------------------------------------------------------------
BenchmarkCalcMultiSigStats   972          79.5         -91.82%

benchmark                    old allocs   new allocs   delta
---------------------------------------------------------------
BenchmarkCalcMultiSigStats   1            0            -100.00%

benchmark                    old bytes    new bytes    delta
---------------------------------------------------------------
BenchmarkCalcMultiSigStats   2304         0            -100.00%
This converts the PushedData function to make use of the new tokenizer
instead of the far less efficient parseScript thereby significantly
optimizing the function.

Also, the comment is modified to explicitly call out the script version
semantics.

The following is a before and after comparison of extracting the data
from a very large script:

benchmark                 old ns/op     new ns/op     delta
BenchmarkPushedData-8     64837         1790          -97.24%

benchmark                 old allocs     new allocs     delta
BenchmarkPushedData-8     7              6              -14.29%

benchmark                 old bytes     new bytes     delta
BenchmarkPushedData-8     312816        1520          -99.51%
This renames the canonicalPush function to isCanonicalPush and converts
it to accept an opcode as a byte and the associate data as a byte slice
instead of the internal parse opcode data struct in order to make it
more flexible for raw script analysis.

It also updates all callers and tests accordingly.
This converts the ExtractAtomicSwapDataPushes function to make use of
the new tokenizer instead of the far less efficient parseScript thereby
significantly optimizing the function.

The new implementation is designed such that it should be fairly easy to
move the function into the atomic swap tools where it more naturally
belongs now that the tokenizer makes it possible to analyze scripts
outside of the txscript module.  Consequently, this also deprecates the
function.

The following is a before and after comparison of attempting to extract
from both a typical atomic swap script and a very large non-atomic swap
script:

benchmark                                       old ns/op     new ns/op     delta
BenchmarkExtractAtomicSwapDataPushesLarge-8     61332         44.4          -99.93%
BenchmarkExtractAtomicSwapDataPushes-8          990           260           -73.74%

benchmark                                       old allocs     new allocs     delta
BenchmarkExtractAtomicSwapDataPushesLarge-8     1              0              -100.00%
BenchmarkExtractAtomicSwapDataPushes-8          2              1              -50.00%

benchmark                                       old bytes     new bytes     delta
BenchmarkExtractAtomicSwapDataPushesLarge-8     311299        0             -100.00%
BenchmarkExtractAtomicSwapDataPushes-8          3168          96            -96.97%
This begins the process of converting the ExtractPkScriptAddrs function
to use the optimized extraction functions recently introduced as part of
the typeOfScript conversion.

In order to ease the review process, the detection of each script type
will be converted in a separate commit such that the script is only
parsed as a fallback for the cases that are not already converted to
more efficient variants.

In particular, this converts the detection for pay-to-script-hash
scripts.
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the detection for pay-to-pubkey-hash
scripts.
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the detection for pay-to-pubkey scripts.
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the detection for multisig scripts.

Also, since the remaining slow path cases are all recursive calls,
the parsed opcodes are no longer used, so parsing is removed.
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the detection for nulldata scripts, removes
the slow path fallback code since it is the final case, and modifies the
comment to call out the script version semantics.

The following is a before and after comparison of analyzing both a
typical standard script and a very large non-standard script:

benchmark                            old ns/op    new ns/op    delta
-----------------------------------------------------------------------
BenchmarkExtractPkScriptAddrsLarge   132400       44.4         -99.97%
BenchmarkExtractPkScriptAddrs        1265         231          -81.74%

benchmark                            old allocs   new allocs   delta
-----------------------------------------------------------------------
BenchmarkExtractPkScriptAddrsLarge   1            0            -100.00%
BenchmarkExtractPkScriptAddrs        5            2            -60.00%

benchmark                            old bytes    new bytes    delta
-----------------------------------------------------------------------
BenchmarkExtractPkScriptAddrsLarge   466944       0            -100.00%
BenchmarkExtractPkScriptAddrs        1600         48           -97.00%
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the extraction for witness-pubkey-hash
scripts.
This continues the process of converting the ExtractPkScriptAddrs
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this converts the extract of witness-pay-to-script-hash
scripts.
This completes the process of converting the ExtractPkScriptAddr
function to use the optimized extraction functions recently introduced
as part of the typeOfScript conversion.

In particular, this cleans up the final remaining case for non-standard
transactions. The method now returns NonStandardTy direclty if no other
branch was taken.

The following is a before and after comparison of attempting to extract
pkscript addrs from a very large, non-standard script.

benchmark                                old ns/op     new ns/op     delta
BenchmarkExtractPkScriptAddrsLarge-8     60713         17.0          -99.97%
BenchmarkExtractPkScriptAddrs-8          289           17.0          -94.12%

benchmark                                old allocs     new allocs     delta
BenchmarkExtractPkScriptAddrsLarge-8     1              0              -100.00%
BenchmarkExtractPkScriptAddrs-8          1              0              -100.00%

benchmark                                old bytes     new bytes     delta
BenchmarkExtractPkScriptAddrsLarge-8     311299        0             -100.00%
BenchmarkExtractPkScriptAddrs-8          768           0             -100.00%
This moves the function definition for mergeMultiSig so it is more
consistent with the preferred order used through the codebase.  In
particular, the functions are defined before they're first used and
generally as close as possible to the first use when they're defined in
the same file.
sputn1ck and others added 27 commits August 4, 2022 11:51
This commit updates the musig2 module to allow
infinity nonces, as per Musig2 0.4.0.
In this commit, we fix a bug that would cause nodes to be unable to
parse a given block from the wire. The block would be properly accepted
if fed in via other mechanisms.

The issue here is that the old checks for the maximum witness size,
circa segwit v0 where placed in the wire package _as well_ as the tx
engine. This check should only be in the engine, since it's properly
gated by other related scrip validation flags.

The fix itself is simple: limit witnesses only based on the maximum
block size in bytes, or ~4MB.
wire: remove erroneous witness size check in wire parsing
This includes the recent fix to the wire witness wire parsing bug.
The two _concrete_ changes between version 0.4.0 (where we are before
this commit), and version 0.7.0 are:

  1. Variable length messages are now allowed, this comes with a new 8
     byte prefix for the messages.

     * Our implementation was already using a `[]byte` for the
       message/hash, so no extra API changes are needed here.

  2. The serialization for a blank message and a normal message (for
     nonce gen) is now distinct. A single byte is added (either 0 or 1)
     to indicate if a message was passed into nonce generation.
The major change in musig 1.0.0 is that plain public keys are used as
input to key aggregation.
btcec/schnorr/musig2: update to musig 1.0.0
…nputMax

wire: increase max witness items per input
@ygaberman-px ygaberman-px merged commit 7d1adc1 into master Jun 16, 2023
6 checks passed
@ygaberman-px ygaberman-px deleted the bump-btcd branch June 16, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet