From 74355f435b7ff0bf493fc813e935675b7af1e26a Mon Sep 17 00:00:00 2001 From: mohanson Date: Thu, 1 Aug 2024 17:16:32 +0800 Subject: [PATCH] Add checkers for cycles and binary size --- tests/src/test_btc.rs | 8 +++++++- tests/src/test_eth.rs | 8 +++++++- tests/src/test_sol.rs | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/src/test_btc.rs b/tests/src/test_btc.rs index aa3f808..a396861 100644 --- a/tests/src/test_btc.rs +++ b/tests/src/test_btc.rs @@ -79,7 +79,8 @@ fn test_success() { let tx_resolved = ckb_types::core::cell::resolve_transaction(tx, &mut std::collections::HashSet::new(), &dl, &dl).unwrap(); let verifier = Verifier::default(); - verifier.verify(&tx_resolved, &dl).unwrap(); + let cycles = verifier.verify(&tx_resolved, &dl).unwrap(); + assert!(cycles <= 4718592); } #[test] @@ -255,3 +256,8 @@ fn test_success_e2e() { let verifier = Verifier::default(); verifier.verify(&tx_resolved, &dl).unwrap(); } + +#[test] +fn test_check_size() { + assert!(BINARY_CCC_LOCK_BTC.len() <= 150 * 1024); +} diff --git a/tests/src/test_eth.rs b/tests/src/test_eth.rs index 05edbff..551e731 100644 --- a/tests/src/test_eth.rs +++ b/tests/src/test_eth.rs @@ -94,7 +94,8 @@ fn test_success() { let tx_resolved = ckb_types::core::cell::resolve_transaction(tx, &mut std::collections::HashSet::new(), &dl, &dl).unwrap(); let verifier = Verifier::default(); - verifier.verify(&tx_resolved, &dl).unwrap(); + let cycles = verifier.verify(&tx_resolved, &dl).unwrap(); + assert!(cycles <= 4718592); } #[test] @@ -235,3 +236,8 @@ fn test_success_e2e() { let verifier = Verifier::default(); verifier.verify(&tx_resolved, &dl).unwrap(); } + +#[test] +fn test_check_size() { + assert!(BINARY_CCC_LOCK_ETH.len() <= 150 * 1024); +} diff --git a/tests/src/test_sol.rs b/tests/src/test_sol.rs index a26ab7d..011d18d 100644 --- a/tests/src/test_sol.rs +++ b/tests/src/test_sol.rs @@ -68,7 +68,8 @@ fn test_success() { let tx_resolved = ckb_types::core::cell::resolve_transaction(tx, &mut std::collections::HashSet::new(), &dl, &dl).unwrap(); let verifier = Verifier::default(); - verifier.verify(&tx_resolved, &dl).unwrap(); + let cycles = verifier.verify(&tx_resolved, &dl).unwrap(); + assert!(cycles <= 2621440); } #[test] @@ -177,3 +178,8 @@ fn test_success_e2e() { let verifier = Verifier::default(); verifier.verify(&tx_resolved, &dl).unwrap(); } + +#[test] +fn test_check_size() { + assert!(BINARY_CCC_LOCK_SOL.len() <= 100 * 1024); +}