diff --git a/crates/aiken-lang/Cargo.toml b/crates/aiken-lang/Cargo.toml index 7838370f..8a3152f2 100644 --- a/crates/aiken-lang/Cargo.toml +++ b/crates/aiken-lang/Cargo.toml @@ -14,7 +14,6 @@ authors = [ rust-version = "1.66.1" [dependencies] -chumsky = "0.9.2" hex = "0.4.3" indexmap = "1.9.2" indoc = "2.0.1" @@ -25,9 +24,13 @@ owo-colors = { version = "3.5.0", features = ["supports-colors"] } strum = "0.24.1" thiserror = "1.0.39" vec1 = "1.10.1" - uplc = { path = '../uplc', version = "1.0.4-alpha" } +[target.'cfg(not(target_family="wasm"))'.dependencies] +chumsky = "0.9.2" +[target.'cfg(target_family="wasm")'.dependencies] +chumsky = { version = "0.9.2", features = ["ahash", "std"], default-features = false } + [dev-dependencies] indoc = "2.0.1" pretty_assertions = "1.3.0" diff --git a/crates/uplc/Cargo.toml b/crates/uplc/Cargo.toml index 7aa14954..b297c748 100644 --- a/crates/uplc/Cargo.toml +++ b/crates/uplc/Cargo.toml @@ -16,7 +16,6 @@ cryptoxide = "0.4.4" hex = "0.4.3" indexmap = "1.9.2" itertools = "0.10.5" -k256 = { version = "0.13.0", optional = true } miette = "5.5.0" num-bigint = "0.4.3" num-integer = "0.1.45" @@ -29,20 +28,18 @@ pallas-traverse = "0.18.0" peg = "0.8.1" pretty = "0.11.3" pretty_assertions = "1.3.0" -secp256k1 = { version = "0.26.0", optional = true } serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.94" strum = "0.24.1" strum_macros = "0.24.3" thiserror = "1.0.39" - flat-rs = { path = "../flat-rs", version = "1.0.4-alpha" } +[target.'cfg(not(target_family="wasm"))'.dependencies] +secp256k1 = { version = "0.26.0" } +[target.'cfg(target_family="wasm")'.dependencies] +k256 = { version = "0.13.0" } + [dev-dependencies] hex = "0.4.3" indoc = "2.0.1" - -[features] -default = ["dep:secp256k1"] -native-secp256k1 = ["dep:k256"] -unstable = [] diff --git a/crates/uplc/src/machine/error.rs b/crates/uplc/src/machine/error.rs index 302fcd4d..86dce919 100644 --- a/crates/uplc/src/machine/error.rs +++ b/crates/uplc/src/machine/error.rs @@ -50,10 +50,10 @@ pub enum Error { DeserialisationError(String, Value), #[error("Integer overflow")] OverflowError, - #[cfg(not(feature = "native-secp256k1"))] + #[cfg(not(target_family = "wasm"))] #[error(transparent)] Secp256k1(#[from] secp256k1::Error), - #[cfg(feature = "native-secp256k1")] + #[cfg(target_family = "wasm")] #[error(transparent)] Secp256k1(#[from] k256::ecdsa::Error), } diff --git a/crates/uplc/src/machine/runtime.rs b/crates/uplc/src/machine/runtime.rs index 51e4644f..43cffa37 100644 --- a/crates/uplc/src/machine/runtime.rs +++ b/crates/uplc/src/machine/runtime.rs @@ -1041,7 +1041,7 @@ pub fn convert_constr_to_tag(constr: u64) -> Option { pub static ANY_TAG: u64 = 102; -#[cfg(not(feature = "native-secp256k1"))] +#[cfg(not(target_family = "wasm"))] fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result { use secp256k1::{ecdsa::Signature, Message, PublicKey, Secp256k1}; @@ -1060,7 +1060,7 @@ fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result Result { use secp256k1::{schnorr::Signature, Message, Secp256k1, XOnlyPublicKey}; @@ -1077,7 +1077,7 @@ fn verify_schnorr(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result Ok(Value::Con(Constant::Bool(valid.is_ok()).into())) } -#[cfg(feature = "native-secp256k1")] +#[cfg(target_family = "wasm")] fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result { use k256::ecdsa::{self, signature::hazmat::PrehashVerifier}; @@ -1090,7 +1090,7 @@ fn verify_ecdsa(public_key: &[u8], message: &[u8], signature: &[u8]) -> Result Result { use k256::schnorr::{self, signature::hazmat::PrehashVerifier};