Skip to content

Commit

Permalink
Merge branch 'develop' into fix/stackerdb-audit-coinfabrik
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson authored Dec 9, 2024
2 parents f1d57a1 + 025af8e commit 7b0d6b5
Show file tree
Hide file tree
Showing 40 changed files with 1,236 additions and 85 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,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
# TODO: enable these once v1 signer is supported by a new nakamoto epoch
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
- 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

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
3 changes: 2 additions & 1 deletion clarity/src/vm/costs/mod.rs
Original file line number Diff line number Diff line change
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
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
6 changes: 5 additions & 1 deletion stacks-common/src/libcommon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ pub mod consts {
pub const PEER_VERSION_EPOCH_2_4: u8 = 0x09;
pub const PEER_VERSION_EPOCH_2_5: u8 = 0x0a;
pub const PEER_VERSION_EPOCH_3_0: u8 = 0x0b;
pub const PEER_VERSION_EPOCH_3_1: u8 = 0x0c;

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

/// set the fourth byte of the peer version
pub const PEER_VERSION_MAINNET: u32 = PEER_VERSION_MAINNET_MAJOR | PEER_NETWORK_EPOCH;
Expand All @@ -93,6 +94,9 @@ pub mod consts {
/// network identifiers
pub const NETWORK_ID_MAINNET: u32 = 0x17000000;
pub const NETWORK_ID_TESTNET: u32 = 0xff000000;

/// number of uSTX per STX
pub const MICROSTACKS_PER_STACKS: u32 = 1_000_000;
}

/// This test asserts that the constant above doesn't change.
Expand Down
Loading

0 comments on commit 7b0d6b5

Please sign in to comment.