Skip to content

build/depends: commit dashpay/bls-signatures@66ee820f to source tree as vendored - #5077

Merged
PastaPastaPasta merged 6 commits into
dashpay:developfrom
kwvg:vendor_bls
Nov 22, 2022
Merged

PastaPastaPasta merged 6 commits into
dashpay:developfrom
kwvg:vendor_bls

Conversation

@kwvg

@kwvg kwvg commented Nov 14, 2022 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Commit dashpay/bls-signatures@66ee820f to source tree as vendored. Resolves #5025.

What was done?

See above. Implement build system changes needed to supported subtree vendored copy. Remove build-generated file from tracking.

How Has This Been Tested?

Running make check

Breaking Changes

Will force a depends rebuild. Will need to add back removed build-generated file before updating subtree.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas N/A
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation N/A

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@kwvg
kwvg force-pushed the vendor_bls branch 8 times, most recently from ada6f8b to d431b52 Compare November 15, 2022 03:34
@kwvg
kwvg marked this pull request as ready for review November 15, 2022 06:23
@PastaPastaPasta

Copy link
Copy Markdown
Member

Starting Gitian-Build

% python3 dash/contrib/gitian-build.py -b -o mwl -j 8 -m 14000 -D -n -c pasta d431b52dd44ed4576c63169f1608713f08e05702

@kwvg kwvg changed the title build: commit dashpay/bls-signatures@1011d113 to source tree as vendored build: commit dashpay/bls-signatures@66ee820f to source tree as vendored Nov 20, 2022
@PastaPastaPasta PastaPastaPasta changed the title build: commit dashpay/bls-signatures@66ee820f to source tree as vendored build/depends: commit dashpay/bls-signatures@66ee820f to source tree as vendored Nov 21, 2022

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK for squash merge

I have done local builds and gitian-builds

@ogabrielides ogabrielides left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ACK

@UdjinM6 UdjinM6 added this to the 18.2 milestone Nov 22, 2022

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit concerned about dashpay/bls-signatures#54 (but can't reproduce it locally) and this PR LGTM otherwise so ACK.

@PastaPastaPasta PastaPastaPasta modified the milestones: 18.2, 19 Nov 22, 2022
@PastaPastaPasta
PastaPastaPasta merged commit 305abe9 into dashpay:develop Nov 22, 2022
UdjinM6 added a commit to UdjinM6/dash that referenced this pull request Dec 6, 2022
@UdjinM6

UdjinM6 commented Dec 6, 2022

Copy link
Copy Markdown

This broke develop unfortunately...

testnet:

2022-12-05T22:43:59Z UpdateTip: new best=0000000616102ada34749f82a3f076b80f2bb6055964c648214bfa303eec1d46 height=53172 version=0x20000000 log2_work=53.930421 tx=243370 date='2019-03-02T00:10:47Z' progress=0.042112 cache=49.0MiB(365273txo) evodb_cache=6.1MiB
2022-12-05T22:43:59Z ERROR: ConnectBlock(DASH): ProcessSpecialTxsInBlock for block 00000014036d75d8a2d29626479498799adf0528ba66ba2ae18f3f69792c1274 failed with bad-protx-payload (code 16)
2022-12-05T22:43:59Z InvalidChainFound: invalid block=00000014036d75d8a2d29626479498799adf0528ba66ba2ae18f3f69792c1274  height=53173  log2_work=53.93042058  date=2019-03-02T00:12:32Z
2022-12-05T22:43:59Z InvalidChainFound:  current best=0000000616102ada34749f82a3f076b80f2bb6055964c648214bfa303eec1d46  height=53172  log2_work=53.93042057  date=2019-03-02T00:10:47Z
2022-12-05T22:43:59Z ERROR: ConnectTip: ConnectBlock 00000014036d75d8a2d29626479498799adf0528ba66ba2ae18f3f69792c1274 failed, bad-protx-payload (code 16)

Reverting these changes (6a9bf06) fixes the issue.

