Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wileyj authored Jun 6, 2024
2 parents 595d86f + 3d96d53 commit 186b828
Show file tree
Hide file tree
Showing 230 changed files with 20,029 additions and 6,641 deletions.
File renamed without changes.
21 changes: 14 additions & 7 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ jobs:
- tests::nakamoto_integrations::vote_for_aggregate_key_burn_op
- tests::nakamoto_integrations::follower_bootup
- tests::nakamoto_integrations::forked_tenure_is_ignored
- tests::signer::stackerdb_dkg
- tests::signer::stackerdb_sign_request_rejected
- tests::signer::stackerdb_block_proposal
- tests::signer::stackerdb_filter_bad_transactions
- tests::signer::stackerdb_mine_2_nakamoto_reward_cycles
- tests::signer::stackerdb_sign_after_signer_reboot
- tests::nakamoto_integrations::nakamoto_attempt_time
- tests::signer::v0::block_proposal_rejection
- tests::signer::v0::miner_gather_signatures
- tests::signer::v1::dkg
- tests::signer::v1::sign_request_rejected
# TODO: enable these once v1 signer is fixed
# - tests::signer::v1::filter_bad_transactions
- tests::signer::v1::delayed_dkg
# TODO: enable these once v1 signer is fixed
# - tests::signer::v1::mine_2_nakamoto_reward_cycles
# - tests::signer::v1::sign_after_signer_reboot
# - tests::signer::v1::block_proposal
- tests::nakamoto_integrations::stack_stx_burn_op_integration_test
- tests::signer::stackerdb_delayed_dkg
- tests::nakamoto_integrations::check_block_heights
- tests::nakamoto_integrations::clarity_burn_state
# Do not run this one until we figure out why it fails in CI
# - tests::neon_integrations::bitcoin_reorg_flap
# - tests::neon_integrations::bitcoin_reorg_flap_with_follower
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ jobs:
name: Rust Format
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Rust Toolchain
id: setup_rust_toolchain
uses: actions-rust-lang/setup-rust-toolchain@f3c84ee10bf5a86e7a5d607d487bf17d57670965 # v1.5.0
with:
components: rustfmt
cache: false

- name: Rustfmt
id: rustfmt
uses: stacks-network/actions/rustfmt@main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clarity-js-sdk-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- name: Checkout latest clarity js sdk
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
token: ${{ secrets.GH_TOKEN }}
repository: ${{ env.CLARITY_JS_SDK_REPOSITORY }}
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: "chore: update clarity-native-bin tag"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- name: Build docs
id: build_docs
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Checkout latest docs
id: git_checkout_docs
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
token: ${{ secrets.DOCS_GITHUB_TOKEN }}
repository: ${{ env.TARGET_REPOSITORY }}
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Open PR
id: open_pr
if: ${{ steps.push.outputs.open_pr == '1' }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.DOCS_GITHUB_TOKEN }}
script: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,23 @@ jobs:
## Downloads the artifacts built in `create-source-binary.yml`
- name: Download Artifacts
id: download_artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: artifact
pattern: ${{ inputs.tag }}-binary-build-*
path: release
merge-multiple: true

## Generate a checksums file to be added to the release page
- name: Generate Checksums
id: generate_checksum
uses: stacks-network/actions/generate-checksum@main
with:
artifact_download_pattern: "${{ inputs.tag }}-binary-build-*"

