Skip to content

Commit c9654b0

Browse files
authored
Merge pull request #1102 from ProvableHQ/rr/fix-for-test-records-module
[Fix] Removed duplicate record module in test/utilities subdirectory
2 parents a5e1b4a + 356036a commit c9654b0

File tree

6 files changed

+34
-47
lines changed

6 files changed

+34
-47
lines changed

wasm/Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wasm/src/account/signature.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ mod tests {
220220

221221
use crate::utilities::test::{
222222
plaintext::{INVALID_NESTED_STRUCT, NESTED_STRUCT},
223-
records::{CREDITS_RECORD, INVALID_CREDITS_RECORD},
223+
records::{INVALID_CREDITS_RECORD, VALID_CREDITS_RECORD},
224224
};
225225
use rand::{Rng, SeedableRng, rngs::StdRng};
226226
use wasm_bindgen_test::*;
@@ -521,8 +521,8 @@ mod tests {
521521

522522
#[wasm_bindgen_test]
523523
pub fn test_sign_record_and_verify() {
524-
let signature = Signature::sign_value(&PrivateKey::new(), CREDITS_RECORD).unwrap();
525-
assert!(signature.verify_value(&signature.to_address(), CREDITS_RECORD).unwrap());
524+
let signature = Signature::sign_value(&PrivateKey::new(), VALID_CREDITS_RECORD).unwrap();
525+
assert!(signature.verify_value(&signature.to_address(), VALID_CREDITS_RECORD).unwrap());
526526
assert!(!signature.verify_value(&signature.to_address(), INVALID_CREDITS_RECORD).unwrap());
527527
}
528528

wasm/src/record/record_plaintext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ mod tests {
337337
utilities::test::get_env,
338338
};
339339

340-
use crate::utilities::test::record::{CREDITS_RECORD_V1, CREDITS_SENDER_CIPHERTEXT, CREDITS_SENDER_PLAINTEXT};
340+
use crate::utilities::test::records::{CREDITS_RECORD_V1, CREDITS_SENDER_CIPHERTEXT, CREDITS_SENDER_PLAINTEXT};
341341
use wasm_bindgen_test::*;
342342

343343
const CREDITS_RECORD: &str = r"{

wasm/src/utilities/encrypt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ mod tests {
301301
use crate::{
302302
test::get_env,
303303
types::native::{PrivateKeyNative, ViewKeyNative},
304-
utilities::test::record::{
304+
utilities::test::records::{
305305
CREDITS_RECORD_V1,
306306
CREDITS_RECORD_VIEW_KEY,
307307
CREDITS_SENDER_CIPHERTEXT,

wasm/src/utilities/test/record.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

wasm/src/utilities/test/records.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,40 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with the Provable SDK library. If not, see <https://www.gnu.org/licenses/>.
1616

17-
pub const CREDITS_RECORD: &str = r"{
17+
/// V1 credits.aleo record.
18+
pub const CREDITS_RECORD_V1: &str = "{ owner: aleo12a4wll9ax6w5355jph0dr5wt2vla5sss2t4cnch0tc3vzh643v8qcfvc7a.private, microcredits: 1000000u64.private, _nonce: 3634848344765318974603121890869676775499130077229666060613233255327643175219group.public, _version: 1u8.public }";
19+
/// Record view key for the V1 credits.aleo record.
20+
pub const CREDITS_RECORD_VIEW_KEY: &str =
21+
"5237002936265850807349726649400053591020997883662246784632368923777787639801field";
22+
/// Sender ciphertext of the credits.aleo record.
23+
pub const CREDITS_SENDER_CIPHERTEXT: &str =
24+
"1182590395568997043375432557467567048762179115999922880321493200728848194550field";
25+
/// Sender plaintext of the credits.aleo record.
26+
pub const CREDITS_SENDER_PLAINTEXT: &str = "aleo1j92w9mhqznj2hvufad796y8suykjppk7f6n6xmncmktfm95vggzqx4sjlh";
27+
28+
/// Token registry record view_key.
29+
pub const TOKEN_REGISTRY_RECORD_OWNER_VIEW_KEY: &str = "AViewKey1pTzjTxeAYuDpACpz2k72xQoVXvfY4bJHrjeAQp6Ywe5g";
30+
31+
/// Token registry test vector.
32+
pub const TOKEN_REGISTRY_RECORD_V1: &str = r#"{
33+
owner: aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t.private,
34+
amount: 1000u128.private,
35+
token_id: 1751493913335802797273486270793650302076377624243810059080883537084141842600field.private,
36+
external_authorization_required: false.private,
37+
authorized_until: 0u32.private,
38+
_nonce: 353510505137682717871934563523691055502582931368477380633253282125012046603group.public,
39+
_version: 1u8.public
40+
}"#;
41+
42+
/// Valid credits.aleo record for testing.
43+
pub const VALID_CREDITS_RECORD: &str = r"{
1844
owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private,
1945
microcredits: 1500000000000000u64.private,
2046
_nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public,
2147
_version: 0u8.public
2248
}";
49+
50+
/// Invalid credits.aleo record for testing.
2351
pub const INVALID_CREDITS_RECORD: &str = r"{
2452
owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private,
2553
microcredits: 1400000000000000u64.private,

0 commit comments

Comments
 (0)