Skip to content

Commit

Permalink
develop merged, fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed Dec 10, 2024
2 parents 1027c9c + b108d09 commit 28ab9b1
Show file tree
Hide file tree
Showing 93 changed files with 4,642 additions and 1,457 deletions.
4 changes: 4 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 All @@ -142,6 +145,7 @@ jobs:
- tests::nakamoto_integrations::v3_signer_api_endpoint
- tests::nakamoto_integrations::test_shadow_recovery
- tests::nakamoto_integrations::signer_chainstate
- tests::nakamoto_integrations::sip029_coinbase_change
- tests::nakamoto_integrations::clarity_cost_spend_down
- tests::nakamoto_integrations::v3_blockbyheight_api_endpoint
- tests::nakamoto_integrations::v3_transactions_api_endpoint
Expand Down
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,38 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
## [Unreleased]

### Added
- Add `/v3/transactions/:txid` rpc endpoint

### Changed
- Add `/v3/transactions/:txid` rpc endpoint

## [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`
- 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))

### Changed

## [3.0.0.0.4]

### Added

### Changed

- Use the same burn view loader in both block validation and block processing
>>>>>>> develop
## [3.0.0.0.3]

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ _Do_ document things that are not clear, e.g.:
Keep in mind that better variable names can reduce the need for comments, e.g.:

- `burnblock_height` instead of `height` may eliminate the need to comment that `height` refers to a burnblock height
- `process_microblocks` instead of `process_blocks` is more correct, and may eliminate the need to to explain that the inputs are microblocks
- `process_microblocks` instead of `process_blocks` is more correct, and may eliminate the need to explain that the inputs are microblocks
- `add_transaction_to_microblock` explains more than `handle_transaction`, and reduces the need to even read the comment

# Licensing and contributor license agreement
Expand Down
3 changes: 2 additions & 1 deletion clarity/src/vm/analysis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ pub fn run_analysis(
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => {
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => {
TypeChecker2_1::run_pass(&epoch, &mut contract_analysis, db, build_type_map)
}
StacksEpochId::Epoch10 => {
Expand Down
6 changes: 4 additions & 2 deletions clarity/src/vm/analysis/type_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ impl FunctionType {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => self.check_args_2_1(accounting, args, clarity_version),
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => self.check_args_2_1(accounting, args, clarity_version),
StacksEpochId::Epoch10 => {
return Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
}
Expand All @@ -75,7 +76,8 @@ impl FunctionType {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => {
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => {
self.check_args_by_allowing_trait_cast_2_1(db, clarity_version, func_args)
}
StacksEpochId::Epoch10 => {
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
33 changes: 18 additions & 15 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 @@ -775,7 +775,8 @@ impl LimitedCostTracker {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => COSTS_3_NAME.to_string(),
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => COSTS_3_NAME.to_string(),
};
Ok(result)
}
Expand Down Expand Up @@ -879,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 @@ -1049,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 @@ -1194,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 @@ -1327,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
2 changes: 1 addition & 1 deletion clarity/src/vm/docs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ const LOG2_API: SimpleFunctionAPI = SimpleFunctionAPI {
snippet: "log2 ${1:expr-1}",
signature: "(log2 n)",
description:
"Returns the power to which the number 2 must be raised to to obtain the value `n`, rounded
"Returns the power to which the number 2 must be raised to obtain the value `n`, rounded
down to the nearest integer. Fails on a negative numbers.
",
example: "(log2 u8) ;; Returns u3
Expand Down
2 changes: 2 additions & 0 deletions clarity/src/vm/functions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ macro_rules! switch_on_global_epoch {
StacksEpochId::Epoch25 => $Epoch205Version(args, env, context),
// Note: We reuse 2.05 for 3.0.
StacksEpochId::Epoch30 => $Epoch205Version(args, env, context),
// Note: We reuse 2.05 for 3.1.
StacksEpochId::Epoch31 => $Epoch205Version(args, env, context),
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ pub fn execute(program: &str) -> Result<Option<Value>> {
)
}

/// Execute for test in in Clarity2, Epoch21, testnet.
/// Execute for test in Clarity2, Epoch21, testnet.
#[cfg(any(test, feature = "testing"))]
pub fn execute_v2(program: &str) -> Result<Option<Value>> {
execute_with_parameters(
Expand Down
3 changes: 2 additions & 1 deletion clarity/src/vm/test_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ pub fn generate_test_burn_state_db(epoch_id: StacksEpochId) -> UnitTestBurnState
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => UnitTestBurnStateDB {
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => UnitTestBurnStateDB {
epoch_id,
ast_rules: ASTRules::PrecheckSize,
},
Expand Down
4 changes: 4 additions & 0 deletions clarity/src/vm/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ epochs_template! {
Epoch24,
Epoch25,
Epoch30,
Epoch31,
}

clarity_template! {
Expand All @@ -140,6 +141,9 @@ clarity_template! {
(Epoch30, Clarity1),
(Epoch30, Clarity2),
(Epoch30, Clarity3),
(Epoch31, Clarity1),
(Epoch31, Clarity2),
(Epoch31, Clarity3),
}

#[cfg(test)]
Expand Down
9 changes: 6 additions & 3 deletions clarity/src/vm/types/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ impl TypeSignature {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => self.admits_type_v2_1(other),
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => self.admits_type_v2_1(other),
StacksEpochId::Epoch10 => {
return Err(CheckErrors::Expects("epoch 1.0 not supported".into()))
}
Expand Down Expand Up @@ -800,7 +801,8 @@ impl TypeSignature {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => self.canonicalize_v2_1(),
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => self.canonicalize_v2_1(),
}
}

Expand Down Expand Up @@ -1158,7 +1160,8 @@ impl TypeSignature {
| StacksEpochId::Epoch23
| StacksEpochId::Epoch24
| StacksEpochId::Epoch25
| StacksEpochId::Epoch30 => Self::least_supertype_v2_1(a, b),
| StacksEpochId::Epoch30
| StacksEpochId::Epoch31 => Self::least_supertype_v2_1(a, b),
StacksEpochId::Epoch10 => {
return Err(CheckErrors::Expects("epoch 1.0 not supported".into()))
}
Expand Down
1 change: 1 addition & 0 deletions clarity/src/vm/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl ClarityVersion {
StacksEpochId::Epoch24 => ClarityVersion::Clarity2,
StacksEpochId::Epoch25 => ClarityVersion::Clarity2,
StacksEpochId::Epoch30 => ClarityVersion::Clarity3,
StacksEpochId::Epoch31 => ClarityVersion::Clarity3,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/rpc-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,6 @@ environment variable to "1"
This will return 404 if the transaction does not exist and 501 (Not Implemented) if
transaction log is not enabled.

This endpoint also accepts a querystring parameter `?tip=` which when supplied will ensure
This endpoint also accepts a query string parameter `?tip=` which when supplied will ensure
the returned transaction is an a block relative to the specified tip (as the transaction log
could store even non canonical tip transactions).
Loading

0 comments on commit 28ab9b1

Please sign in to comment.