Skip to content

Commit 1b2198f

Browse files
committed
docs: add comment to highlight that deserialize is consensus-critical
1 parent 4417826 commit 1b2198f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

stacks-common/src/deps_common/bitcoin/network/serialize.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ where
188188

189189
/// Deserialize an object from a vector, will error if said deserialization
190190
/// doesn't consume the entire vector.
191+
///
192+
/// # Consensus-critical
193+
///
194+
/// This function is consensus-critical: it is used to parse sortition-relevant
195+
/// Bitcoin transactions, and is reachable from Clarity contract execution. Any
196+
/// change that causes a given input to produce a different output — including
197+
/// making a previously-parseable transaction unparseable or vice versa (e.g.
198+
/// adopting a new BIP that alters transaction structure) is a consensus change
199+
/// and must be gated behind an epoch boundary.
191200
pub fn deserialize<'a, T>(data: &'a [u8]) -> Result<T, Error>
192201
where
193202
T: ConsensusDecodable<RawDecoder<Cursor<&'a [u8]>>>,

0 commit comments

Comments
 (0)