Skip to content

Commit

Permalink
Fixing Wasm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauan committed Aug 4, 2024
1 parent e7e9374 commit 614059a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
11 changes: 7 additions & 4 deletions wasm/src/programs/proving_key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ mod tests {
ProvingKey::from_string(&transfer_public_proving_key_string).unwrap();
assert_eq!(key, transfer_public_proving_key_from_string);

#[cfg(feature = "testnet")]
let checksum = "846f86cabf9fa50e5abe347e559a8e9f3018459b5af9fdf52f1c44892b05f7e5";

#[cfg(feature = "mainnet")]
let checksum = "f8e5f6437b945174b62313ece8a1c9dcbeac5dfff5b0fef2e968c9b92f86da06";

let transfer_public_proving_key_checksum = key.checksum();
assert_eq!(
transfer_public_proving_key_checksum,
"846f86cabf9fa50e5abe347e559a8e9f3018459b5af9fdf52f1c44892b05f7e5"
);
assert_eq!(transfer_public_proving_key_checksum, checksum);
}
}
2 changes: 1 addition & 1 deletion wasm/src/programs/verifying_key/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Metadata {
}

impl Metadata {
const BASE_URL: &'static str = "https://parameters.aleo.org/testnet/";
const BASE_URL: &'static str = crate::types::native::BASE_URL;

fn new(name: &str, verifying_key: &str, locator: &str, prover: &'static str, verifier: &'static str) -> Self {
fn url(function_name: &str, kind: &str, proving_key_metadata: &'static str) -> String {
Expand Down
16 changes: 12 additions & 4 deletions wasm/src/programs/verifying_key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ mod tests {
use super::*;
use wasm_bindgen_test::*;

#[cfg(feature = "testnet")]
const TRANSFER_PUBLIC_VERIFYING_KEY: &str = "verifier1qygqqqqqqqqqqqp3xqqqqqqqqqqzvvqqqqqqqqqq23hqqqqqqqqqqau5qqqqqqqqqq5yzqqqqqqqqqqvqqqqqqqqqqqz2rh4q6m4u0ycv2z5qx95echpdcsktezkr2j9cvff0dngp45jfqggm8q3578nkhjudslm2rdpsgcpks4ulquyqrtd978zvj65pxmhkudyjtj005h66jcnwg3f6mdqqaqjed3avcz599kth8a3nak0tftsrk4hczcdvlmrdnzsa6rfppy72flsrhdhn6npxfxt2rrudk8jrk5fefkawhhrf0psccp6l9akckaps898v5mk7vprkx90gg798d6j5tvvtma0r9phq3jndan5rkwv8wmkngeha3pzrjzslkt8ct9umm4wfq8dhnpdv8m4plq70c3d6wxs4l3cv4gyqhgjtwfuydc5fflulwgjvdtaxxlmpf0l5n800jn2lwnt5kqqtdsx2lvzl3kw3ns5hnsu4jzg9ejptg7n7r7d9dvqsrvldw9paeq86hjxeaac6typemynwzt8w3vq3e27l4swd9aqxaas7zsy5mw7ftnjct9jq6t9rdq0kx8vjag77nt0z894xqkrfp27hehk83nfcg7cpjcc7f8mznga33xp36seafxpn26rq4w5l9uawtx02mzpq9kuyyx7nvhtad0mxk5su659xx5wv3yhqqy3577kwc40spvp9dst59ap2ll5uuq7qaauy9vy5yvrjd77c443evxrwfsee8jg5hvt6f9xaupjzq2cmuuwdvjs0qtxmnwjmdepu5979qy4nhqs63zljatt7kkggddxctt74crayt4djvnh3u6tjzm8wyqpc7nf0r0k9mp34x9musgdqegkmscey50ckyehm67c5tcdlawkh6my2v3xzwaug7c4y9xyw0dfkqup24jdckk5wxkyfd8rsp6h220dj786t54fyj59ehtq0gyut6lcattumgdss4kkchrdp7f5sjgcu7ycpzq0d47m6xe3yh2q5q76fa20lm46pe8fcd9yqcrxduhkdqfe4c9pw3pqqqqqqqqqq0qvtsl";

#[cfg(feature = "mainnet")]
const TRANSFER_PUBLIC_VERIFYING_KEY: &str = "verifier1qygqqqqqqqqqqqp3xqqqqqqqqqqzvvqqqqqqqqqq23hqqqqqqqqqqau5qqqqqqqqqq5yzqqqqqqqqqqvqqqqqqqqqqqz2rh4q6m4u0ycv2z5qx95echpdcsktezkr2j9cvff0dngp45jfqggm8q3578nkhjudslm2rdpsgcpks4ulquyqrtd978zvj65pxmhkudyjtj005h66jcnwg3f6mdqqaqjed3avcz599kth8a3nak0tftsrk4hczcdvlmrdnzsa6rfppy72flsrhdhn6npxfxt2rrudk8jrk5fefkawhhrf0psccp6l9akckaps898v5mk7vprkx90gg798d6j5tvvtma0r9phq3jndan5rkwv8wmkngeha3pzrjzslkt8ct9umm4wfq8dhnpdv8m4plq70c3d6wxs4l3cv4gyqhgjtwfuydc5fflulwgjvdtaxxlmpf0l5n800jn2lwnt5kqqtdsx2lvzl3kw3ns5hnsu4jzg9ejptg7n7r7d9dvqsrvldw9paeq86hjxeaac6typemynwzt8w3vq3e27l4swd9aqxaas7zsy5mw7ftnjct9jq6t9rdq0kx8vjag77nt0z894xqkrfp27hehk83nfcg7cpjcc7f8mznga33xp36seafxpn26rq4w5l9uawtx02mzpq9kuyyx7nvhtad0mxk5su659xx5wv3yhqqy3577kwc40spvp9dst59ap2ll5uuq7qaauy9vy5yvrjd77c443evxrwfsee8jg5hvt6f9xaupjzqdd2jexnaselrezp7eptfjtpgs6ga5p3nkycwf26k6nkrf8j302e3a62rq7x5xpz9r8q9ttf36y3vqq6kvvmnuuzv6zkv0p8ds0g6z7stfhtxvzl4vjgj9vf35tnkxxvhmk4xgqcycz6g5aaejlmskvr8uq24jdckk5wxkyfd8rsp6h220dj786t54fyj59ehtq0gyut6lcattumgdss4kkchrdp7f5sjgcu7ycppt59jx985rpqa04krg2sh5je7dt6rntnvf2xd76vrgh3ldnp33lw3pqqqqqqqqqqjgex6x";

#[allow(dead_code)]
#[test]
fn verifying_key_strings() {
Expand Down Expand Up @@ -218,9 +222,13 @@ mod tests {
crate::types::native::parameters::TransferPublicVerifier::load_bytes().unwrap();
let transfer_public_verifier = VerifyingKey::from_bytes(&transfer_public_verifier_bytes).unwrap();
let transfer_public_verifying_key_checksum = transfer_public_verifier.checksum();
assert_eq!(
transfer_public_verifying_key_checksum,
"1b5109468e7992c39bbbc299dd1f94f18e49928e253e60ed68c7d9f02e73fe8d"
);

#[cfg(feature = "testnet")]
let checksum = "1b5109468e7992c39bbbc299dd1f94f18e49928e253e60ed68c7d9f02e73fe8d";

#[cfg(feature = "mainnet")]
let checksum = "ea77f42a35b3f891e7753c7333df365f356883550c4602df11f270237bef340d";

assert_eq!(transfer_public_verifying_key_checksum, checksum);
}
}
2 changes: 2 additions & 0 deletions wasm/src/types/networks/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ pub use snarkvm_circuit_network::AleoV0 as CurrentAleo;
pub use snarkvm_console::network::MainnetV0 as CurrentNetwork;

pub use snarkvm_parameters::mainnet as parameters;

pub const BASE_URL: &'static str = "https://parameters.aleo.org/mainnet/";
2 changes: 2 additions & 0 deletions wasm/src/types/networks/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ pub use snarkvm_circuit_network::AleoTestnetV0 as CurrentAleo;
pub use snarkvm_console::network::TestnetV0 as CurrentNetwork;

pub use snarkvm_parameters::testnet as parameters;

pub const BASE_URL: &'static str = "https://parameters.aleo.org/testnet/";

0 comments on commit 614059a

Please sign in to comment.