@kwvg kwvg mentioned this pull request Dec 29, 2022
4 of 5 tasks
PastaPastaPasta added a commit that referenced this pull request Nov 17, 2026
80f4dcd test: suppress blst's implicit-conversion UBSan reports (pasta)
ee33a22 build: compile blst from src/blst instead of depends (pasta)
65b1b9b Squashed 'src/blst/' changes from a14feeb96e..a5fd18802b (pasta)
8fd9779 Squashed 'src/blst/' content from commit a14feeb96e (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  Resolves #8144. blst, the BLS12-381 backend of `src/dashbls`, was pinned in two places. One was `depends/packages/blst.mk` (plus a patch). The other was a copy of the same version, checksum and build flags in `contrib/containers/ci/ci.Dockerfile`, added by #8106 because no distribution packages blst and `linux64_asan` builds against system libraries. If one pin is bumped without the other, the CI image and depends silently build different blst revisions or flags.

  ## What was done?
  blst now lives in the tree as a squashed `git subtree` at `src/blst`, and the CMake build compiles it, so the source tree is the only pin. dashbls made the same move from depends to a subtree in #5077.

  - **Subtree:** `src/blst` comes from the `dash-subtree` branch of the dashpay/blst fork of supranational/blst. That branch is v0.3.17 with the language bindings, MSVC/CHERI assembly, perl generators and upstream CI removed. This follows the leveldb and crc32c pattern: where the tree has to differ from upstream, it is taken from a fork branch, and `test/lint/git-subtree-check.sh -r src/blst` still passes. The first two commits add it at a14feeb96e, and the next two pull in a5fd18802b.
  - **Local change, carried by the fork:** in `src/vect.h`, `__BLST_NO_ASM__` now selects blst's C implementation with 32-bit limbs on x86_64, aarch64 and Win64 too. Upstream picks 64-bit limbs there, and its C code does not compile with them. The MSan build needs the C path, because MSan cannot see through assembly. This replaces `depends/patches/blst/no_asm_limbs.patch`, which covered x86_64/aarch64 only and missed 64-bit MinGW.
  - **Build:** `cmake/blst.cmake` builds a static `blst` library next to dashbls and mimalloc. It mirrors blst's `build.sh`:
    - sources are `server.c` (which `#include`s the rest of the C sources) and `build/assembly.S`;
    - `-fno-builtin`;
    - `__BLST_PORTABLE__`, so ADX is chosen at runtime rather than from the builder's CPU.

    `assembly.S` is compiled as C with `-x assembler-with-cpp`. That way it gets the target flags the depends toolchain puts in the C compiler and its flags, which CMake's ASM language would not pick up, for example in the darwin cross builds.
  - **Assembly on/off:** the C implementation is used, with `assembly.S` left out, on targets other than x86_64 and aarch64, or with the new `-DENABLE_BLST_ASM=OFF`. The MSan job now passes that option next to `SECP256K1_ASM=OFF`, instead of defining `__BLST_NO_ASM__` through depends.
  - **Sanitizers:** blst is now built with the sanitizers that `core_interface` carries. The UBSan suppressions gain `blst/` entries for the unsigned wraparound, shifts and sign-changing masks (such as `& -64` on a `size_t`) that blst does by design, matching the existing dashbls and secp256k1 entries: `unsigned-integer-overflow`, `shift-base`, `implicit-integer-sign-change`, and the two implicit-truncation checks.
  - **Removed:**
    - the depends package and its patch;
    - `cmake/module/FindBLST.cmake` and `find_package(BLST)`;
    - the blst build in the CI image;
    - the blst row in `doc/dependencies.md`.
  - **Exclusions and docs:** `src/blst` is excluded from lints, coverage and the copyright script like the other subtrees, and is listed in `contrib/debian/copyright`. `doc/developer-notes.md` and `test/lint/README.md` name the fork branch as its upstream. `src/blst/README.md` (in the fork) describes how to update it.

  ## How Has This Been Tested?
  On macOS arm64 against a depends prefix with no blst in it:
  - **Default build (assembly):** `dashd`, `test_dash`, `dashbls_runtest`, `dashbls_runbench` and `libdashconsensus` build. `libdashconsensus` contains blst. `dashbls_runtest` passes (1843 assertions), and so does `test_dash --run_test='bls_tests,evo_*,llmq_*'`.
  - **C-only build** (`-DENABLE_BLST_ASM=OFF -DSECP256K1_ASM=OFF`): no assembly object is built and `server.c` gets `-D__BLST_NO_ASM__`. `libdashconsensus` links, and `dashbls_runtest` and `bls_tests` pass.
  - **Sanitizers:**
    - On macOS, with the ASan job's `-DSANITIZERS=address,float-divide-by-zero,integer,undefined` and its `UBSAN_OPTIONS` (`halt_on_error=1`, the in-tree suppressions), `dashbls_runtest` and `test_dash --run_test='bls_tests,evo_*,llmq_*'` pass. Clang on arm64 macOS does not run the implicit-conversion checks.
    - On x86_64 Linux with clang-19, the CI compiler, a keygen/hash/sign/verify/serialize driver over blst, with and without assembly, runs clean under `halt_on_error=1` and the in-tree suppressions. Without the `blst/` entries it reports unsigned overflow, shift-base and implicit sign changes.
  - **Other targets:**
    - The `assembly.S` compile line (`-x c ... -x assembler-with-cpp`) assembles with clang for x86_64 ELF, COFF and Mach-O and for aarch64, and with GCC for x86_64 and aarch64.
    - `server.c` with `__BLST_NO_ASM__` compiles for x86_64 and aarch64 MinGW; before the `vect.h` change it failed with 21 errors.
  - **Lints:** `test/lint/all-lint.py` passes, apart from a `lint-shell` finding in `ci/dash/build_src.sh`, which this PR does not touch. CI covers the Linux, Windows, cross and sanitizer jobs.

  ## Breaking Changes
  Builds no longer use a system or depends `libblst`. blst is always built from `src/blst`.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(if you have permission to set one)_

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  knst:
    utACK 80f4dcd

Tree-SHA512: 3fad4d48de8713884ca0d787fde7cb298161a863baa0110b30542959597253ba614c7bb35d16f8595b1371e001048953131bfa672530d222e2fd6f5322128bf6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants