Commit Graph

55 Commits

Author SHA1 Message Date
Andrew Poelstra a1aaf5f12c
ci: fix run syntax in fuzz job 2023-05-08 22:11:40 +00:00
Andrew Poelstra ab4a48c8ba
ci: use new fuzzing cfg flags when fuzzing bitcoin (but not hashes) 2023-05-01 21:33:11 +00:00
Andrew Poelstra 6534f22362
fuzz: auto-generate CI and Cargo.toml files 2023-04-27 00:24:52 +00:00
Andrew Poelstra 8021034d86
rename travis-fuzz.sh to fuzz.sh; partially patch CI 2023-04-27 00:24:52 +00:00
Tobin C. Harding e223cbe6df
CI: Only run release job for release PRs
Currently we run the release jobs for all PRs, this leads to red CI runs
any time we have unreleased changes in one crate used by another i.e.,
basically days after a release comes out.

Add a `release.sh` script that has more smarts to try and figure out if
the patch series currently ontop of tip of mater contains changes that
imply its a release PR. To do so we check for changes to the version
field in the manifest of each crate.
2023-04-04 12:49:59 +10:00
Andrew Poelstra 3e31a785e1
Merge rust-bitcoin/rust-bitcoin#1725: ci: do dry-run releases in CI
99cb83c3e9 ci: do dry-run releases in CI (Andrew Poelstra)

Pull request description:

  Will set this to "allow failure" since I think it'll fail during large parts of development, but this will be useful to avoid last-minute problems with releases.

ACKs for top commit:
  tcharding:
    ACK 99cb83c3e9
  Kixunil:
    ACK 99cb83c3e9

Tree-SHA512: 32a3e541deba26c0ef3b70a5cf9b4cf8efcebcb962258dd50ff77bd78b38cd9e749246e37133e9ddb806c558faa9cbbc9d8039061cbe888e8abb247c673325a6
2023-03-23 16:46:09 +00:00
Andrew Poelstra 99cb83c3e9
ci: do dry-run releases in CI 2023-03-22 23:40:09 +00:00
Tobin C. Harding 71fa9e81e7
Bump MSRV to 1.48.1
As per discussion [0] bump our MSRV for all crates in `rust-bitcoin`
repo to 1.48.1 [1].

[0] https://github.com/rust-bitcoin/rust-bitcoin/discussions/1329
[1] https://blog.rust-lang.org/2020/11/19/Rust-1.48.html
2023-03-23 08:03:06 +11:00
Jonathan Underwood a629bef85e
CI: Prevent duplicate CI runs 2023-03-22 08:19:30 -07:00
Tobin C. Harding c1360067e9
Enable formatting in CI
Enable formatting in CI by doing:

- Add a section to the `test.sh` scripts to run the formatter (guarded by
  the env variable `DO_FMT`) for all crates (bitcoin, hashes, internals).
- Add `DO_FMT` to the nightly `Tests` CI job.
2023-03-07 08:57:32 +11:00
Andrew Poelstra 9615dd12b8
Merge rust-bitcoin/rust-bitcoin#1505: Improve test coverage for docs build
41f2dcf6ae Improve test coverage for docs build (Tobin C. Harding)
b4c14a4b7c hashes: Use automatic link (Tobin C. Harding)
96e8a080d1 ci: Remove redundant || exit (Tobin C. Harding)

Pull request description:

  Currently the docs build commands in `hashes` and `bitcoin` differ, they should be the same.

  Add a command `cargo doc` to improve coverage e.g., recently we botched the feature guarding but since CI only runs `cargo rustdoc` with custom compiler conditional set we didn't catch it.

  Done after seeing: https://github.com/rust-bitcoin/rust-bitcoin/pull/1504 and CI should fail on this PR until 1504 is in.

ACKs for top commit:
  apoelstra:
    ACK 41f2dcf6ae
  Kixunil:
    ACK 41f2dcf6ae

Tree-SHA512: 7cde68292cfc6f32b75d066e188e7c418ee251f9a5abc57fbd642ba33e9cd5bd8ef7c5ba7cffd206acae6ddec2f8c3db38c8c911a4319e979158666b8225953d
2023-02-10 23:20:57 +00:00
Tobin C. Harding 53ee42d7c1
Fix ASAN in CI
When we merged `hashes` into `rust-bitcoin` we ran the test script a
couple of times using `./hashes/contrib/test.sh` this causes the `cargo`
commands in the CI script to be run from the crate root which is not
what we want.

