From 759fd62fa58e8072a944fd9c3f210239435661b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 25 Nov 2019 14:11:50 +0100 Subject: [PATCH 1/2] Remove keystore parameter. --- client/src/call_executor.rs | 3 --- client/src/light/call_executor.rs | 4 +--- primitives/state-machine/src/lib.rs | 20 ++++---------------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/client/src/call_executor.rs b/client/src/call_executor.rs index e03293f2a722b..6611b496674ba 100644 --- a/client/src/call_executor.rs +++ b/client/src/call_executor.rs @@ -253,9 +253,6 @@ where &self.executor, method, call_data, - // Passing `None` here, since we don't really want to prove anything - // about our local keys. - None, ) .map_err(Into::into) } diff --git a/client/src/light/call_executor.rs b/client/src/light/call_executor.rs index a4a8a549de93c..29b9ca46af1fe 100644 --- a/client/src/light/call_executor.rs +++ b/client/src/light/call_executor.rs @@ -113,7 +113,7 @@ impl CallExecutor for _manager: ExecutionManager, native_call: Option, recorder: &Option>, - extensions: Option, + extensions: Option, ) -> ClientResult> where ExecutionManager: Clone { // there's no actual way/need to specify native/wasm execution strategy on light node // => we can safely ignore passed values @@ -277,7 +277,6 @@ fn check_execution_proof_with_make_header( exec: &Exec, method: &str, call_data: &[u8], - keystore: Option, ) -> Result<(Vec, StorageProof), Box> where B: Backend, @@ -461,7 +460,7 @@ where { let trie_backend = backend.as_trie_backend() .ok_or_else(|| Box::new(ExecutionError::UnableToGenerateProof) as Box)?; - prove_execution_on_trie_backend(trie_backend, overlay, exec, method, call_data, keystore) + prove_execution_on_trie_backend(trie_backend, overlay, exec, method, call_data) } /// Prove execution using the given trie backend, overlayed changes, and call executor. @@ -479,7 +478,6 @@ pub fn prove_execution_on_trie_backend( exec: &Exec, method: &str, call_data: &[u8], - keystore: Option, ) -> Result<(Vec, StorageProof), Box> where S: trie_backend_essence::TrieBackendStorage, @@ -487,12 +485,8 @@ where Exec: CodeExecutor, { let proving_backend = proving_backend::ProvingBackend::new(trie_backend); - let mut extensions = Extensions::new(); - if let Some(keystore) = keystore { - extensions.register(keystore); - } let mut sm = StateMachine::<_, H, _, InMemoryChangesTrieStorage, Exec>::new( - &proving_backend, None, overlay, exec, method, call_data, extensions, + &proving_backend, None, overlay, exec, method, call_data, Extensions::default(), ); let (result, _, _) = sm.execute_using_consensus_failure_handler::<_, NeverNativeValue, fn() -> _>( @@ -512,7 +506,6 @@ pub fn execution_proof_check( exec: &Exec, method: &str, call_data: &[u8], - keystore: Option, ) -> Result, Box> where H: Hasher, @@ -520,7 +513,7 @@ where H::Out: Ord + 'static, { let trie_backend = create_proof_check_backend::(root.into(), proof)?; - execution_proof_check_on_trie_backend(&trie_backend, overlay, exec, method, call_data, keystore) + execution_proof_check_on_trie_backend(&trie_backend, overlay, exec, method, call_data) } /// Check execution proof on proving backend, generated by `prove_execution` call. @@ -530,18 +523,13 @@ pub fn execution_proof_check_on_trie_backend( exec: &Exec, method: &str, call_data: &[u8], - keystore: Option, ) -> Result, Box> where H: Hasher, Exec: CodeExecutor, { - let mut extensions = Extensions::new(); - if let Some(keystore) = keystore { - extensions.register(keystore); - } let mut sm = StateMachine::<_, H, _, InMemoryChangesTrieStorage, Exec>::new( - trie_backend, None, overlay, exec, method, call_data, extensions, + trie_backend, None, overlay, exec, method, call_data, Extensions::default(), ); sm.execute_using_consensus_failure_handler::<_, NeverNativeValue, fn() -> _>( From df94d9043b435482371c57ed81954e11686cb351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 25 Nov 2019 18:44:21 +0100 Subject: [PATCH 2/2] Fix tests. --- primitives/sr-api/test/tests/runtime_calls.rs | 1 - primitives/state-machine/src/lib.rs | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/primitives/sr-api/test/tests/runtime_calls.rs b/primitives/sr-api/test/tests/runtime_calls.rs index ce6300bc41282..031d547819a8b 100644 --- a/primitives/sr-api/test/tests/runtime_calls.rs +++ b/primitives/sr-api/test/tests/runtime_calls.rs @@ -193,6 +193,5 @@ fn record_proof_works() { &executor, "Core_execute_block", &block.encode(), - None, ).expect("Executes block while using the proof backend"); } diff --git a/primitives/state-machine/src/lib.rs b/primitives/state-machine/src/lib.rs index 5c3f21385a203..151b1a776fd84 100644 --- a/primitives/state-machine/src/lib.rs +++ b/primitives/state-machine/src/lib.rs @@ -24,7 +24,7 @@ use hash_db::Hasher; use codec::{Decode, Encode}; use primitives::{ storage::well_known_keys, NativeOrEncoded, NeverNativeValue, - traits::{KeystoreExt, CodeExecutor}, hexdisplay::HexDisplay, hash::H256, + traits::CodeExecutor, hexdisplay::HexDisplay, hash::H256, }; use overlayed_changes::OverlayedChangeSet; use externalities::Extensions; @@ -902,7 +902,6 @@ mod tests { &executor, "test", &[], - None, ).unwrap(); // check proof locally @@ -913,7 +912,6 @@ mod tests { &executor, "test", &[], - None, ).unwrap(); // check that both results are correct