Explorar o código

contract/dao/tests: erroneous txs assert added

aggstam %!s(int64=3) %!d(string=hai) anos
pai
achega
2f7d0e75f9
Modificáronse 1 ficheiros con 51 adicións e 8 borrados
  1. 51 8
      src/contract/dao/tests/integration.rs

+ 51 - 8
src/contract/dao/tests/integration.rs

@@ -116,7 +116,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     mint_verify_times.push(timer.elapsed());
     mint_verify_times.push(timer.elapsed());
     // TODO: Witness and add to wallet merkle tree?
     // TODO: Witness and add to wallet merkle tree?
 
 
@@ -188,7 +194,13 @@ async fn integration_test() -> Result<()> {
     let sigs = tx.create_sigs(&mut OsRng, &vec![dao_th.faucet_kp.secret])?;
     let sigs = tx.create_sigs(&mut OsRng, &vec![dao_th.faucet_kp.secret])?;
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
 
 
     // Wallet stuff
     // Wallet stuff
 
 
@@ -299,12 +311,13 @@ async fn integration_test() -> Result<()> {
     let sigs = tx3.create_sigs(&mut OsRng, &[gdrk_mint_auth.secret])?;
     let sigs = tx3.create_sigs(&mut OsRng, &[gdrk_mint_auth.secret])?;
     tx3.signatures = vec![sigs];
     tx3.signatures = vec![sigs];
 
 
-    dao_th
+    let erroneous_txs = dao_th
         .alice_state
         .alice_state
         .read()
         .read()
         .await
         .await
         .verify_transactions(&[tx1.clone(), tx2.clone(), tx3.clone()], current_slot, true)
         .verify_transactions(&[tx1.clone(), tx2.clone(), tx3.clone()], current_slot, true)
         .await?;
         .await?;
+    assert!(erroneous_txs.is_empty());
 
 
     // Wallet
     // Wallet
     {
     {
@@ -435,7 +448,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     propose_verify_times.push(timer.elapsed());
     propose_verify_times.push(timer.elapsed());
 
 
     //// Wallet
     //// Wallet
@@ -542,7 +561,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     vote_verify_times.push(timer.elapsed());
     vote_verify_times.push(timer.elapsed());
 
 
     // Secret vote info. Needs to be revealed at some point.
     // Secret vote info. Needs to be revealed at some point.
@@ -612,7 +637,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     vote_verify_times.push(timer.elapsed());
     vote_verify_times.push(timer.elapsed());
 
 
     let vote_note_2 = {
     let vote_note_2 = {
@@ -679,7 +710,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![sigs];
     tx.signatures = vec![sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     vote_verify_times.push(timer.elapsed());
     vote_verify_times.push(timer.elapsed());
 
 
     // Secret vote info. Needs to be revealed at some point.
     // Secret vote info. Needs to be revealed at some point.
@@ -872,7 +909,13 @@ async fn integration_test() -> Result<()> {
     tx.signatures = vec![xfer_sigs, exec_sigs];
     tx.signatures = vec![xfer_sigs, exec_sigs];
 
 
     let timer = Instant::now();
     let timer = Instant::now();
-    dao_th.alice_state.read().await.verify_transactions(&[tx.clone()], current_slot, true).await?;
+    let erroneous_txs = dao_th
+        .alice_state
+        .read()
+        .await
+        .verify_transactions(&[tx.clone()], current_slot, true)
+        .await?;
+    assert!(erroneous_txs.is_empty());
     exec_verify_times.push(timer.elapsed());
     exec_verify_times.push(timer.elapsed());
 
 
     // Statistics
     // Statistics