This showed up recently because `cargo test` was getting run in
`bitcoin` after building with address/memory sanitazation configured
into the build.

While we are at it run `cargo clean` after the last sanitizer build just
to future proof the CI script in case we later accidentally re-use the same
build with plain old `cargo` (without `-Zbuild-std etc.`).
2023-01-20 15:47:43 +11:00
Tobin C. Harding 41f2dcf6ae
Improve test coverage for docs build
Currently the docs build commands in `hashes` and `bitcoin` differ, they
should be the same.

Add a command `cargo doc` to improve coverage e.g., recently we botched
the feature guarding but since CI only runs `cargo rustdoc` with custom
compiler conditional set we didn't catch it.

Run docs in CI using nightly and stable toolchains as required.
2023-01-16 13:56:56 +11:00
Tobin C. Harding f4e7def72f
internals: Add CI test script
We do not currently run the `internals` crate tests in CI. Bad
rust-bitcoin developers, no biscuit.
2023-01-13 07:59:38 +11:00
Andrew Poelstra 86eda8feee
Merge rust-bitcoin/rust-bitcoin#1511: Run kani daily on a schedule
3372333865 Add a kani badge to the README (Tobin C. Harding)
3d2a62fdd5 Run kani daily on a schedule (Tobin C. Harding)

Pull request description:

  Running kani takes ages, instead of running it on every pull request we can just run it daily.

ACKs for top commit:
  sanket1729:
    ACK 3372333865
  apoelstra:
    ACK 3372333865

Tree-SHA512: 63f71155eb3f2dd9bfbc3733c407c80b59a019d356127efc6d65cf53b517f15ddd8afd92d89f968734a508882eabbf720757d95c04d688438b762bb55a22f601
2022-12-30 15:25:52 +00:00
Andrew Poelstra bd7ae6d5e9
Merge rust-bitcoin/rust-bitcoin#1509: Use dtonlnay instead of actions-rs
4201612837 Use dtonlnay instead of actions-rs (Tobin C. Harding)

Pull request description:

  Done on top of #1508

  Currently we use the `actions-rs` GitHub action to run our tests. It seems the project is now unmaintained [0].

  Well known Rust developer dtonlnay maintains a GitHub action that can be used instead.

  Replace all uses of `actions-rs/toolchain` with `dtonlnay/rust-toolchain`. Note that with the new action there is no way to configure the toolchain, instead a different `uses` statement is required - this means we have to split our jobs up by toolchain. This is arguably cleaner anyways.

  Note that with this patch applied the "no-std" tests are now _not_ run for MSRV since we explicitly support "no-std" only for the 1.47 and above toolchains - strange that this was working?

  [0] https://github.com/actions-rs/toolchain/issues/216

ACKs for top commit:
  sanket1729:
    ACK 4201612837. Verified that we did not miss any checks in the translation.
  elichai:
    ACK 4201612837

Tree-SHA512: 117b35953c7e0d93ff1ea76fbff948d9a50aff9b3d0854beced540321f84eb83510af23067ff2ebc29b8d9c59b3ca205beeecde6e968bc619e21430b951f02cb
2022-12-30 14:31:42 +00:00
Tobin C. Harding 4201612837
Use dtonlnay instead of actions-rs
Currently we use the `actions-rs` GitHub action to run our tests. It
seems the project is now unmaintained [0].

Well known Rust developer dtonlnay maintains a GitHub action that can be
used instead.

Replace all uses of `actions-rs/toolchain` with
`dtonlnay/rust-toolchain`. Note that with the new action there is no way
to configure the toolchain, instead a different `uses` statement is
required - this means we have to split our jobs up by toolchain. This is
arguably cleaner anyways.

Note that with this patch applied the "no-std" tests are now _not_ run
for MSRV since we explicitly support "no-std" only for the 1.47 and
above toolchains - strange that this was working?

[0] https://github.com/actions-rs/toolchain/issues/216
2022-12-30 09:50:03 +11:00
Tobin C. Harding 3d2a62fdd5 Run kani daily on a schedule
Running kani takes ages, instead of running it on every pull request we
can just run it daily.
2022-12-29 16:23:59 +11:00
Tobin C. Harding 0aef1576fa Use cargo install cross `--locked`
`cross` currently fails to install, this has been reported already

