2019-01-07 11:33:07 +01:00
|
|
|
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
|
|
// This file is part of Parity Ethereum.
|
2016-05-16 18:33:32 +02:00
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is free software: you can redistribute it and/or modify
|
2016-05-16 18:33:32 +02:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is distributed in the hope that it will be useful,
|
2016-05-16 18:33:32 +02:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2019-01-07 11:33:07 +01:00
|
|
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2016-05-16 18:33:32 +02:00
|
|
|
|
|
|
|
//! Transaction execution format module.
|
|
|
|
|
2019-07-18 12:27:08 +02:00
|
|
|
use ethereum_types::{U256, Address};
|
2019-08-13 12:33:34 +02:00
|
|
|
use parity_bytes::Bytes;
|
2017-08-01 12:37:57 +02:00
|
|
|
use vm;
|
2016-07-28 20:31:29 +02:00
|
|
|
use trace::{VMTrace, FlatTrace};
|
2019-08-13 12:33:34 +02:00
|
|
|
use common_types::{
|
2019-07-18 12:27:08 +02:00
|
|
|
state_diff::StateDiff,
|
|
|
|
log_entry::LogEntry,
|
|
|
|
errors::ExecutionError,
|
|
|
|
};
|
2016-07-27 17:41:21 +02:00
|
|
|
|
2016-05-16 18:33:32 +02:00
|
|
|
/// Transaction execution receipt.
|
2016-12-21 15:09:35 +01:00
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
2017-10-20 15:40:25 +02:00
|
|
|
pub struct Executed<T = FlatTrace, V = VMTrace> {
|
2017-01-12 11:06:12 +01:00
|
|
|
/// True if the outer call/create resulted in an exceptional exit.
|
2017-08-01 12:37:57 +02:00
|
|
|
pub exception: Option<vm::Error>,
|
2017-01-12 11:06:12 +01:00
|
|
|
|
2016-05-16 18:33:32 +02:00
|
|
|
/// Gas paid up front for execution of transaction.
|
|
|
|
pub gas: U256,
|
|
|
|
|
|
|
|
/// Gas used during execution of transaction.
|
|
|
|
pub gas_used: U256,
|
|
|
|
|
|
|
|
/// Gas refunded after the execution of transaction.
|
|
|
|
/// To get gas that was required up front, add `refunded` and `gas_used`.
|
|
|
|
pub refunded: U256,
|
|
|
|
|
|
|
|
/// Cumulative gas used in current block so far.
|
|
|
|
///
|
|
|
|
/// `cumulative_gas_used = gas_used(t0) + gas_used(t1) + ... gas_used(tn)`
|
|
|
|
///
|
|
|
|
/// where `tn` is current transaction.
|
|
|
|
pub cumulative_gas_used: U256,
|
|
|
|
|
|
|
|
/// Vector of logs generated by transaction.
|
|
|
|
pub logs: Vec<LogEntry>,
|
|
|
|
|
|
|
|
/// Addresses of contracts created during execution of transaction.
|
|
|
|
/// Ordered from earliest creation.
|
|
|
|
///
|
|
|
|
/// eg. sender creates contract A and A in constructor creates contract B
|
|
|
|
///
|
|
|
|
/// B creation ends first, and it will be the first element of the vector.
|
|
|
|
pub contracts_created: Vec<Address>,
|
|
|
|
/// Transaction output.
|
|
|
|
pub output: Bytes,
|
|
|
|
/// The trace of this transaction.
|
2017-10-20 15:40:25 +02:00
|
|
|
pub trace: Vec<T>,
|
2016-05-28 16:52:33 +02:00
|
|
|
/// The VM trace of this transaction.
|
2017-10-20 15:40:25 +02:00
|
|
|
pub vm_trace: Option<V>,
|
2016-05-31 21:03:44 +02:00
|
|
|
/// The state diff, if we traced it.
|
2016-06-02 12:39:25 +02:00
|
|
|
pub state_diff: Option<StateDiff>,
|
2016-05-16 18:33:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Transaction execution result.
|
2019-03-06 15:30:35 +01:00
|
|
|
pub type ExecutionResult = Result<Box<Executed>, ExecutionError>;
|