Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: switch from agent-rs to miracl_core #590

Merged
merged 2 commits into from Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions packages/agent/src/vendor/bls/README.md
@@ -1,16 +1,15 @@
# How to generate bls.wasm
# How to Generate `wasm.ts`

The Wasm is generated from the BLS Rust code of the Agent RS (see http://github.com/dfinity/agent-rs/),
with the following `Cargo.toml`.
This WASM is generated from the miracl BLS Rust code (see https://github.com/dfinity/miracl_core_bls12381/)

```
[dependencies]
wasm-bindgen = "0.2.70"
Run the following commands to build, minify, and base64 encode the wasm.

```bash
wasm-pack build --out-name bls --no-default-features --features="wasm-bindgen allow_alt_compress" --profile=wasm

[profile.release]
lto = true
opt-level = 'z'
echo -n "export const wasmBytesBase64 = \`" >pkg/wasm.ts
base64 ./pkg/bls_bg.wasm | tr -d "\n" >>pkg/wasm.ts
echo "\`;" >>pkg/wasm.ts
```

To build the package, run `wasm-pack build --target web`. You can base64 encode the wasm binary and
paste it into `bls.ts`.
Copy the resulting `pkg/wasm.ts` to `packages/agent/src/vendor/bls/wasm.ts`.