From 6f9bc19972454aa9561a1ae7c61209fefc0e854c Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Mon, 10 May 2021 19:42:55 +0200 Subject: [PATCH] Make Allocator trait pub (#8777) We need this in order to be able to assemble more fine grained host function sets. E.g. we don't want to use `SubstrateHostFunctions` for PVF. We would better whitelist certain host functions. However, we cannot do that because we cannot refer to the `Allocator` runtime interface. I have not been able to find the reason why it wasn't made `pub` in the first place, but do not see any reason why not to. --- substrate/primitives/io/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/primitives/io/src/lib.rs b/substrate/primitives/io/src/lib.rs index a7ad4c16c3..35daaa3989 100644 --- a/substrate/primitives/io/src/lib.rs +++ b/substrate/primitives/io/src/lib.rs @@ -1051,7 +1051,7 @@ pub trait Offchain { /// Wasm only interface that provides functions for calling into the allocator. #[runtime_interface(wasm_only)] -trait Allocator { +pub trait Allocator { /// Malloc the given number of bytes and return the pointer to the allocated memory location. fn malloc(&mut self, size: u32) -> Pointer { self.allocate_memory(size).expect("Failed to allocate memory")