Skip to content

Commit 8c99a12

Browse files
authored
Merge pull request #5461 from stacks-network/feat/sip-029
feat/SIP-029
2 parents 583b857 + e4a042b commit 8c99a12

File tree

37 files changed

+1229
-83
lines changed

37 files changed

+1229
-83
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
- tests::nakamoto_integrations::v3_signer_api_endpoint
143143
- tests::nakamoto_integrations::test_shadow_recovery
144144
- tests::nakamoto_integrations::signer_chainstate
145+
- tests::nakamoto_integrations::sip029_coinbase_change
145146
- tests::nakamoto_integrations::clarity_cost_spend_down
146147
- tests::nakamoto_integrations::v3_blockbyheight_api_endpoint
147148
# TODO: enable these once v1 signer is supported by a new nakamoto epoch

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/costs/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
}

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
}

clarity/src/vm/version.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl ClarityVersion {
4040
StacksEpochId::Epoch24 => ClarityVersion::Clarity2,
4141
StacksEpochId::Epoch25 => ClarityVersion::Clarity2,
4242
StacksEpochId::Epoch30 => ClarityVersion::Clarity3,
43+
StacksEpochId::Epoch31 => ClarityVersion::Clarity3,
4344
}
4445
}
4546
}

stacks-common/src/libcommon.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ pub mod consts {
8181
pub const PEER_VERSION_EPOCH_2_4: u8 = 0x09;
8282
pub const PEER_VERSION_EPOCH_2_5: u8 = 0x0a;
8383
pub const PEER_VERSION_EPOCH_3_0: u8 = 0x0b;
84+
pub const PEER_VERSION_EPOCH_3_1: u8 = 0x0c;
8485

8586
/// this should be updated to the latest network epoch version supported by
8687
/// this node. this will be checked by the `validate_epochs()` method.
87-
pub const PEER_NETWORK_EPOCH: u32 = PEER_VERSION_EPOCH_3_0 as u32;
88+
pub const PEER_NETWORK_EPOCH: u32 = PEER_VERSION_EPOCH_3_1 as u32;
8889

8990
/// set the fourth byte of the peer version
9091
pub const PEER_VERSION_MAINNET: u32 = PEER_VERSION_MAINNET_MAJOR | PEER_NETWORK_EPOCH;
@@ -93,6 +94,9 @@ pub mod consts {
9394
/// network identifiers
9495
pub const NETWORK_ID_MAINNET: u32 = 0x17000000;
9596
pub const NETWORK_ID_TESTNET: u32 = 0xff000000;
97+
98+
/// number of uSTX per STX
99+
pub const MICROSTACKS_PER_STACKS: u32 = 1_000_000;
96100
}
97101

98102
/// This test asserts that the constant above doesn't change.

0 commit comments

Comments
 (0)