Skip to content

Commit 837f4a4

Browse files
authored
Merge branch 'develop' into fix/agg-increase-event
2 parents cbd2037 + 41e57ef commit 837f4a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+992
-63
lines changed

.github/actions/dockerfiles/Dockerfile.alpine-binary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ RUN case ${TARGETPLATFORM} in \
2323
&& unzip ${BIN_ARCH}.zip -d /out
2424

2525
FROM --platform=${TARGETPLATFORM} alpine
26-
COPY --from=builder /out/stacks-node /bin/
26+
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
2727
CMD ["stacks-node", "mainnet"]

.github/actions/dockerfiles/Dockerfile.debian-binary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ RUN case ${TARGETPLATFORM} in \
2323
&& unzip ${BIN_ARCH}.zip -d /out
2424

2525
FROM --platform=${TARGETPLATFORM} debian:bookworm
26-
COPY --from=builder /out/stacks-node /bin/
26+
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
2727
CMD ["stacks-node", "mainnet"]

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
- tests::signer::stackerdb_delayed_dkg
9393
# Do not run this one until we figure out why it fails in CI
9494
# - tests::neon_integrations::bitcoin_reorg_flap
95+
# - tests::neon_integrations::bitcoin_reorg_flap_with_follower
9596
steps:
9697
## Setup test environment
9798
- name: Setup Test Environment

