From f8169d13f3a7ea7492ec8d9301e447206e686553 Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Fri, 6 Dec 2024 15:18:31 -0800 Subject: [PATCH 1/3] fix: when validating a block, clone the blocks version --- stackslib/src/net/api/postblock_proposal.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/stackslib/src/net/api/postblock_proposal.rs b/stackslib/src/net/api/postblock_proposal.rs index 27a930d634..bb2fbf375e 100644 --- a/stackslib/src/net/api/postblock_proposal.rs +++ b/stackslib/src/net/api/postblock_proposal.rs @@ -538,6 +538,7 @@ impl NakamotoBlockProposal { } let mut block = builder.mine_nakamoto_block(&mut tenure_tx); + block.header.version = self.block.header.version; let size = builder.get_bytes_so_far(); let cost = builder.tenure_finish(tenure_tx)?; From 4e18e0fe4613a2f5ea16cc57fac61d7344518231 Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Sat, 7 Dec 2024 16:54:22 -0800 Subject: [PATCH 2/3] fix: add comment when cloning proposed block's version --- stackslib/src/net/api/postblock_proposal.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stackslib/src/net/api/postblock_proposal.rs b/stackslib/src/net/api/postblock_proposal.rs index bb2fbf375e..2f35f29a18 100644 --- a/stackslib/src/net/api/postblock_proposal.rs +++ b/stackslib/src/net/api/postblock_proposal.rs @@ -538,6 +538,9 @@ impl NakamotoBlockProposal { } let mut block = builder.mine_nakamoto_block(&mut tenure_tx); + // Override the block version with the one from the proposal. This must be + // done before computing the block hash, because the block hash includes the + // version in its computation. block.header.version = self.block.header.version; let size = builder.get_bytes_so_far(); let cost = builder.tenure_finish(tenure_tx)?; From 4f5f6f606612bfc719f7a273bab5e90be771d134 Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Sat, 7 Dec 2024 17:04:16 -0800 Subject: [PATCH 3/3] feat: changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f383cb596c..76bc175722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE - New RPC endpoints - `/v2/clarity/marf/:marf_key_hash` - `/v2/clarity/metadata/:principal/:contract_name/:clarity_metadata_key` +- When a proposed block is validated by a node, the block can be validated even when the block version is different than the node's default ([#5539](https://github.com/stacks-network/stacks-core/pull/5539)) ### Changed