## Upload the release archives with the checksums file
- name: Upload Release
id: upload_release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v0.1.15
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 #v2.0.5
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/image-build-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
## ex. debian will have this tag: `type=ref,event=tag,enable=${{ matrix.dist == 'debian' }}`
- name: Docker Metadata ( ${{matrix.dist}} )
id: docker_metadata
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 #v5.5.1
with:
## tag images with current repo name `stacks-core` as well as legacy `stacks-blockchain`
images: |
Expand All @@ -79,7 +79,7 @@ jobs:
## Build docker image for release
- name: Build and Push ( ${{matrix.dist}} )
id: docker_build
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{ matrix.dist }}-binary
platforms: ${{ env.docker_platforms }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/image-build-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
## Set docker metatdata
- name: Docker Metadata ( ${{matrix.dist}} )
id: docker_metadata
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 #v5.5.1
with:
images: |
${{env.docker-org}}/${{ github.event.repository.name }}
Expand All @@ -61,7 +61,7 @@ jobs:
## Build docker image
- name: Build and Push ( ${{matrix.dist}} )
id: docker_build
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: ./.github/actions/dockerfiles/Dockerfile.${{matrix.dist}}-source
platforms: ${{ env.docker_platforms }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/stacks-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
## checkout the code
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- name: Run network relay tests
id: nettest
Expand All @@ -145,10 +145,10 @@ jobs:
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Execute core contract unit tests with clarinet-sdk
id: clarinet_unit_test
uses: actions/setup-node@v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 18.x
cache: "npm"
Expand All @@ -174,7 +174,7 @@ jobs:
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Execute core contract unit tests in Clarinet
id: clarinet_unit_test_v1
uses: docker://hirosystems/clarinet:1.7.1
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

## Unreleased

### Added

- Added support for Clarity 3, with new keywords, `tenure-height` and `stacks-block-height`, and removal of `block-height`

### Changed

- Downgraded log messages about transactions from warning to info (#4697)

### Fixed

- Allow Nakamoto blocks to access the burn block associated with the current tenure (#4333)

## [2.5.0.0.3]

This release fixes a regression in `2.5.0.0.0` from `2.4.0.1.0` caused by git merge
Expand Down
20 changes: 20 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @stacks-network/blockchain-team-codeowners will be requested for
# review when someone opens a pull request.
* @stacks-network/blockchain-team-codeowners

# Generic file extensions that shouldn't require much scrutiny. Anyone with write access to the repo may approve a PR
*.md @stacks-network/blockchain-team
*.yml @stacks-network/blockchain-team
*.yaml @stacks-network/blockchain-team
*.txt @stacks-network/blockchain-team
*.toml @stacks-network/blockchain-team

# Signer code
libsigner/**/*.rs @stacks-network/blockchain-team-signer
stacks-signer/**/*.rs @stacks-network/blockchain-team-signer

# CI workflows
./github/workflows/ @stacks-network/blockchain-team-ci
./github/actions/ @stacks-network/blockchain-team-ci
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ _Note on building_: you may set `RUSTFLAGS` to build binaries for your native cp
RUSTFLAGS="-Ctarget-cpu=native"
```

or uncomment these lines in `./cargo/config`:
or uncomment these lines in `./cargo/config.toml`:

```
# [build]
Expand Down Expand Up @@ -87,7 +87,7 @@ cd testnet/stacks-node
cargo run --bin stacks-node -- start --config ./conf/testnet-follower-conf.toml
```

_On Windows, many tests will fail if the line endings aren't `LF`. Please ensure that you are have git's `core.autocrlf` set to `input` when you clone the repository to avoid any potential issues. This is due to the Clarity language currently being sensitive to line endings._
_On Windows, many tests will fail if the line endings aren't `LF`. Please ensure that you have git's `core.autocrlf` set to `input` when you clone the repository to avoid any potential issues. This is due to the Clarity language currently being sensitive to line endings._

Additional testnet documentation is available [here](./docs/testnet.md) and [here](https://docs.stacks.co/docs/nodes-and-miners/miner-testnet)

Expand Down
10 changes: 6 additions & 4 deletions clarity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ regex = "1"
lazy_static = "1.4.0"
integer-sqrt = "0.1.3"
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
stacks_common = { package = "stacks-common", path = "../stacks-common" }
stacks_common = { package = "stacks-common", path = "../stacks-common", optional = true, default-features = false }
rstest = "0.17.0"
rstest_reuse = "0.5.0"
hashbrown = { workspace = true }
Expand All @@ -39,6 +39,7 @@ features = ["arbitrary_precision", "unbounded_depth"]

[dependencies.rusqlite]
version = "=0.24.2"
optional = true
features = ["blob", "serde_json", "i128_blob", "bundled", "trace"]

[dependencies.time]
Expand All @@ -52,8 +53,9 @@ assert-json-diff = "1.0.0"
# criterion = "0.3"

[features]
default = []
developer-mode = []
default = ["canonical"]
canonical = ["rusqlite", "stacks_common/canonical"]
developer-mode = ["stacks_common/developer-mode"]
slog_json = ["stacks_common/slog_json"]
testing = []
testing = ["canonical"]
devtools = []
2 changes: 1 addition & 1 deletion clarity/src/vm/analysis/arithmetic_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<'a> ArithmeticOnlyChecker<'a> {
{
match native_var {
ContractCaller | TxSender | TotalLiquidMicroSTX | BlockHeight | BurnBlockHeight
| Regtest | TxSponsor | Mainnet | ChainId => {
| Regtest | TxSponsor | Mainnet | ChainId | StacksBlockHeight | TenureHeight => {
Err(Error::VariableForbidden(native_var))
}
NativeNone | NativeTrue | NativeFalse => Ok(()),
Expand Down
3 changes: 2 additions & 1 deletion clarity/src/vm/analysis/arithmetic_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ use stacks_common::types::StacksEpochId;

use crate::vm::analysis::arithmetic_checker::Error::*;
use crate::vm::analysis::arithmetic_checker::{ArithmeticOnlyChecker, Error};
use crate::vm::analysis::{mem_type_check, ContractAnalysis};
use crate::vm::analysis::ContractAnalysis;
use crate::vm::ast::parse;
use crate::vm::costs::LimitedCostTracker;
use crate::vm::functions::define::DefineFunctions;
use crate::vm::functions::NativeFunctions;
use crate::vm::tests::test_clarity_versions;
use crate::vm::tooling::mem_type_check;
use crate::vm::types::QualifiedContractIdentifier;
use crate::vm::variables::NativeVariables;
use crate::vm::ClarityVersion;
Expand Down
2 changes: 2 additions & 0 deletions clarity/src/vm/analysis/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ pub enum CheckErrors {
GetBurnBlockInfoExpectPropertyName,

NameAlreadyUsed(String),
ReservedWord(String),

// expect a function, or applying a function to a list
NonFunctionApplication,
Expand Down Expand Up @@ -408,6 +409,7 @@ impl DiagnosableError for CheckErrors {
CheckErrors::GetBlockInfoExpectPropertyName => "missing property name for block info introspection".into(),
CheckErrors::GetBurnBlockInfoExpectPropertyName => "missing property name for burn block info introspection".into(),
CheckErrors::NameAlreadyUsed(name) => format!("defining '{}' conflicts with previous value", name),
CheckErrors::ReservedWord(name) => format!("{name} is a reserved word"),
CheckErrors::NonFunctionApplication => "expecting expression of type function".into(),
CheckErrors::ExpectedListApplication => "expecting expression of type list".into(),
CheckErrors::ExpectedSequence(found_type) => format!("expecting expression of type 'list', 'buff', 'string-ascii' or 'string-utf8' - found '{}'", found_type),
Expand Down
5 changes: 4 additions & 1 deletion clarity/src/vm/analysis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ use self::type_checker::v2_1::TypeChecker as TypeChecker2_1;
pub use self::types::{AnalysisPass, ContractAnalysis};
use crate::vm::ast::{build_ast_with_rules, ASTRules};
use crate::vm::costs::LimitedCostTracker;
use crate::vm::database::{MemoryBackingStore, STORE_CONTRACT_SRC_INTERFACE};
#[cfg(feature = "canonical")]
use crate::vm::database::MemoryBackingStore;
use crate::vm::database::STORE_CONTRACT_SRC_INTERFACE;
use crate::vm::representations::SymbolicExpression;
use crate::vm::types::{QualifiedContractIdentifier, TypeSignature};
use crate::vm::ClarityVersion;

/// Used by CLI tools like the docs generator. Not used in production
#[cfg(feature = "canonical")]
pub fn mem_type_check(
snippet: &str,
version: ClarityVersion,
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/analysis/trait_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ fn test_dynamic_dispatch_pass_bound_principal_as_trait_in_user_defined_functions
_ => panic!("{:?}", err),
};
}
Ok(_) if version == ClarityVersion::Clarity2 => (),
Ok(_) if version >= ClarityVersion::Clarity2 => (),
_ => panic!("got {:?}", result),
}
}
Expand Down
18 changes: 18 additions & 0 deletions clarity/src/vm/analysis/type_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,21 @@ impl FunctionType {
}
}
}

fn is_reserved_word_v3(word: &str) -> bool {
match word {
"block-height" => true,
_ => false,
}
}

/// Is this a reserved word that should trigger an analysis error for the given
/// Clarity version? Note that most of the reserved words do not trigger an
/// analysis error, but will trigger an error at runtime. This should likely be
/// changed in a future Clarity version.
pub fn is_reserved_word(word: &str, version: ClarityVersion) -> bool {
match version {
ClarityVersion::Clarity1 | ClarityVersion::Clarity2 => false,
ClarityVersion::Clarity3 => is_reserved_word_v3(word),
}
}
4 changes: 2 additions & 2 deletions clarity/src/vm/analysis/type_checker/v2_05/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ fn type_reserved_variable(variable_name: &str) -> CheckResult<Option<TypeSignatu
NativeFalse => TypeSignature::BoolType,
TotalLiquidMicroSTX => TypeSignature::UIntType,
Regtest => TypeSignature::BoolType,
TxSponsor | Mainnet | ChainId => {
TxSponsor | Mainnet | ChainId | StacksBlockHeight | TenureHeight => {
return Err(CheckErrors::Expects(
"tx-sponsor, mainnet, and chain-id should not reach here in 2.05".into(),
"tx-sponsor, mainnet, chain-id, stacks-block-height, and tenure-height should not reach here in 2.05".into(),
)
.into())
}
Expand Down
3 changes: 2 additions & 1 deletion clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
use stacks_common::types::StacksEpochId;

use crate::vm::analysis::errors::CheckErrors;
use crate::vm::analysis::{mem_type_check, AnalysisDatabase};
use crate::vm::analysis::AnalysisDatabase;
use crate::vm::ast::parse;
use crate::vm::database::MemoryBackingStore;
use crate::vm::tooling::mem_type_check;
use crate::vm::types::{
QualifiedContractIdentifier, SequenceSubtype, StringSubtype, TypeSignature,
};
Expand Down
Loading

0 comments on commit 186b828

Please sign in to comment.