Struct sputnikvm::ValidTransaction
source · pub struct ValidTransaction {
pub caller: Option<Address>,
pub gas_price: Gas,
pub gas_limit: Gas,
pub action: TransactionAction,
pub value: U256,
pub input: Rc<Vec<u8>>,
pub nonce: U256,
}
Expand description
Represents an Ethereum transaction.
About SYSTEM transaction
SYSTEM transaction in Ethereum is something that cannot be executed by the user, and is enforced by the blockchain rules. The SYSTEM transaction does not have a caller. When executed in EVM, however, the CALLER opcode would return 0xffffffffffffffffffffffffffffffffffffffff. As a result, when executing a message call or a contract creation, nonce are not changed. A SYSTEM transaction must have gas_price set to zero. Because the transaction reward is always zero, a SYSTEM transaction will also not invoke creation of the beneficiary address if it does not exist before.
Fields
caller: Option<Address>
Caller of this transaction. If caller is None, then this is a SYSTEM transaction.
gas_price: Gas
Gas price of this transaction.
gas_limit: Gas
Gas limit of this transaction.
action: TransactionAction
Transaction action.
value: U256
Value of this transaction.
input: Rc<Vec<u8>>
Data or init associated with this transaction.
nonce: U256
Nonce of the transaction.
Implementations
sourceimpl ValidTransaction
impl ValidTransaction
sourcepub fn from_transaction<P: Patch>(
transaction: &Transaction,
account_state: &AccountState<P::Account>
) -> Result<Result<ValidTransaction, PreExecutionError>, RequireError>
pub fn from_transaction<P: Patch>(
transaction: &Transaction,
account_state: &AccountState<P::Account>
) -> Result<Result<ValidTransaction, PreExecutionError>, RequireError>
Create a valid transaction from a block transaction. Caller is always Some.
sourceimpl ValidTransaction
impl ValidTransaction
sourcepub fn intrinsic_gas<P: Patch>(&self) -> Gas
pub fn intrinsic_gas<P: Patch>(&self) -> Gas
Intrinsic gas to be paid in prior to this transaction execution.
sourcepub fn into_context<P: Patch>(
self,
upfront: Gas,
origin: Option<Address>,
account_state: &mut AccountState<P::Account>,
is_code: bool,
is_static: bool
) -> Result<Context, RequireError>
pub fn into_context<P: Patch>(
self,
upfront: Gas,
origin: Option<Address>,
account_state: &mut AccountState<P::Account>,
is_code: bool,
is_static: bool
) -> Result<Context, RequireError>
Convert this transaction into a context. Note that this will change the account state.
sourcepub fn preclaimed_value(&self) -> U256
pub fn preclaimed_value(&self) -> U256
When the execution of a transaction begins, this preclaimed value is deducted from the account.
Trait Implementations
sourceimpl Clone for ValidTransaction
impl Clone for ValidTransaction
sourcefn clone(&self) -> ValidTransaction
fn clone(&self) -> ValidTransaction
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more