Skip to content

Commit 7a9aab9

Browse files
committed
added test private key and value for tvk
1 parent 71d1282 commit 7a9aab9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

wasm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"The Provable Team"
77
],
88
"license": "GPL-3.0",
9-
"type": "module",
9+
1010
"main": "./dist/testnet/index.js",
1111
"browser": "./dist/testnet/index.js",
1212
"types": "./dist/testnet/index.d.ts",

wasm/src/ledger/transition.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ mod tests {
251251
pub const OUTPUT_RECORD_COMMITMENT: &str =
252252
"3771264214823666953346974490700157125043441681812666085949968314967709800215field";
253253
pub const TRANSITION: &str = r#"{"id":"au1naeu56spz0x0zct003sa8qgpzndy6nxj8rrcm7n0fehy9llcl5yscflt0k","program":"token_registry.aleo","function":"burn_private","inputs":[{"type":"record","id":"4569194627311410524427044648350523511369013276760031398859310110870190258038field","tag":"4584393733726099907383249165298083023636530416018938077800083356406243497342field"},{"type":"public","id":"4155661860779318196369465902681808025430867777096367712868886959018716227815field","value":"2853086u128"}],"outputs":[{"type":"record","id":"3771264214823666953346974490700157125043441681812666085949968314967709800215field","checksum":"17461704767783030875142836237730678349755524657182224909428747180538982740field","value":"record1qyqspwnlv6gfxx05yj7aw7z2dl44gyh06jrvgf42jux0dep33cy7jlsvqsrxzmt0w4h8ggcqqgqsqwdwr889h9fhnyclazs8yt26t6r5ua4qk7yksj7p40rz9846mzgrpp6x76m9de0kjezrqqpqyq9sj8x3qdmz6nal4j470a0wwcray54lffe3ya5u2zlpeq45lg4up3na8gul0vgrn3eced6dka4ax2ja85xzds4pmqf8csrn8ku5cv3qz8m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq8djhghnte2w86qsdjaumy4zcux2fxszm3ej2956af8cpl2w95g9pqct4w35x7unf0fjkghm4de6xjmprqqpqzqxd6c782j0ny65ed2ckzp3vlx7cv8drslasq8kqpdzmjeyzal38qemw38x0axnz5t53fj6ttavh8l4jlfjdryc6mesd4w6uvpmzfsqqjvtu0xd"},{"type":"future","id":"2177527202823505610844479366424698260670813913152550670302738921219693374616field","value":"{\n program_id: token_registry.aleo,\n function_name: burn_private,\n arguments: [\n 3443843282313283355522573239085696902919850365217539366784739393210722344986field,\n 2853086u128,\n aleo1tjkv7vquk6yldxz53ecwsy5csnun43rfaknpkjc97v5223dlnyxsglv7nm,\n 5783861720504029593520331872442756678068735468923730684279741068753131773333field\n ]\n}"}],"tpk":"8426225807947287980879824833030089440060785195861154519084544916641544071836group","tcm":"3226339871444496417979841037237975848011574524309845233165930705339306709897field","scm":"6845182532650964173356391969005331370591444046632036068754797772530920467754field"}"#;
254-
254+
pub const TEST_PRIVATE_KEY: &str = "APrivateKey1zkp6rE5FSWGD3jxrsAT64aZutFs3w6xvF8uQzGZKJEKsN8j";
255+
255256
#[test]
256257
fn transition_to_and_from_serialization() {
257258
let transition = Transition::from_string(TRANSITION).unwrap();
@@ -261,10 +262,10 @@ mod tests {
261262
assert!(Transition::from_bytes_le(bytes).is_ok());
262263
}
263264

264-
#[test]
265+
#[wasm_bindgen_test]
265266
fn test_transition_helpers() {
266-
// Create a random private key and view key.
267-
let private_key = PrivateKey::new();
267+
// Create a view key from the test private key.
268+
let private_key = PrivateKey::from_str(TEST_PRIVATE_KEY).unwrap();
268269
let view_key = ViewKey::from_private_key(&private_key);
269270

270271
let transition = Transition::from_string(TRANSITION).unwrap();
@@ -287,7 +288,7 @@ mod tests {
287288
);
288289
assert_eq!(
289290
transition.tvk(&view_key),
290-
Field::from_string("_placeholder_") // Placeholder for the view key, will replace with manually computed value.
291+
Field::from_string("4386935145534748320784836619728244316439880324135120862336274251207085504468field")
291292
.unwrap()
292293
)
293294
}

0 commit comments

Comments
 (0)