Contracts: return arbitrary sized buffers (#711)

* WIP

* Direct return of output data.

* Docs and renamings.

* Add get_storage test.

* Overwrite the scratch buffer.
This commit is contained in:
Sergey Pepyakin
2018-09-15 13:46:59 +03:00
committed by Gav Wood
parent 56def2a38b
commit dcd181f31e
5 changed files with 274 additions and 145 deletions
+4 -2
View File
@@ -163,7 +163,7 @@ decl_module! {
origin,
value: T::Balance,
gas_limit: T::Gas,
ctor: Vec<u8>,
init_code: Vec<u8>,
data: Vec<u8>
) -> Result;
}
@@ -227,7 +227,9 @@ impl<T: Trait> Module<T> {
depth: 0,
overlay: OverlayAccountDb::<T>::new(&account_db::DirectAccountDb),
};
let result = ctx.call(origin.clone(), dest, value, &mut gas_meter, &data);
let mut output_data = Vec::new();
let result = ctx.call(origin.clone(), dest, value, &mut gas_meter, &data, &mut output_data);
if let Ok(_) = result {
// Commit all changes that made it thus far into the persistant storage.