pub fn execute_using_consensus_failure_handler<Handler, R, NC>(
		&mut self,
		manager: ExecutionManager<Handler>,
		compute_tx: bool,
		mut native_call: Option<NC>,
	) -> Result<(NativeOrEncoded<R>, Option<B::Transaction>, Option<MemoryDB<H>>), Box<Error>> where
		R: Decode + Encode + PartialEq,
		NC: FnOnce() -> result::Result<R, &'static str> + UnwindSafe,
		Handler: FnOnce(
			CallResult<R, Exec::Error>,
			CallResult<R, Exec::Error>
		) -> CallResult<R, Exec::Error>
	{
		// read changes trie configuration. The reason why we're doing it here instead of the
		// `OverlayedChanges` constructor is that we need proofs for this read as a part of
		// proof-of-execution on light clients. And the proof is recorded by the backend which
		// is created after OverlayedChanges

		let backend = self.backend.clone();
		let init_overlay = |overlay: &mut OverlayedChanges, final_check: bool| {
			let changes_trie_config = try_read_overlay_value(
				overlay,
				backend,
				well_known_keys::CHANGES_TRIE_CONFIG
			)?;
			set_changes_trie_config(overlay, changes_trie_config, final_check)
		};
		init_overlay(self.overlay, false)?;

		let result = {
			let orig_prospective = self.overlay.prospective.clone();

			let (result, storage_delta, changes_delta) = match manager {
				ExecutionManager::Both(on_consensus_failure) => {
					self.execute_call_with_both_strategy(compute_tx, native_call.take(), orig_prospective, on_consensus_failure)
				},
				ExecutionManager::NativeElseWasm => {
					self.execute_call_with_native_else_wasm_strategy(compute_tx, native_call.take(), orig_prospective)
				},
				ExecutionManager::AlwaysWasm => {
					let (result, _, storage_delta, changes_delta) = self.execute_aux(compute_tx, false, native_call);
					(result, storage_delta, changes_delta)
				},
				ExecutionManager::NativeWhenPossible => {
					let (result, _was_native, storage_delta, changes_delta) = self.execute_aux(compute_tx, true, native_call);
					(result, storage_delta, changes_delta)
				},
			};
			result.map(move |out| (out, storage_delta, changes_delta))
		};

		if result.is_ok() {
			init_overlay(self.overlay, true)?;
		}

		result.map_err(|e| Box::new(e) as _)
	}
/// Execute a call using the given state backend, overlayed changes, and call executor.
/// Produces a state-backend-specific "transaction" which can be used to apply the changes
/// to the backing store, such as the disk.
///
/// On an error, no prospective changes are written to the overlay.
///
/// Note: changes to code will be in place if this call is made again. For running partial
/// blocks (e.g. a transaction at a time), ensure a different method is used.
Execute a call using the given state backend, overlayed changes, and call executor.
Produces a state-backend-specific "transaction" which can be used to apply the changes
to the backing store, such as the disk.

On an error, no prospective changes are written to the overlay.

