Revert "Don't include :code by default in storage proofs (#5060)" (#5136)

This reverts commit 6ee39261c8.
This commit is contained in:
Arkadiy Paronyan
2020-03-05 10:55:05 +01:00
committed by GitHub
parent ff2a36d7cb
commit 9a1b3b53f2
31 changed files with 182 additions and 478 deletions
+2 -9
View File
@@ -25,7 +25,7 @@ use sp_state_machine::{
};
use sc_executor::{RuntimeVersion, RuntimeInfo, NativeVersion};
use sp_externalities::Extensions;
use sp_core::{NativeOrEncoded, NeverNativeValue, traits::{CodeExecutor, RuntimeCode}};
use sp_core::{NativeOrEncoded, NeverNativeValue, traits::CodeExecutor};
use sp_api::{ProofRecorder, InitializeBlock, StorageTransactionCache};
use sc_client_api::{backend, call_executor::CallExecutor};
@@ -90,7 +90,6 @@ where
method,
call_data,
extensions.unwrap_or_default(),
&sp_state_machine::backend::get_runtime_code(&state)?,
).execute_using_consensus_failure_handler::<_, NeverNativeValue, fn() -> _>(
strategy.get_manager(),
None,
@@ -141,8 +140,6 @@ where
// make sure to destroy state before exiting this function
let mut state = self.backend.state_at(*at)?;
let runtime_code = sp_state_machine::backend::get_runtime_code(&state)?;
let result = match recorder {
Some(recorder) => state.as_trie_backend()
.ok_or_else(||
@@ -163,7 +160,6 @@ where
method,
call_data,
extensions.unwrap_or_default(),
&runtime_code,
)
// TODO: https://github.com/paritytech/substrate/issues/4455
// .with_storage_transaction_cache(storage_transaction_cache.as_mut().map(|c| &mut **c))
@@ -177,7 +173,6 @@ where
method,
call_data,
extensions.unwrap_or_default(),
&runtime_code,
)
.with_storage_transaction_cache(storage_transaction_cache.as_mut().map(|c| &mut **c))
.execute_using_consensus_failure_handler(execution_manager, native_call)
@@ -202,8 +197,7 @@ where
changes_trie_state,
None,
);
let wasm_code = RuntimeCode::from_externalities(&ext).map_err(|e| e.to_string().into());
let version = wasm_code.and_then(|c| self.executor.runtime_version(&mut ext, &c));
let version = self.executor.runtime_version(&mut ext);
{
let _lock = self.backend.get_import_lock().read();
self.backend.destroy_state(state)?;
@@ -224,7 +218,6 @@ where
&self.executor,
method,
call_data,
&sp_state_machine::backend::get_runtime_code(trie_state)?,
)
.map_err(Into::into)
}