aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.am
AgeCommit message (Collapse)Author
2022-06-04Merge bitcoin/bitcoin#25065: [kernel 2c/n] Introduce `kernel::Context`, ↵fanquake
encapsulate global init/teardown d87784ac87364fc977bbf9769c8bdb72dea8cbf9 kernel: SanityChecks: Return an error struct (Carl Dong) 265d6393bf9ef52e7ef7de97ca9c031da82a5ad1 Move init::SanityCheck to kernel::SanityCheck (Carl Dong) fed085a1a4cd2787202752b6a0d98e42dce97f09 init: Initialize globals with kernel::Context's life (Carl Dong) 7d03feef8156ef37a4efa01dc591467bc7d957bf kernel: Introduce empty and unused kernel::Context (Carl Dong) eeb4fc20c578b1e428a92d64cc9f8f903a677580 test: Use Set/UnsetGlobals in BasicTestingSetup (Carl Dong) Pull request description: The full `init/common.cpp` is dependent on things like ArgsManager (which we wish to remove from libbitcoinkernel in the future) and sanity checks. These aren't necessary for libbitcoinkernel so we only extract the portion that is necessary (namely `init::{Set,Unset}Globals()`. ACKs for top commit: theuni: ACK d87784ac87364fc977bbf9769c8bdb72dea8cbf9 vasild: ACK d87784ac87364fc977bbf9769c8bdb72dea8cbf9 Tree-SHA512: cd6b4923ea1865001b5f0caed9a4ff99c198d22bf74154d935dc09a47fda22ebe585ec912398cea69f722454ed1dbb4898faab5a2d02fb4c5e719c5c8d71a3f9
2022-06-02Move init::SanityCheck to kernel::SanityCheckCarl Dong
2022-06-02init: Initialize globals with kernel::Context's lifeCarl Dong
...instead of explicitly calling init::{Set,Unset}Globals. Cool thing about this is that in both the testing and bitcoin-chainstate codepaths, we no longer need to explicitly unset globals. The kernel::Context goes out of scope and the globals are unset "automatically". Also construct kernel::Context outside of AppInitSanityChecks()
2022-06-02Merge bitcoin/bitcoin#24531: Use designated initializersMacroFake
fa72e0ba15c6382e9068be221ab4872bef000cbc Use designated initializers (MarcoFalke) Pull request description: Designated initializers are supported since gcc 4.7 (Our minimum required is 8) and clang 3 (Our minimum required is 7). They work out of the box with C++17, and only msvc requires the C++20 flag to be set. I don't expect any of our msvc users will run into issues due to this. See also https://bitcoin.jonasschnelli.ch/ircmeetings/logs/bitcoin-core-dev/2022/bitcoin-core-dev.2022-03-10-19.00.log.html#l-114 ACKs for top commit: kristapsk: ACK fa72e0ba15c6382e9068be221ab4872bef000cbc hebasto: ACK fa72e0ba15c6382e9068be221ab4872bef000cbc Tree-SHA512: a198e9addd9af69262a7e79ae4377b55697c8dfe768b8b3d444526544b1d1f85df46f0ae81b7541bf2f73e5868fb944b159e5bf234303c7b8b9d778afb0b2840
2022-06-01Use designated initializersMarcoFalke
2022-05-31kernel: Introduce empty and unused kernel::ContextCarl Dong
[META] In the next commit, we will move the init::{Set,Unset}Globals logic into this struct. Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
2022-05-31build: pass bdb cppflags only where neededfanquake
Move bdb cppflags out of the catch-all BITCOIN_INCLUDES, and pass them only where they are needed, which is in libbitcoin_node/wallet and the tests.
2022-05-28compat: remove glibcxx sanity checksfanquake
These checks were added in #4339, (see also #4081), to test our back-compat stubs, however, those stubs no-longer exist (#22930), meaning that these checks are now just testing some specific standard library behaviour, without a particular rationale, or reason, compared to any other standard library functions we use. There has also been some discussion about the sanity checks in the context of the libbitcoinkernel refactoring, see https://github.com/bitcoin/bitcoin/pull/25065#discussion_r880668218. Removing the checks removes the need to worry about atleast the glibcxx checks. Also remove the list of check from the doc in init.h, because it is incomplete, and anyone who wants to know what checks are included can look at the function.
2022-05-25multiprocess build cleanup: comment on manual dependenciesRyan Ofsky
Also move manual dependency closer to actual build target
2022-05-25multiprocess build fix: ipc/capnp/init.capnp.h: No such file or directoryRyan Ofsky
Error was reported by SatoriHoshiAiko in https://github.com/bitcoin/bitcoin/issues/25207 and happens unpredictably because make doesn't always build dependencies in the same order. The source file src/ipc/capnp/protocol.cpp includes some generated headers so needs to have an explicit dependency specified in the makefile so the headers will be generated before the file is compiled. #19160 added the explicit dependency, but it was incorrect because it referred to an old file path from before the source file was renamed (ipc.cpp -> protocol.cpp)
2022-05-23coinstats: Move GetUTXOStats to rpc/blockchainCarl Dong
rpc/blockchain.cpp is now the only user of the vestigial GetUTXOStats(...). And since GetUTXOStats(...)'s special fallback logic was only really relevant/meant for rpc/blockchain.cpp, we can just move it there.
2022-05-23kernel: Use ComputeUTXOStats in validationCarl Dong
This is the "fruit of our labor" for this patchset. ChainstateManager::PopulateAndValidateSnapshot can now directly call ComputeUTXOStats(...). Our consensus engine is now fully decoupled from all indices. See the src/Makefile.am for some satisfying removals.
2022-05-23coinstats: Split node/coinstats.h to kernel/coinstats.hCarl Dong
Most of this commit is pure-move. After this change: - kernel/coinstats.h -> Contains declarations for: - enum class CoinStatsHashType - struct CCoinsStats - GetBogoSize(...) - TxOutSer(...) - ComputeUTXOStats(...) - node/coinstats.h -> Just GetUTXOStats, which will be removed as we change callers to directly use the hashing/indexing codepaths in future commits.
2022-05-23coinstats: Move hasher codepath to kernel/coinstatsCarl Dong
As mentioned in a previous commit, the hashing codepath can now be moved to a separate file. This decouples callers that only rely on the hashing codepath from the indexing one. This is key for libbitcoinkernel, which needs to have the CoinsStats hashing codepath for AssumeUTXO, but does not wish to be coupled with indexes. Note that only the .cpp file is split in this commit, the header files will be split in a subsequent commit and the #includes to node/coinstats.h will be adjusted to only #include the necessary headers.
2022-05-20kernel: Remove unnecessary blockfilter{index,}.cppCarl Dong
It is no longer necessary to link in blockfilter.cpp and index/blockfilterindex.cpp after merge of PR#21726 since validation has been decouple from the blockfilterindex.
2022-05-20Add ChainstateManager::m_adjusted_time_callbackCarl Dong
This decouples validation.cpp from netaddress.cpp (transitively, timedata.cpp, and asmap.cpp). This is important for libbitcoinkernel as: - There is no reason for the consensus engine to be coupled with netaddress, timedata, and asmap - Users of libbitcoinkernel can now easily supply their own std::function that provides the adjusted time. See the src/Makefile.am changes for some satisfying removals.
2022-05-20Add ChainstateManagerOpts, using as ::OptionsCarl Dong
[META] Although it seems like we don't need it for just one option, we're going to introduce another member to this struct *in the next commit*. In future patchsets for libbitcoinkernel decoupling it from ArgsManager, even more members will be added here.
2022-05-05Wrap boost::replace_allMacroFake
2022-05-04Merge bitcoin/bitcoin#24933: util: Replace non-threadsafe strerrorlaanwj
e3a06a3c6cbb288ac89a2725cf71ae8adaebf35c test: Add `strerror` to locale-dependence linter (laanwj) f00fb1265a8bc26e1612c771173325dbe49b3612 util: Increase buffer size to 1024 in SysErrorString (laanwj) 718da302c7b11b375042c3000d421fd93348c199 util: Refactor SysErrorString logic (laanwj) e7f2f77756d33c6be9c8998a575b263ff2d39270 util: Use strerror_s for SysErrorString on Windows (laanwj) 46971c6dbfbc39ebbc74ab1ed8c00edc12859373 util: Replace non-threadsafe strerror (laanwj) Pull request description: Some uses of non-threadsafe `strerror` have snuck into the code since they were removed in #4152. Add a wrapper `SysErrorString` for thread-safe strerror alternatives (with code from `NetworkErrorString`) and replace all uses of `strerror` with this. Edit: I've also added a commit that refactors the code so that buf[] is never read at all if the function fails, making some fragile-looking code unnecessary. Edit2: from the linux manpage: ``` ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌───────────────────┬───────────────┬─────────────────────────┐ │Interface │ Attribute │ Value │ ├───────────────────┼───────────────┼─────────────────────────┤ │strerror() │ Thread safety │ MT-Unsafe race:strerror │ ├───────────────────┼───────────────┼─────────────────────────┤ … ├───────────────────┼───────────────┼─────────────────────────┤ │strerror_r(), │ Thread safety │ MT-Safe │ │strerror_l() │ │ │ └───────────────────┴───────────────┴─────────────────────────┘ ``` As the function can be called from any thread at any time, using a non-thread-safe function is unacceptable. ACKs for top commit: jonatack: ACK e3a06a3c6cbb288ac89a2725cf71ae8adaebf35c Tree-SHA512: 20e71ebb9e979d4e1d8cafbb2e32e20c2a63f09115fe72cdde67c8f80ae98c531d286f935fd8a6e92a18b72607d7bd3e846b2d871d9691a6036b0676de8aaf25
2022-05-03scripted-diff: Rename rpc/misc.cpp to rpc/node.cppMacroFake
-BEGIN VERIFY SCRIPT- git mv src/rpc/misc.cpp src/rpc/node.cpp sed -i 's@rpc/misc.cpp@rpc/node.cpp@g' $(git grep -l misc.cpp) sed -i 's,RegisterMiscRPCCommands,RegisterNodeRPCCommands,g' $(git grep -l RegisterMiscRPCCommands) -END VERIFY SCRIPT-
2022-05-03rpc: Move output script RPCs to separate fileMacroFake
Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-04-29rpc: Move fee estimation RPCs to separate fileMacroFake
Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-04-29Merge bitcoin/bitcoin#25013: Remove cs_main from verifymessage, move msg ↵fanquake
utils to new file fa60169811d6991a116bd37e1ff58049d2beee77 rpc: Move signmessage RPC util to new file (MacroFake) fa9425177e6be2c53fb5c1333636fa4d678ab401 Remove cs_main from verifymessage (MacroFake) Pull request description: The `verifymessage` RPC has several issues: * It takes `cs_main` for no reason, blocking progress on removing the `cs_main` global mutex. * It is located in a file called `misc`, which is not a very helpful name. Fix all issues. ACKs for top commit: vincenzopalazzo: ACK https://github.com/bitcoin/bitcoin/pull/25013/commits/fa60169811d6991a116bd37e1ff58049d2beee77 Tree-SHA512: c71a1f481b828e0a544405fecbbc7ca44e66ea46b498d7aed1f1c584d6a99724deb13e89d90b9d5cdeecbce293e6a41e9f7ae299543f6d761bf9e7a839b6c7f3
2022-04-28Merge bitcoin/bitcoin#24322: [kernel 1/n] Introduce initial `libbitcoinkernel`fanquake
035fa1f07aacb7bce74c0884ae28c8cf00fe3b1b build: Remove LIBTOOL_APP_LDFLAGS for bitcoin-chainstate (Cory Fields) 3f0595095dd6d230dc661641227937e3ab4ca8d3 docs: Add libbitcoinkernel_la_SOURCES explanation (Carl Dong) 94ad45deb257a95b4e98aa85da0371fb072fcd4c ci: Build libbitcoinkernel (Carl Dong) 26b2e7ffb3471a4712e5b9e50e066e0e3218f0dd build: Extract the libbitcoinkernel library (Carl Dong) 1df44dd20ca9e6e55eb353824b27d11bd1878c59 b-cs: Define G_TRANSLATION_FUN in bitcoinkernel.cpp (Carl Dong) 83a0bb7cc9907dbe089409ed5a417277ed63ed95 build: Separate lib_LTLIBRARIES initialization (Carl Dong) c1e16cb31f4d8edde8fea310011189b8b272cb07 build: Create .la library for bitcoincrypto (Carl Dong) 8bdfe057c796dde1cd2e5a37a73e87a879e9fe56 build: Create .la library for leveldb (Carl Dong) 05d1525b6d4412f68ff4c5460cd1daa6fb49969b build: Create .la library for crc32c (Carl Dong) 64caf944797bc35c3044fe5675389656f9511a41 build: Remove vestigial LIBLEVELDB_SSE42 (Carl Dong) 1392e8e2d8cfe4115f0a152aca16ffe3f0f4573a build: Don't add unrelated libs to LIBTEST_* (Carl Dong) Pull request description: Part of: #24303 This PR introduces a `libbitcoinkernel` static library linking in the minimal list of files necessary to use our consensus engine as-is. `bitcoin-chainstate` introduced in #24304 now will link against `libbitcoinkernel`. Most of the changes are related to the build system. Please read the commit messages for more details. ACKs for top commit: theuni: This may be my favorite PR ever. It's a privilege to ACK 035fa1f07aacb7bce74c0884ae28c8cf00fe3b1b. Tree-SHA512: b755edc3471c7c1098847e9b16ab182a6abb7582563d9da516de376a770ac7543c6fdb24238ddd4d3d2d458f905a0c0614b8667aab182aa7e6b80c1cca7090bc
2022-04-28rpc: Move signmessage RPC util to new fileMacroFake
Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-04-28util: Replace non-threadsafe strerrorlaanwj
Some uses of non-threadsafe `strerror` have snuck into the code since they were removed in #4152. Add a wrapper `SysErrorString` for thread-safe strerror alternatives and replace all uses of `strerror` with this.
2022-04-27build: Remove LIBTOOL_APP_LDFLAGS for bitcoin-chainstateCory Fields
See added comment. Note that this won't actually have any effect until we add the mingw-w64 DLL fix since LIBTOOL_APP_LDFLAGS is undefined for other platforms.
2022-04-27docs: Add libbitcoinkernel_la_SOURCES explanationCarl Dong
2022-04-27build: Extract the libbitcoinkernel libraryCarl Dong
I strongly recommend reviewing with the following git-diff flags: --patience --color-moved=dimmed-zebra Extract out a libbitcoinkernel library linking in all files necessary for using our consensus engine as-is. Link bitcoin-chainstate against it. See previous commit "build: Add example bitcoin-chainstate executable" for more context. We explicitly specify -fvisibility=default, which effectively overrides the effects of --enable-reduced-exports since libbitcoinkernel requires default symbol visibility When compiling for mingw-w64, specify -static in both: - ..._la_CXXFLAGS so that libtool will avoid building two versions of each object (one PIC, one non-PIC). We just need the one that is suitable for static linking. - ..._la_LDFLAGS so that libtool will create a static library. If we don't specify this, then libtool will prefer the non-static PIC version of the object, which is built with -DDLL_EXPORT -DPIC for mingw-w64 targets. This can cause symbol resolution problems when we link this library against an executable that does specify -all-static, since that will be built without the -DDLL_EXPORT flag. Unfortunately, this means that for mingw-w64 we can only build a static version of the library for now. This will be fixed. However, on other targets, the shared library creation works fine. ----- Note to users: You need to either specify: --enable-experimental-util-chainstate or, --with-experimental-kernel-lib To build the libbitcionkernel library. See the configure help for more details. build shared libbitcoinkernel where we can
2022-04-26b-cs: Define G_TRANSLATION_FUN in bitcoinkernel.cppCarl Dong
[META] This is done in preparation for extracting libbitcoinkernel in a following commit. It seems logical that generally users of a library shouldn't need to export its own symbols to use the library.
2022-04-26build: Separate lib_LTLIBRARIES initializationCarl Dong
Set lib_LTLIBRARIES with '=' to an empty value at the top of the Makefile.am and append to it from the library-local block for readability. Here's the error you get if you don't set lib_LTLIBRARIES to be empty: error: lib_LTLIBRARIES must be set with '=' before using '+=' [META] In a subsequent commit, we're going to introduce a library and append it to lib_LTLIBRARIES in its local block, this makes things more readable.
2022-04-26build: Create .la library for bitcoincryptoCarl Dong
Libtool will yell at you if you try to link a shared library against static ones. This change creates a libtool archive library for bitcoincrypto and allows a shared library to be linked against it portably. Also specify -static in both: - ..._la_CXXFLAGS so that libtool will avoid building two versions of each object (one PIC, one non-PIC). We just need the one that is suitable for static linking. - ..._la_LDFLAGS so that libtool will create a static library. [META] This change is done in preparation for a future commit where we link the libbitcoinkernel library against this one.
2022-04-19[build] Add netgroup.cpp|hJohn Newbery
These aren't used yet.
2022-04-11build: Remove vestigial LIBLEVELDB_SSE42Carl Dong
- LIBLEVELDB_SSE42_INT was defined, but never referenced anywhere - LIBLEVELDB_SSE42 is referenced, but never defined anywhere Apparently leveldb used to have platform-specific crc32 code before it got split off into a separate lib.
2022-04-06Merge bitcoin/bitcoin#24098: rest: Use query parameters to control resource ↵MarcoFalke
loading 54b39cfb342d10a448d49299c715e3a25c2aca4a Add release notes (stickies-v) f959fc0397c3f3615e99bc28d2df549d9d52f277 Update /<count>/ endpoints to use a '?count=' query parameter instead (stickies-v) a09497614e9bb603fff36286d9611a25b23eeb02 Add GetQueryParameter helper function (stickies-v) fff771ee864975cee8c831651239bac95503c37a Handle query string when parsing data format (stickies-v) c1aad1b3b95b7c6bdf05e0c2095aba2f2db8310b scripted-diff: rename RetFormat to RESTResponseFormat (stickies-v) 9f1c54787c81177dd56a31c881a9ad2834a122dc Refactoring: move declarations to rest.h (stickies-v) Pull request description: In RESTful APIs, [typically](https://rapidapi.com/blog/api-glossary/parameters/query/) path parameters (e.g. `/some/unique/resource/`) are used to represent resources, and query parameters (e.g. `?sort=asc`) are used to control how these resources are being loaded through e.g. sorting, pagination, filtering, ... As first [discussed in #17631](https://github.com/bitcoin/bitcoin/pull/17631#discussion_r733031180), the [current REST api](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md) contains two endpoints `/headers/` and `/blockfilterheaders/` that rather unexpectedly use path parameters to control how many (filter) headers are returned in the response. While this is no critical issue, it is unintuitive and we are still early enough to easily phase this behaviour out and ensure new endpoints (if any) do not have to stick to non-standard behaviour just for internal consistency. In this PR, a new `HTTPRequest::GetQueryParameter` method is introduced to easily parse query parameters, as well as two new `/headers/` and `/blockfilterheaders/` endpoints that use a count query parameter are introduced. The old path parameter-based endpoints are kept without too much overhead, but the documentation now points to the new query parameter-based endpoints as the default interface to encourage standardness. ## Behaviour change ### New endpoints and default values `/headers/` and `/blockfilterheaders/` now have 2 new endpoints that contain query parameters (`?count=<count>`) instead of path parameters (`/<count>/`), as described in REST-interface.md. Since query parameters can easily have default values, I have set this at 5 for both endpoints. **headers** `GET /rest/headers/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>` should now be used instead of `GET /rest/headers/<COUNT>/<BLOCK-HASH>.<bin|hex|json>` **blockfilterheaders** `GET /rest/blockfilterheaders/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>` should now be used instead of `GET /rest/blockfilterheaders/<FILTERTYPE>/<COUNT>/<BLOCK-HASH>.<bin|hex|json>` ### Some previously invalid API calls are now valid API calls that contained query strings in the URI could not be parsed prior to this PR. This PR changes behaviour in that previously invalid calls (e.g. `GET /rest/headers/5/somehash.json?someunusedparam=foo`) would now become valid, as the query parameters are properly parsed, and discarded if unused. For example, prior to this PR, adding an irrelevant `someparam` parameter would be illegal: ``` GET /rest/headers/5/0000004c6aad0c89c1c060e8e116dcd849e0554935cd78ff9c6a398abeac6eda.json?someparam=true -> Invalid hash: 0000004c6aad0c89c1c060e8e116dcd849e0554935cd78ff9c6a398abeac6eda.json?someparam=true ``` **This behaviour change affects all rest endpoints, not just the 2 new ones introduced here.** *(Note: I'd be open to implementing additional logic to refuse requests containing unrecognized query parameters to minimize behaviour change, but for the endpoints that we currently have I don't really see the point for that added complexity. E.g. I don't see any scenarios where misspelling a parameter could lead to harmful outcomes)* ## Using the REST API To run the API HTTP server, start a bitcoind instance with the `-rest` flag enabled. To use the `blockfilterheaders` endpoint, you'll also need to set `-blockfilterindex=1`: ``` ./bitcoind -signet -rest -blockfilterindex=1 ``` As soon as bitcoind is fully up and running, you should be able to query the API, for example by using curl on the command line: ```curl "127.0.0.1:38332/rest/chaininfo.json"```. To more easily parse the JSON output, you can also use tools like 'jq' or `json_pp`, e.g.: ``` curl -s "localhost:38332/rest/blockfilterheaders/basic/0000004c6aad0c89c1c060e8e116dcd849e0554935cd78ff9c6a398abeac6eda.json?count=2" | json_pp . ``` ## To do - [x] update `doc/release-notes` ## Feedback This is my first PR (hooray!). Please don't hold back on any feedback/comments/nits/... you may have, big or small, whether they are code, process, language, ... related. I welcome private messages too if there's anything you don't want to clutter the PR with. I'm here to learn and am grateful for everyone's input. ACKs for top commit: stickies-v: I've had to push a tiny doc update to `REST-interface.md` (`git range-diff 219d728 9aac438 54b39cf`) since this was not merged for v23, but since there are no significant changes beyond theStack and jnewbery's ACKs I think this PR is now ready to be considered for merging? @MarcoFalke jnewbery: ACK 54b39cfb342d10a448d49299c715e3a25c2aca4a theStack: re-ACK 54b39cfb342d10a448d49299c715e3a25c2aca4a Tree-SHA512: 3b393ffde34f25605ca12c0b1300799a19684b816a1d03aed38b0f5439df47bfe6a589ffbcd7b83fd2def6c9d00a1bae5e45b1d18df4ae998c617c709990f83f
2022-04-05Merge bitcoin/bitcoin#24147: Miniscript integrationlaanwj
2da94a4c6f55f7a3621f4a6f70902c52f735c868 fuzz: add a fuzz target for Miniscript decoding from Script (Antoine Poinsot) f8369996e76dbc41a12f7b7eea14a7e7990a81c1 Miniscript: ops limit and stack size computation (Pieter Wuille) 2e55e88f86d0dd49b35d04af3f57e863498aabae Miniscript: conversion from script (Pieter Wuille) 1ddaa66eae67b102f5e37d212d366a5dcad4aa26 Miniscript: type system, script creation, text notation, tests (Pieter Wuille) 4fe29368c0ded0e62f437cab3a7c904f7fd3ad67 script: expose getter for CScriptNum, add a BuildScript helper (Antoine Poinsot) f4e289f384efdda6c3f56e1e1c30820a91ac2612 script: move CheckMinimalPush from interpreter to script.h (Antoine Poinsot) 31ec6ae92a5d9910a26d90a6ff20bab27dee5826 script: make IsPushdataOp non-static (Antoine Poinsot) Pull request description: Miniscript is a language for writing (a subset of) Bitcoin Scripts in a structured way. Miniscript permits: - To safely extend the Output Descriptor language to many more scripting features thanks to the typing system (composition). - Statical analysis of spending conditions, maximum spending cost of each branch, security properties, third-party malleability. - General satisfaction of any correctly typed ("valid" [0]) Miniscript. The satisfaction itself is also analyzable. - To extend the possibilities of external signers, because of all of the above and since it carries enough metadata. Miniscript guarantees: - That for any statically-analyzed as "safe" [0] Script, a witness can be constructed in the bounds of the consensus and standardness rules (standardness complete). - That unless the conditions of the Miniscript are met, no witness can be created for the Script (consensus sound). - Third-party malleability protection for the satisfaction of a sane Miniscript, which is too complex to summarize here. For more details around Miniscript (including the specifications), please refer to the [website](https://bitcoin.sipa.be/miniscript/). Miniscript was designed by Pieter Wuille, Andrew Poelstra and Sanket Kanjalkar. This PR is an updated and rebased version of #16800. See [the commit history of the Miniscript repository](https://github.com/sipa/miniscript/commits/master) for details about the changes made since September 2019 (TL;DR: bugfixes, introduction of timelock conflicts in the type system, `pk()` and `pkh()` aliases, `thresh_m` renamed to `multi`, all recursive algorithms were made non-recursive). This PR is also the first in a series of 3: - The first one (here) integrates the backbone of Miniscript. - The second one (#24148) introduces support for Miniscript in Output Descriptors, allowing for watch-only support of Miniscript Descriptors in the wallet. - The third one (#24149) implements signing for these Miniscript Descriptors, using Miniscript's satisfaction algorithm. Note to reviewers: - Miniscript is currently defined only for P2WSH. No Taproot yet. - Miniscript is different from the policy language (a high-level logical representation of a spending policy). A policy->Miniscript compiler is not included here. - The fuzz target included here is more interestingly extended in the 3rd PR to check a script's satisfaction against `VerifyScript`. I think it could be further improved by having custom mutators as we now have for multisig (see https://github.com/bitcoin/bitcoin/issues/23105). A minified corpus of Miniscript Scripts is available at https://github.com/bitcoin-core/qa-assets/pull/85. [0] We call "valid" any correctly-typed Miniscript. And "safe" any sane Miniscript, ie one whose satisfaction isn't malleable, which requires a key for any spending path, etc.. ACKs for top commit: jb55: ACK 2da94a4c6f55f7a3621f4a6f70902c52f735c868 laanwj: Light code review ACK 2da94a4c6f55f7a3621f4a6f70902c52f735c868 (mostly reviewed the changes to the existing code and build system) Tree-SHA512: d3ef558436cfcc699a50ad13caf1e776f7d0addddb433ee28ef38f66ea5c3e581382d8c748ccac9b51768e4b95712ed7a6112b0e3281a6551e0f325331de9167
2022-04-03build: stop overriding user CXXFLAGSfanquake
Let users have the final say in regards to CXXFLAGS.
2022-04-03build: stop overriding user LDFLAGSfanquake
Let the user have the final say in regards to LDFLAGS.
2022-04-03build: stop overriding user CPPFLAGSfanquake
Let the user have the final say in regards to CPPFLAGS
2022-03-31Merge bitcoin/bitcoin#24714: util/check: Don't use a lambda for Assert/AssumeMarcoFalke
2ef47ba6c57a12840499a13908ab61aefca6cb55 util/check: stop using lambda for Assert/Assume (Anthony Towns) 7c9fe25c16d48b53a61fa2f6ff77eaf8820cb1f6 wallet: move Assert() check into constructor (Anthony Towns) Pull request description: Using a lambda creates a couple of odd namespacing issues, in particular making clang's thread safety analysis less helpful, and confusing gcc when calling member functions. Fix this by not using a lambda. Fixes #21596 Fixes #24654 ACKs for top commit: MarcoFalke: ACK 2ef47ba6c57a12840499a13908ab61aefca6cb55 🚢 jonatack: Tested re-ACK 2ef47ba6c57a12840499a13908ab61aefca6cb55 Tree-SHA512: 4bdbf3215f3d14472df0552362c5eebe8b7eea2d0928a8a41109edd4e0c5f95de6f8220eb2fee8506874e352c003907faf5ef344174795939306a618157b1bae
2022-03-30util/check: stop using lambda for Assert/AssumeAnthony Towns
2022-03-29compat: remove strnlen back-compat codefanquake
This was needed for mingw (not mingw-w64), and some older versions of macOS, which we no-longer support.
2022-03-17Miniscript: type system, script creation, text notation, testsPieter Wuille
More information about Miniscript can be found at https://bitcoin.sipa.be/miniscript/ (the website source is hosted at https://github.com/sipa/miniscript/). This commit defines all fragments, their composition, parsing from string representation and conversion to Script. Co-Authored-By: Antoine Poinsot <darosior@protonmail.com> Co-Authored-By: Sanket Kanjalkar <sanket1729@gmail.com> Co-Authored-By: Samuel Dobson <dobsonsa68@gmail.com>
2022-03-17Move txoutproof RPCs to txoutproof.cppMarcoFalke
2022-03-11rpc: Move mempool RPCs to new fileMarcoFalke
Can be reviewed with: --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-03-10Refactoring: move declarations to rest.hstickies-v
This facilitates unit testing
2022-03-03Merge bitcoin/bitcoin#24304: [kernel 0/n] Introduce `bitcoin-chainstate`MarcoFalke
2c03cec2ff8cdbfd5da92bfb507d218e5c6435b0 ci: Build bitcoin-chainstate (Carl Dong) 095aa6ca37bf0bd5c5e221bab779978a99b2a34c build: Add example bitcoin-chainstate executable (Carl Dong) Pull request description: Part of: #24303 This PR introduces an example/demo `bitcoin-chainstate` executable using said library which can print out information about a datadir and take in new blocks on stdin. Please read the commit messages for more details. ----- #### You may ask: WTF?! Why is `index/*.cpp`, etc. being linked in? This PR is meant only to capture the state of dependencies in our consensus engine as of right now. There are many things to decouple from consensus, which will be done in subsequent PRs. Listing the files out right now in `bitcoin_chainstate_SOURCES` is purely to give us a clear picture of the task at hand, it is **not** to say that these dependencies _belongs_ there in any way. ### TODO 1. Clean up `bitcoin-chainstate.cpp` It is quite ugly, with a lot of comments I've left for myself, I should clean it up to the best of my abilities (the ugliness of our init/shutdown might be the upper bound on cleanliness here...) ACKs for top commit: ajtowns: ACK 2c03cec2ff8cdbfd5da92bfb507d218e5c6435b0 ryanofsky: Code review ACK 2c03cec2ff8cdbfd5da92bfb507d218e5c6435b0. Just rebase, comments, formatting change since last review MarcoFalke: re-ACK 2c03cec2ff8cdbfd5da92bfb507d218e5c6435b0 🏔 Tree-SHA512: 86e7fb5718caa577df8abc8288c754f4a590650d974df9d2f6476c87ed25c70f923c4db651c6963f33498fc7a3a31f6692b9a75cbc996bf4888c5dac2f34a13b
2022-02-14Merge bitcoin/bitcoin#24115: ARMv8 SHA2 Intrinsicslaanwj
aaa1d03d3acebeb44fdd40a302f086aad3d329ce Add optimized sha256d64_arm_shani::Transform_2way (Pieter Wuille) fe0629852aaf3a26f291bfa535e7e455fe7bea06 Implement sha256_arm_shani::Transform (Pavol Rusnak) 48a72fa81f80c8a3c7c6de8339b5feb361dece1c Add sha256_arm_shani to build system (Pavol Rusnak) c2b79342506e24e9b7100fb7a6025dc870375ef6 Rename SHANI to X86_SHANI to allow future implementation of ARM_SHANI (Pavol Rusnak) Pull request description: This PR adds support for ARMv8 SHA2 Intrinsics. Fixes https://github.com/bitcoin/bitcoin/issues/13401 and https://github.com/bitcoin/bitcoin/issues/17414 * Integration part was done by me. * The original SHA2 NI code comes from https://github.com/noloader/SHA-Intrinsics/blob/master/sha256-arm.c * Minor optimizations from https://github.com/rollmeister/bitcoin-armv8/blob/master/src/crypto/sha256.cpp are applied too. * The 2-way transform added by @sipa ACKs for top commit: laanwj: Code review and lightly tested ACK aaa1d03d3acebeb44fdd40a302f086aad3d329ce Tree-SHA512: 9689d6390c004269cb1ee79ed05430d7d35a6efef2554a2b6732f7258a11e7e959b3306c04b4e8637a9623fb4c12d1c1b3592da0ff0dc6d737932db302509669
2022-02-14ci: Build bitcoin-chainstateCarl Dong
...to make sure that the linker errors that arise from coupling regressions are caught by CI. Adding to the "no wallet" ci job as suggested by MarcoFalke.
2022-02-14build: Add example bitcoin-chainstate executableCarl Dong
The bitcoin-chainstate executable serves to surface the dependencies required by a program wishing to use Bitcoin Core's consensus engine as it is right now. More broadly, the _SOURCES list serves as a guiding "North Star" for the libbitcoinkernel project: as we decouple more and more modules of the codebase from our consensus engine, this _SOURCES list will grow shorter and shorter. One day, only what is critical to our consensus engine will remain. Right now, it's "the minimal list of files to link in to even use our consensus engine". [META] In a future commit the libbitcoinkernel library will be extracted from bitcoin-chainstate, and the libbitcoinkernel library's _SOURCES list will be the list that we aim to shrink.