From 17f0f54eb7b16830070f4e6ff967188d448286a7 Mon Sep 17 00:00:00 2001 From: Evan Vigil-McClanahan Date: Thu, 12 Nov 2020 14:15:05 -0800 Subject: [PATCH] fix tests for election v4 stuff --- rebar.lock | 2 +- run.sh | 2 +- src/cli/miner_cli_genesis.erl | 2 +- test/miner_blockchain_SUITE.erl | 4 ++++ test/miner_ct_utils.erl | 9 ++++++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/rebar.lock b/rebar.lock index 952a28c13..82178409b 100644 --- a/rebar.lock +++ b/rebar.lock @@ -4,7 +4,7 @@ {<<"base64url">>,{pkg,<<"base64url">>,<<"1.0.1">>},1}, {<<"blockchain">>, {git,"https://github.com/helium/blockchain-core.git", - {ref,"7801ba9797b9675e463b710b5c00e38c27dd40ef"}}, + {ref,"14f283ddb68c43fdbabf708865442a094a99d275"}}, 0}, {<<"clique">>, {git,"https://github.com/helium/clique.git", diff --git a/run.sh b/run.sh index f50b987bb..e69982bc3 100755 --- a/run.sh +++ b/run.sh @@ -100,7 +100,7 @@ echo "Node not in consensus: $non_consensus_node" exported_genesis_file="/tmp/genesis_$(date +%Y%m%d%H%M%S)" # get the genesis block from one of the consensus nodes LOOP=5 -while [ $LOOP -ne 0 ]; do +while [ $LOOP -gt 0 ]; do for node in ${nodes[@]}; do if [[ $(./_build/testdev\+miner$node/rel/miner$node/bin/miner$node info in_consensus) = *true* ]]; then ./_build/testdev\+miner$node/rel/miner$node/bin/miner$node genesis export $exported_genesis_file diff --git a/src/cli/miner_cli_genesis.erl b/src/cli/miner_cli_genesis.erl index bef13427e..73165ba5a 100644 --- a/src/cli/miner_cli_genesis.erl +++ b/src/cli/miner_cli_genesis.erl @@ -329,7 +329,7 @@ make_vars() -> ?block_time => BlockTime, ?election_interval => Interval, ?election_restart_interval => 5, - ?election_version => 3, + ?election_version => 4, ?election_bba_penalty => 0.01, ?election_seen_penalty => 0.25, ?election_selection_pct => 75, diff --git a/test/miner_blockchain_SUITE.erl b/test/miner_blockchain_SUITE.erl index 1757e4bee..ef568f580 100644 --- a/test/miner_blockchain_SUITE.erl +++ b/test/miner_blockchain_SUITE.erl @@ -72,6 +72,10 @@ init_per_testcase(TestCase, Config0) -> ?election_bba_penalty => 0.01, ?election_seen_penalty => 0.05, ?election_version => 3}; + election_v3_test -> + #{ + ?election_version => 2 + }; _ -> #{} end, diff --git a/test/miner_ct_utils.erl b/test/miner_ct_utils.erl index fabbf8ff5..7975a288e 100644 --- a/test/miner_ct_utils.erl +++ b/test/miner_ct_utils.erl @@ -921,7 +921,9 @@ make_vars(Keys, Map, Mode) -> ?poc_challengers_percent => 0.09 + 0.06, ?poc_witnesses_percent => 0.02 + 0.03, ?consensus_percent => 0.10, - ?election_version => 2, + ?election_version => 4, + ?election_bba_penalty => 0.01, + ?election_seen_penalty => 0.05, ?election_cluster_res => 8, ?election_removal_pct => 85, ?election_selection_pct => 60, @@ -956,9 +958,10 @@ make_vars(Keys, Map, Mode) -> legacy -> %% ideally figure out a few more that are safe to %% remove or bring back the splitting code - LegVars = maps:without([?poc_version, ?poc_path_limit, + LegVars = maps:without([?poc_version, ?poc_path_limit, ?sc_grace_blocks, ?election_version, ?election_removal_pct, ?election_cluster_res, - ?chain_vars_version, ?block_version], + ?chain_vars_version, ?block_version, ?election_bba_penalty, + ?election_seen_penalty], Vars), Proof = blockchain_txn_vars_v1:legacy_create_proof(Priv, LegVars), Txn = blockchain_txn_vars_v1:new(LegVars, 1, #{master_key => BinPub,