fix (light/provider) : Make read_only executions read-only (#9591)
* `ExecutionsRequest` from light-clients as read-only This changes so all `ExecutionRequests` from light-clients are executed as read-only which the `virtual``flag == true ensures. This boost up the current transaction to always succeed Note, this only affects `eth_estimateGas` and `eth_call` AFAIK. * grumbles(revert renaming) : TransactionProof * grumbles(trace) : remove incorrect trace * grumbles(state/prove_tx) : explicit `virt` Remove the boolean flag to determine that a `state::prove_transaction` whether it should be executed in a virtual context or not. Because of that also rename the function to `state::prove_transction_virtual` to make more clear
This commit is contained in:
@@ -224,17 +224,16 @@ pub fn check_proof(
|
||||
}
|
||||
}
|
||||
|
||||
/// Prove a transaction on the given state.
|
||||
/// Prove a `virtual` transaction on the given state.
|
||||
/// Returns `None` when the transacion could not be proved,
|
||||
/// and a proof otherwise.
|
||||
pub fn prove_transaction<H: AsHashDB<KeccakHasher> + Send + Sync>(
|
||||
pub fn prove_transaction_virtual<H: AsHashDB<KeccakHasher> + Send + Sync>(
|
||||
db: H,
|
||||
root: H256,
|
||||
transaction: &SignedTransaction,
|
||||
machine: &Machine,
|
||||
env_info: &EnvInfo,
|
||||
factories: Factories,
|
||||
virt: bool,
|
||||
) -> Option<(Bytes, Vec<DBValue>)> {
|
||||
use self::backend::Proving;
|
||||
|
||||
@@ -252,7 +251,7 @@ pub fn prove_transaction<H: AsHashDB<KeccakHasher> + Send + Sync>(
|
||||
};
|
||||
|
||||
let options = TransactOptions::with_no_tracing().dont_check_nonce().save_output_from_contract();
|
||||
match state.execute(env_info, machine, transaction, options, virt) {
|
||||
match state.execute(env_info, machine, transaction, options, true) {
|
||||
Err(ExecutionError::Internal(_)) => None,
|
||||
Err(e) => {
|
||||
trace!(target: "state", "Proved call failed: {}", e);
|
||||
|
||||
Reference in New Issue
Block a user