pub unsafe extern "C" fn ecall_execute(bytecode: *const u8, bytecode_len: usize,
                                       callable: *const u8, callable_len: usize,
                                       args: *const u8, args_len: usize,
                                       user_key: &[u8; 64], contract_address: &ContractAddress,
                                       gas_limit: *const u64, db_ptr: *const RawPointer, result: &mut ExecuteResult) -> EnclaveReturn {
    let bytecode = slice::from_raw_parts(bytecode, bytecode_len);
    let callable = slice::from_raw_parts(callable, callable_len);
    let args = slice::from_raw_parts(args, args_len);

    let mut pre_execution_data = vec![];
    let io_key = match get_io_key(user_key) {
        Ok(v) => v,
        Err(e) => return e.into(),
    };

// in order to view the specific error print out the result of the function
    let mut internal_result = ecall_execute_internal(&mut pre_execution_data, bytecode,
                           callable,
                           args, user_key,
                         &io_key,
                           (*contract_address).into(),
                           *gas_limit,
                           db_ptr,
                           result);
    if let Err(e) = internal_result.clone() {
        println!("Error in execution of smart contract function: {}", e);
        internal_result = output_task_failure(&pre_execution_data,e, result, &io_key);
    }
    internal_result.into()
}
/// Ecall for invocation of the external function `callable` of deployed contract with code `bytecode`.
/// arguments:
/// * `bytecode` - WASM bytecode of the deployed contract
/// * `bytecode_len` - the length of the `bytecode`.
/// * `callable` - the encrypted signature of the contract function to call
/// * `callable_len` - the length of the `callable`
/// * `args` - the encrypted arguments for the function
/// * `args_len` - the length of the `args`
/// * `user_key` - the DH key of the user to decrypt `callable` and `args`
/// * `contract_address` - the address of the deployed contract with code `bytecode`
/// * `gas_limit` - the gas limit for the function execution
/// * `result` - the result of the function invocation
// TODO: add arguments of callable.
Ecall for invocation of the external function `callable` of deployed contract with code `bytecode`.
Ecall for invocation of the external function ` callable ` of deployed contract with code ` bytecode ` .
pub unsafe extern "C" fn ecall_execute(bytecode: *const u8, bytecode_len: usize,
                                       callable: *const u8, callable_len: usize,
                                       args: *const u8, args_len: usize,
                                       user_key: &[u8; 64], contract_address: &ContractAddress,
                                       gas_limit: *const u64, db_ptr: *const RawPointer, result: &mut ExecuteResult) -> EnclaveReturn {
    let bytecode = slice::from_raw_parts(bytecode, bytecode_len);
    let callable = slice::from_raw_parts(callable, callable_len);
    let args = slice::from_raw_parts(args, args_len);
    let mut pre_execution_data = vec![];
    let io_key = match get_io_key(user_key) {
        Ok(v) => v,
        Err(e) => return e.into(),
    };
// in order to view the specific error print out the result of the function
    let mut internal_result = ecall_execute_internal(&mut pre_execution_data, bytecode,
                           callable,
                           args, user_key,
                         &io_key,
                           (*contract_address).into(),
                           *gas_limit,
                           db_ptr,
                           result);
    if let Err(e) = internal_result.clone() {
        println!("Error in execution of smart contract function: {}", e);
        internal_result = output_task_failure(&pre_execution_data,e, result, &io_key);
    }
    internal_result.into()
}
pub unsafe extern " " fn ecall_execute ( bytecode : * const u8 , bytecode_len : usize , callable : * const u8 , callable_len : usize , args : * const u8 , args_len : usize , user_key : & [ u8 ; 64 ] , contract_address : & ContractAddress , gas_limit : * const u64 , db_ptr : * const RawPointer , result : & mut ExecuteResult ) -> EnclaveReturn { let bytecode = slice :: from_raw_parts ( bytecode , bytecode_len ) ; let callable = slice :: from_raw_parts ( callable , callable_len ) ; let args = slice :: from_raw_parts ( args , args_len ) ; let mut pre_execution_data = vec ! [ ] ; let io_key = match get_io_key ( user_key ) { Ok ( v ) => v , Err ( e ) => return e . into ( ) , } ; // in order to view the specific error print out the result of the function let mut internal_result = ecall_execute_internal ( & mut pre_execution_data , bytecode , callable , args , user_key , & io_key , ( * contract_address ) . into ( ) , * gas_limit , db_ptr , result ) ; if let Err ( e ) = internal_result . clone ( ) { println ! ( " " e ) ; internal_result = output_task_failure ( & pre_execution_data , e , result , & io_key ) ; } internal_result . into ( ) }
Ecall for invocation of the external function `callable` of deployed contract with code `bytecode`.
Ecall for invocation of the external function ` callable ` of deployed contract with code ` bytecode ` .
bytecode
*const u8
bytecode_len
usize
callable
*const u8
callable_len
usize
args
*const u8
args_len
usize
user_key
&[u8; 64]
contract_address
&ContractAddress
gas_limit
*const u64
db_ptr
*const RawPointer
result
&mut ExecuteResult
bytecode
*const u8
bytecode_len
usize
callable
*const u8
callable_len
usize
args
*const u8
args_len
usize
user_key
&[u8; 64]
contract_address
&ContractAddress
gas_limit
*const u64
db_ptr
*const RawPointer
result
&mut ExecuteResult