Merge rust-bitcoin/rust-bitcoin#2116: ci(fuzz): replace toolchain and runner

539f4ba64c apoelstra run of generate-files.sh (Andrew Poelstra)
20f3a05d2a ci: replace fuzz toolchain (Einherjar)

Pull request description:

  1. Changes the toolchain fom `actions-rs/toolchain` to `dtolnay/rust-toolchain`.
     Closes #2113.
  1. Changes the CI runner from `ubuntu-20.04` to `ubuntu-latest`.
     Related #2114.
  1. Updates the `fuzz/generate-files.sh` to match `.github/workflows/fuzz.yml`.
     Closes #2115.

ACKs for top commit:
  realeinherjar:
    > ACK [539f4ba](539f4ba64c)
  apoelstra:
    ACK 539f4ba64c
  vincenzopalazzo:
    ACK 539f4ba64c
  tcharding:
    ACK 539f4ba64c

Tree-SHA512: 3f1c744022794f1d1dbb7c7dc10d6d5252431ce54ee2309c906183c3c12570ac5e7833bb352749ad9be336b404ae3dd42fcf414107fb7a5bc73043cf5158cb88
This commit is contained in:
Andrew Poelstra 2023-10-11 17:34:52 +00:00
commit 90a95f6d28
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 65 additions and 68 deletions

View File

@ -11,29 +11,29 @@ on:
jobs: jobs:
fuzz: fuzz:
if: ${{ !github.event.act }} if: ${{ !github.event.act }}
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
fuzz_target: [ fuzz_target: [
bitcoin_outpoint_string,
bitcoin_deserialize_amount,
bitcoin_deserialize_transaction,
bitcoin_deser_net_msg,
bitcoin_deserialize_address, bitcoin_deserialize_address,
bitcoin_script_bytes_to_asm_fmt, bitcoin_deserialize_amount,
bitcoin_deserialize_prefilled_transaction,
bitcoin_deserialize_witness,
bitcoin_deserialize_psbt,
bitcoin_deserialize_block, bitcoin_deserialize_block,
bitcoin_deserialize_prefilled_transaction,
bitcoin_deserialize_psbt,
bitcoin_deserialize_script, bitcoin_deserialize_script,
hashes_json, bitcoin_deserialize_transaction,
bitcoin_deserialize_witness,
bitcoin_deser_net_msg,
bitcoin_outpoint_string,
bitcoin_script_bytes_to_asm_fmt,
hashes_cbor, hashes_cbor,
hashes_sha256, hashes_json,
hashes_ripemd160, hashes_ripemd160,
hashes_sha1,
hashes_sha256,
hashes_sha512_256, hashes_sha512_256,
hashes_sha512, hashes_sha512,
hashes_sha1,
] ]
steps: steps:
- name: Install test dependencies - name: Install test dependencies
@ -47,11 +47,9 @@ hashes_sha1,
fuzz/target fuzz/target
target target
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: "1.65.0" toolchain: '1.65.0'
override: true
profile: minimal
- name: fuzz - name: fuzz
run: | run: |
if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then

View File

