Commit 27087f20 authored by Andrew Jones's avatar Andrew Jones Committed by Hero Bird

Replace input buffer with scratch buffer (#129)

* [examples] fix erc20 tests

* [core] ditch input buffer, read from scratch instead
parent efe69028
...@@ -113,17 +113,7 @@ where ...@@ -113,17 +113,7 @@ where
T: EnvTypes, T: EnvTypes,
{ {
fn input() -> Vec<u8> { fn input() -> Vec<u8> {
let size = unsafe { sys::ext_input_size() }; read_scratch_buffer()
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
}
} }
impl_getters_for_srml_env!( impl_getters_for_srml_env!(
......
...@@ -82,12 +82,6 @@ extern "C" { ...@@ -82,12 +82,6 @@ extern "C" {
/// Copies the contents of the scratch buffer to `dest_ptr`. /// Copies the contents of the scratch buffer to `dest_ptr`.
pub fn ext_scratch_copy(dest_ptr: u32, offset: u32, len: u32); 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 /// Immediately returns contract execution to the caller
/// with the provided data at `data_ptr`. /// with the provided data at `data_ptr`.
pub fn ext_return(data_ptr: u32, data_len: u32) -> !; pub fn ext_return(data_ptr: u32, data_len: u32) -> !;
......
...@@ -151,7 +151,7 @@ contract! { ...@@ -151,7 +151,7 @@ contract! {
mod tests { mod tests {
use super::*; use super::*;
use ink_core::env; use ink_core::env;
type Types = ink_types_node_runtime::NodeRuntimeTypes; type Types = ink_core::env::DefaultSrmlTypes;
#[test] #[test]
fn deployment_works() { fn deployment_works() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment