Skip to content

Cherry picks from 23.x into 23.3.x - #1599

Open
psgreco wants to merge 12 commits into
ElementsProject:elements-23.3.xfrom
psgreco:elem-23.3.x-picks
Open

Cherry picks from 23.x into 23.3.x#1599
psgreco wants to merge 12 commits into
ElementsProject:elements-23.3.xfrom
psgreco:elem-23.3.x-picks

Conversation

@psgreco

@psgreco psgreco commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

All clean cherry picks from 23.x branch, in preparation for 23.3.4rc2

delta1 and others added 12 commits September 3, 2026 10:36
CreateAssetSurjectionProof asserted on secp256k1_surjectionproof_generate
and _verify failure. A crafted PSET can supply unrelated tags/generators
with no known discrete-log relationship, causing generation to fail and the
assert to abort the process. Make these recoverable errors by returning
false.

(cherry picked from commit 2391041)
BlindPSBT passed the blinding pubkey straight to CKey::ECDH, whose only
validation is an assert on the peer key, so a crafted off-curve pubkey
(reaching IsBlinded() but failing IsFullyValid()) aborted the process.
Mirror the non-PSET path and return BlindingStatus::INVALID_BLINDER when the
pubkey is not fully valid.

(cherry picked from commit 0ce3c24)
BlindPSBT dereferenced output.amount without a nullopt check. A crafted v0
PSET output (m_blinder_index set, amount absent) reached the blinding loop
and dereferenced a disengaged std::optional, which is undefined behaviour.
Refuse such outputs with BlindingStatus::INVALID_BLINDER.

(cherry picked from commit 6a49991)
NextBlockIsParameterTransition computed the approval threshold as
(epoch_length*4)/5, which floor-divides. For epoch lengths not divisible by
5 this is below the intended at-least-four-fifths rule, so a transition
could pass with fewer than 80% of the epoch's blocks voting for it.

Use the overflow-safe ceiling N - N/5 (== ceil(N*4/5)). This is a no-op for
epoch lengths divisible by 5 (the only currently deployed case) and only
corrects the under-approximation for non-divisible epoch lengths.

(cherry picked from commit 4309282)
…ueProof

A range-membership proof whose lower bound equalled the displayed PSET
amount was accepted even when the committed value was larger, because only
min_value was compared. Require both verified bounds to equal the claimed
amount so a proof can no longer understate an output's value.

(cherry picked from commit 99e9f25)
An explicit 9-byte value (or a null field) passed the IsNull() check and
its buffer was then parsed as a 33-byte Pedersen commitment, reading past
the end. Require IsCommitment() on both the value and asset fields so the
parser's length precondition holds and the out-of-bounds read is avoided.

(cherry picked from commit 3e11e03)
The raw-blind RPC path can reach SurjectOutput with an empty
surjection_targets vector (a zero-input tx with multiple blindable
outputs), which indexed element [0] of the empty vector and passed it to
secp256k1_surjectionproof_initialize, triggering undefined behaviour.
Reject empty target sets up front, matching the existing over-limit guard.

(cherry picked from commit 7c23bd1)
04aa60c build: add simplicity/cmr.c to src/CMakeLists.txt (Byron Hambly)
e15a625 Squashed 'src/simplicity/' changes from 49b96499a6..abede47eb8 (Byron Hambly)

Pull request description:

  Updates the simplicity subtree to abede47eb835f5d39568cc705cefe5bf9e6ee769 matching BlockstreamResearch/simplicity#348

ACKs for top commit:
  tomt1664:
    ACK 04aa60c tested locally

Tree-SHA512: 6e4b1a640398f8a3017bab2ea94704bb6166612b239069512e9fcb831cbac502a4efab4517ca9c54d39fdee731d9a1cce9374df4d16ee6f63ff23bb090d42c19
(cherry picked from commit f80fb30)
In CreatePeginWitnessInner, the MerkleBlock is always serialized without
witness: PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS

In DecomposePeginWitness before this change, the MerkleBlock was
deserialized with witness: PROTOCOL_VERSION

This was only noticed as an issue in the pegin subsidy implementation,
in a failure in the feature_dynafed functional test. In the
test_transition_mempool_eject test case, the Merkle block proof is coming
from the same chain where we are creating a pegin.

See the comment: "hack: since we're not validating peg-ins in parent chain,
just make both the funding and claim tx on same chain (printing money)"

I haven't investigated enough to explain why this causes a
deserialization failure in this specific case, but presumably this change
is correct since we're always serializing without witness. Before this
DecomposePeginWitness was only used in src/psbt.cpp

(cherry picked from commit f3b63f4)
…d rangeproofs

a9db3b1 Add startup warning for signed-blocks parent chain (Tom Trevethan)
246c5ab Add virtual desctructor to CChainParams (Tom Trevethan)
779e71f PAK enforcement on confidential nAsset (Tom Trevethan)
ffd91c0 PartiallySignedTransaction::SetupFromTx indexes vtxinwit checked (Tom Trevethan)
84a05e3 check pubkey validity in tweakfedpegscript to prevent assert failure (Tom Trevethan)
3a8dec1 Return error for psbt if explicit amounts/assets deleted (Tom Trevethan)
4e5ca94 Return error for invalid rangproof amounts (Tom Trevethan)

Pull request description:

  Fixes for a number of issues with RPC errors for invalid PSBTs and amounts/rangeproofs.

ACKs for top commit:
  delta1:
    ACK a9db3b1; tested locally

Tree-SHA512: bf35348a5fad30e0f1f2b3caa2ec35ec521b583155e97f3a5f2504a3d70b41677f215fc01b28ccd30706ff5a7d021afb74c110a2c8f270942f5cba344544a55d
(cherry picked from commit 3d7134f)
    Github-Pull: #15973
    Rebased-From: 7fd7901

(cherry picked from commit ff69c2f)
@psgreco
psgreco requested review from delta1 and tomt1664 September 4, 2026 19:36
@psgreco psgreco self-assigned this Sep 4, 2026
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.

3 participants