Skip to content

Conversation

@dathonohm
Copy link

@dathonohm dathonohm commented Nov 15, 2025

ReducedData Temporary Softfork, implemented as a MASF

See bitcoin/bips#2017 for the BIP.

luke-jr and others added 30 commits November 14, 2025 21:22
…to reduce data push size limit to 256 bytes (except for P2SH redeemScript push)
…l never), limit non-OP_RETURN scripts to 34 bytes
…BLE_WITNESS_PROGRAM,UPGRADABLE_TAPROOT_VERSION,OP_SUCCESS}
…AM,UPGRADABLE_TAPROOT_VERSION,OP_SUCCESS} on blocks when DEPLOYMENT_REDUCED_DATA is active (never yet)
Github-Pull: bitcoin#10532
Rebased-From: cd74a23fcf9588199e196ab31bc64972400c2027
… risk

Github-Pull: bitcoin#10532
Rebased-From: e42a2f6beb61df3e3a201804cf3bcce6b00c88ba
3c853b6299 and others added 20 commits November 14, 2025 21:37
…imit; add reduced_data deployment name to allow regtest RPC access for testing
…DUCED_DATA); adapt 6 tests to NODE_BIP148 service flag; add assert_equal_without_usage helper for testmempoolaccept results
…eviction threshold

The test was failing because commit 58a329b changed gen_return_txouts()
from using 1 large OP_RETURN output to 734 small OP_RETURN outputs (to
comply with the new MAX_OUTPUT_SCRIPT_SIZE=34 consensus rule in bip444).

This change altered how fill_mempool() fills the mempool, raising the
eviction threshold from ~0.68 sat/vB to ~1.10 sat/vB. The test's
create_package_2p1c() was using hardcoded feerates (1.0 and 2.0 sat/vB),
causing parent1 to be below the new eviction threshold and get rejected.

Solution: Calculate parent feerates dynamically based on the actual
mempoolminfee after fill_mempool() runs. This makes the test robust to
future changes in mempool dynamics.

- Store mempoolminfee in raise_network_minfee()
- Use 2x and 4x mempoolminfee for parent1 and parent2 feerates
- Add logging to show the calculated feerates

Test results with fix:
- mempoolminfee: 1.101 sat/vB
- parent1: 2.202 sat/vB (2x threshold) → accepted ✓
- parent2: 4.404 sat/vB (4x threshold) → accepted ✓
The test was expecting services string ending with "nwl2?" but now
receives "nwl1" because NODE_BIP148 is advertised (BIP148 service bit
is represented as "1" in the services string).

Updated regex pattern from "nwl2?" to "nwl[12]?" to accept both the
BIP148 service bit (1) and any other service bits that may be represented
as (2).
…coding

The test was expecting addrv2 messages to be 187 bytes, but they're now
227 bytes due to the BIP148 service bit being added to P2P_SERVICES.

P2P_SERVICES is now NODE_NETWORK | NODE_WITNESS | NODE_BIP148 = 0x08000009,
which requires 5 bytes in CompactSize encoding (not 1 byte as before).

Updated calc_addrv2_msg_size() to properly calculate the services field
size using ser_compact_size() instead of assuming 1 byte.

Difference: 5 bytes - 1 byte = 4 bytes per address × 10 addresses = 40 bytes
187 + 40 = 227 bytes ✓
The addpeeraddress RPC was creating addresses with only NODE_NETWORK |
NODE_WITNESS, but the node requires NODE_BIP148 for outbound connections
(added in commit c684ff1 from 2017).

ThreadOpenConnections filters addresses using HasAllDesirableServiceFlags,
which requires NODE_NETWORK | NODE_WITNESS | NODE_BIP148. Addresses
without NODE_BIP148 are skipped entirely, making addpeeraddress useless
for its intended testing purpose.

This fix updates addpeeraddress to match production requirements, allowing
test-added addresses to actually be used for outbound connections.

Fixes p2p_seednode.py test which was failing because addresses added via
addpeeraddress were being filtered out, preventing "trying v1 connection"
log messages from appearing.
…gin from reduced_data script validation rules
Adapt unit tests to comply with REDUCED_DATA restrictions:
- Add REDUCED_DATA flag to mapFlagNames in transaction_tests
- Update witness test from 520-byte to 256-byte push limit
- Accept SCRIPT_ERR_PUSH_SIZE in miniscript satisfaction tests
- Update Taproot tree depth tests from 128 to 7 levels
- Fix descriptor error message to report correct nesting limit (7)

REDUCED_DATA enforces MAX_SCRIPT_ELEMENT_SIZE_REDUCED (256 bytes)
and TAPROOT_CONTROL_MAX_NODE_COUNT_REDUCED (7 levels) at the
policy level via STANDARD_SCRIPT_VERIFY_FLAGS.
Replace thresh(2,pk(...),s:pk(...),adv:older(42)) with
and_v(v:pk(...),pk(...)) because thresh() uses OP_IF opcodes
which are completely forbidden in Tapscript when REDUCED_DATA
is active (see src/script/interpreter.cpp:621-623).

The and_v() construction provides equivalent 2-of-2 multisig
functionality without conditional branching, making it
compatible with REDUCED_DATA restrictions.

Also update line 1010 test to expect "tr() supports at most 7
nesting levels" error instead of multi() error, as the test's
22 opening braces exceed REDUCED_DATA's 7-level limit before
the parser can discover the multi() error.
Add NODE_BIP444 flag to GetDesirableServiceFlags assertions in
peerman_tests and to service flags in denialofservice_tests and
net_tests peer setup.

NODE_BIP444 (bit 27) signals BIP444/REDUCED_DATA enforcement and
is now included in desirable service flags alongside NODE_NETWORK
and NODE_WITNESS for peer connections.
@dathonohm dathonohm changed the title Bip9 temporary ReducedData Temporary Softfork Nov 15, 2025
Copy link
Collaborator

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strongly disagree with reviving BIP9, especially giving miners decision-making authority over any protocol change. At the very least, there should be an end height where it activates unconditionally.

For merging, this also needs to demonstrate strong community acceptance. I understand there are bad actors and trolls who will fabricate objections, and the importance of activating this quickly even if support isn't as strong as might be needed for a new feature, but try to do what you can.

@dathonohm
Copy link
Author

Closing in favor of #238.

All review comments from this PR have been either resolved or carried forward to the new PR.

@dathonohm dathonohm closed this Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants