From 8cc43009924773b9d0f5cf0de6c1a57bef21efa4 Mon Sep 17 00:00:00 2001
From: Oleh <oleg@skalelabs.com>
Date: Mon, 25 Oct 2021 16:22:16 +0300
Subject: [PATCH 1/4] SKALE-4666 fix random fails

---
 test/test_TE_wrappers.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/test/test_TE_wrappers.cpp b/test/test_TE_wrappers.cpp
index 05691fc9..fde94dce 100644
--- a/test/test_TE_wrappers.cpp
+++ b/test/test_TE_wrappers.cpp
@@ -602,7 +602,6 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
         std::get< 1 >( cypher ) =
             "Hello, SKALE users and fans, gl!Hello, SKALE users and fans, gl!";
         std::get< 2 >( cypher ) = W;
-
         BOOST_REQUIRE_THROW( decr_set.merge( cypher ), libBLS::ThresholdUtils::IncorrectInput );
     }
 }
@@ -655,12 +654,12 @@ BOOST_AUTO_TEST_CASE( ExceptionsDKGWrappersTest ) {
 
     {
         DKGTEWrapper dkg_te( num_signed, num_all );
-        std::shared_ptr< std::vector< libff::alt_bn128_Fr > > shares =
-            dkg_te.createDKGSecretShares();
-        shares->erase( shares->begin() + shares->size() - 2 );
-        shares->shrink_to_fit();
+        dkg_te.createDKGSecretShares();
+
+        std::shared_ptr< std::vector< libff::alt_bn128_Fr > > v;
+
         BOOST_REQUIRE_THROW(
-            dkg_te.setDKGSecret( shares ), libBLS::ThresholdUtils::IncorrectInput );
+            dkg_te.setDKGSecret( v ), libBLS::ThresholdUtils::IncorrectInput );
     }
 
     {

From 3ad357c2eb4af90e180a06bcb467b3e1f8608efc Mon Sep 17 00:00:00 2001
From: Oleh <oleg@skalelabs.com>
Date: Mon, 25 Oct 2021 17:13:14 +0300
Subject: [PATCH 2/4] SKALE-4666 fix random fails

---
 test/test_TE_wrappers.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/test/test_TE_wrappers.cpp b/test/test_TE_wrappers.cpp
index fde94dce..fd4bb3a8 100644
--- a/test/test_TE_wrappers.cpp
+++ b/test/test_TE_wrappers.cpp
@@ -337,9 +337,12 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
     BOOST_REQUIRE_THROW(
         libBLS::ThresholdUtils::checkSigners( 0, 0 ), libBLS::ThresholdUtils::IncorrectInput );
 
-    // null public key share
-    BOOST_REQUIRE_THROW( TEPublicKeyShare( nullptr, 1, num_signed, num_all ),
-        libBLS::ThresholdUtils::IncorrectInput );
+    {
+        // null public key share
+        std::shared_ptr< std::vector< std::string > > share_ptr = nullptr;
+        BOOST_REQUIRE_THROW( TEPublicKeyShare( share_ptr, 1, num_signed, num_all ),
+            libBLS::ThresholdUtils::IncorrectInput );
+    }
 
     {
         // 1 coord of public key share is not a number
@@ -568,10 +571,6 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
     {
         // not enough elements in decrypt set
         TEDecryptSet decr_set( num_signed, num_all );
-        libff::alt_bn128_G2 el1 = libff::alt_bn128_G2::random_element();
-
-        auto el_ptr1 = std::make_shared< libff::alt_bn128_G2 >( el1 );
-        decr_set.addDecrypt( 1, el_ptr1 );
 
         libff::alt_bn128_G2 U = libff::alt_bn128_G2::random_element();
 
@@ -582,7 +581,7 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
         std::get< 1 >( cypher ) =
             "Hello, SKALE users and fans, gl!Hello, SKALE users and fans, gl!";
         std::get< 2 >( cypher ) = W;
-
+        
         BOOST_REQUIRE_THROW( decr_set.merge( cypher ), libBLS::ThresholdUtils::IsNotWellFormed );
     }
 
@@ -602,6 +601,7 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
         std::get< 1 >( cypher ) =
             "Hello, SKALE users and fans, gl!Hello, SKALE users and fans, gl!";
         std::get< 2 >( cypher ) = W;
+
         BOOST_REQUIRE_THROW( decr_set.merge( cypher ), libBLS::ThresholdUtils::IncorrectInput );
     }
 }

From 0afcfe9f21318fa02e88a080c5c13b0e871db1fd Mon Sep 17 00:00:00 2001
From: Oleh Nikolaiev <oleg@skalelabs.com>
Date: Wed, 10 Nov 2021 13:32:37 +0200
Subject: [PATCH 3/4] SKALE-4666 format code

---
 test/test_TE_wrappers.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/test_TE_wrappers.cpp b/test/test_TE_wrappers.cpp
index fd4bb3a8..da3c9401 100644
--- a/test/test_TE_wrappers.cpp
+++ b/test/test_TE_wrappers.cpp
@@ -581,7 +581,7 @@ BOOST_AUTO_TEST_CASE( ExceptionsTest ) {
         std::get< 1 >( cypher ) =
             "Hello, SKALE users and fans, gl!Hello, SKALE users and fans, gl!";
         std::get< 2 >( cypher ) = W;
-        
+
         BOOST_REQUIRE_THROW( decr_set.merge( cypher ), libBLS::ThresholdUtils::IsNotWellFormed );
     }
 
@@ -658,8 +658,7 @@ BOOST_AUTO_TEST_CASE( ExceptionsDKGWrappersTest ) {
 
         std::shared_ptr< std::vector< libff::alt_bn128_Fr > > v;
 
-        BOOST_REQUIRE_THROW(
-            dkg_te.setDKGSecret( v ), libBLS::ThresholdUtils::IncorrectInput );
+        BOOST_REQUIRE_THROW( dkg_te.setDKGSecret( v ), libBLS::ThresholdUtils::IncorrectInput );
     }
 
     {

From eedb2fc8a9f9444da7731dc9e8799eb49defcfe6 Mon Sep 17 00:00:00 2001
From: Oleh Nikolaiev <oleg@skalelabs.com>
Date: Wed, 10 Nov 2021 15:48:21 +0200
Subject: [PATCH 4/4] SKALE-4666 imporve nightly build

---
 .github/workflows/nightly.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 3365e2f2..1cad978c 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -123,7 +123,6 @@ jobs:
         export CC=gcc-7
         export CXX=g++-7
         export TARGET=all
-        export CMAKE_BUILD_FLAGS="-DCOVERAGE=ON"
         cd deps
         ./build.sh WITH_EMSCRIPTEN=1
         cd ..