Commit graph

39524 commits

Author SHA1 Message Date
merge-script
53dc403306
Merge ElementsProject/elements#1514: Mitigate disk filling attacks by rate limiting Log writing
d23b6c86d0 [log] Introduce log rate limiter class (Niklas Gögge)
817c68a64f Merge bitcoin/bitcoin#24464: logging: Add severity level to logs (laanwj)

Pull request description:

  Mitigation of [CVE-2025-54604](https://bitcoincore.org/en/2025/10/24/disclose-cve-2025-54604/) and [CVE-2025-54605 - Disk filling from invalid blocks](https://bitcoincore.org/en/2025/10/24/disclose-cve-2025-54605/)

  Port of https://github.com/bitcoin/bitcoin/pull/21603 (the later PR merged for inclusion in bitcoin v30 https://github.com/bitcoin/bitcoin/pull/32604 relies on `std::source_location` in C++20). 21603 implements `SourceLocation ` and `SourceLocationHasher` for use with C++17.

  Dependent on: bitcoin/bitcoin#24464: logging: Add severity level to logs

ACKs for top commit:
  delta1:
    ACK d23b6c86d0

Tree-SHA512: 0e49eb9fa46e65c7f5deb5f4cc40f25812756510fbe7eb16140e482e0259c91b4584e65cb43a7d83b7aa9dcf586fd26436aed4efa2757de32cc3f3c3a71acbf0
2025-11-26 11:59:16 +02:00
merge-script
946db0fe20
Merge ElementsProject/elements#1512: Detect witness stripping without re-running Script checks
0cb5c660bb Merge bitcoin/bitcoin#33105: validation: detect witness stripping without re-running Script checks (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/33105

ACKs for top commit:
  delta1:
    ACK 0cb5c660bb

Tree-SHA512: 6e982a18450edfe8c8f6ce0087af4d084f04dd39c0113144ab367802a2aee7e991899941c95e4f01e9d67248e7b87810b23d6fcb687c0582f6b69b72583ae829
2025-11-26 11:25:34 +02:00
Niklas Gögge
d23b6c86d0 [log] Introduce log rate limiter class
The LogRatelimiter class implements a fixed window rate limiter. The
rate limiter allows a fixed amount of bytes to be consumed within a
fixed time window.

[log] Introduce source location type

The SourceLocation type stores the filename and line of a source code
location.
In a later commit we use this type as the key type in an unordered map
and set to keep track of rate limters for each location.

[config] Add -ratelimitlogging config option

The -ratelimitlogging can be used to enable/disable the rate limiting to
disk. Rate limiting is enabled by default.

[log] Add two new categories for unconditional logging

We create two new categories `UNCONDITIONAL_ALWAYS` and
`UNCONDITIONAL_RATE_LIMITED` that are always enabled by default.

LogPrintf now logs using the `UNCONDITIONAL_RATE_LIMITED` category which
will start to apply rate limiting in a later commit.

For some log locations it might be safe to allow more frequent logging
without rate limiting. These locations should use the
`UNCONDITIONAL_ALWAYS` category.

[validation] Exempt UpdateTipLog from rate limiting

UpdateTipLog logs everytime a new tip is activated. This occurs at an
increased frequency during IBD and should therefore be exempt from rate
limiting.

[log] Add rate limiting to LogPrintf

To mitigate disk filling attacks caused by unsafe usages of LogPrintf,
we rate limit LogPrintf by using the fixed window rate limiter
(BCLog::LogRatelimiter) introduced in an earlier commit.

The rate limiting logic is applied per source location instead of
globally. A source location is allowed to log up to 1 MiB per hour.
Source locations that violate the limit will have their logs supressed
for up to one hour.

[test util] Mark ~DebugLogHelper as noexcept(false)

We mark ~DebugLogHelper as noexcept(false) to be able to catch the
exception it throws. This lets us use it in test in combination with
BOOST_CHECK_THROW and BOOST_CHECK_NO_THROW to check that certain log
messages are (not) logged.

[test] Check for expected log rate limiting messages

[test] Test for expected file size changes when rate limiting is enabled

[test] Check that log rate limiting is disabled for exempt source locations

[test] Check that rate limiting can be disabled
2025-11-24 13:36:23 +00:00
laanwj
817c68a64f Merge bitcoin/bitcoin#24464: logging: Add severity level to logs
e11cdc9303  logging: Add log severity level to net.cpp (klementtan)
a8290649a6 logging: Add severity level to logs. (klementtan)

Pull request description:

  **Overview**: This PR introduces a new macro, `LogPrintLevel`, that allows developers to add logs with the severity level. Additionally, it will also print the log category if it is specified.

  Sample log:
  ```
  2022-03-04T16:41:15Z [opencon] [net:debug] trying connection XX.XX.XXX.XXX:YYYYY lastseen=2.7hrs
  ```

  **Motivation**: This feature was suggested in #20576 and I believe that it will bring the following benefits:
  * Allow for easier filtering of logs in `debug.log`
  * Can be extended to allow users to select the minimum level of logs they would like to view (not in the scope of this PR)

  **Details**:
  * New log format. `... [category:level]...`. ie:
    * Do not print category if `category == NONE`
    * Do not print level if `level == NONE`
    * If `category == NONE` and `level == NONE`, do not print any fields (current behaviour)
  * Previous logging functions:
    * `LogPrintf`:  no changes in log as it calls `LogPrintf_` with `category = NONE` and `level = NONE`
    * `LogPrint`: prints additional `[category]` field as it calls `LogPrintf_` with `category = category` and `level = NONE`
  * `net.cpp`: As a proof of concept, updated logs with obvious severity (ie prefixed with `Warning/Error:..`) to use the new logging with severity.

  **Testing**:
  * Compiling and running `bitcoind` with this PR should instantly display logs with the category name (ie `net/tor/...`)
  * Grepping for `net:debug` in `debug.log` should display the updated logs with severity level:
    <details>
    <summary>Code</summary>

    ```
    $ grep "net:debug" debug.log

    2022-03-04T16:41:15Z [opencon] [net:debug] trying connection XXX:YYY lastseen=2.7hrs
    2022-03-04T16:41:16Z [opencon] [net:debug] trying connection XXX:YYY lastseen=16.9hrs
    2022-03-04T16:41:17Z [opencon] [net:debug] trying connection XXX:YYY lastseen=93.2hrs
    2022-03-04T16:41:18Z [opencon] [net:debug] trying connection XXX:YYY lastseen=2.7hrs
    ```
    </details>

ACKs for top commit:
  laanwj:
    Code review and lightly tested ACK e11cdc9303

Tree-SHA512: 89a8c86667ccc0688e5acfdbd399aac1f5bec9f978a160e40b0210b0d9b8fdc338479583fc5bd2e2bc785821363f174f578d52136d228e8f638a20abbf0a568f
2025-11-24 12:33:33 +00:00
merge-script
0cb5c660bb Merge bitcoin/bitcoin#33105: validation: detect witness stripping without re-running Script checks
27aefac42505e9c083fa131d3d7edbec7803f3c0 validation: detect witness stripping without re-running Script checks (Antoine Poinsot)
2907b58834ab011f7dd0c42d323e440abd227c25 policy: introduce a helper to detect whether a transaction spends Segwit outputs (Antoine Poinsot)
eb073209db9efdbc2c94bc1f535a27ec6b20d954 qa: test witness stripping in p2p_segwit (Antoine Poinsot)

Pull request description:

  Since it was introduced in 4eb515574e (#18044), the detection of a stripped witness relies on running the Script checks 3 times. In the worst case, this consists in running Script validation for every single input 3 times.

  Detection of a stripped witness is necessary because in this case wtxid==txid, and the transaction's wtxid must not be added to the reject filter or it could allow a malicious peer to interfere with txid-based orphan resolution as used in 1p1c package relay.

  However it is not necessary to run Script validation to detect a stripped witness (much less so doing it 3 times in a row). There are 3 types of witness program: defined program types (Taproot, P2WPKH and P2WSH), undefined types, and the Pay-to-anchor carve-out.

  For defined program types, Script validation with an empty witness will always fail (by consensus). For undefined program types, Script validation is always going to fail regardless of the witness (by standardness). For P2A, an empty witness is never going to lead to a failure.

  Therefore it holds that we can always detect a stripped witness without re-running Script validation. However this might lead to more "false positives" (cases where we return witness stripping for an otherwise invalid transaction) than the existing implementation. For instance a transaction with one P2PKH input with an invalid signature and one P2WPKH input with its witness stripped. The existing implementation would treat it as consensus invalid while the implementation in this PR would always consider it witness stripped.

  h/t AJ: this essentially implements a variant of https://github.com/bitcoin/bitcoin/pull/33066#issuecomment-3135258539.

ACKs for top commit:
  sipa:
    re-ACK 27aefac42505e9c083fa131d3d7edbec7803f3c0
  Crypt-iQ:
    re-ACK 27aefac42505e9c083fa131d3d7edbec7803f3c0
  glozow:
    reACK 27aefac42505e9c083fa131d3d7edbec7803f3c0

Tree-SHA512: 70cf76b655b52bc8fa2759133315a3f11140844b6b80d9de3c95f592050978cc01a87bd2446e3a9c25cc872efea7659d6da3337b1a709511771fece206e9f149
2025-11-21 00:13:00 +00:00
merge-script
98bd7180c2
Merge ElementsProject/elements#1510: Merge bitcoin#32530: node: cap -maxmempool and -dbcache for 32 bit systems.
8ea4b7aae9 Merge bitcoin/bitcoin#32530: node: cap `-maxmempool` and `-dbcache` values for 32-bit (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/32530

ACKs for top commit:
  delta1:
    ACK 8ea4b7aae9

Tree-SHA512: fc8aea76fd49e05ca2499c40e657451890d84b5424c124b594768821a231138eef64d9b331ccbfa7a2f0e224def45f7f4630a15a7a609d32b68ebfcba76ac64b
2025-11-19 10:16:33 +02:00
merge-script
8ea4b7aae9 Merge bitcoin/bitcoin#32530: node: cap -maxmempool and -dbcache values for 32-bit
9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6 node: cap -dbcache to 1GiB on 32-bit architectures (Antoine Poinsot)
2c43b6adebbfabb3c8dd82fe821ce0a5d6173b3b init: cap -maxmempool to 500 MB on 32-bit systems (Antoine Poinsot)

Pull request description:

  32-bit architecture is limited to 4GiB of RAM, so it doesn't make sense to set a too high value. A too high value could cause an OOM unbeknownst to the user a while after startup as mempool / dbcache fills.

ACKs for top commit:
  achow101:
    ACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  instagibbs:
    utACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  dergoegge:
    Code review ACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6
  glozow:
    utACK 9f8e7b0b3b787b873045a4a8194e77d0b0a2b3b6

Tree-SHA512: cc7541b2c0040fc21a43916caec464dfb443af808f4e85deffa1187448ffff6edb0d69f9ebdb43915d145b8b4694d8465afe548f88da53ccebc9ce4b7c34b735
2025-11-17 14:55:35 +00:00
Pablo Greco
e4990fe9ea
Merge pull request #1506 from psgreco/elem-23.3.1
Prepare 23.3.1
2025-11-17 01:35:17 -08:00
Pablo Greco
b46e2db705
Bump version to 23.3.1 2025-11-12 08:08:14 -08:00
Pablo Greco
6272e08c64
Merge branch 'master' into elem-23.3.1 2025-11-12 08:08:06 -08:00
Byron Hambly
72b7c4646b
Merge pull request #1509 from psgreco/master-fixguix
Guix: fix codeberg link
2025-11-12 16:40:34 +02:00
Pablo Greco
4296205e2f
Guix: fix codeberg link 2025-11-12 04:58:21 -08:00
Byron Hambly
4929fec91a
Merge pull request #1508 from psgreco/elem-23.3.1rc3
Prepare 23.3.1rc3
2025-11-11 15:03:23 +02:00
Pablo Greco
343bd60ce2
Bump version to 23.3.1-rc3 2025-11-11 00:13:25 -08:00
Pablo Greco
959a368701
Update manpages 2025-11-11 00:10:48 -08:00
Pablo Greco
752b11dae7
Merge branch 'master' into elem-23.3.1rc3 2025-11-11 00:10:38 -08:00
Pablo Greco
72f289d81c
Merge pull request #1507 from tomt1664/fix/reissuance-token-moneyrange
Reissuance token amount MoneyRange check
2025-11-11 00:06:42 -08:00
Tom Trevethan
a700d7f2b8 add reissuance token moneyrange check 2025-11-11 00:24:23 +00:00
Pablo Greco
35bc203315
Merge pull request #1504 from psgreco/master-release-gpgkey
Add GPG key for release signing
2025-11-10 04:38:40 -08:00
Pablo Greco
4465853a90
Add GPG key for release signing 2025-11-10 03:43:46 -08:00
Byron Hambly
d7995d8a56
Merge pull request #1503 from psgreco/master-buildfixes
Minor fixes for guix and regular builds
2025-11-05 08:34:28 +02:00
Pablo Greco
000227db76 Fix tag parsing when doing local tagged builds 2025-11-04 05:59:37 -08:00
Pablo Greco
4a131c80e9 guix builds: Use codeberg.org instead of git.savannah.gnu.org
Cherry-picked from 5c2ba9f583
2025-11-04 05:59:27 -08:00
Pablo Greco
eb7d626428
Merge pull request #1497 from delta1/ci/cirrus-macos
ci: fix macos native task
2025-10-23 05:12:13 -07:00
Byron Hambly
8272615241
Merge pull request #1498 from tomt1664/fix/p2p_invalid_messages_test
Fix p2p_invalid_messages functional test
2025-10-16 11:26:47 +02:00
Tom Trevethan
1484272806 fixed payload limit for elements 2025-10-15 16:06:22 +01:00
Byron Hambly
6ad3eebb7f
ci: fix macos native task 2025-10-15 10:22:23 +02:00
Pablo Greco
9d66aa9587
Merge pull request #1495 from psgreco/elem-23.3.1-rc2
Prepare 23.3.1rc2
2025-10-11 05:59:20 -07:00
Pablo Greco
ec67e56d0e Bump version to 23.3.1-rc2 2025-10-07 07:54:16 -07:00
Pablo Greco
afb63a43a6 Merge branch 'master' into elem-23.3.1-rc2 2025-10-07 07:53:22 -07:00
Byron Hambly
af1463a7a1
Merge pull request #1494 from Nazarevsky/fix/tapscript-opcodes-word-reduplication
doc: Remove 'pops a' reduplication
2025-10-02 15:04:34 +02:00
nazarevsky
16799ae3f6
Remove 'pops a' duplication 2025-10-02 13:47:29 +02:00
Pablo Greco
6150a745f9
Merge pull request #1493 from tomt1664/unlimitedissuances_chainparams
acceptunlimitedissuances configurable for CLiquidV1TestParams
2025-09-30 07:08:39 -07:00
Tom Trevethan
2dd017d98c added unlimitedissuance config option for CLiquidV1TestParams 2025-09-30 11:40:24 +01:00
Pablo Greco
cc7aee39b9
Merge pull request #1492 from tomt1664/unlimited_issuance_defaults
Default settings for acceptunlimitedissuances in chainparams
2025-09-29 09:18:04 -07:00
Tom Trevethan
a937d53a23 moved acceptunlimitedissuances to chainparams and set defaults 2025-09-26 14:15:46 +01:00
Byron Hambly
93c84a97f9
fix: unblinded re/issuance for non-policy asset greater than 21 million (#1445)
* test: add test for unblinded re/issuance greater than 21 million

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>

* fix: unblinded re/issuance for greater than 21 million

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>

* enable with param config

* change range check to policy with config option

* refactoring, additional error messages and test extension

---------

Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>
Co-authored-by: Tom Trevethan <ttrevethan@blockstream.com>
2025-09-23 13:17:02 +02:00
Tom Trevethan
e145690b42
apply mandatory coinbase only to policyAsset (#1488)
Co-authored-by: Tom Trevethan <ttrevethan@blockstream.com>
2025-09-19 11:44:39 +01:00
Tom Trevethan
9f1cc945b6
Fix: address error messages and test (#1486)
* fix address error messages and test

* newline

---------

Co-authored-by: Tom Trevethan <ttrevethan@blockstream.com>
2025-08-25 15:05:57 +02:00
Byron Hambly
992147b07e
Merge pull request #1483 from tomt1664/fix/functional_sync
Test: fix intermittent failures for wallet_elements_regression_1259.py and feature_dynafed.py
2025-08-11 11:30:32 +02:00
Tom Trevethan
7532092cbc fix intermittent functional test failures 2025-08-08 14:54:54 +01:00
Pablo Greco
7cb85f19c4
Merge pull request #1477 from ElementsProject/simplicity
Unconditionally accept Simplicity spends in the mempool
2025-08-06 06:20:25 -07:00
Byron Hambly
f49f0a2f8a
Merge pull request #1481 from tomt1664/fix/feature_pak_test
test: fix feature_pak.py test
2025-08-05 18:29:06 +02:00
Tom Trevethan
da9d7c16ce fix feature_pak test 2025-08-05 13:51:27 +01:00
Byron Hambly
b1749fb5ff
Merge pull request #1482 from tomt1664/fix/macos_ci_pip_install
Fix macos CI pip install
2025-08-05 05:55:43 +02:00
Tom Trevethan
fcaa080e8d update macos ci install 2025-08-04 11:36:16 +01:00
Byron Hambly
6e2d87990e
Merge pull request #1333 from delta1/mintxfee
wallet: allow mintxfee=0
2025-07-31 10:07:07 +02:00
Tom Trevethan
2eb5b084bc
Enable sending of different assets to the same address (#1479)
* enable rawtransaction send multiple assets to same address

* fix whitespace

* Update test/functional/feature_issuance.py

Co-authored-by: Byron Hambly <byron@hambly.dev>

* Update test/functional/feature_issuance.py

Co-authored-by: Byron Hambly <byron@hambly.dev>

---------

Co-authored-by: Tom Trevethan <ttrevethan@blockstream.com>
Co-authored-by: Byron Hambly <byron@hambly.dev>
2025-07-30 12:41:37 +01:00
Byron Hambly
3524ec0f83
Merge pull request #1480 from tomt1664/fix/mempool_unbroadcast_test
Fix `mempool_unbroadcast.py` test
2025-07-30 10:17:50 +02:00
Tom Trevethan
c1a47134ff prevent reused utxo 2025-07-28 14:30:09 +01:00