State machine call proof backend (#3945)

* drafting a proof extraction at the hashdb level (to include everything
for the 'call' proof case).

* use full proof by default (replace previous proof recorder).

* fix warnings.

* Cache value not found in proof recorder.

* Remove need or internal backend struct.

* fix type.

* doc
This commit is contained in:
cheme
2019-11-12 16:57:37 +01:00
committed by Gavin Wood
parent 61e43218e5
commit 05391f7e04
10 changed files with 91 additions and 73 deletions
+3 -3
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use std::{sync::Arc, cmp::Ord, panic::UnwindSafe, result, cell::RefCell, rc::Rc};
use std::{sync::Arc, cmp::Ord, panic::UnwindSafe, result, cell::RefCell};
use codec::{Encode, Decode};
use sr_primitives::{
generic::BlockId, traits::Block as BlockT, traits::NumberFor,
@@ -81,7 +81,7 @@ where
execution_manager: ExecutionManager<EM>,
native_call: Option<NC>,
side_effects_handler: Option<OffchainExt>,
proof_recorder: &Option<Rc<RefCell<ProofRecorder<B>>>>,
proof_recorder: &Option<ProofRecorder<B>>,
enable_keystore: bool,
) -> error::Result<NativeOrEncoded<R>> where ExecutionManager<EM>: Clone;
@@ -241,7 +241,7 @@ where
execution_manager: ExecutionManager<EM>,
native_call: Option<NC>,
side_effects_handler: Option<OffchainExt>,
recorder: &Option<Rc<RefCell<ProofRecorder<Block>>>>,
recorder: &Option<ProofRecorder<Block>>,
enable_keystore: bool,
) -> Result<NativeOrEncoded<R>, error::Error> where ExecutionManager<EM>: Clone {
match initialize_block {
+2 -2
View File
@@ -18,7 +18,7 @@
use std::{
marker::PhantomData, collections::{HashSet, BTreeMap, HashMap}, sync::Arc,
panic::UnwindSafe, result, cell::RefCell, rc::Rc,
panic::UnwindSafe, result, cell::RefCell,
};
use log::{info, trace, warn};
use futures03::channel::mpsc;
@@ -1494,7 +1494,7 @@ impl<B, E, Block, RA> CallRuntimeAt<Block> for Client<B, E, Block, RA> where
initialize_block: InitializeBlock<'a, Block>,
native_call: Option<NC>,
context: ExecutionContext,
recorder: &Option<Rc<RefCell<ProofRecorder<Block>>>>,
recorder: &Option<ProofRecorder<Block>>,
) -> error::Result<NativeOrEncoded<R>> {
let manager = match context {
ExecutionContext::BlockConstruction =>
@@ -16,7 +16,9 @@
//! Methods that light client could use to execute runtime calls.
use std::{sync::Arc, panic::UnwindSafe, result, cell::RefCell, rc::Rc};
use std::{
sync::Arc, panic::UnwindSafe, result, cell::RefCell,
};
use codec::{Encode, Decode};
use primitives::{
@@ -108,7 +110,7 @@ impl<Block, B, Local> CallExecutor<Block, Blake2Hasher> for
_manager: ExecutionManager<EM>,
native_call: Option<NC>,
side_effects_handler: Option<OffchainExt>,
recorder: &Option<Rc<RefCell<ProofRecorder<Block>>>>,
recorder: &Option<ProofRecorder<Block>>,
enable_keystore: bool,
) -> ClientResult<NativeOrEncoded<R>> where ExecutionManager<EM>: Clone {
// there's no actual way/need to specify native/wasm execution strategy on light node
@@ -334,7 +336,7 @@ mod tests {
_execution_manager: ExecutionManager<EM>,
_native_call: Option<NC>,
_side_effects_handler: Option<OffchainExt>,
_proof_recorder: &Option<Rc<RefCell<ProofRecorder<Block>>>>,
_proof_recorder: &Option<ProofRecorder<Block>>,
_enable_keystore: bool,
) -> ClientResult<NativeOrEncoded<R>> where ExecutionManager<EM>: Clone {
unreachable!()