From 6ca044b7c498e0d539cb4efd522406e47c4d18b7 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 28 Nov 2023 07:37:42 -0600 Subject: [PATCH 1/2] GH-1916 fthreshold should be > to ensure Byzantine fault tolerance of at least one --- libraries/chain/webassembly/privileged.cpp | 2 +- libraries/testing/tester.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/chain/webassembly/privileged.cpp b/libraries/chain/webassembly/privileged.cpp index 164fc58a15..431a3c7945 100644 --- a/libraries/chain/webassembly/privileged.cpp +++ b/libraries/chain/webassembly/privileged.cpp @@ -196,7 +196,7 @@ namespace eosio { namespace chain { namespace webassembly { // system contract should perform a duplicate check and fthreshold check before calling EOS_ASSERT( finalizers.size() == unique_finalizer_keys.size(), wasm_execution_error, "Duplicate finalizer bls key in finalizer set" ); - EOS_ASSERT( finset.fthreshold >= f_weight_sum / 2, wasm_execution_error, "Finalizer set threshold cannot be met by finalizer weights" ); + EOS_ASSERT( finset.fthreshold > f_weight_sum / 2, wasm_execution_error, "Finalizer set threshold cannot be met by finalizer weights" ); context.control.set_proposed_finalizers( finset ); } diff --git a/libraries/testing/tester.cpp b/libraries/testing/tester.cpp index 152d53ccb8..2e084bbc26 100644 --- a/libraries/testing/tester.cpp +++ b/libraries/testing/tester.cpp @@ -1186,7 +1186,7 @@ namespace eosio { namespace testing { } transaction_trace_ptr base_tester::set_finalizers(const vector& finalizer_names) { - uint64_t fthreshold = finalizer_names.size() * 2 / 3; + uint64_t fthreshold = finalizer_names.size() * 2 / 3 + 1; fc::variants finalizer_auths; for (const auto& n: finalizer_names) { From 4b20808323f8e7dab71e15eba3ff4e29b6c6c34a Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 28 Nov 2023 07:39:02 -0600 Subject: [PATCH 2/2] GH-1916 tester sets to 2/3+1 --- unittests/api_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/api_tests.cpp b/unittests/api_tests.cpp index b4b903d55c..a226866116 100644 --- a/unittests/api_tests.cpp +++ b/unittests/api_tests.cpp @@ -3880,7 +3880,7 @@ BOOST_AUTO_TEST_CASE(set_finalizer_test) { try { BOOST_TEST(!!ext); BOOST_TEST(std::get(*ext).finalizers.size() == finalizers.size()); BOOST_TEST(std::get(*ext).generation == 1); - BOOST_TEST(std::get(*ext).fthreshold == finalizers.size() / 3 * 2); + BOOST_TEST(std::get(*ext).fthreshold == finalizers.size() / 3 * 2 + 1); // old dpos still in affect until block is irreversible BOOST_TEST(block->confirmed == 0);