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

View File

@ -16,6 +16,8 @@ jobs:
DO_LINT: true DO_LINT: true
AS_DEPENDENCY: true AS_DEPENDENCY: true
DO_NO_STD: 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 - rust: beta
env: env:
AS_DEPENDENCY: true AS_DEPENDENCY: true
@ -89,6 +91,9 @@ jobs:
Embedded: Embedded:
runs-on: ubuntu-latest 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -102,8 +107,44 @@ jobs:
override: true override: true
components: rust-src components: rust-src
target: thumbv7m-none-eabi 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: env:
RUSTFLAGS: "-C link-arg=-Tlink.x" DO_ASAN: true
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel" run: ./hashes/contrib/test.sh
run: cd embedded && cargo run --target thumbv7m-none-eabi
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 Cargo.lock
internals/Cargo.lock internals/Cargo.lock
bitcoin/Cargo.lock bitcoin/Cargo.lock
hashes/Cargo.lock
# Build artifacts # Build artifacts
target target
internals/target internals/target
bitcoin/target bitcoin/target
hashes/target
# Test artifacts # Test artifacts
bitcoin/dep_test bitcoin/dep_test
# Fuzz artifacts # Fuzz artifacts
fuzz/hfuzz_target bitcoin/fuzz/hfuzz_target
fuzz/hfuzz_workspace bitcoin/fuzz/hfuzz_workspace
hashes/fuzz/hfuzz_target
hashes/fuzz/hfuzz_workspace

View File

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

View File

@ -5,13 +5,17 @@ readme = "README.md"
name = "embedded" name = "embedded"
version = "0.1.0" version = "0.1.0"
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[dependencies] [dependencies]
cortex-m = "0.6.0" cortex-m = "0.6.0"
cortex-m-rt = "0.6.10" cortex-m-rt = "0.6.10"
cortex-m-semihosting = "0.3.3" cortex-m-semihosting = "0.3.3"
panic-halt = "0.2.0" panic-halt = "0.2.0"
alloc-cortex-m = "0.4.1" 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]] [[bin]]
name = "embedded" name = "embedded"

View File

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

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