From 845da59a600b8c46d3e9e3f003458558f7ab555d Mon Sep 17 00:00:00 2001 From: Alice Carroll Date: Fri, 3 Nov 2023 13:22:26 +0300 Subject: [PATCH] fix(pallet-contracts): Add a handler for `MemoryGrow`. This error kind was introduced with bb32803 (see #1), but pallet-contracts was not updated after adding it. Note that adding a variant to an public exhaustive enum is a breaking change. See https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new. --- frame/contracts/src/wasm/runtime.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frame/contracts/src/wasm/runtime.rs b/frame/contracts/src/wasm/runtime.rs index 52b864bf18eac..81bed1c557062 100644 --- a/frame/contracts/src/wasm/runtime.rs +++ b/frame/contracts/src/wasm/runtime.rs @@ -409,6 +409,8 @@ where // Any other kind of a trap should result in a failure. Err(sp_sandbox::Error::Execution) | Err(sp_sandbox::Error::OutOfBounds) => Err(Error::::ContractTrapped)?, + Err(sp_sandbox::Error::MemoryGrow) => + unreachable!("MemoryGrow returnes by the sandboxed runtime"), } }