From ff76792ecacd5d6f59e273988a8dcce75ce5b24a Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Wed, 9 Dec 2020 10:48:54 +0800 Subject: [PATCH] rename need_storage to vm_type (#105) --- ontio-std/src/mock/runtime.rs | 8 ++++---- ontio-std/src/runtime.rs | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ontio-std/src/mock/runtime.rs b/ontio-std/src/mock/runtime.rs index d1a8b35..637a680 100644 --- a/ontio-std/src/mock/runtime.rs +++ b/ontio-std/src/mock/runtime.rs @@ -250,10 +250,10 @@ mod env { #[no_mangle] pub fn ontio_contract_create( - _code_ptr: *const u8, _code_len: u32, _need_storage: u32, _name_ptr: *const u8, - _name_len: u32, _ver_ptr: *const u8, _ver_len: u32, _author_ptr: *const u8, - _author_len: u32, _email_ptr: *const u8, _email_len: u32, _desc_ptr: *const u8, - _desc_len: u32, _new_addr_ptr: *mut u8, + _code_ptr: *const u8, _code_len: u32, _vm_type: u32, _name_ptr: *const u8, _name_len: u32, + _ver_ptr: *const u8, _ver_len: u32, _author_ptr: *const u8, _author_len: u32, + _email_ptr: *const u8, _email_len: u32, _desc_ptr: *const u8, _desc_len: u32, + _new_addr_ptr: *mut u8, ) -> u32 { unimplemented!() } diff --git a/ontio-std/src/runtime.rs b/ontio-std/src/runtime.rs index 20aaf31..6880403 100644 --- a/ontio-std/src/runtime.rs +++ b/ontio-std/src/runtime.rs @@ -32,10 +32,10 @@ mod env { pub fn ontio_storage_delete(key: *const u8, klen: u32); pub fn ontio_sha256(data: *const u8, len: u32, val: *mut u8); pub fn ontio_contract_create( - code_ptr: *const u8, code_len: u32, need_storage: u32, name_ptr: *const u8, - name_len: u32, ver_ptr: *const u8, ver_len: u32, author_ptr: *const u8, - author_len: u32, email_ptr: *const u8, email_len: u32, desc_ptr: *const u8, - desc_len: u32, new_addr_ptr: *mut u8, + code_ptr: *const u8, code_len: u32, vm_type: u32, name_ptr: *const u8, name_len: u32, + ver_ptr: *const u8, ver_len: u32, author_ptr: *const u8, author_len: u32, + email_ptr: *const u8, email_len: u32, desc_ptr: *const u8, desc_len: u32, + new_addr_ptr: *mut u8, ) -> u32; pub fn ontio_contract_destroy() -> !; } @@ -77,7 +77,7 @@ pub fn call_contract(addr: &Address, input: &[u8]) -> Vec { /// /// code: new contract code /// -/// need_storage: +/// vm_type: 1 for neovm, 3 for wasmvm /// /// name: contract name /// @@ -97,19 +97,19 @@ pub fn call_contract(addr: &Address, input: &[u8]) -> Vec { /// # use ontio_std::runtime; /// let input = runtime::input(); /// let mut source = Source::new(&input); -/// let (code, need_storage, name, ver, author, email, desc) = source.read().unwrap(); -/// let res = runtime::contract_create(code, need_storage, name, ver, author, email, desc); +/// let (code, vm_type, name, ver, author, email, desc) = source.read().unwrap(); +/// let res = runtime::contract_create(code, vm_type, name, ver, author, email, desc); /// ``` /// pub fn contract_create( - code: &[u8], need_storage: u32, name: &str, ver: &str, author: &str, email: &str, desc: &str, + code: &[u8], vm_type: u32, name: &str, ver: &str, author: &str, email: &str, desc: &str, ) -> Address { let mut addr: Address = Address::zero(); unsafe { env::ontio_contract_create( code.as_ptr(), code.len() as u32, - need_storage, + vm_type, name.as_ptr(), name.len() as u32, ver.as_ptr(), @@ -131,7 +131,7 @@ pub fn contract_create( /// /// code: new contract code /// -/// need_storage: +/// vm_type: 1 for neovm, 3 for wasmvm /// /// name: contract name /// @@ -151,8 +151,8 @@ pub fn contract_create( /// # use ontio_std::runtime; /// let input = runtime::input(); /// let mut source = Source::new(&input); -/// let (code, need_storage, name, ver, author, email, desc) = source.read().unwrap(); -/// let res = runtime::contract_migrate(code, need_storage, name, ver, author, email, desc); +/// let (code, vm_type, name, ver, author, email, desc) = source.read().unwrap(); +/// let res = runtime::contract_migrate(code, vm_type, name, ver, author, email, desc); /// ``` /// pub fn contract_migrate(