code: def handle_onchain_secretreveal(
          target_state: TargetTransferState,
          state_change: ContractReceiveSecretReveal,
          channel_state: NettingChannelState,
  ) -> TransitionResult[TargetTransferState]:
      
      valid_secret = is_valid_secret_reveal(
          state_change=state_change,
          transfer_secrethash=target_state.transfer.lock.secrethash,
          secret=state_change.secret,
      )
  
      if valid_secret:
          channel.register_onchain_secret(
              channel_state=channel_state,
              secret=state_change.secret,
              secrethash=state_change.secrethash,
              secret_reveal_block_number=state_change.block_number,
          )
  
          target_state.state = TargetTransferState.ONCHAIN_UNLOCK
          target_state.secret = state_change.secret
  
      return TransitionResult(target_state, list())
docs: Validates and handles a ContractReceiveSecretReveal state change.