LCOV - code coverage report
Current view: top level - irohad/validation - stateful_validator_common.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 1 1 100.0 %
Date: 2019-03-07 14:46:43 Functions: 17 17 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_STATEFUL_VALIDATOR_COMMON_HPP
       7             : #define IROHA_STATEFUL_VALIDATOR_COMMON_HPP
       8             : 
       9             : #include <memory>
      10             : #include <utility>
      11             : #include <vector>
      12             : 
      13             : #include <unordered_map>
      14             : 
      15             : #include "cryptography/hash.hpp"
      16             : #include "interfaces/common_objects/types.hpp"
      17             : 
      18             : namespace shared_model {
      19             :   namespace interface {
      20             :     class Proposal;
      21             :   }
      22             : }  // namespace shared_model
      23             : 
      24             : namespace iroha {
      25             :   namespace validation {
      26             : 
      27             :     /// Type of command error report which appeared during validation
      28             :     /// process; contains name of command, command error itself and
      29             :     /// the command index in the transaction.
      30             :     struct CommandError {
      31             :       /// Name of the failed command
      32             :       std::string name;
      33             : 
      34             :       /// Error code, with which the command failed
      35             :       uint32_t error_code;
      36             : 
      37             :       /// Extra information about error for developers to be placed into the log
      38             :       std::string error_extra;
      39             : 
      40             :       /// Shows, if transaction has passed initial validation
      41             :       bool tx_passed_initial_validation;
      42             : 
      43             :       /// Position of the failed command in transaction
      44         726 :       size_t index = 0;
      45             :     };
      46             : 
      47             :     /// Hash of transaction with error, which appeared during validation of this
      48             :     /// transaction
      49             :     struct TransactionError {
      50             :       shared_model::crypto::Hash tx_hash;
      51             :       CommandError error;
      52             :     };
      53             : 
      54             :     /// Collection of transactions errors
      55             :     using TransactionsErrors = std::vector<TransactionError>;
      56             : 
      57             :     /// Type of verified proposal and errors appeared in the process
      58             :     // TODO [IR-1849] mboldyrev 27.10.2018: create a special class
      59             :     // for VerifiedProposal which will include the rejected tx hashes
      60             :     struct VerifiedProposalAndErrors {
      61             :       std::shared_ptr<const shared_model::interface::Proposal>
      62             :           verified_proposal;
      63             :       TransactionsErrors rejected_transactions;
      64             :     };
      65             : 
      66             :   }  // namespace validation
      67             : }  // namespace iroha
      68             : 
      69             : #endif  // IROHA_STATEFUL_VALIDATOR_COMMON_HPP

Generated by: LCOV version 1.13