name: "Validator Lifecycle Test"
timeout: 72h
config:
  #walletPrivkey: ""
  validatorMnemonic: "trial jeans seat abstract runway cupboard please elevator club file arrow lounge crash sun thumb clock duty priority key fence funny trick diary album"
  #validatorPairNames: []
tasks:
- name: check_clients_are_healthy
  title: "Check if at least one client is ready"
  timeout: 5m
  config:
    minClientCount: 1

- name: run_tasks_concurrent
  title: "Generate deposits & Track inclusion"
  config:
    tasks:
    - name: generate_deposits
      title: "Generate 300 deposits"
      config:
        limitTotal: 300
        limitPerSlot: 20
        depositContract: "0x4242424242424242424242424242424242424242"
      configVars:
        walletPrivkey: "walletPrivkey"
        mnemonic: "validatorMnemonic"

    - name: run_task_options
      title: "Check deposit inclusion"
      config:
        ignoreFailure: true
        task:
          name: run_task_matrix
          title: "Check deposit inclusion with all client pairs"
          timeout: 48h
          configVars:
            matrixValues: "validatorPairNames"
          config:
            runConcurrent: true
            matrixVar: "validatorPairName"
            task:
              name: check_consensus_block_proposals
              title: "Wait for block proposal with deposits from ${validatorPairName}"
              configVars:
                validatorNamePattern: "validatorPairName"
              config:
                minDepositCount: 1
    
# due to the deposits we should reach un-finality soon.
- name: check_consensus_validator_status
  title: "Wait for the last deposit to become activated"
  timeout: 48h
  config:
    validatorPubKey: 0xa4a6121cb76eaf63e520615368a21d504c6f7363b5045f965e3587f623a6f7f1ce32af63ce3c535e75cd831db27c5abd
    validatorStatus:
    - active_ongoing

# due to the deposits we should have reached un-finality now.
- name: check_consensus_finality
  title: "Check for consensus chain un-finality"
  timeout: 1m
  config:
    minUnfinalizedEpochs: 5

# check if all client pairs propose blocks with bls changes during un-finality
- name: run_task_background
  title: "Check if all clients propose blocks with BLS changes during un-finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_bls_changes
      title: "Generate 50 BLS changes (1 bls change per slot)"
      config:
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 100
        targetAddress: 0x65D08a056c17Ae13370565B04cF77D2AfA1cB9FA
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check bls change inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with deposits from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minBlsChangeCount: 1

# check if all client pairs propose blocks with exits during un-finality
- name: run_task_background
  title: "Check if all clients propose blocks with exits during un-finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_exits
      title: "Generate 50 Voluntary Exits (1 exit per slot)"
      config:
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 100
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check exit inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with deposits from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minExitCount: 1

# check if all client pairs propose blocks with attester slashings
- name: run_task_background
  title: "Check if all clients propose blocks with attester slashings during un-finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_slashings
      title: "Generate 1 attester slashing per slot"
      config:
        slashingType: "attester"
        startIndex: 50
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check slashing inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with attester slashings from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minAttesterSlashingCount: 1

# check if all client pairs propose blocks with proposer slashings
- name: run_task_background
  title: "Check if all clients propose blocks with proposer slashings during un-finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_slashings
      title: "Generate 1 proposer slashing per slot"
      config:
        slashingType: "proposer"
        startIndex: 100
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check slashing inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with proposer slashings from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minProposerSlashingCount: 1

# exit 150 validators and wait for finality
- name: generate_exits
  title: "Exit 150 Validators"
  config:
    indexCount: 150
  configVars:
    mnemonic: "validatorMnemonic"
- name: check_consensus_finality
  title: "Wait for consensus chain finality"
  timeout: 18h
  config:
    maxUnfinalizedEpochs: 4

# check if all client pairs propose blocks with bls changes during finality
- name: run_task_background
  title: "Check if all clients propose blocks with BLS changes during finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_bls_changes
      title: "Generate 1 bls change per slot"
      config:
        startIndex: 150
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
        targetAddress: 0x65D08a056c17Ae13370565B04cF77D2AfA1cB9FA
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check bls change inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with deposits from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minBlsChangeCount: 1

# check if all client pairs propose blocks with exits during finality
- name: run_task_background
  title: "Check if all clients propose blocks with exits during finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_exits
      title: "Generate 1 exit per slot"
      config:
        startIndex: 150
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check exit inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with deposits from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minExitCount: 1

# check if all client pairs propose blocks with attester slashings
- name: run_task_background
  title: "Check if all clients propose blocks with attester slashings during finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_slashings
      title: "Generate 1 attester slashing per slot"
      config:
        slashingType: "attester"
        startIndex: 200
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check slashing inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with attester slashings from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minAttesterSlashingCount: 1

# check if all client pairs propose blocks with proposer slashings
- name: run_task_background
  title: "Check if all clients propose blocks with proposer slashings during finality"
  config:
    onBackgroundComplete: failOrIgnore
    backgroundTask:
      name: generate_slashings
      title: "Generate 1 proposer slashing per slot"
      config:
        slashingType: "proposer"
        startIndex: 250
        limitTotal: 50
        limitPerSlot: 1
        indexCount: 50
      configVars:
        mnemonic: "validatorMnemonic"

    foregroundTask:
      name: run_task_matrix
      title: "Check slashing inclusion with all client pairs"
      timeout: 1h
      configVars:
        matrixValues: "validatorPairNames"
      config:
        runConcurrent: true
        matrixVar: "validatorPairName"
        task:
          name: check_consensus_block_proposals
          title: "Wait for block proposal with proposer slashings from ${validatorPairName}"
          configVars:
            validatorNamePattern: "validatorPairName"
          config:
            minProposerSlashingCount: 1

cleanupTasks:
- name: generate_exits
  title: "Exit all test validators"
  config:
    limitTotal: 300
    indexCount: 300
  configVars:
    mnemonic: "validatorMnemonic"