Skip to content

Commit 9b31092

Browse files
authored
Merge pull request #7195 from brice-stacks/feat/pox-wf-locking
pox-locking
2 parents f8683bf + 91ab461 commit 9b31092

259 files changed

Lines changed: 13033 additions & 8233 deletions

File tree

Some content is hidden

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

changelog.d/pox-locking-v5.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support to the pox-locking library for PoX-5.

clarity/src/vm/database/clarity_db.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ pub trait BurnStateDB {
201201
fn get_v3_unlock_height(&self) -> u32;
202202
fn get_pox_3_activation_height(&self) -> u32;
203203
fn get_pox_4_activation_height(&self) -> u32;
204+
fn get_pox_5_activation_height(&self) -> u32;
204205

205206
/// Returns the *burnchain block height* for the `sortition_id` is associated with.
206207
fn get_burn_block_height(&self, sortition_id: &SortitionId) -> Option<u32>;
@@ -419,6 +420,10 @@ impl BurnStateDB for NullBurnStateDB {
419420
u32::MAX
420421
}
421422

423+
fn get_pox_5_activation_height(&self) -> u32 {
424+
u32::MAX
425+
}
426+
422427
fn get_pox_prepare_length(&self) -> u32 {
423428
panic!("NullBurnStateDB should not return PoX info");
424429
}
@@ -1068,6 +1073,16 @@ impl ClarityDatabase<'_> {
10681073
}
10691074
}
10701075

1076+
/// Return the height for PoX v4 -> v5 auto unlocks
1077+
/// from the burn state db
1078+
pub fn get_v4_unlock_height(&mut self) -> Result<u32, VmExecutionError> {
1079+
if self.get_clarity_epoch_version()? >= StacksEpochId::Epoch40 {
1080+
Ok(self.burn_state_db.get_pox_5_activation_height())
1081+
} else {
1082+
Ok(u32::MAX)
1083+
}
1084+
}
1085+
10711086
/// Return the block height for a given tenure height
10721087
/// if the block information is queryable for the tenure height.
10731088
/// The block information for a given tenure height is queryable iff:
@@ -2346,13 +2361,15 @@ impl<'a> ClarityDatabase<'a> {
23462361
cur_burn_height,
23472362
self.get_v1_unlock_height(),
23482363
self.get_v2_unlock_height()?,
2349-
self.get_v3_unlock_height()?
2364+
self.get_v3_unlock_height()?,
2365+
self.get_v4_unlock_height()?,
23502366
)?,
23512367
stx_balance.has_unlockable_tokens_at_burn_block(
23522368
cur_burn_height,
23532369
self.get_v1_unlock_height(),
23542370
self.get_v2_unlock_height()?,
2355-
self.get_v3_unlock_height()?
2371+
self.get_v3_unlock_height()?,
2372+
self.get_v4_unlock_height()?,
23562373
)
23572374
);
23582375

@@ -2380,13 +2397,15 @@ impl<'a> ClarityDatabase<'a> {
23802397
cur_burn_height,
23812398
self.get_v1_unlock_height(),
23822399
self.get_v2_unlock_height()?,
2383-
self.get_v3_unlock_height()?
2400+
self.get_v3_unlock_height()?,
2401+
self.get_v4_unlock_height()?,
23842402
)?,
23852403
stx_balance.has_unlockable_tokens_at_burn_block(
23862404
cur_burn_height,
23872405
self.get_v1_unlock_height(),
23882406
self.get_v2_unlock_height()?,
2389-
self.get_v3_unlock_height()?
2407+
self.get_v3_unlock_height()?,
2408+
self.get_v4_unlock_height()?,
23902409
)
23912410
);
23922411

0 commit comments

Comments
 (0)