Contracts: Stabilize APIs (#3384)

Remove `#[unstable]` on `call_v2`, `instantiate_v2`,
`lock_delegate_dependency` and `unlock_delegate_dependency`.
See ink! integrations: 
- call_v2: https://github.com/paritytech/ink/pull/2077
- instantiate_v2: <TODO>
- lock/unlock dependency: https://github.com/paritytech/ink/pull/2076
This commit is contained in:
PG Herveou
2024-02-20 15:28:05 +01:00
committed by GitHub
parent e89d0fca35
commit d250a6e427
26 changed files with 137 additions and 140 deletions
+5 -15
View File
@@ -93,7 +93,7 @@ pub trait HostFn {
/// - `output`: A reference to the output data buffer to write the address.
fn address(output: &mut &mut [u8]);
/// Adds a new delegate dependency to the contract.
/// Lock a new delegate dependency to the contract.
///
/// Traps if the maximum number of delegate_dependencies is reached or if
/// the delegate dependency already exists.
@@ -102,10 +102,7 @@ pub trait HostFn {
///
/// - `code_hash`: The code hash of the dependency. Should be decodable as an `T::Hash`. Traps
/// otherwise.
#[deprecated(
note = "Unstable function. Behaviour can change without further notice. Use only for testing."
)]
fn add_delegate_dependency(code_hash: &[u8]);
fn lock_delegate_dependency(code_hash: &[u8]);
/// Stores the *free* balance of the current account into the supplied buffer.
///
@@ -142,6 +139,7 @@ pub trait HostFn {
///
/// Equivalent to the newer [`Self::call_v2`] version but works with
/// *ref_time* Weight only
#[deprecated(note = "Deprecated, use newer version instead")]
fn call_v1(
flags: CallFlags,
callee: &[u8],
@@ -178,9 +176,6 @@ pub trait HostFn {
/// - [CalleeTrapped][`crate::ReturnErrorCode::CalleeTrapped]
/// - [TransferFailed][`crate::ReturnErrorCode::TransferFailed]
/// - [NotCallable][`crate::ReturnErrorCode::NotCallable]
#[deprecated(
note = "Unstable function. Behaviour can change without further notice. Use only for testing."
)]
fn call_v2(
flags: CallFlags,
callee: &[u8],
@@ -480,6 +475,7 @@ pub trait HostFn {
///
/// Equivalent to the newer [`Self::instantiate_v2`] version but works
/// with *ref_time* Weight only.
#[deprecated(note = "Deprecated, use newer version instead")]
fn instantiate_v1(
code_hash: &[u8],
gas: u64,
@@ -524,9 +520,6 @@ pub trait HostFn {
/// - [CalleeTrapped][`crate::ReturnErrorCode::CalleeTrapped]
/// - [TransferFailed][`crate::ReturnErrorCode::TransferFailed]
/// - [CodeNotFound][`crate::ReturnErrorCode::CodeNotFound]
#[deprecated(
note = "Unstable function. Behaviour can change without further notice. Use only for testing."
)]
fn instantiate_v2(
code_hash: &[u8],
ref_time_limit: u64,
@@ -602,10 +595,7 @@ pub trait HostFn {
///
/// - `code_hash`: The code hash of the dependency. Should be decodable as an `T::Hash`. Traps
/// otherwise.
#[deprecated(
note = "Unstable function. Behaviour can change without further notice. Use only for testing."
)]
fn remove_delegate_dependency(code_hash: &[u8]);
fn unlock_delegate_dependency(code_hash: &[u8]);
/// Cease contract execution and save a data buffer as a result of the execution.
///
@@ -281,11 +281,11 @@ impl HostFn for HostFnImpl {
todo!()
}
fn add_delegate_dependency(code_hash: &[u8]) {
fn lock_delegate_dependency(code_hash: &[u8]) {
todo!()
}
fn remove_delegate_dependency(code_hash: &[u8]) {
fn unlock_delegate_dependency(code_hash: &[u8]) {
todo!()
}
@@ -23,7 +23,7 @@ mod sys {
extern "C" {
pub fn account_reentrance_count(account_ptr: *const u8) -> u32;
pub fn add_delegate_dependency(code_hash_ptr: *const u8);
pub fn lock_delegate_dependency(code_hash_ptr: *const u8);
pub fn address(output_ptr: *mut u8, output_len_ptr: *mut u32);
@@ -125,7 +125,7 @@ mod sys {
pub fn reentrance_count() -> u32;
pub fn remove_delegate_dependency(code_hash_ptr: *const u8);
pub fn unlock_delegate_dependency(code_hash_ptr: *const u8);
pub fn seal_return(flags: u32, data_ptr: *const u8, data_len: u32) -> !;
@@ -803,12 +803,12 @@ impl HostFn for HostFnImpl {
unsafe { sys::account_reentrance_count(account.as_ptr()) }
}
fn add_delegate_dependency(code_hash: &[u8]) {
unsafe { sys::add_delegate_dependency(code_hash.as_ptr()) }
fn lock_delegate_dependency(code_hash: &[u8]) {
unsafe { sys::lock_delegate_dependency(code_hash.as_ptr()) }
}
fn remove_delegate_dependency(code_hash: &[u8]) {
unsafe { sys::remove_delegate_dependency(code_hash.as_ptr()) }
fn unlock_delegate_dependency(code_hash: &[u8]) {
unsafe { sys::unlock_delegate_dependency(code_hash.as_ptr()) }
}
fn instantiation_nonce() -> u64 {