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
T: EnvTypes,
{
fn input() -> Vec<u8> {
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!(
......
......@@ -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) -> !;
......
......@@ -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() {
......
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