.github/workflows/github-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
draft: false
7171
prerelease: true
7272
fail_on_unmatched_files: true
73+
target_commitish: ${{ github.sha }}
74+
generate_release_notes: true
7375
files: |
7476
release/*.zip
7577
CHECKSUMS.txt

CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,30 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8-
## [Next-Branch]
8+
## [2.5.0.0.3]
9+
10+
This release fixes a regression in `2.5.0.0.0` from `2.4.0.1.0` caused by git merge
11+
12+
## [2.5.0.0.2]
13+
14+
This release fixes two bugs in `2.5.0.0.0`, correctly setting the activation height for 2.5, and the network peer version.
15+
16+
## [2.5.0.0.0]
17+
18+
This release implements the 2.5 Stacks consensus rules which activates at Bitcoin block `840,360`: primarily the instantiation
19+
of the pox-4 contract. For more details see SIP-021.
20+
21+
This is the first consensus-critical release for Nakamoto. Nodes which do not update before the 2.5 activation height will be forked away from the rest of the network. This release is compatible with 2.4.x chain state directories and does not require resyncing from genesis. The first time a node boots with this version it will perform some database migrations which could lengthen the normal node startup time.
22+
23+
**This is a required release before Nakamoto rules are enabled in 3.0.**
24+
25+
26+
### Timing of Release from 2.5 to 3.0
27+
28+
Activating Nakamoto will include two epochs:
29+
30+
- **Epoch 2.5:** Pox-4 contract is booted up but no Nakamoto consensus rules take effect.
31+
- **Epoch 3:** Nakamoto consensus rules take effect.
932

1033
### Added
1134

clarity/src/vm/contexts.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ impl<'a, 'b, 'hooks> Environment<'a, 'b, 'hooks> {
13401340
self.global_context.begin();
13411341
let result = stx_transfer_consolidated(self, from, to, amount, memo);
13421342
match result {
1343-
Ok(value) => match value.clone().expect_result() {
1343+
Ok(value) => match value.clone().expect_result()? {
13441344
Ok(_) => {
13451345
self.global_context.commit()?;
13461346
Ok(value)
@@ -1966,8 +1966,14 @@ impl CallStack {
19661966

19671967
#[cfg(test)]
19681968
mod test {
1969+
use stacks_common::types::chainstate::StacksAddress;
1970+
use stacks_common::util::hash::Hash160;
1971+
19691972
use super::*;
19701973
use crate::vm::callables::DefineType;
1974+
use crate::vm::tests::{
1975+
test_epochs, tl_env_factory, MemoryEnvironmentGenerator, TopLevelMemoryEnvironmentGenerator,
1976+
};
19711977
use crate::vm::types::signatures::CallableSubtype;
19721978
use crate::vm::types::{FixedFunction, FunctionArg, FunctionType, StandardPrincipalData};
19731979

@@ -2123,6 +2129,35 @@ mod test {
21232129
assert_eq!(table[&p2][&t7], AssetMapEntry::Burn(35 + 36));
21242130
}
21252131

2132+
/// Test the stx-transfer consolidation tx invalidation
2133+
/// bug from 2.4.0.1.0-rc1
2134+
#[apply(test_epochs)]
2135+
fn stx_transfer_consolidate_regr_24010(
2136+
epoch: StacksEpochId,
2137+
mut tl_env_factory: TopLevelMemoryEnvironmentGenerator,
2138+
) {
2139+
let mut env = tl_env_factory.get_env(epoch);
2140+
let u1 = StacksAddress {
2141+
version: 0,
2142+
bytes: Hash160([1; 20]),
2143+
};
2144+
let u2 = StacksAddress {
2145+
version: 0,
2146+
bytes: Hash160([2; 20]),
2147+
};
2148+
// insufficient balance must be a non-includable transaction. it must error here,
2149+
// not simply rollback the tx and squelch the error as includable.
2150+
let e = env
2151+
.stx_transfer(
2152+
&PrincipalData::from(u1.clone()),
2153+
&PrincipalData::from(u2.clone()),
2154+
1000,
2155+
&BuffData::empty(),
2156+
)
2157+
.unwrap_err();
2158+
assert_eq!(e.to_string(), "Interpreter(InsufficientBalance)");
2159+
}
2160+
21262161
#[test]
21272162
fn test_canonicalize_contract_context() {
21282163
let trait_id = TraitIdentifier::new(

clarity/src/vm/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl MemoryEnvironmentGenerator {
149149

150150
pub struct TopLevelMemoryEnvironmentGenerator(MemoryBackingStore);
151151
impl TopLevelMemoryEnvironmentGenerator {
152-
fn get_env(&mut self, epoch: StacksEpochId) -> OwnedEnvironment {
152+
pub fn get_env(&mut self, epoch: StacksEpochId) -> OwnedEnvironment {
153153
let owned_env = OwnedEnvironment::new(self.0.as_clarity_db(), epoch);
154154
owned_env
155155
}

pox-locking/src/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn create_event_info_data_code(
288288
;; Get start cycle ID
289289
start-cycle-id: (+ (current-pox-reward-cycle) u1 pox-set-offset),
290290
}}
291-
}}
291+
}})
292292
"#,
293293
stacker = &args[0],
294294
pox_addr = &args[1],

stackslib/src/burnchains/affirmation.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,14 @@ fn inner_find_heaviest_block_commit_ptr(
788788
}
789789

790790
if let Some(last_vtxindex) = last_vtxindex.as_mut() {
791-
assert!(*last_vtxindex < opdata.vtxindex);
791+
assert!(
792+
*last_vtxindex < opdata.vtxindex,
793+
"{} !< {} at block {} (op {:?})",
794+
*last_vtxindex,
795+
opdata.vtxindex,
796+
opdata.block_height,
797+
&opdata
798+
);
792799
*last_vtxindex = opdata.vtxindex;
793800
} else {
794801
last_vtxindex = Some(opdata.vtxindex);

stackslib/src/burnchains/db.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ CREATE TABLE burnchain_db_block_ops (
232232
-- 32-byte transaction ID
233233
txid TEXT NOT NULL,
234234
235+
-- This should have been present when we created this table, but we forgot.
236+
-- So instead, query methods against this table need to use REPLACE INTO and
237+
-- SELECT DISTINCT for compatibility.
238+
-- PRIMARY KEY(txid,block_hash),
239+
235240
-- ensure that the operation corresponds to an actual block
236241
FOREIGN KEY(block_hash) REFERENCES burnchain_db_block_headers(block_hash)
237242
);
@@ -432,7 +437,8 @@ impl<'a> BurnchainDBTransaction<'a> {
432437
) -> Result<(), BurnchainError> {
433438
// find all block-commits for this block
434439
let commits: Vec<LeaderBlockCommitOp> = {
435-
let block_ops_qry = "SELECT * FROM burnchain_db_block_ops WHERE block_hash = ?";
440+
let block_ops_qry =
441+
"SELECT DISTINCT * FROM burnchain_db_block_ops WHERE block_hash = ?";
436442
let block_ops = query_rows(&self.sql_tx, block_ops_qry, &[&hdr.block_hash])?;
437443
block_ops
438444
.into_iter()
@@ -891,7 +897,7 @@ impl<'a> BurnchainDBTransaction<'a> {
891897
block_header: &BurnchainBlockHeader,
892898
block_ops: &[BlockstackOperationType],
893899
) -> Result<(), BurnchainError> {
894-
let sql = "INSERT INTO burnchain_db_block_ops
900+
let sql = "REPLACE INTO burnchain_db_block_ops
895901
(block_hash, txid, op) VALUES (?, ?, ?)";
896902
let mut stmt = self.sql_tx.prepare(sql)?;
897903
for op in block_ops.iter() {
@@ -1133,7 +1139,7 @@ impl BurnchainDB {
11331139
) -> Result<BurnchainBlockData, BurnchainError> {
11341140
let block_header_qry =
11351141
"SELECT * FROM burnchain_db_block_headers WHERE block_hash = ? LIMIT 1";
1136-
let block_ops_qry = "SELECT * FROM burnchain_db_block_ops WHERE block_hash = ?";
1142+
let block_ops_qry = "SELECT DISTINCT * FROM burnchain_db_block_ops WHERE block_hash = ?";
11371143

11381144
let block_header = query_row(conn, block_header_qry, &[block])?
11391145
.ok_or_else(|| BurnchainError::UnknownBlock(block.clone()))?;
@@ -1150,7 +1156,8 @@ impl BurnchainDB {
11501156
burn_header_hash: &BurnchainHeaderHash,
11511157
txid: &Txid,
11521158
) -> Option<BlockstackOperationType> {
1153-
let qry = "SELECT op FROM burnchain_db_block_ops WHERE txid = ?1 AND block_hash = ?2";
1159+
let qry =
1160+
"SELECT DISTINCT op FROM burnchain_db_block_ops WHERE txid = ?1 AND block_hash = ?2";
11541161
let args: &[&dyn ToSql] = &[txid, burn_header_hash];
11551162

11561163
match query_row(conn, qry, args) {
@@ -1169,7 +1176,7 @@ impl BurnchainDB {
11691176
indexer: &B,
11701177
txid: &Txid,
11711178
) -> Option<BlockstackOperationType> {
1172-
let qry = "SELECT op FROM burnchain_db_block_ops WHERE txid = ?1";
1179+
let qry = "SELECT DISTINCT op FROM burnchain_db_block_ops WHERE txid = ?1";
11731180
let args: &[&dyn ToSql] = &[txid];
11741181

11751182
let ops: Vec<BlockstackOperationType> =

0 commit comments

Comments
 (0)