Skip to content

Commit

Permalink
build: bump wasm-bindgen to 0.2.99 (#2395)
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek authored Dec 17, 2024
1 parent 889d192 commit d318b1c
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ RUN set -ex; \
rm /tmp/cargo-binstall; \
cargo binstall -V
RUN cargo binstall [email protected].86 --locked \
RUN cargo binstall [email protected].99 --locked \
--no-discover-github-token \
--disable-telemetry \
--no-track \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
if: ${{ steps.check-artifact.outputs.exists != 'true' }}

- name: Install wasm-bindgen-cli
run: cargo binstall [email protected].86
run: cargo binstall [email protected].99
if: ${{ steps.check-artifact.outputs.exists != 'true' }}

- name: Build packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-build-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
if: ${{ steps.check-artifact.outputs.exists != 'true' }}

- name: Install wasm-bindgen-cli
run: cargo binstall [email protected].86
run: cargo binstall [email protected].99
if: ${{ steps.check-artifact.outputs.exists != 'true' }}

- name: Build JS packages
Expand Down
52 changes: 27 additions & 25 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ RUN --mount=type=secret,id=AWS \

RUN --mount=type=secret,id=AWS \
source /root/env; \
cargo binstall [email protected].86 [email protected] \
cargo binstall [email protected].99 [email protected] \
--locked \
--no-discover-github-token \
--disable-telemetry \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ this repository may be used on the following networks:
in terminal run `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc` or `echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile` depending on your default shell.
You can find your default shell with `echo $SHELL`
- Reload your shell with `source ~/.zshrc` or `source ~/.bash_profile`
- `cargo install [email protected].86`
- `cargo install [email protected].99`
- *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file*
- *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)*
- essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang cmake llvm`
Expand Down
4 changes: 2 additions & 2 deletions packages/wasm-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ serde_json = { version = "1.0", features = ["preserve_order"] }
# Meantime if you want to update wasm-bindgen you also need to update version in:
# - packages/wasm-dpp/scripts/build-wasm.sh
# - Dockerfile
wasm-bindgen = { version = "=0.2.86" }
wasm-bindgen = { version = "=0.2.99" }
js-sys = "0.3.53"
web-sys = { version = "0.3.6", features = ["console"] }
thiserror = { version = "1.0.63" }
Expand Down Expand Up @@ -49,7 +49,7 @@ hex = { version = "0.4" }
paste = "1.0.14"
anyhow = { version = "1.0.75" }
# required, cargo-machete false positive
wasm-bindgen-futures = "0.4.33"
wasm-bindgen-futures = "0.4.49"
async-trait = "0.1.59"
bincode = "2.0.0-rc.3"
[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion packages/wasm-dpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Library consumers must ignore class names minification for `@dashevo/wasm-dpp` l

- Install [Rust](https://www.rust-lang.org/tools/install) v1.73+
- Add wasm32 target: `$ rustup target add wasm32-unknown-unknown`
- Install wasm-bingen-cli: `cargo install [email protected].86`
- Install wasm-bingen-cli: `cargo install [email protected].99`
- *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file*
- *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)*

Expand Down
12 changes: 5 additions & 7 deletions packages/wasm-dpp/src/identity/factory_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use dpp::identity::{IdentityPublicKey, KeyID};
use dpp::serialization::ValueConvertible;
use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation;
use std::collections::BTreeMap;
use wasm_bindgen::__rt::Ref;
use wasm_bindgen::{JsCast, JsValue};

pub fn parse_public_keys(
Expand Down Expand Up @@ -47,11 +46,10 @@ pub fn parse_create_identity_update_transition_keys(
let keys: Vec<IdentityPublicKeyInCreation> = add_public_keys_array
.iter()
.map(|key| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
&key,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
&key,
"IdentityPublicKeyWithWitness",
)?;

Ok(public_key.clone().into())
})
Expand All @@ -74,7 +72,7 @@ pub fn parse_create_identity_update_transition_keys(
let keys: Vec<KeyID> = disable_public_keys_array
.iter()
.map(|key| {
let public_key_wasm: Ref<IdentityPublicKeyWasm> =
let public_key_wasm =
generic_of_js_val::<IdentityPublicKeyWasm>(&key, "IdentityPublicKey")?;
Ok(public_key_wasm.get_id())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub use chain::*;
pub use instant::*;
use std::convert::TryInto;
use wasm_bindgen::JsCast;
use wasm_bindgen::__rt::Ref;

use dpp::identity::errors::UnknownAssetLockProofTypeError;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -144,13 +143,13 @@ pub fn create_asset_lock_proof_from_wasm_instance(

match lock_type {
AssetLockProofType::Instant => {
let instant: Ref<InstantAssetLockProofWasm> =
let instant =
generic_of_js_val::<InstantAssetLockProofWasm>(js_value, "InstantAssetLockProof")?;

Ok(AssetLockProof::Instant(instant.clone().into()))
}
AssetLockProofType::Chain => {
let chain: Ref<ChainAssetLockProofWasm> =
let chain =
generic_of_js_val::<ChainAssetLockProofWasm>(js_value, "ChainAssetLockProof")?;

Ok(AssetLockProof::Chain(chain.clone().into()))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::default::Default;

use wasm_bindgen::__rt::Ref;
use wasm_bindgen::prelude::*;

use crate::bls_adapter::BlsAdapter;
Expand Down Expand Up @@ -101,11 +100,10 @@ impl IdentityCreateTransitionWasm {
let public_keys = public_keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand All @@ -120,11 +118,10 @@ impl IdentityCreateTransitionWasm {
let mut public_keys = public_keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
use std::convert::TryInto;
use std::default::Default;

use serde::{Deserialize, Serialize};

use wasm_bindgen::__rt::Ref;
use wasm_bindgen::prelude::*;

use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};
use crate::errors::from_dpp_err;
use crate::identifier::IdentifierWrapper;

use crate::utils::{generic_of_js_val, WithJsError};
use crate::{
buffer::Buffer,
identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm,
identity::IdentityPublicKeyWasm, with_js_error,
};

use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};

use crate::utils::{generic_of_js_val, WithJsError};

use crate::errors::from_dpp_err;
use dpp::errors::consensus::signature::SignatureError;
use dpp::errors::consensus::ConsensusError;
use dpp::errors::ProtocolError;
Expand All @@ -34,6 +22,10 @@ use dpp::state_transition::StateTransition;
use dpp::state_transition::StateTransitionIdentitySigned;
use dpp::version::PlatformVersion;
use dpp::{identifier::Identifier, state_transition::StateTransitionLike};
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use std::default::Default;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name=IdentityUpdateTransition)]
#[derive(Clone)]
Expand Down Expand Up @@ -93,11 +85,10 @@ impl IdentityUpdateTransitionWasm {
keys_to_add = keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand Down

0 comments on commit d318b1c

Please sign in to comment.