Cherry picks from 23.x into 23.3.x - #1599
Open
psgreco wants to merge 12 commits into
Open
Conversation
(cherry picked from commit 6253d7e)
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All clean cherry picks from 23.x branch, in preparation for 23.3.4rc2