mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
[contracts] stabilize seal_code_hash, seal_set_code_hash and seal_own_code_hash (#11337)
* stabilize seal_code_hash, seal_set_code_hash, seal_own_code_hash * fix missed place found by CI * Fixed missed __unstable__ Co-authored-by: Alexander Theißen <alex.theissen@me.com>
This commit is contained in:
committed by
GitHub
parent
e8c688e301
commit
9fd4df9ccf
@@ -147,10 +147,8 @@ pub enum RuntimeCosts {
|
||||
/// Weight of calling `seal_is_contract`.
|
||||
IsContract,
|
||||
/// Weight of calling `seal_code_hash`.
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
CodeHash,
|
||||
/// Weight of calling `seal_own_code_hash`.
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
OwnCodeHash,
|
||||
/// Weight of calling `seal_caller_is_origin`.
|
||||
CallerIsOrigin,
|
||||
@@ -225,7 +223,6 @@ pub enum RuntimeCosts {
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
CallRuntime(Weight),
|
||||
/// Weight of calling `seal_set_code_hash`
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
SetCodeHash,
|
||||
/// Weight of calling `ecdsa_to_eth_address`
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
@@ -245,9 +242,7 @@ impl RuntimeCosts {
|
||||
CopyToContract(len) => s.input_per_byte.saturating_mul(len.into()),
|
||||
Caller => s.caller,
|
||||
IsContract => s.is_contract,
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
CodeHash => s.code_hash,
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
OwnCodeHash => s.own_code_hash,
|
||||
CallerIsOrigin => s.caller_is_origin,
|
||||
Address => s.address,
|
||||
@@ -312,7 +307,6 @@ impl RuntimeCosts {
|
||||
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
CallRuntime(weight) => weight,
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
SetCodeHash => s.set_code_hash,
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
EcdsaToEthAddress => s.ecdsa_to_eth_address,
|
||||
@@ -1401,7 +1395,7 @@ define_env!(Env, <E: Ext>,
|
||||
// # Errors
|
||||
//
|
||||
// `ReturnCode::KeyNotFound`
|
||||
[__unstable__] seal_code_hash(ctx, account_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => {
|
||||
[seal0] seal_code_hash(ctx, account_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => {
|
||||
ctx.charge_gas(RuntimeCosts::CodeHash)?;
|
||||
let address: <<E as Ext>::T as frame_system::Config>::AccountId =
|
||||
ctx.read_sandbox_memory_as(account_ptr)?;
|
||||
@@ -1420,7 +1414,7 @@ define_env!(Env, <E: Ext>,
|
||||
// - `out_ptr`: pointer to the linear memory where the returning value is written to.
|
||||
// - `out_len_ptr`: in-out pointer into linear memory where the buffer length
|
||||
// is read from and the value length is written to.
|
||||
[__unstable__] seal_own_code_hash(ctx, out_ptr: u32, out_len_ptr: u32) => {
|
||||
[seal0] seal_own_code_hash(ctx, out_ptr: u32, out_len_ptr: u32) => {
|
||||
ctx.charge_gas(RuntimeCosts::OwnCodeHash)?;
|
||||
let code_hash_encoded = &ctx.ext.own_code_hash().encode();
|
||||
Ok(ctx.write_sandbox_output(out_ptr, out_len_ptr, code_hash_encoded, false, already_charged)?)
|
||||
@@ -2048,7 +2042,7 @@ define_env!(Env, <E: Ext>,
|
||||
// # Errors
|
||||
//
|
||||
// `ReturnCode::CodeNotFound`
|
||||
[__unstable__] seal_set_code_hash(ctx, code_hash_ptr: u32) -> ReturnCode => {
|
||||
[seal0] seal_set_code_hash(ctx, code_hash_ptr: u32) -> ReturnCode => {
|
||||
ctx.charge_gas(RuntimeCosts::SetCodeHash)?;
|
||||
let code_hash: CodeHash<<E as Ext>::T> = ctx.read_sandbox_memory_as(code_hash_ptr)?;
|
||||
match ctx.ext.set_code_hash(code_hash) {
|
||||
|
||||
Reference in New Issue
Block a user