add &mut to c.stack in new_raw_bytes calls

This commit is contained in:
Matthew LeVan 2023-11-20 11:56:32 -05:00
parent ce85495bcc
commit 394883bd03

View File

@ -134,34 +134,34 @@ mod tests {
let c = &mut init_context();
let ret = A(
c.stack,
&mut c.stack,
&ubig!(_0xfb099b0acc4d1ce37f9982a2ed331245e0cdfdf6979364b7676a142b8233e53b),
);
assert_jet(c, jet_puck, D(32), ret);
let sam = A(
c.stack,
&mut c.stack,
&ubig!(_0xfb099b0acc4d1ce37f9982a2ed331245e0cdfdf6979364b7676a142b8233e53b),
);
assert_jet_err(s, jet_puck, sam, JetErr::Fail(Error::Deterministic(D(0))));
assert_jet_err(c, jet_puck, sam, JetErr::Fail(Error::Deterministic(D(0))));
}
#[test]
fn test_shar() {
let c = &mut init_context();
let sam = T(c.stack, &[D(234), D(234)]);
let sam = T(&mut c.stack, &[D(234), D(234)]);
let ret = A(
c.stack,
&mut c.stack,
&ubig!(_0x6ecd5779a47841207a2cd0c9d085796aa646842885a332adac540027d768c1c5),
);
assert_jet(s, jet_shar, sam, ret);
assert_jet(c, jet_shar, sam, ret);
let sam = A(
s,
&mut c.stack,
&ubig!(_0xfb099b0acc4d1ce37f9982a2ed331245e0cdfdf6979364b7676a142b8233e53b),
);
assert_jet_err(s, jet_shar, sam, JetErr::Fail(Error::Deterministic(D(0))));
assert_jet_err(c, jet_shar, sam, JetErr::Fail(Error::Deterministic(D(0))));
}
#[test]
@ -172,7 +172,7 @@ mod tests {
let sig_ubig = ubig!(_0x92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00);
let sig_bytes = sig_ubig.to_be_bytes();
let signature =
IndirectAtom::new_raw_bytes(c.stack, sig_bytes.len(), sig_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, sig_bytes.len(), sig_bytes.as_ptr()).as_noun();
let message = D(0x72);
@ -180,28 +180,28 @@ mod tests {
ubig!(_0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c);
let pub_bytes = pub_ubig.to_be_bytes();
let public_key =
IndirectAtom::new_raw_bytes(c.stack, pub_bytes.len(), pub_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, pub_bytes.len(), pub_bytes.as_ptr()).as_noun();
let sam = T(c.stack, &[signature, message, public_key]);
let sam = T(&mut c.stack, &[signature, message, public_key]);
assert_jet(c, jet_veri, sam, YES);
let sig_ubig = ubig!(_0x6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a);
let sig_bytes = sig_ubig.to_be_bytes();
let signature =
IndirectAtom::new_raw_bytes(c.stack, sig_bytes.len(), sig_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, sig_bytes.len(), sig_bytes.as_ptr()).as_noun();
let msg_ubig = ubig!(0xaf82);
let msg_bytes = msg_ubig.to_be_bytes();
let message =
IndirectAtom::new_raw_bytes(c.stack, msg_bytes.len(), msg_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, msg_bytes.len(), msg_bytes.as_ptr()).as_noun();
let pub_ubig =
ubig!(_0xfc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025);
let pub_bytes = pub_ubig.to_be_bytes();
let public_key =
IndirectAtom::new_raw_bytes(c.stack, pub_bytes.len(), pub_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, pub_bytes.len(), pub_bytes.as_ptr()).as_noun();
let sam = T(s, &[signature, message, public_key]);
let sam = T(&mut c.stack, &[signature, message, public_key]);
assert_jet(c, jet_veri, sam, YES);
}
}
@ -217,25 +217,25 @@ mod tests {
ubig!(_0x4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb);
let sed_bytes = sed_ubig.to_be_bytes();
let seed =
IndirectAtom::new_raw_bytes(c.stack, sed_bytes.len(), sed_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, sed_bytes.len(), sed_bytes.as_ptr()).as_noun();
let sam = T(c.stack, &[message, seed]);
let ret = A(c.stack, &ubig!(_0x92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00));
let sam = T(&mut c.stack, &[message, seed]);
let ret = A(&mut c.stack, &ubig!(_0x92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00));
assert_jet(c, jet_sign, sam, ret);
let msg_ubig = ubig!(_0xaf82);
let msg_bytes = msg_ubig.to_be_bytes();
let message =
IndirectAtom::new_raw_bytes(c.stack, msg_bytes.len(), msg_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, msg_bytes.len(), msg_bytes.as_ptr()).as_noun();
let sed_ubig =
ubig!(_0xc5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7);
let sed_bytes = sed_ubig.to_be_bytes();
let seed =
IndirectAtom::new_raw_bytes(c.stack, sed_bytes.len(), sed_bytes.as_ptr()).as_noun();
IndirectAtom::new_raw_bytes(&mut c.stack, sed_bytes.len(), sed_bytes.as_ptr()).as_noun();
let sam = T(c.stack, &[message, seed]);
let ret = A(c.stack, &ubig!(_0x6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a));
let sam = T(&mut c.stack, &[message, seed]);
let ret = A(&mut c.stack, &ubig!(_0x6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a));
assert_jet(c, jet_sign, sam, ret);
}
}