@ -17,65 +17,69 @@ serde_json = "1.0"
serde_cbor = "0.9" serde_cbor = "0.9"
[[bin]] [[bin]]
name = "bitcoin_outpoint_string" name = "bitcoin_deserialize_address"
path = "fuzz_targets/bitcoin/outpoint_string.rs" path = "fuzz_targets/bitcoin/deserialize_address.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_amount" name = "bitcoin_deserialize_amount"
path = "fuzz_targets/bitcoin/deserialize_amount.rs" path = "fuzz_targets/bitcoin/deserialize_amount.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_transaction" name = "bitcoin_deserialize_block"
path = "fuzz_targets/bitcoin/deserialize_transaction.rs" path = "fuzz_targets/bitcoin/deserialize_block.rs"
[[bin]]
name = "bitcoin_deser_net_msg"
path = "fuzz_targets/bitcoin/deser_net_msg.rs"
[[bin]]
name = "bitcoin_deserialize_address"
path = "fuzz_targets/bitcoin/deserialize_address.rs"
[[bin]]
name = "bitcoin_script_bytes_to_asm_fmt"
path = "fuzz_targets/bitcoin/script_bytes_to_asm_fmt.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_prefilled_transaction" name = "bitcoin_deserialize_prefilled_transaction"
path = "fuzz_targets/bitcoin/deserialize_prefilled_transaction.rs" path = "fuzz_targets/bitcoin/deserialize_prefilled_transaction.rs"
[[bin]]
name = "bitcoin_deserialize_witness"
path = "fuzz_targets/bitcoin/deserialize_witness.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_psbt" name = "bitcoin_deserialize_psbt"
path = "fuzz_targets/bitcoin/deserialize_psbt.rs" path = "fuzz_targets/bitcoin/deserialize_psbt.rs"
[[bin]]
name = "bitcoin_deserialize_block"
path = "fuzz_targets/bitcoin/deserialize_block.rs"
[[bin]] [[bin]]
name = "bitcoin_deserialize_script" name = "bitcoin_deserialize_script"
path = "fuzz_targets/bitcoin/deserialize_script.rs" path = "fuzz_targets/bitcoin/deserialize_script.rs"
[[bin]] [[bin]]
name = "hashes_json" name = "bitcoin_deserialize_transaction"
path = "fuzz_targets/hashes/json.rs" path = "fuzz_targets/bitcoin/deserialize_transaction.rs"
[[bin]]
name = "bitcoin_deserialize_witness"
path = "fuzz_targets/bitcoin/deserialize_witness.rs"
[[bin]]
name = "bitcoin_deser_net_msg"
path = "fuzz_targets/bitcoin/deser_net_msg.rs"
[[bin]]
name = "bitcoin_outpoint_string"
path = "fuzz_targets/bitcoin/outpoint_string.rs"
[[bin]]
name = "bitcoin_script_bytes_to_asm_fmt"
path = "fuzz_targets/bitcoin/script_bytes_to_asm_fmt.rs"
[[bin]] [[bin]]
name = "hashes_cbor" name = "hashes_cbor"
path = "fuzz_targets/hashes/cbor.rs" path = "fuzz_targets/hashes/cbor.rs"
[[bin]] [[bin]]
name = "hashes_sha256" name = "hashes_json"
path = "fuzz_targets/hashes/sha256.rs" path = "fuzz_targets/hashes/json.rs"
[[bin]] [[bin]]
name = "hashes_ripemd160" name = "hashes_ripemd160"
path = "fuzz_targets/hashes/ripemd160.rs" path = "fuzz_targets/hashes/ripemd160.rs"
[[bin]]
name = "hashes_sha1"
path = "fuzz_targets/hashes/sha1.rs"
[[bin]]
name = "hashes_sha256"
path = "fuzz_targets/hashes/sha256.rs"
[[bin]] [[bin]]
name = "hashes_sha512_256" name = "hashes_sha512_256"
path = "fuzz_targets/hashes/sha512_256.rs" path = "fuzz_targets/hashes/sha512_256.rs"
@ -83,7 +87,3 @@ path = "fuzz_targets/hashes/sha512_256.rs"
[[bin]] [[bin]]
name = "hashes_sha512" name = "hashes_sha512"
path = "fuzz_targets/hashes/sha512.rs" path = "fuzz_targets/hashes/sha512.rs"
[[bin]]
name = "hashes_sha1"
path = "fuzz_targets/hashes/sha1.rs"

View File

@ -4,7 +4,7 @@ REPO_DIR=$(git rev-parse --show-toplevel)
listTargetFiles() { listTargetFiles() {
pushd "$REPO_DIR/fuzz" > /dev/null || exit 1 pushd "$REPO_DIR/fuzz" > /dev/null || exit 1
find fuzz_targets/ -type f -name "*.rs" find fuzz_targets/ -type f -name "*.rs" | sort
popd > /dev/null || exit 1 popd > /dev/null || exit 1
} }
@ -12,7 +12,8 @@ targetFileToName() {
echo "$1" \ echo "$1" \
| sed 's/^fuzz_targets\///' \ | sed 's/^fuzz_targets\///' \
| sed 's/\.rs$//' \ | sed 's/\.rs$//' \
| sed 's/\//_/g' | sed 's/\//_/g' \
| sed 's/^_//g'
} }
targetFileToHFuzzInputArg() { targetFileToHFuzzInputArg() {

View File

@ -53,7 +53,7 @@ on:
jobs: jobs:
fuzz: fuzz:
if: \${{ !github.event.act }} if: \${{ !github.event.act }}
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -63,8 +63,8 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
steps: steps:
- name: Install test dependencies - name: Install test dependencies
run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/cache@v2 - uses: actions/cache@v3
id: cache-fuzz id: cache-fuzz
with: with:
path: | path: |
@ -72,11 +72,9 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
fuzz/target fuzz/target
target target
key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1 - uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: 1.58 toolchain: '1.65.0'
override: true
profile: minimal
- name: fuzz - name: fuzz
run: | run: |
if [[ "\${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then if [[ "\${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then
@ -85,7 +83,7 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
echo "Using RUSTFLAGS \$RUSTFLAGS" echo "Using RUSTFLAGS \$RUSTFLAGS"
cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}" cd fuzz && ./fuzz.sh "\${{ matrix.fuzz_target }}"
- run: echo "\${{ matrix.fuzz_target }}" >executed_\${{ matrix.fuzz_target }} - run: echo "\${{ matrix.fuzz_target }}" >executed_\${{ matrix.fuzz_target }}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: executed_\${{ matrix.fuzz_target }} name: executed_\${{ matrix.fuzz_target }}
path: executed_\${{ matrix.fuzz_target }} path: executed_\${{ matrix.fuzz_target }}
@ -95,8 +93,8 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
needs: fuzz needs: fuzz
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
- 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