github.com/prysmaticlabs/prysm@v1.4.4/scripts/interop_start.sh (about)

     1  #!/bin/bash
     2  
     3  """
     4  2019/09/08 -- Interop start script.
     5  This script is intended for dockerfile deployment for interop testing.
     6  This script is fragile and subject to break as flags change.
     7  Use at your own risk!
     8  
     9  
    10  Use with interop.Dockerfile from the workspace root:
    11  
    12  docker build -f interop.Dockerfile .
    13  """
    14  
    15  # Flags
    16  IDENTITY="" # P2P private key
    17  PEERS="" # Comma separated list of peers
    18  GEN_STATE="" # filepath to ssz encoded state.
    19  PORT="8000" # port to serve p2p traffic
    20  RPCPORT="8001" # port to serve rpc traffic
    21  YAML_KEY_FILE="" # Path to yaml keyfile as defined here: https://github.com/ethereum/eth2.0-pm/tree/master/interop/mocked_start
    22  
    23  # Constants
    24  BEACON_LOG_FILE="/tmp/beacon.log"
    25  VALIDATOR_LOG_FILE="/tmp/validator.log"
    26  
    27  usage() {
    28      echo "--identity=<identity>"
    29      echo "--peer=<peer>"
    30      echo "--num-validators=<number>"
    31      echo "--gen-state=<file path>"
    32      echo "--port=<port number>"
    33      echo "--rpcport=<port number>"
    34  }
    35  
    36  while [ "$1" != "" ];
    37  do
    38      PARAM=`echo $1 | awk -F= '{print $1}'`
    39      VALUE=`echo $1 | sed 's/^[^=]*=//g'`
    40  
    41      case $PARAM in
    42          --identity)
    43              IDENTITY=$VALUE
    44              ;;
    45          --peers)
    46              [ -z "$PEERS" ] && PEERS+=","
    47             PEERS+="$VALUE"
    48              ;;
    49          --validator-keys)
    50              YAML_KEY_FILE=$VALUE
    51              ;;
    52          --gen-state)
    53              GEN_STATE=$VALUE
    54              ;;
    55          --port)
    56              PORT=$VALUE
    57              ;;
    58          --rpcport)
    59              RPCPORT=$VALUE
    60              ;;
    61          --help)
    62              usage
    63              exit
    64              ;;
    65          *)
    66              echo "ERROR: unknown parameter \"$PARAM\""
    67              usage
    68              exit 1
    69              ;;
    70      esac
    71      shift
    72  done
    73  
    74  
    75  echo "Converting hex yaml keys to a format that Prysm understands"
    76  
    77  # Expect YAML keys in hex encoded format. Convert this into the format the the validator already understands.
    78  ./convert-keys $YAML_KEY_FILE /tmp/keys.json
    79  
    80  echo "Starting beacon chain and logging to $BEACON_LOG_FILE"
    81  
    82  echo -n "$IDENTITY" > /tmp/id.key
    83  
    84  
    85  
    86  BEACON_FLAGS="--bootstrap-node= \
    87    --deposit-contract=0xD775140349E6A5D12524C6ccc3d6A1d4519D4029 \
    88    --p2p-port=$PORT \
    89    --grpc-gateway-port=$RPCPORT \
    90    --peer=$PEERS \
    91    --interop-genesis-state=$GEN_STATE \
    92    --p2p-priv-key=/tmp/id.key \
    93    --log-file=$BEACON_LOG_FILE"
    94  
    95  ./beacon-chain $BEACON_FLAGS &
    96  
    97  echo "Starting validator client and logging to $VALIDATOR_LOG_FILE"
    98  
    99  VALIDATOR_FLAGS="--monitoring-port=9091 \
   100    --unencrypted-keys /tmp/keys.json \
   101    --log-file=$VALIDATOR_LOG_FILE
   102  
   103  ./validator- $VALIDATOR_FLAGS &
   104