From 6bddb641e7c3cff4ee499f9b6301e02a05fb0dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Thu, 25 Jun 2020 18:34:02 +0200 Subject: [PATCH] Re-enter runtime after resetting overlay from runtime This still assumes that the client did not start any transactions before calling into runtime. This is the case for benchmarking as long as either NativeWhenPossible or AlwaysWasm exection strategy is chosen. Using any other will result in a panic. --- primitives/state-machine/src/ext.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/primitives/state-machine/src/ext.rs b/primitives/state-machine/src/ext.rs index e25a08adb0423..cd4f83661b9e3 100644 --- a/primitives/state-machine/src/ext.rs +++ b/primitives/state-machine/src/ext.rs @@ -575,6 +575,9 @@ where ).expect(EXT_NOT_ALLOWED_TO_FAIL); self.backend.wipe().expect(EXT_NOT_ALLOWED_TO_FAIL); self.mark_dirty(); + self.overlay + .enter_runtime() + .expect("We have reset the overlay above, so we can not be in the runtime; qed"); } fn commit(&mut self) { @@ -593,6 +596,9 @@ where changes.main_storage_changes, ).expect(EXT_NOT_ALLOWED_TO_FAIL); self.mark_dirty(); + self.overlay + .enter_runtime() + .expect("We have reset the overlay above, so we can not be in the runtime; qed"); } fn read_write_count(&self) -> (u32, u32, u32, u32) {