Skip to content

Commit 252d4f1

Browse files
committed
Merge branch 'develop' of https://github.com/stacks-network/stacks-core into feat/signer-subscribe-to-block-events
2 parents 6649c8c + b108d09 commit 252d4f1

Some content is hidden

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

87 files changed

+4443
-1387
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ jobs:
122122
- tests::signer::v0::signer_set_rollover
123123
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
124124
- tests::signer::v0::continue_after_tenure_extend
125+
- tests::signer::v0::tenure_extend_after_idle
126+
- tests::signer::v0::stx_transfers_dont_effect_idle_timeout
127+
- tests::signer::v0::idle_tenure_extend_active_mining
125128
- tests::signer::v0::multiple_miners_with_custom_chain_id
126129
- tests::signer::v0::block_commit_delay
127130
- tests::signer::v0::continue_after_fast_block_no_sortition
@@ -143,6 +146,7 @@ jobs:
143146
- tests::nakamoto_integrations::v3_signer_api_endpoint
144147
- tests::nakamoto_integrations::test_shadow_recovery
145148
- tests::nakamoto_integrations::signer_chainstate
149+
- tests::nakamoto_integrations::sip029_coinbase_change
146150
- tests::nakamoto_integrations::clarity_cost_spend_down
147151
- tests::nakamoto_integrations::v3_blockbyheight_api_endpoint
148152
# TODO: enable these once v1 signer is supported by a new nakamoto epoch

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
99

1010
### Added
1111