https://github.com/cross-rs/cross/issues/1177

The workaround is to use `cargo install --locked`.
2022-12-28 11:28:37 +11:00
Martin Habovstiak 6acf9ac8b8 Patch hashes and update the code
This patches `bitcoin_hashes` to use the version in the repository and
fixes the code after removal of `Deref`.

This also turns off `AS_DEPENDENCY` check with the intention to refactor
it later.
2022-12-18 14:33:55 +01:00
Andrew Poelstra d4bfc3d7b1
github: add Kani to Github CI 2022-11-27 19:01:32 +00:00
Tobin C. Harding b9643bf3e9 Import bitcoin_hashes crate into hashes
We would like to bring the `bitcoin_hashes` crate into the
`rust-bitcoin` repository.

Import `bitcoin_hashes` into `rust-bitocin/hashes`, doing so looses all
the commit history from the original crate but if we archive the
original repository then the history will be preserved. We maintain the
same version number obviously and in the changelog we note the change of
repository.

Commit hash that was tip of `bitcoin_hashes` at time of import:

 commit 54c16249e06cc6b7870c7fc07d90f489d82647c7

Includes making `embedded` and `fuzzing` per-crate i.e., move them into
`bitcoin` as hashes includes these also.

NOTE: Does _not_ enable fuzzing for `hashes` in CI.

Notes on CI:

Attempts to merge in the github actions from the hashes crate however reduces
coverage by not running hashes tests for beta toolchain. Some additional
work could be done to improve the CI to increase efficiency without
reducing coverage. Leaving for another day.
2022-11-08 08:58:09 +11:00
Tobin C. Harding cb9893c4a9 Add Target and Difficulty types
Currently we use the `Uint256` type to represent two proof of work
integers, namely target and difficulty (work).

It would be nice to not have a public integer type that is not fully
implemented (i.e., does not implement arithmetic etc as do integer types
in stdlib). Instead of implementing all the stdlib functions we can
instead add two new wrapper types, since these are not general purpose
integers they do not need to implement anything we do not need to use.

- Add a `pow` module.
- Put a modified version of `Uint256` to `pow`.
- Add two new wrapper types `Target` and `Difficulty`.
- Only implement methods that we use on each type.

Note this patch does not remove the original `Uint256`, that will be
done as a separate patch.
2022-09-28 04:16:59 +10:00
Tobin Harding b79c178ea8 Add fuzz test for PrefilledTransaction
Add a simple deserialization fuzz test for `PrefilledTransaction`.
2022-09-16 13:02:24 +10:00
Andrew Poelstra d25aba8ca0 fuzz: use travis-fuzz.sh in CI 2022-08-30 21:51:42 +00:00
Andrew Poelstra 407cbca111
fuzz: remove mysteriously-not-necessary quotes from gh action script 2022-08-30 20:42:28 +00:00
Andrew Poelstra 0a32525862
fuzz: disable features in honggfuzz 2022-08-30 20:42:28 +00:00
Andrew Poelstra c7910f4561
Revert "Temporarily disable fuzzing"
This reverts commit 720ea29865.
2022-08-30 20:42:28 +00:00
Tobin C. Harding 720ea29865 Temporarily disable fuzzing
Honggfuzz is broken, I have no idea why but no PRs can merge while its
broken.
2022-08-24 08:34:57 +10:00
Tobin C. Harding 74f3a5aeda Run clippy from the test script
Currently we run clippy in CI using a github action. The invocation has
a couple of shortcomings

1. it does not lint the tests (this requires `--all-targets`)
2. it does not lint the examples

I could not find a way to lint the examples without explicitly linting
each example by name.

Move the clippy control to `test.sh` and add an env var `DO_LINT` to
control it. Remove the explicit CI job and run the linter during the
`Test` job using the stable toolchain.
2022-07-26 08:48:15 +10:00
Tobin C. Harding 668b37af5c Enable clippy on CI
Add a clippy configuration file configuring the MSRV. Add a github
actions job to run clippy on CI.

