Skip to content

Commit

Permalink
Merge pull request #4539 from stacks-network/fix/remove-needless-asserts
Browse files Browse the repository at this point in the history
Fix/remove needless asserts
  • Loading branch information
jcnelson authored Mar 14, 2024
2 parents c17586a + c13769e commit 2c224b2
Show file tree
Hide file tree
Showing 24 changed files with 443 additions and 239 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/atlas-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,17 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- atlas-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
14 changes: 14 additions & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,17 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- integration-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
4 changes: 2 additions & 2 deletions .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ jobs:
git add src/_data/boot-contracts-reference.json
if $(git diff --staged --quiet --exit-code); then
echo "No reference.json changes, stopping"
echo "::set-output name=open_pr::0"
echo "open_pr=0" >> "$GITHUB_OUTPUT"
else
git remote add robot https://github.com/$ROBOT_OWNER/$ROBOT_REPO
git commit -m "auto: update Clarity references JSONs from stacks-core@${GITHUB_SHA}"
git push robot $ROBOT_BRANCH
echo "::set-output name=open_pr::1"
echo "open_pr=1" >> "$GITHUB_OUTPUT"
fi
- name: Open PR
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/epoch-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,17 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- epoch-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
7 changes: 1 addition & 6 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ jobs:
## Generate a checksums file to be added to the release page
- name: Generate Checksums
id: generate_checksum
uses: jmgilman/actions-generate-checksum@3ea6dc9bf8eecf28e2ecc982fab683484a1a8561 # v1.0.1
with:
method: sha512
output: CHECKSUMS.txt
patterns: |
release/*.zip
uses: stacks-network/actions/generate-checksum@main

## Upload the release archives with the checksums file
- name: Upload Release
Expand Down
139 changes: 139 additions & 0 deletions .github/workflows/pr-differences-mutants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: PR Differences Mutants

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- "**.rs"

concurrency:
group: pr-differences-${{ github.head_ref || github.ref || github.run_id }}
# Always cancel duplicate jobs
cancel-in-progress: true

jobs:
# Check and output whether to run big (`stacks-node`/`stackslib`) or small (others) packages with or without shards
check-big-packages-and-shards:
name: Check Packages and Shards

runs-on: ubuntu-latest

outputs:
run_big_packages: ${{ steps.check_packages_and_shards.outputs.run_big_packages }}
big_packages_with_shards: ${{ steps.check_packages_and_shards.outputs.big_packages_with_shards }}
run_small_packages: ${{ steps.check_packages_and_shards.outputs.run_small_packages }}
small_packages_with_shards: ${{ steps.check_packages_and_shards.outputs.small_packages_with_shards }}

steps:
- id: check_packages_and_shards
uses: stacks-network/actions/stacks-core/mutation-testing/check-packages-and-shards@main

# Mutation testing - Execute on PR on small packages that have functions modified (normal run, no shards)
pr-differences-mutants-small-normal:
name: Mutation Testing - Normal, Small

needs: check-big-packages-and-shards

if: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'false' }}

runs-on: ubuntu-latest

steps:
- name: Run mutants on diffs
uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main
with:
package-dimension: "small"

# Mutation testing - Execute on PR on small packages that have functions modified (run with strategy matrix shards)
pr-differences-mutants-small-shards:
name: Mutation Testing - Shards, Small

needs: check-big-packages-and-shards

if: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'true' }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]

steps:
- name: Run mutants on diffs
uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main
with:
shard: ${{ matrix.shard }}
package-dimension: "small"

# Mutation testing - Execute on PR on big packages that have functions modified (normal run, no shards)
pr-differences-mutants-big-normal:
name: Mutation Testing - Normal, Big

needs: check-big-packages-and-shards

if: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages == 'true' && needs.check-big-packages-and-shards.outputs.big_packages_with_shards == 'false' }}

runs-on: ubuntu-latest

steps:
- name: Run Run mutants on diffs
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main
with:
package-dimension: "big"

# Mutation testing - Execute on PR on big packages that have functions modified (run with strategy matrix shards)
pr-differences-mutants-big-shards:
name: Mutation Testing - Shards, Big

needs: check-big-packages-and-shards

if: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages == 'true' && needs.check-big-packages-and-shards.outputs.big_packages_with_shards == 'true' }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]

steps:
- name: Run mutants on diffs
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main
with:
shard: ${{ matrix.shard }}
package-dimension: "big"

# Output the mutants and fail the workflow if there are missed/timeout/unviable mutants
output-mutants:
name: Output Mutants

runs-on: ubuntu-latest

needs:
[
check-big-packages-and-shards,
pr-differences-mutants-small-normal,
pr-differences-mutants-small-shards,
pr-differences-mutants-big-normal,
pr-differences-mutants-big-shards,
]

steps:
- name: Output Mutants
uses: stacks-network/actions/stacks-core/mutation-testing/output-pr-mutants@main
with:
big_packages: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages }}
shards_for_big_packages: ${{ needs.check-big-packages-and-shards.outputs.big_packages_with_shards }}
small_packages: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages }}
shards_for_small_packages: ${{ needs.check-big-packages-and-shards.outputs.small_packages_with_shards }}
14 changes: 14 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,17 @@ jobs:
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- slow-tests
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
16 changes: 16 additions & 0 deletions .github/workflows/stacks-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,19 @@ jobs:
with:
args: test --manifest-path=./contrib/core-contract-tests/Clarinet.toml contrib/core-contract-tests/tests/bns/name_register_test.ts

check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- full-genesis
- unit-tests
- open-api-validation
- core-contracts-clarinet-test
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ is responsible for:
6. Merging the new PR.

For an example of this process, see PRs
[#3598](https://github.com/stacks-network/stacks-blockchain/pull/3598) and
[#3626](https://github.com/stacks-network/stacks-blockchain/pull/3626).
[#3598](https://github.com/stacks-network/stacks-core/pull/3598) and
[#3626](https://github.com/stacks-network/stacks-core/pull/3626).


### Documentation Updates
Expand Down Expand Up @@ -226,7 +226,7 @@ Contributions should not contain `unsafe` blocks if at all possible.
## Documentation

* Each file must have a **copyright statement**.
* Any new non-test modules should have **module-level documentation** explaining what the module does, and how it fits into the blockchain as a whole ([example](https://github.com/stacks-network/stacks-blockchain/blob/4852d6439b473e24705f14b8af637aded33cb422/testnet/stacks-node/src/neon_node.rs#L17)).
* Any new non-test modules should have **module-level documentation** explaining what the module does, and how it fits into the blockchain as a whole ([example](https://github.com/stacks-network/stacks-core/blob/4852d6439b473e24705f14b8af637aded33cb422/testnet/stacks-node/src/neon_node.rs#L17)).
* Any new files must have some **top-of-file documentation** that describes what the contained code does, and how it fits into the overall module.

Within the source files, the following **code documentation** standards are expected:
Expand All @@ -247,7 +247,7 @@ Within the source files, the following **code documentation** standards are expe
handle I/O reads and writes in an "outer" function. The "outer"
function only does the needful I/O and passes the data into the
"inner" function. The "inner" function is often private, whereas
the "outer" function is often public. For example, [`inner_try_mine_microblock` and `try_mine_microblock`](https://github.com/stacks-network/stacks-blockchain/blob/4852d6439b473e24705f14b8af637aded33cb422/testnet/stacks-node/src/neon_node.rs#L1148-L1216).
the "outer" function is often public. For example, [`inner_try_mine_microblock` and `try_mine_microblock`](https://github.com/stacks-network/stacks-core/blob/4852d6439b473e24705f14b8af637aded33cb422/testnet/stacks-node/src/neon_node.rs#L1148-L1216).

## Refactoring

Expand Down Expand Up @@ -281,7 +281,7 @@ Within the source files, the following **code documentation** standards are expe
does not decode with the allotted resources, then no further
processing may be done and the data is discarded. For an example, see
how the parsing functions in the http module use `BoundReader` and
`MAX_PAYLOAD_LEN` in [http.rs](https://github.com/stacks-network/stacks-blockchain/blob/4852d6439b473e24705f14b8af637aded33cb422/src/net/http.rs#L2260-L2285).
`MAX_PAYLOAD_LEN` in [http.rs](https://github.com/stacks-network/stacks-core/blob/4852d6439b473e24705f14b8af637aded33cb422/src/net/http.rs#L2260-L2285).

* **All network input reception is time-bound.** Every piece of code that ingests data _from the network_ must impose a maximum amount of time that ingestion can take. If the data takes too long to arrive, then it must be discarded without any further processing. There is no time bound for data ingested from disk or passed as an argument; this requirement is meant by the space-bound requirement.

Expand All @@ -303,7 +303,7 @@ Changes to the peer network should be deployed incrementally and tested by multi

Any PRs that claim to improve performance **must ship with reproducible benchmarks** that accurately measure the improvement. This data must also be reported in the PR submission.

For an example, see [PR #3075](https://github.com/stacks-network/stacks-blockchain/pull/3075).
For an example, see [PR #3075](https://github.com/stacks-network/stacks-core/pull/3075).

## Error Handling

Expand Down Expand Up @@ -597,7 +597,7 @@ Keep in mind that better variable names can reduce the need for comments, e.g.:

# Licensing and contributor license agreement

`stacks-blockchain` is released under the terms of the GPL version 3. Contributions
`stacks-core` is released under the terms of the GPL version 3. Contributions
that are not licensed under compatible terms will be rejected. Moreover,
contributions will not be accepted unless _all_ authors accept the project's
contributor license agreement.
Expand Down
Loading

0 comments on commit 2c224b2

Please sign in to comment.