changes to code will be in place if this call is made again. For running partial
blocks , ensure a different method is used.
Execute a call using the given state backend overlayed changes and call executor . Produces a state - backend - specific " transaction " which can be used to apply the changes to the backing store such as the disk . On an error no prospective changes are written to the overlay . changes to code will be in place if this call is made again . For running partial blocks ensure a different method is used .
pub fn execute_using_consensus_failure_handler<Handler, R, NC>(
		&mut self,
		manager: ExecutionManager<Handler>,
		compute_tx: bool,
		mut native_call: Option<NC>,
	) -> Result<(NativeOrEncoded<R>, Option<B::Transaction>, Option<MemoryDB<H>>), Box<Error>> where
		R: Decode + Encode + PartialEq,
		NC: FnOnce() -> result::Result<R, &'static str> + UnwindSafe,
		Handler: FnOnce(
			CallResult<R, Exec::Error>,
			CallResult<R, Exec::Error>
		) -> CallResult<R, Exec::Error>
	{
		// read changes trie configuration. The reason why we're doing it here instead of the
		// `OverlayedChanges` constructor is that we need proofs for this read as a part of
		// proof-of-execution on light clients. And the proof is recorded by the backend which
		// is created after OverlayedChanges
		let backend = self.backend.clone();
		let init_overlay = |overlay: &mut OverlayedChanges, final_check: bool| {
			let changes_trie_config = try_read_overlay_value(
				overlay,
				backend,
				well_known_keys::CHANGES_TRIE_CONFIG
			)?;
			set_changes_trie_config(overlay, changes_trie_config, final_check)
		};
		init_overlay(self.overlay, false)?;
		let result = {
			let orig_prospective = self.overlay.prospective.clone();
			let (result, storage_delta, changes_delta) = match manager {
				ExecutionManager::Both(on_consensus_failure) => {
					self.execute_call_with_both_strategy(compute_tx, native_call.take(), orig_prospective, on_consensus_failure)
				},
				ExecutionManager::NativeElseWasm => {
					self.execute_call_with_native_else_wasm_strategy(compute_tx, native_call.take(), orig_prospective)
				},
				ExecutionManager::AlwaysWasm => {
					let (result, _, storage_delta, changes_delta) = self.execute_aux(compute_tx, false, native_call);
					(result, storage_delta, changes_delta)
				},
				ExecutionManager::NativeWhenPossible => {
					let (result, _was_native, storage_delta, changes_delta) = self.execute_aux(compute_tx, true, native_call);
					(result, storage_delta, changes_delta)
				},
			};
			result.map(move |out| (out, storage_delta, changes_delta))
		};
		if result.is_ok() {
			init_overlay(self.overlay, true)?;
		}
		result.map_err(|e| Box::new(e) as _)
	}
pub fn execute_using_consensus_failure_handler < Handler , R , NC > ( & mut self , manager : ExecutionManager < Handler > , compute_tx : bool , mut native_call : Option < NC > , ) -> Result < ( NativeOrEncoded < R > , Option < B :: Transaction > , Option < MemoryDB < H > > ) , Box < Error > > where R : Decode + Encode + PartialEq , NC : FnOnce ( ) -> result :: Result < R , & ' static str > + UnwindSafe , Handler : FnOnce ( CallResult < R , Exec :: Error > , CallResult < R , Exec :: Error > ) -> CallResult < R , Exec :: Error > { // read changes trie configuration. The reason why we're doing it here instead of the // `OverlayedChanges` constructor is that we need proofs for this read as a part of // proof-of-execution on light clients. And the proof is recorded by the backend which // is created after OverlayedChanges let backend = self . backend . clone ( ) ; let init_overlay = | overlay : & mut OverlayedChanges , final_check : bool | { let changes_trie_config = try_read_overlay_value ( overlay , backend , well_known_keys :: CHANGES_TRIE_CONFIG ) ? ; set_changes_trie_config ( overlay , changes_trie_config , final_check ) } ; init_overlay ( self . overlay , false ) ? ; let result = { let orig_prospective = self . overlay . prospective . clone ( ) ; let ( result , storage_delta , changes_delta ) = match manager { ExecutionManager :: Both ( on_consensus_failure ) => { self . execute_call_with_both_strategy ( compute_tx , native_call . take ( ) , orig_prospective , on_consensus_failure ) } , ExecutionManager :: NativeElseWasm => { self . execute_call_with_native_else_wasm_strategy ( compute_tx , native_call . take ( ) , orig_prospective ) } , ExecutionManager :: AlwaysWasm => { let ( result , _ , storage_delta , changes_delta ) = self . execute_aux ( compute_tx , false , native_call ) ; ( result , storage_delta , changes_delta ) } , ExecutionManager :: NativeWhenPossible => { let ( result , _was_native , storage_delta , changes_delta ) = self . execute_aux ( compute_tx , true , native_call ) ; ( result , storage_delta , changes_delta ) } , } ; result . map ( move | out | ( out , storage_delta , changes_delta ) ) } ; if result . is_ok ( ) { init_overlay ( self . overlay , true ) ? ; } result . map_err ( | e | Box :: new ( e ) as _ ) }
Execute a call using the given state backend, overlayed changes, and call executor.
Execute a call using the given state backend overlayed changes and call executor .
&mut self
manager
ExecutionManager<Handler>
compute_tx
bool
native_call
Option<NC>
&mut self
manager
ExecutionManager<Handler>
compute_tx
bool
native_call
Option<NC>