12+
### Changed
13+
14+
## [3.1.0.0.1]
15+
16+
### Added
17+
18+
- A miner will now generate a tenure-extend when at least 70% of the signers have confirmed that they are willing to allow one, via the new timestamp included in block responses. This allows the miner to refresh its budget in between Bitcoin blocks. ([#5476](https://github.com/stacks-network/stacks-core/discussions/5476))
19+
20+
### Changed
21+
22+
## [3.1.0.0.0]
23+
24+
### Added
25+
26+
- **SIP-029 consensus rules, activating in epoch 3.1 at block 875,000** (see [SIP-029](https://github.com/stacksgov/sips/blob/main/sips/sip-029/sip-029-halving-alignment.md) for details)
1227
- New RPC endpoints
1328
- `/v2/clarity/marf/:marf_key_hash`
1429
- `/v2/clarity/metadata/:principal/:contract_name/:clarity_metadata_key`
30+
- 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))
1531

1632
### Changed
1733

clarity/src/vm/analysis/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ pub fn run_analysis(
148148
| StacksEpochId::Epoch23
149149
| StacksEpochId::Epoch24
150150
| StacksEpochId::Epoch25
151-
| StacksEpochId::Epoch30 => {
151+
| StacksEpochId::Epoch30
152+
| StacksEpochId::Epoch31 => {
152153
TypeChecker2_1::run_pass(&epoch, &mut contract_analysis, db, build_type_map)
153154
}
154155
StacksEpochId::Epoch10 => {

clarity/src/vm/analysis/type_checker/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ impl FunctionType {
5252
| StacksEpochId::Epoch23
5353
| StacksEpochId::Epoch24
5454
| StacksEpochId::Epoch25
55-
| StacksEpochId::Epoch30 => self.check_args_2_1(accounting, args, clarity_version),
55+
| StacksEpochId::Epoch30
56+
| StacksEpochId::Epoch31 => self.check_args_2_1(accounting, args, clarity_version),
5657
StacksEpochId::Epoch10 => {
5758
return Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
5859
}
@@ -75,7 +76,8 @@ impl FunctionType {
7576
| StacksEpochId::Epoch23
7677
| StacksEpochId::Epoch24
7778
| StacksEpochId::Epoch25
78-
| StacksEpochId::Epoch30 => {
79+
| StacksEpochId::Epoch30
80+
| StacksEpochId::Epoch31 => {
7981
self.check_args_by_allowing_trait_cast_2_1(db, clarity_version, func_args)
8082
}
8183
StacksEpochId::Epoch10 => {

clarity/src/vm/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ mod test {
353353
) -> std::result::Result<ExecutionCost, CostErrors> {
354354
self.invoked_functions.push((cost_f, input.to_vec()));
355355
self.invocation_count += 1;
356-
Ok(ExecutionCost::zero())
356+
Ok(ExecutionCost::ZERO)
357357
}
358358
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
359359
self.cost_addition_count += 1;

clarity/src/vm/costs/mod.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl CostTracker for () {
140140
_cost_function: ClarityCostFunction,
141141
_input: &[u64],
142142
) -> std::result::Result<ExecutionCost, CostErrors> {
143-
Ok(ExecutionCost::zero())
143+
Ok(ExecutionCost::ZERO)
144144
}
145145
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
146146
Ok(())
@@ -707,7 +707,7 @@ impl LimitedCostTracker {
707707
contract_call_circuits: HashMap::new(),
708708
limit,
709709
memory_limit: CLARITY_MEMORY_LIMIT,
710-
total: ExecutionCost::zero(),
710+
total: ExecutionCost::ZERO,
711711
memory: 0,
712712
epoch,
713713
mainnet,
@@ -731,7 +731,7 @@ impl LimitedCostTracker {
731731
contract_call_circuits: HashMap::new(),
732732
limit,
733733
memory_limit: CLARITY_MEMORY_LIMIT,
734-
total: ExecutionCost::zero(),
734+
total: ExecutionCost::ZERO,
735735
memory: 0,
736736
epoch,
737737
mainnet,
@@ -775,7 +775,8 @@ impl LimitedCostTracker {
775775
| StacksEpochId::Epoch23
776776
| StacksEpochId::Epoch24
777777
| StacksEpochId::Epoch25
778-
| StacksEpochId::Epoch30 => COSTS_3_NAME.to_string(),
778+
| StacksEpochId::Epoch30
779+
| StacksEpochId::Epoch31 => COSTS_3_NAME.to_string(),
779780
};
780781
Ok(result)
781782
}
@@ -879,7 +880,7 @@ impl LimitedCostTracker {
879880
pub fn get_total(&self) -> ExecutionCost {
880881
match self {
881882
Self::Limited(TrackerData { total, .. }) => total.clone(),
882-
Self::Free => ExecutionCost::zero(),
883+
Self::Free => ExecutionCost::ZERO,
883884
}
884885
}
885886
#[allow(clippy::panic)]
@@ -1049,7 +1050,7 @@ impl CostTracker for LimitedCostTracker {
10491050
match self {
10501051
Self::Free => {
10511052
// tracker is free, return zero!
1052-
return Ok(ExecutionCost::zero());
1053+
return Ok(ExecutionCost::ZERO);
10531054
}
10541055
Self::Limited(ref mut data) => {
10551056
if cost_function == ClarityCostFunction::Unimplemented {
@@ -1194,15 +1195,13 @@ impl CostOverflowingMath<u64> for u64 {
11941195
}
11951196

11961197
impl ExecutionCost {
1197-
pub fn zero() -> ExecutionCost {
1198-
Self {
1199-
runtime: 0,
1200-
write_length: 0,
1201-
read_count: 0,
1202-
write_count: 0,
1203-
read_length: 0,
1204-
}
1205-
}
1198+
pub const ZERO: Self = Self {
1199+
runtime: 0,
1200+
write_length: 0,
1201+
read_count: 0,
1202+
write_count: 0,
1203+
read_length: 0,
1204+
};
12061205

12071206
/// Returns the percentage of self consumed in `numerator`'s largest proportion dimension.
12081207
pub fn proportion_largest_dimension(&self, numerator: &ExecutionCost) -> u64 {
@@ -1327,6 +1326,10 @@ impl ExecutionCost {
13271326
read_length: first.read_length.max(second.read_length),
13281327
}
13291328
}
1329+
1330+
pub fn is_zero(&self) -> bool {
1331+
*self == Self::ZERO
1332+
}
13301333
}
13311334

13321335
// ONLY WORKS IF INPUT IS u64

clarity/src/vm/functions/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ macro_rules! switch_on_global_epoch {
6363
StacksEpochId::Epoch25 => $Epoch205Version(args, env, context),
6464
// Note: We reuse 2.05 for 3.0.
6565
StacksEpochId::Epoch30 => $Epoch205Version(args, env, context),
66+
// Note: We reuse 2.05 for 3.1.
67+
StacksEpochId::Epoch31 => $Epoch205Version(args, env, context),
6668
}
6769
}
6870
};

clarity/src/vm/test_util/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ pub fn generate_test_burn_state_db(epoch_id: StacksEpochId) -> UnitTestBurnState
5252
| StacksEpochId::Epoch23
5353
| StacksEpochId::Epoch24
5454
| StacksEpochId::Epoch25
55-
| StacksEpochId::Epoch30 => UnitTestBurnStateDB {
55+
| StacksEpochId::Epoch30
56+
| StacksEpochId::Epoch31 => UnitTestBurnStateDB {
5657
epoch_id,
5758
ast_rules: ASTRules::PrecheckSize,
5859
},

clarity/src/vm/tests/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ epochs_template! {
122122
Epoch24,
123123
Epoch25,
124124
Epoch30,
125+
Epoch31,
125126
}
126127

127128
clarity_template! {
@@ -140,6 +141,9 @@ clarity_template! {
140141
(Epoch30, Clarity1),
141142
(Epoch30, Clarity2),
142143
(Epoch30, Clarity3),
144+
(Epoch31, Clarity1),
145+
(Epoch31, Clarity2),
146+
(Epoch31, Clarity3),
143147
}
144148

145149
#[cfg(test)]

clarity/src/vm/types/signatures.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ impl TypeSignature {
587587
| StacksEpochId::Epoch23
588588
| StacksEpochId::Epoch24
589589
| StacksEpochId::Epoch25
590-
| StacksEpochId::Epoch30 => self.admits_type_v2_1(other),
590+
| StacksEpochId::Epoch30
591+
| StacksEpochId::Epoch31 => self.admits_type_v2_1(other),
591592
StacksEpochId::Epoch10 => {
592593
return Err(CheckErrors::Expects("epoch 1.0 not supported".into()))
593594
}
@@ -800,7 +801,8 @@ impl TypeSignature {
800801
| StacksEpochId::Epoch23
801802
| StacksEpochId::Epoch24
802803
| StacksEpochId::Epoch25
803-
| StacksEpochId::Epoch30 => self.canonicalize_v2_1(),
804+
| StacksEpochId::Epoch30
805+
| StacksEpochId::Epoch31 => self.canonicalize_v2_1(),
804806
}
805807
}
806808

@@ -1158,7 +1160,8 @@ impl TypeSignature {
11581160
| StacksEpochId::Epoch23
11591161
| StacksEpochId::Epoch24
11601162
| StacksEpochId::Epoch25
1161-
| StacksEpochId::Epoch30 => Self::least_supertype_v2_1(a, b),
1163+
| StacksEpochId::Epoch30
1164+
| StacksEpochId::Epoch31 => Self::least_supertype_v2_1(a, b),
11621165
StacksEpochId::Epoch10 => {
11631166
return Err(CheckErrors::Expects("epoch 1.0 not supported".into()))
11641167
}

0 commit comments

Comments
 (0)