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.
This commit is contained in:
Tobin C. Harding 2022-09-16 11:52:57 +10:00
parent 580feab3f9
commit b9643bf3e9
499 changed files with 5961 additions and 13 deletions

View File

@ -29,7 +29,7 @@ jobs:
override: true
profile: minimal
- name: fuzz
run: cd fuzz && ./travis-fuzz.sh "${{ matrix.fuzz_target }}"
run: cd bitcoin/fuzz && ./travis-fuzz.sh "${{ matrix.fuzz_target }}"
- run: echo "${{ matrix.fuzz_target }}.rs" >executed_${{ matrix.fuzz_target }}
- uses: actions/upload-artifact@v2
with:
@ -46,5 +46,5 @@ jobs:
- name: Display structure of downloaded files
run: ls -R
- run: find executed_* -type f -exec cat {} + | sort > executed
- run: ls fuzz/fuzz_targets | sort > expected
- run: ls bitcoin/fuzz/fuzz_targets | sort > expected
- run: diff expected executed

View File

@ -16,6 +16,8 @@ jobs:
DO_LINT: true
AS_DEPENDENCY: true
DO_NO_STD: true
DO_FEATURE_MATRIX: true # Currently only used in hashes crate.
DO_SCHEMARS_TESTS: true # Currently only used in hashes crate.
- rust: beta
env:
AS_DEPENDENCY: true
@ -89,6 +91,9 @@ jobs:
Embedded:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
steps:
- name: Checkout
uses: actions/checkout@v2
@ -102,8 +107,44 @@ jobs:
override: true
components: rust-src
target: thumbv7m-none-eabi
- name: Run
- name: Run bitcoin/embedded
run: cd bitcoin/embedded && cargo run --target thumbv7m-none-eabi
- name: Run hashes/embedded no alloc
run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi
- name: Run hashes/embedded with alloc
run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi --features=alloc
ASAN:
name: Address sanitizer # hashes crate only.
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v2
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rust-src
- name: Running address sanitizer
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
run: cd embedded && cargo run --target thumbv7m-none-eabi
DO_ASAN: true
run: ./hashes/contrib/test.sh
WASM:
name: WebAssembly Build # hashes crate only.
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v2
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Running WASM build
env:
DO_WASM: true
run: ./hashes/contrib/test.sh

8
.gitignore vendored
View File

@ -4,15 +4,19 @@
Cargo.lock
internals/Cargo.lock
bitcoin/Cargo.lock
hashes/Cargo.lock
# Build artifacts
target
internals/target
bitcoin/target
hashes/target
# Test artifacts
bitcoin/dep_test
# Fuzz artifacts
fuzz/hfuzz_target
fuzz/hfuzz_workspace
bitcoin/fuzz/hfuzz_target
bitcoin/fuzz/hfuzz_workspace
hashes/fuzz/hfuzz_target
hashes/fuzz/hfuzz_workspace

View File

@ -1,3 +1,2 @@
[workspace]
members = ["bitcoin", "internals"]
exclude = ["embedded", "fuzz"]
members = ["bitcoin", "hashes", "internals"]

View File

@ -5,13 +5,17 @@ readme = "README.md"
name = "embedded"
version = "0.1.0"
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[dependencies]
cortex-m = "0.6.0"
cortex-m-rt = "0.6.10"
cortex-m-semihosting = "0.3.3"
panic-halt = "0.2.0"
alloc-cortex-m = "0.4.1"
bitcoin = { path="../bitcoin", default-features = false, features = ["no-std", "secp-lowmemory"] }
bitcoin = { path="../", default-features = false, features = ["no-std", "secp-lowmemory"] }
[[bin]]
name = "embedded"

View File

@ -14,7 +14,7 @@ honggfuzz_fuzz = ["honggfuzz"]
[dependencies]
honggfuzz = { version = "0.5", optional = true, default-features = false }
afl = { version = "0.4", optional = true }
bitcoin = { path = "../bitcoin" }
bitcoin = { path = "../" }
# Prevent this from interfering with workspaces
[workspace]

Some files were not shown because too many files have changed in this diff Show More