LCOV - code coverage report
Current view: top level - irohad/validation - stateful_validator_common.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 1 1 100.0 %
Date: 2018-12-05 17:11:35 Functions: 13 13 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         719 :       size_t index = 0;
      45             :     };
      46             : 
      47             :     /// Collection of transactions errors - a map from the failed transaction
      48             :     /// hash to the description of failed command.
      49             :     using TransactionHash = shared_model::crypto::Hash;
      50             :     using TransactionsErrors = std::
      51             :         unordered_map<TransactionHash, CommandError, TransactionHash::Hasher>;
      52             :     using TransactionError = TransactionsErrors::value_type;
      53             : 
      54             :     /// Type of verified proposal and errors appeared in the process; first
      55             :     /// dimension of errors vector is transaction, second is error itself with
      56             :     /// number of transaction, where it happened
      57             :     // TODO mboldyrev 27.10.2018: create a special class for VerifiedProposal
      58             :     //      IR-1849               which will include the rejected tx hashes
      59             :     struct VerifiedProposalAndErrors {
      60             :       std::unique_ptr<shared_model::interface::Proposal> verified_proposal;
      61             :       TransactionsErrors rejected_transactions;
      62             :     };
      63             : 
      64             :   }  // namespace validation
      65             : }  // namespace iroha
      66             : 
      67             : #endif  // IROHA_STATEFUL_VALIDATOR_COMMON_HPP

Generated by: LCOV version 1.13