Skip to content

Commit

Permalink
Add VC9 - Suspend before response
Browse files Browse the repository at this point in the history
  • Loading branch information
bb111189 authored and Sunny committed Jun 21, 2021
1 parent 84883ce commit 322bcad
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Expand Up @@ -182,6 +182,11 @@ if(VC_TEST_VC_PRECHECK_2)
add_definitions(-DVC_TEST_VC_PRECHECK_2)
endif()

if(VC_TEST_FB_SUSPEND_1)
message(STATUS "VC 9 test enabled")
add_definitions(-VC_TEST_FB_SUSPEND_1)
endif()

# For Merging DSMB into FINALBLOCK
if(DM_TEST_DM_LESSTXN_ONE)
message(STATUS "DM 1 test enabled")
Expand Down
22 changes: 13 additions & 9 deletions build.sh
Expand Up @@ -64,39 +64,43 @@ do
;;
vc1)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_DS_SUSPEND_1=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 1 time (before DS block consensus)"
echo "Build with VC test DS Suspend 1 - Suspend DS leader for 1 time (before DS block consensus)"
;;
vc2)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_DS_SUSPEND_3=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 3 times (before DS block consensus)"
echo "Build with VC test DS Suspend 3 - Suspend DS leader for 3 times (before DS block consensus)"
;;
govvc2)
CMAKE_EXTRA_OPTIONS="-DGOVVC_TEST_DS_SUSPEND_3=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with GOVVC test - Suspend DS leader for 3 times (before DS block consensus)"
;;
vc3)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_FB_SUSPEND_1=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 1 time (before Final block consensus)"
echo "Build with VC test FB Suspend 1 - Suspend DS leader for 1 time (before Final block consensus)"
;;
vc4)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_FB_SUSPEND_3=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 3 times (before Final block consensus)"
echo "Build with VC test FB Suspend 3- Suspend DS leader for 3 times (before Final block consensus)"
;;
vc5)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_VC_SUSPEND_1=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 1 time (before VC block consensus)"
echo "Build with VC test VC Suspend 1 - Suspend DS leader for 1 time (before VC block consensus)"
;;
vc6)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_VC_SUSPEND_3=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Suspend DS leader for 3 times (before VC block consensus)"
echo "Build with VC test VC Suspend 3 - Suspend DS leader for 3 times (before VC block consensus)"
;;
vc7)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_VC_PRECHECK_1=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Caused the node to lag behind at ds epoch"
echo "Build with VC test VC Precheck 1 - Caused the node to lag behind at ds epoch"
;;
vc8)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_VC_PRECHECK_2=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test - Caused the node to lag behind at tx epoch"
echo "Build with VC test VC Precheck 2 - Caused the node to lag behind at tx epoch"
;;
vc9)
CMAKE_EXTRA_OPTIONS="-DVC_TEST_FB_SUSPEND_RESPONSE=1 ${CMAKE_EXTRA_OPTIONS}"
echo "Build with VC test FB Suspend consensus at commit done 1 - Caused the node to lag behind at tx epoch"
;;
dm1)
CMAKE_EXTRA_OPTIONS="-DDM_TEST_DM_LESSTXN_ONE=1 ${CMAKE_EXTRA_OPTIONS}"
Expand Down Expand Up @@ -143,7 +147,7 @@ do
echo "Build with SJ test - New Seed misses the mbtxns message from multiplier"
;;
*)
echo "Usage $0 [cuda|opencl] [tsan|asan] [style] [heartbeattest] [vc<1-8>] [dm<1-9>] [sj<1-2>]"
echo "Usage $0 [cuda|opencl] [tsan|asan] [style] [heartbeattest] [vc<1-9>] [dm<1-9>] [sj<1-2>]"
exit 1
;;
esac
Expand Down
3 changes: 2 additions & 1 deletion scripts/make_image_for_test.sh
Expand Up @@ -32,6 +32,7 @@ Test_scenarios=("-DVC_TEST_DS_SUSPEND_3=1 "
"-DVC_TEST_FB_SUSPEND_3=1 -DVC_TEST_VC_SUSPEND_3=1 "
"-DVC_TEST_VC_PRECHECK_1=1 "
"-DVC_TEST_VC_PRECHECK_2=1 "
"-DVC_TEST_FB_SUSPEND_1=1 "
"-DDM_TEST_DM_LESSTXN_ONE=1 "
"-DDM_TEST_DM_LESSTXN_ALL=1 "
"-DDM_TEST_DM_LESSMB_ONE=1 "
Expand All @@ -46,7 +47,7 @@ Test_scenarios=("-DVC_TEST_DS_SUSPEND_3=1 "
"-DSJ_TEST_SJ_TXNBLKS_PROCESS_SLOW=1 "
"-DSJ_TEST_SJ_MISSING_MBTXNS=1 " )

Test_scenarios_name=( "vc2" "govvc2" "vc4" "vc1vc6" "vc3vc6" "vc7" "vc8" "dm1" "dm2" "dm3" "dm4" "dm5" "dm6" "dm7" "dm8" "dm9" "asan" "tsan" "sj1" "sj2" )
Test_scenarios_name=( "vc2" "govvc2" "vc4" "vc1vc6" "vc3vc6" "vc7" "vc8" "vc9" "dm1" "dm2" "dm3" "dm4" "dm5" "dm6" "dm7" "dm8" "dm9" "asan" "tsan" "sj1" "sj2" )

cmd=$0

Expand Down
14 changes: 14 additions & 0 deletions src/libDirectoryService/FinalBlockPostProcessing.cpp
Expand Up @@ -567,6 +567,20 @@ bool DirectoryService::ProcessFinalBlockConsensusCore(
return false;
}

#ifdef VC_TEST_FB_SUSPEND_RESPONSE
ConsensusCommon::State state = m_consensusObject->GetState();

if (state == FINALCHALLENGE_DONE && m_mode == PRIMARY_DS &&
m_viewChangeCounter == 0 &&
m_mediator.m_txBlockChain.GetBlockCount() % NUM_FINAL_BLOCK_PER_POW !=
0) {
LOG_EPOCH(WARNING, m_mediator.m_currentEpochNum,
"I am suspending myself to test viewchange "
"(VC_TEST_FB_SUSPEND_RESPONSE)");
return false;
}
#endif // VC_TEST_FB_SUSPEND_RESPONSE

if (!m_consensusObject->ProcessMessage(message, offset, from)) {
return false;
}
Expand Down

0 comments on commit 322bcad

Please sign in to comment.