You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.4 KiB

  1. #! /bin/bash
  2. set -eu
  3. set -o pipefail
  4. DOCKER_IMAGE=$1
  5. NETWORK_NAME=$2
  6. IPV=$3
  7. ID=$4
  8. N=$5
  9. PROXY_APP=$6
  10. ASSERT_NODE_UP=1
  11. ASSERT_NODE_DOWN=0
  12. ###########################s####################################
  13. # this runs on each peer:
  14. # kill peer
  15. # bring it back online with double_sign_check_height 10
  16. # wait node is not run by double sign risk reduction
  17. #
  18. # kill peer
  19. # bring it back online with double_sign_check_height 1
  20. # pass double sign risk reduction, wait for it to sync and check the app hash
  21. #
  22. # kill peer
  23. # bring it back online with double_sign_check_height 0
  24. # wait for it to sync and check the app hash
  25. ###############################################################
  26. echo "Testing double sign risk reduction on node $ID"
  27. # kill peer
  28. set +e
  29. docker rm -vf local_testnet_$ID
  30. set -e
  31. PERSISTENT_PEERS="$(test/p2p/address.sh $IPV 1 26656 $DOCKER_IMAGE)"
  32. for j in `seq 2 $N`; do
  33. PERSISTENT_PEERS="$PERSISTENT_PEERS,$(test/p2p/address.sh $IPV $j 26656 $DOCKER_IMAGE)"
  34. done
  35. # bring it back online with double_sign_check_height 10
  36. # wait node is not run by double sign risk reduction
  37. DSCH=10
  38. bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $IPV $ID $PROXY_APP "--p2p.persistent_peers $PERSISTENT_PEERS --p2p.pex --rpc.unsafe --consensus.double_sign_check_height $DSCH"
  39. bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $IPV fs_$ID "test/p2p/dsrr/check_peer.sh $IPV $ID $ASSERT_NODE_DOWN"
  40. docker stop local_testnet_$ID
  41. docker rm local_testnet_$ID
  42. # bring it back online with double_sign_check_height 1
  43. # pass double sign risk reduction, wait for it to sync and check the app hash
  44. DSCH=1
  45. bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $IPV $ID $PROXY_APP "--p2p.persistent_peers $PERSISTENT_PEERS --p2p.pex --rpc.unsafe --consensus.double_sign_check_height $DSCH"
  46. bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $IPV fs_$ID "test/p2p/dsrr/check_peer.sh $IPV $ID $ASSERT_NODE_UP"
  47. docker stop local_testnet_$ID
  48. docker rm local_testnet_$ID
  49. DSCH=0
  50. # bring it back online with double_sign_check_height 0
  51. # double sign risk reduction is not activated, wait for it to sync and check the app hash
  52. bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $IPV $ID $PROXY_APP "--p2p.persistent_peers $PERSISTENT_PEERS --p2p.pex --rpc.unsafe --consensus.double_sign_check_height $DSCH"
  53. bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $IPV fs_$ID "test/p2p/dsrr/check_peer.sh $IPV $ID $ASSERT_NODE_UP"
  54. echo ""
  55. echo "PASS"
  56. echo ""