Skip to content

Commit

Permalink
Merge branch 'develop' into fix/5502
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson authored Dec 9, 2024
2 parents 462a0b9 + b108d09 commit 1e8e2ca
Show file tree
Hide file tree
Showing 61 changed files with 3,208 additions and 1,291 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ jobs:
- tests::signer::v0::signer_set_rollover
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
- tests::signer::v0::continue_after_tenure_extend
- tests::signer::v0::tenure_extend_after_idle
- tests::signer::v0::stx_transfers_dont_effect_idle_timeout
- tests::signer::v0::idle_tenure_extend_active_mining
- tests::signer::v0::multiple_miners_with_custom_chain_id
- tests::signer::v0::block_commit_delay
- tests::signer::v0::continue_after_fast_block_no_sortition
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

### Added

### Changed

## [3.1.0.0.1]

### Added

- 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))

### Changed

## [3.1.0.0.0]

### Added

- **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)
- New RPC endpoints
- `/v2/clarity/marf/:marf_key_hash`
- `/v2/clarity/metadata/:principal/:contract_name/:clarity_metadata_key`
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ mod test {
) -> std::result::Result<ExecutionCost, CostErrors> {
self.invoked_functions.push((cost_f, input.to_vec()));
self.invocation_count += 1;
Ok(ExecutionCost::zero())
Ok(ExecutionCost::ZERO)
}
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
self.cost_addition_count += 1;
Expand Down
30 changes: 16 additions & 14 deletions clarity/src/vm/costs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl CostTracker for () {
_cost_function: ClarityCostFunction,
_input: &[u64],
) -> std::result::Result<ExecutionCost, CostErrors> {
Ok(ExecutionCost::zero())
Ok(ExecutionCost::ZERO)
}
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
Ok(())
Expand Down Expand Up @@ -707,7 +707,7 @@ impl LimitedCostTracker {
contract_call_circuits: HashMap::new(),
limit,
memory_limit: CLARITY_MEMORY_LIMIT,
total: ExecutionCost::zero(),
total: ExecutionCost::ZERO,
memory: 0,
epoch,
mainnet,
Expand All @@ -731,7 +731,7 @@ impl LimitedCostTracker {
contract_call_circuits: HashMap::new(),
limit,
memory_limit: CLARITY_MEMORY_LIMIT,
total: ExecutionCost::zero(),
total: ExecutionCost::ZERO,
memory: 0,
epoch,
mainnet,
Expand Down Expand Up @@ -880,7 +880,7 @@ impl LimitedCostTracker {
pub fn get_total(&self) -> ExecutionCost {
match self {
Self::Limited(TrackerData { total, .. }) => total.clone(),
Self::Free => ExecutionCost::zero(),
Self::Free => ExecutionCost::ZERO,
}
}
#[allow(clippy::panic)]
Expand Down Expand Up @@ -1050,7 +1050,7 @@ impl CostTracker for LimitedCostTracker {
match self {
Self::Free => {
// tracker is free, return zero!
return Ok(ExecutionCost::zero());
return Ok(ExecutionCost::ZERO);
}
Self::Limited(ref mut data) => {
if cost_function == ClarityCostFunction::Unimplemented {
Expand Down Expand Up @@ -1195,15 +1195,13 @@ impl CostOverflowingMath<u64> for u64 {
}

impl ExecutionCost {
pub fn zero() -> ExecutionCost {
Self {
runtime: 0,
write_length: 0,
read_count: 0,
write_count: 0,
read_length: 0,
}
}
pub const ZERO: Self = Self {
runtime: 0,
write_length: 0,
read_count: 0,
write_count: 0,
read_length: 0,
};

/// Returns the percentage of self consumed in `numerator`'s largest proportion dimension.
pub fn proportion_largest_dimension(&self, numerator: &ExecutionCost) -> u64 {
Expand Down Expand Up @@ -1328,6 +1326,10 @@ impl ExecutionCost {
read_length: first.read_length.max(second.read_length),
}
}

pub fn is_zero(&self) -> bool {
*self == Self::ZERO
}
}

// ONLY WORKS IF INPUT IS u64
Expand Down
Loading

0 comments on commit 1e8e2ca

Please sign in to comment.