Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Jun 10, 2024
2 parents 96bf8c1 + 49dbad3 commit e1d01b3
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 62 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: build

permissions:
contents: write
repository-projects: write

on:
workflow_dispatch:
branches: [dev]

jobs:
build:
name: bls-wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: node
uses: actions/setup-node@v4
with:
node-version: "20"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
git pull
cur=$(git rev-parse --abbrev-ref HEAD)
echo "current branch is $cur."
if [ "$cur" != "dev" ]; then
echo "err : not dev branch"
exit 1
fi
git config user.name github-actions
git config user.email github-actions@github.com
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk/
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
emcc -v
cd ..
git submodule update --init --recursive
make -C src
cd browser
npm install -D webpack webpack-cli
npx webpack
cd ..
npm test
sha256sum src/bls_c.js browser/bls.js
git add -f src/bls_c.js browser/bls.js
changes=$(git diff --staged --numstat | wc -l)
if [[ $changes -gt 0 ]]
then
git commit -m "build: bls_c.js is generated by GitHub Action"
git push origin dev
fi
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ jobs:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '20'
- run: node test/test.js
- run: node test/mcl-test.js

114 changes: 57 additions & 57 deletions browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "herumi <herumi@nifty.com> (https://github.com/herumi/)",
"license": "BSD-3-Clause",
"devDependencies": {
"webpack": "^5.90.3",
"webpack": "^5.91.0",
"webpack-cli": "^4.10.0"
}
}
7 changes: 6 additions & 1 deletion src/bls.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const _blsSetupFactory = (createModule) => {
/* eslint-disable */
exports.BN254 = 0
exports.BN381_1 = 1
exports.BN_SNARK1 = 4
exports.BLS12_381 = 5
exports.ethMode = ETH_MODE
exports.ETH_MODE_DRAFT_05 = 1
Expand Down Expand Up @@ -568,13 +569,17 @@ const _blsSetupFactory = (createModule) => {
_free(pubPos)
if (r !== 0) throw new Error('bad public key')
}
exports.getGeneratorofPublicKey = () => {
exports.getGeneratorOfPublicKey = () => {
const pub = new exports.PublicKey()
const pubPos = _malloc(BLS_SIGNATURE_SIZE)
mod._blsGetGeneratorOfPublicKey(pubPos)
pub._saveAndFree(pubPos)
return pub
}
exports.getGeneratorofPublicKey = () => {
console.log('WARNING : getGeneratorofPublicKey is renamed to getGeneratorOfPublicKey')
return exports.getGeneratorOfPublicKey()
}

exports.Signature = class extends Common {
constructor () {
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function addTest () {

function generatorOfPublicKeyTest() {
// save the generater
const keep = bls.getGeneratorofPublicKey()
const keep = bls.getGeneratorOfPublicKey()
const keepStr = keep.getStr(16)
const gen = new bls.PublicKey()
gen.setStr("1 24aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801 606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be", 16)
Expand Down

0 comments on commit e1d01b3

Please sign in to comment.