Use Bytes for contract rpc input_data (#3841)

* Use Bytes for contract input_data

* Update srml/contracts/rpc/src/lib.rs
This commit is contained in:
kwingram25
2019-10-18 09:28:48 +02:00
committed by Bastian Köcher
parent 5b9952ef1c
commit fddfcbacea
3 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -23,6 +23,7 @@ use client::blockchain::HeaderBackend;
use codec::Codec;
use jsonrpc_core::{Error, ErrorCode, Result};
use jsonrpc_derive::rpc;
use primitives::Bytes;
use sr_primitives::{
generic::BlockId,
traits::{Block as BlockT, ProvideRuntimeApi},
@@ -41,7 +42,7 @@ pub struct CallRequest<AccountId, Balance> {
dest: AccountId,
value: Balance,
gas_limit: number::NumberOrHex<u64>,
input_data: Vec<u8>,
input_data: Bytes,
}
/// Contracts RPC methods.
@@ -111,7 +112,7 @@ where
})?;
let exec_result = api
.call(&at, origin, dest, value, gas_limit, input_data)
.call(&at, origin, dest, value, gas_limit, input_data.to_vec())
.map_err(|e| Error {
code: ErrorCode::ServerError(RUNTIME_ERROR),
message: "Runtime trapped while executing a contract.".into(),