From 3098f50f37f64746e63a9a29e16ac3f933b7ee7f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Jun 2019 16:22:43 +0100 Subject: [PATCH 1/2] [examples] fix erc20 tests --- examples/lang/erc20/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lang/erc20/src/lib.rs b/examples/lang/erc20/src/lib.rs index 0d53f0acecd..7538bf39eb4 100644 --- a/examples/lang/erc20/src/lib.rs +++ b/examples/lang/erc20/src/lib.rs @@ -151,7 +151,7 @@ contract! { mod tests { use super::*; use ink_core::env; - type Types = ink_types_node_runtime::NodeRuntimeTypes; + type Types = ink_core::env::DefaultSrmlTypes; #[test] fn deployment_works() { From 6ed0e224f4fb52c298f87a5204fb73d801998cf9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Jun 2019 17:30:41 +0100 Subject: [PATCH 2/2] [core] ditch input buffer, read from scratch instead --- core/src/env/srml/srml_only/impls.rs | 12 +----------- core/src/env/srml/srml_only/sys.rs | 6 ------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/core/src/env/srml/srml_only/impls.rs b/core/src/env/srml/srml_only/impls.rs index 4c765b452ef..683a493967f 100644 --- a/core/src/env/srml/srml_only/impls.rs +++ b/core/src/env/srml/srml_only/impls.rs @@ -113,17 +113,7 @@ where T: EnvTypes, { fn input() -> Vec { - let size = unsafe { sys::ext_input_size() }; - if size == 0 { - Vec::new() - } else { - let mut buffer = Vec::new(); - buffer.resize(size as usize, 0); - unsafe { - sys::ext_input_copy(buffer.as_mut_ptr() as u32, 0, size); - } - buffer - } + read_scratch_buffer() } impl_getters_for_srml_env!( diff --git a/core/src/env/srml/srml_only/sys.rs b/core/src/env/srml/srml_only/sys.rs index e5e9be76123..af3763b0312 100644 --- a/core/src/env/srml/srml_only/sys.rs +++ b/core/src/env/srml/srml_only/sys.rs @@ -82,12 +82,6 @@ extern "C" { /// Copies the contents of the scratch buffer to `dest_ptr`. pub fn ext_scratch_copy(dest_ptr: u32, offset: u32, len: u32); - /// Returns the length of the input buffer. - pub fn ext_input_size() -> u32; - - /// Copies the contents of the input buffer to `dest_ptr`. - pub fn ext_input_copy(dest_ptr: u32, offset: u32, len: u32); - /// Immediately returns contract execution to the caller /// with the provided data at `data_ptr`. pub fn ext_return(data_ptr: u32, data_len: u32) -> !;