Please note the job does _not_ use `--all-targets` because doing so
causes:
```
error[E0554]: `#![feature]` may not be used on the stable release channel
--> src/lib.rs:46:54
|
46 | #![cfg_attr(all(test, feature = "unstable"), feature(test))]
```
2022-06-23 14:07:02 +10:00
mcroad 7854bd7918
Fix `no_std` MSRV
Fixes #690, #947
2022-04-25 11:14:41 -05:00
Tobin C. Harding 15bae28b6b Remove CI check for Rust 1.29
In preparation for starting to merge patches that rely on an MSRV of
1.41 update the CI pipeline.
2022-04-22 07:41:39 +10:00
Tobin Harding 0d36455d74 Build the docs with test.sh
We currently build the docs as a separate CI job, we can however just do
it as part of the `Tests` job using the nightly toolchain.

Conditionally build the docs based on a `DO_DOCS` env var.

Note, uses `--cfg docsrs` so can only be built run with nightly toolchain.
2022-03-09 08:18:48 +11:00
sanket1729 8016a858f9 Tempararily pin fuzzer on rust 1.58
I think this might take a while to resolve and we should move ahead with
1.58. Looks like the fresh release of 1.59 added LLVM 13.0 that broke
some things.
2022-02-24 23:47:30 -08:00
Andrew Ahlers 006193f5b6 feat: Support running CI locally with `act`
Disable problematic jobs that involve Github Actions caching or `cross`
whenever the environment is set to ACT. This allows running the CI
pipeline locally and hopefully speeds up PR cycle times by reducing
unexpected CI pipeline results.
2022-02-17 21:11:30 +01:00
Dr Maxim Orlovsky f39b1300fa CI: do not fail fast 2022-01-11 16:10:29 +01:00
Riccardo Casatta 106acdc3ac
Add fuzzing for Witness struct 2021-12-28 09:56:41 +01:00
Dr. Maxim Orlovsky ff1ed818b1
Merge pull request #637 from devrandom/2021-08-no-std-cleanup
no-std cleanup
2021-11-12 20:39:16 +01:00
Martin Habovstiak 0e1b99359c Added fuzz test for `Script::bytes_to_asm_fmt`
This adds fuzz target for `Script::bytes_to_asm_fmt` which could
panic due to overflow in the past. Fuzzing should decrease the risk of
other panics.
2021-09-30 15:06:18 +02:00
Riccardo Casatta 2bbf63c7e0
Use stable toolchain for fuzzing 2021-09-27 20:04:14 +02:00
Riccardo Casatta 9b6b50a987
Drop fuzzing in rust workflow 2021-09-24 11:54:17 +02:00
Riccardo Casatta 1aefc1ccf3
In fuzzing add a final job verifying all the fuzz targets have been executed 2021-09-24 11:49:42 +02:00
Riccardo Casatta 3e310d3c26
execute fuzzing in separate ci workflow 2021-09-23 11:41:03 +02:00
Riccardo Casatta 9049eef700
Install deps only if needed for fuzzing 2021-09-23 11:41:01 +02:00
Martin Habovstiak f2042bd89a Add i686 to tested architectures
This adds i686 to CI which can help catching pointer-size-related bugs
such as the one addressed by #658.
2021-09-19 18:42:15 +02:00
Devrandom 206c648869 Clean up embedded test memory configuration 2021-08-02 22:09:14 +02:00
Andrew Poelstra df4d70a37e
Merge pull request #627 from RCasatta/bigendian
Bigendian fixes and CI test
2021-07-20 20:56:16 +00:00
Devrandom bba57d7d69 Embedded test via qemu 2021-07-15 09:04:49 +02:00
Devrandom 4826d0c6cc no_std support
Based on the original work by Justin Moon.

*MSRV unchanged from 1.29.0.*

When `std` is off, `no-std` must be on, and we use the [`alloc`](https://doc.rust-lang.org/alloc/) and core2 crates. The `alloc` crate requires the user define a global allocator.

* Import from `core` and `alloc` instead of `std`
* `alloc` only used if `no-std` is on
* Create `std` feature
* Create `no-std` feature which adds a core2 dependency to polyfill `std::io` features. This is an experimental feature and should be
used with caution.
* CI runs tests `no-std`
* MSRV for `no-std` is 1.51 or so
2021-07-15 09:04:49 +02:00