Skip to content

Commit b1ff3fc

Browse files
committed
fix(iota-execution): Make CreateAuthInfoV1ImplCostParams with Optional gas
Otherwise we would need a new cut, which we don't want to have.
1 parent 8baa24c commit b1ff3fc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

iota-execution/latest/iota-move-natives/src/account.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::{NativesCostTable, raw_module_loader::RawModuleLoader};
2222

2323
#[derive(Copy, Clone, Debug)]
2424
pub struct CreateAuthInfoV1ImplCostParams {
25-
pub create_auth_info_v1_cost_base: InternalGas,
25+
pub create_auth_info_v1_cost_base: Option<InternalGas>,
2626
}
2727

2828
pub fn create_auth_info_v1_impl(
@@ -38,10 +38,15 @@ pub fn create_auth_info_v1_impl(
3838
.extensions_mut()
3939
.get::<NativesCostTable>()
4040
.account_create_auth_info_v1_impl_params;
41-
native_charge_gas_early_exit!(
42-
context,
43-
account_create_auth_info_v1_impl_params.create_auth_info_v1_cost_base
44-
);
41+
42+
let create_auth_info_v1_cost_base = account_create_auth_info_v1_impl_params
43+
.create_auth_info_v1_cost_base
44+
.ok_or_else(|| {
45+
PartialVMError::new(StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR)
46+
.with_message("gas cost is not set".to_string())
47+
})?;
48+
49+
native_charge_gas_early_exit!(context, create_auth_info_v1_cost_base);
4550

4651
let function_name_bytes = pop_arg!(args, VectorRef);
4752
let function_name = String::from(unsafe {

iota-execution/latest/iota-move-natives/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ impl NativesCostTable {
192192
// account
193193
account_create_auth_info_v1_impl_params: CreateAuthInfoV1ImplCostParams {
194194
create_auth_info_v1_cost_base: protocol_config
195-
.create_auth_info_v1_cost_base()
196-
.into(),
195+
.create_auth_info_v1_cost_base_as_option()
196+
.map(Into::into),
197197
},
198198
// address
199199
address_from_bytes_cost_params: AddressFromBytesCostParams {

0 commit comments

Comments
 (0)