forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'src/dashbls/' changes from 22b066020c..9329803969
9329803969 wip: fix FromBytesUnchecked (dashpay#68) 767713de3d feat: js bindings in camel case (dashpay#66) 06df92693a chore(release): bump version (dashpay#64) 73593feefd fix: the JS bundle script and bindings (dashpay#47) 38a8f768c6 Merge pull request dashpay#61 from kittywhiskers/compat_support d9b375145e ci: ensure that CMakeFiles are compatible with LTS-bundled cmake 5ba1b520cc build: restore CMake 3.14.0 compatibility d1c1b66e5f backport: merge bls-signatures#332 (Python 3.11) git-subtree-dir: src/dashbls git-subtree-split: 9329803969fd325dc0d5c9029ab15669d658ed5d
- Loading branch information
Showing
21 changed files
with
4,650 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,16 +43,34 @@ jobs: | |
python: | ||
- major-dot-minor: '3.7' | ||
cibw-build: 'cp37-*' | ||
manylinux: | ||
arch: manylinux2014 | ||
intel: manylinux2010 | ||
matrix: '3.7' | ||
- major-dot-minor: '3.8' | ||
cibw-build: 'cp38-*' | ||
manylinux: | ||
arch: manylinux2014 | ||
intel: manylinux2010 | ||
matrix: '3.8' | ||
- major-dot-minor: '3.9' | ||
cibw-build: 'cp39-*' | ||
manylinux: | ||
arch: manylinux2014 | ||
intel: manylinux2010 | ||
matrix: '3.9' | ||
- major-dot-minor: '3.10' | ||
cibw-build: 'cp310-*' | ||
manylinux: | ||
arch: manylinux2014 | ||
intel: manylinux2010 | ||
matrix: '3.10' | ||
- major-dot-minor: '3.11' | ||
cibw-build: 'cp311-*' | ||
manylinux: | ||
arch: manylinux2014 | ||
intel: manylinux2014 | ||
matrix: '3.11' | ||
arch: | ||
- name: ARM | ||
matrix: arm | ||
|
@@ -114,25 +132,24 @@ jobs: | |
- name: Install pipx | ||
run: | | ||
pip install pipx | ||
- name: Build and test | ||
uses: pypa/[email protected] | ||
with: | ||
output-dir: dist | ||
env: | ||
CIBW_PRERELEASE_PYTHONS: True | ||
CIBW_BUILD_VERBOSITY_MACOS: 0 | ||
CIBW_BUILD_VERBOSITY_LINUX: 0 | ||
CIBW_BUILD_VERBOSITY_WINDOWS: 0 | ||
CIBW_BUILD: ${{ matrix.python.cibw-build }} | ||
CIBW_SKIP: '*-manylinux_i686 *-win32 *-musllinux_*' | ||
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | ||
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 | ||
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.17.3-Linux-`uname -m`/bin:$PATH" | ||
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.python.manylinux['arm'] }} | ||
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.python.manylinux['intel'] }} | ||
CIBW_ENVIRONMENT_LINUX: "PATH=/project/cmake-3.14.3-Linux-`uname -m`/bin:$PATH" | ||
CIBW_BEFORE_ALL_LINUX: > | ||
yum -y install epel-release | ||
&& echo "epel-release installed" | ||
&& yum -y install lzip | ||
&& echo "lzip installed" | ||
&& curl -L https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-`uname -m`.sh > cmake.sh | ||
&& curl -L https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3-Linux-`uname -m`.sh > cmake.sh | ||
&& yes | sh cmake.sh | cat | ||
&& rm -f /usr/bin/cmake | ||
&& curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | tar x --lzip | ||
|
@@ -176,6 +193,8 @@ jobs: | |
&& cp {wheel} {dest_dir} | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_TEST_COMMAND: py.test -v {project}/python-bindings/test.py | ||
run: | ||
pipx run --spec='cibuildwheel==2.9.0' cibuildwheel --output-dir dist 2>&1 | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// The code manipulation from this file needs to be done for Chrome, as | ||
// it requires wasm to be loaded asynchronously, and it doesn't | ||
// work when bundling complex projects. With this solution, wasm is | ||
// included right into the bundle itself in a form of base64 string | ||
// and compiled asynchronously, just as Chrome requires | ||
|
||
const fs = require('fs'); | ||
|
||
const outputPath = './blsjs.js'; | ||
|
||
const wasm = fs.readFileSync('./blsjstmp.wasm'); | ||
const wasmBase = wasm.toString('base64'); | ||
|
||
const codeToPrepend = ` | ||
if (typeof window === "object") { | ||
var buf = Buffer.from("${wasmBase}", "base64"); | ||
var blob = new Blob([buf], { type: "application/wasm" }); | ||
var wasmUrl = URL.createObjectURL(blob); | ||
} | ||
`; | ||
|
||
const originalSourceCode = fs.readFileSync('./blsjstmp.js', 'utf-8'); | ||
const modifiedSourceCode = originalSourceCode | ||
.replace(/fetch\(.,/g, "fetch(wasmUrl,"); | ||
|
||
const modifiedSourceBuffer = Buffer.from(modifiedSourceCode, 'utf-8'); | ||
|
||
const bundleFileDescriptor = fs.openSync(outputPath, 'w+'); | ||
|
||
const bufferToPrepend = Buffer.from(codeToPrepend); | ||
|
||
fs.writeSync(bundleFileDescriptor, bufferToPrepend, 0, bufferToPrepend.length, 0); | ||
fs.writeSync(bundleFileDescriptor, modifiedSourceBuffer, 0, modifiedSourceBuffer.length, bufferToPrepend.length); | ||
|
||
fs.close(bundleFileDescriptor, (err) => { | ||
if (err) throw err; | ||
}); |
Oops, something went wrong.