Skip to content

Commit 841c449

Browse files
committed
first boilerplate code for epoch 3.2
1 parent 38b7c30 commit 841c449

File tree

24 files changed

+298
-40
lines changed

24 files changed

+298
-40
lines changed

clarity/src/vm/analysis/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ pub fn run_analysis(
152152
| StacksEpochId::Epoch24
153153
| StacksEpochId::Epoch25
154154
| StacksEpochId::Epoch30
155-
| StacksEpochId::Epoch31 => {
155+
| StacksEpochId::Epoch31
156+
| StacksEpochId::Epoch32 => {
156157
TypeChecker2_1::run_pass(&epoch, &mut contract_analysis, db, build_type_map)
157158
}
158159
StacksEpochId::Epoch10 => {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ impl FunctionType {
4545
| StacksEpochId::Epoch24
4646
| StacksEpochId::Epoch25
4747
| StacksEpochId::Epoch30
48-
| StacksEpochId::Epoch31 => self.check_args_2_1(accounting, args, clarity_version),
48+
| StacksEpochId::Epoch31
49+
| StacksEpochId::Epoch32 => self.check_args_2_1(accounting, args, clarity_version),
4950
StacksEpochId::Epoch10 => {
5051
Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
5152
}
@@ -69,7 +70,8 @@ impl FunctionType {
6970
| StacksEpochId::Epoch24
7071
| StacksEpochId::Epoch25
7172
| StacksEpochId::Epoch30
72-
| StacksEpochId::Epoch31 => {
73+
| StacksEpochId::Epoch31
74+
| StacksEpochId::Epoch32 => {
7375
self.check_args_by_allowing_trait_cast_2_1(db, clarity_version, func_args)
7476
}
7577
StacksEpochId::Epoch10 => {

clarity/src/vm/costs/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,8 @@ impl LimitedCostTracker {
857857
| StacksEpochId::Epoch24
858858
| StacksEpochId::Epoch25
859859
| StacksEpochId::Epoch30
860-
| StacksEpochId::Epoch31 => COSTS_3_NAME.to_string(),
860+
| StacksEpochId::Epoch31
861+
| StacksEpochId::Epoch32 => COSTS_3_NAME.to_string(),
861862
};
862863
Ok(result)
863864
}

clarity/src/vm/functions/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ macro_rules! switch_on_global_epoch {
5656
StacksEpochId::Epoch30 => $Epoch205Version(args, env, context),
5757
// Note: We reuse 2.05 for 3.1.
5858
StacksEpochId::Epoch31 => $Epoch205Version(args, env, context),
59+
// Note: We reuse 2.05 for 3.2.
60+
StacksEpochId::Epoch32 => $Epoch205Version(args, env, context),
5961
}
6062
}
6163
};

clarity/src/vm/test_util/mod.rs

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

clarity/src/vm/tests/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ epochs_template! {
125125
Epoch25,
126126
Epoch30,
127127
Epoch31,
128+
Epoch32,
128129
}
129130

130131
clarity_template! {
@@ -146,6 +147,9 @@ clarity_template! {
146147
(Epoch31, Clarity1),
147148
(Epoch31, Clarity2),
148149
(Epoch31, Clarity3),
150+
(Epoch32, Clarity1),
151+
(Epoch32, Clarity2),
152+
(Epoch32, Clarity3),
149153
}
150154

151155
#[cfg(test)]

clarity/src/vm/types/signatures.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ impl TypeSignature {
585585
| StacksEpochId::Epoch24
586586
| StacksEpochId::Epoch25
587587
| StacksEpochId::Epoch30
588-
| StacksEpochId::Epoch31 => self.admits_type_v2_1(other),
588+
| StacksEpochId::Epoch31
589+
| StacksEpochId::Epoch32 => self.admits_type_v2_1(other),
589590
StacksEpochId::Epoch10 => Err(CheckErrors::Expects("epoch 1.0 not supported".into())),
590591
}
591592
}
@@ -793,7 +794,8 @@ impl TypeSignature {
793794
| StacksEpochId::Epoch24
794795
| StacksEpochId::Epoch25
795796
| StacksEpochId::Epoch30
796-
| StacksEpochId::Epoch31 => self.canonicalize_v2_1(),
797+
| StacksEpochId::Epoch31
798+
| StacksEpochId::Epoch32 => self.canonicalize_v2_1(),
797799
}
798800
}
799801

@@ -1152,7 +1154,8 @@ impl TypeSignature {
11521154
| StacksEpochId::Epoch24
11531155
| StacksEpochId::Epoch25
11541156
| StacksEpochId::Epoch30
1155-
| StacksEpochId::Epoch31 => Self::least_supertype_v2_1(a, b),
1157+
| StacksEpochId::Epoch31
1158+
| StacksEpochId::Epoch32 => Self::least_supertype_v2_1(a, b),
11561159
StacksEpochId::Epoch10 => Err(CheckErrors::Expects("epoch 1.0 not supported".into())),
11571160
}
11581161
}

clarity/src/vm/version.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ impl ClarityVersion {
4141
StacksEpochId::Epoch25 => ClarityVersion::Clarity2,
4242
StacksEpochId::Epoch30 => ClarityVersion::Clarity3,
4343
StacksEpochId::Epoch31 => ClarityVersion::Clarity3,
44+
StacksEpochId::Epoch32 => ClarityVersion::Clarity3,
4445
}
4546
}
4647
}

stacks-common/src/libcommon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ pub mod consts {
8080
pub const PEER_VERSION_EPOCH_2_5: u8 = 0x0a;
8181
pub const PEER_VERSION_EPOCH_3_0: u8 = 0x0b;
8282
pub const PEER_VERSION_EPOCH_3_1: u8 = 0x0c;
83+
pub const PEER_VERSION_EPOCH_3_2: u8 = 0x0d;
8384

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

8889
/// set the fourth byte of the peer version
8990
pub const PEER_VERSION_MAINNET: u32 = PEER_VERSION_MAINNET_MAJOR | PEER_NETWORK_EPOCH;

stacks-common/src/types/mod.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub enum StacksEpochId {
102102
Epoch25 = 0x0201a,
103103
Epoch30 = 0x03000,
104104
Epoch31 = 0x03001,
105+
Epoch32 = 0x03002,
105106
}
106107

107108
#[derive(Debug)]
@@ -269,7 +270,7 @@ impl StacksEpochId {
269270
| StacksEpochId::Epoch23
270271
| StacksEpochId::Epoch24
271272
| StacksEpochId::Epoch25 => MempoolCollectionBehavior::ByStacksHeight,
272-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => {
273+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => {
273274
MempoolCollectionBehavior::ByReceiveTime
274275
}
275276
}
@@ -286,7 +287,10 @@ impl StacksEpochId {
286287
| StacksEpochId::Epoch22
287288
| StacksEpochId::Epoch23
288289
| StacksEpochId::Epoch24 => false,
289-
StacksEpochId::Epoch25 | StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => true,
290+
StacksEpochId::Epoch25
291+
| StacksEpochId::Epoch30
292+
| StacksEpochId::Epoch31
293+
| StacksEpochId::Epoch32 => true,
290294
}
291295
}
292296

@@ -303,7 +307,8 @@ impl StacksEpochId {
303307
StacksEpochId::Epoch24
304308
| StacksEpochId::Epoch25
305309
| StacksEpochId::Epoch30
306-
| StacksEpochId::Epoch31 => true,
310+
| StacksEpochId::Epoch31
311+
| StacksEpochId::Epoch32 => true,
307312
}
308313
}
309314

@@ -319,7 +324,7 @@ impl StacksEpochId {
319324
| StacksEpochId::Epoch23
320325
| StacksEpochId::Epoch24
321326
| StacksEpochId::Epoch25 => false,
322-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => true,
327+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => true,
323328
}
324329
}
325330

@@ -335,7 +340,7 @@ impl StacksEpochId {
335340
| StacksEpochId::Epoch23
336341
| StacksEpochId::Epoch24
337342
| StacksEpochId::Epoch25 => false,
338-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => true,
343+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => true,
339344
}
340345
}
341346

@@ -350,7 +355,7 @@ impl StacksEpochId {
350355
| StacksEpochId::Epoch23
351356
| StacksEpochId::Epoch24
352357
| StacksEpochId::Epoch25 => false,
353-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => true,
358+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => true,
354359
}
355360
}
356361

@@ -381,7 +386,9 @@ impl StacksEpochId {
381386
| StacksEpochId::Epoch23
382387
| StacksEpochId::Epoch24
383388
| StacksEpochId::Epoch25 => 0,
384-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => MINING_COMMITMENT_FREQUENCY_NAKAMOTO,
389+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => {
390+
MINING_COMMITMENT_FREQUENCY_NAKAMOTO
391+
}
385392
}
386393
}
387394

@@ -417,7 +424,7 @@ impl StacksEpochId {
417424
| StacksEpochId::Epoch23
418425
| StacksEpochId::Epoch24
419426
| StacksEpochId::Epoch25 => false,
420-
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 => {
427+
StacksEpochId::Epoch30 | StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => {
421428
cur_reward_cycle > first_epoch30_reward_cycle
422429
}
423430
}
@@ -535,7 +542,7 @@ impl StacksEpochId {
535542
| StacksEpochId::Epoch30 => {
536543
self.coinbase_reward_pre_sip029(first_burnchain_height, current_burnchain_height)
537544
}
538-
StacksEpochId::Epoch31 => self.coinbase_reward_sip029(
545+
StacksEpochId::Epoch31 | StacksEpochId::Epoch32 => self.coinbase_reward_sip029(
539546
mainnet,
540547
first_burnchain_height,
541548
current_burnchain_height,
@@ -557,6 +564,7 @@ impl std::fmt::Display for StacksEpochId {
557564
StacksEpochId::Epoch25 => write!(f, "2.5"),
558565
StacksEpochId::Epoch30 => write!(f, "3.0"),
559566
StacksEpochId::Epoch31 => write!(f, "3.1"),
567+
StacksEpochId::Epoch32 => write!(f, "3.2"),
560568
}
561569
}
562570
}

0 commit comments

Comments
 (0)