Repository: paritytech/substrate
File: frame/contracts/src/wasm/runtime.rs (Rust)

Code before:
				.saturating_add(s.take_storage_per_byte.saturating_mul(len.into())),
			Transfer => s.transfer,
			CallBase => s.call,
			DelegateCallBase => s.delegate_call,
			CallSurchargeTransfer => s.call_transfer_surcharge,
			CallInputCloned(len) => s.call_per_cloned_byte.saturating_mul(len.into()),
			InstantiateBase { input_data_len, salt_len } => s
				.instantiate
				.saturating_add(s.return_per_byte.saturating_mul(input_data_len.into()))
				.saturating_add(s.instantiate_per_salt_byte.saturating_mul(salt_len.into())),
			InstantiateSurchargeTransfer => s.instantiate_transfer_surcharge,
			HashSha256(len) => s
				.hash_sha2_256
				.saturating_add(s.hash_sha2_256_per_byte.saturating_mul(len.into())),
			HashKeccak256(len) => s
				.hash_keccak_256
				.saturating_add(s.hash_keccak_256_per_byte.saturating_mul(len.into())),
			HashBlake256(len) => s
				.hash_blake2_256
				.saturating_add(s.hash_blake2_256_per_byte.saturating_mul(len.into())),
			HashBlake128(len) => s
				.hash_blake2_128
				.saturating_add(s.hash_blake2_128_per_byte.saturating_mul(len.into())),
			EcdsaRecovery => s.ecdsa_recover,
			ChainExtension(amount) => amount,
			#[cfg(feature = "unstable-interface")]
			CallRuntime(weight) => weight.ref_time(),
			SetCodeHash => s.set_code_hash,
			EcdsaToEthAddress => s.ecdsa_to_eth_address,
			#[cfg(feature = "unstable-interface")]
			ReentrantCount => s.reentrance_count,
			#[cfg(feature = "unstable-interface")]
			AccountEntranceCount => s.account_reentrance_count,
			InstantationNonce => s.instantiation_nonce,
		};
		RuntimeToken {
			#[cfg(test)]
			_created_from: *self,
			weight: Weight::from_ref_time(weight),
		}
	}
}

/// Same as [`Runtime::charge_gas`].
///
/// We need this access as a macro because sometimes hiding the lifetimes behind
/// a function won't work out.
macro_rules! charge_gas {
	($runtime:expr, $costs:expr) => {{
		let token = $costs.token(&$runtime.ext.schedule().host_fn_weights);
		$runtime.ext.gas_meter().charge(token)

Review comment (suggestion):
Above would imply it here as well

```suggestion
			#[cfg(feature = "unstable-interface")]
			InstantationNonce => s.instantiation_nonce,
```

Code after:
			CallInputCloned(len) => s.call_per_cloned_byte.saturating_mul(len.into()),
			InstantiateBase { input_data_len, salt_len } => s
				.instantiate
				.saturating_add(s.return_per_byte.saturating_mul(input_data_len.into()))
				.saturating_add(s.instantiate_per_salt_byte.saturating_mul(salt_len.into())),
			InstantiateSurchargeTransfer => s.instantiate_transfer_surcharge,
			HashSha256(len) => s
				.hash_sha2_256
				.saturating_add(s.hash_sha2_256_per_byte.saturating_mul(len.into())),
			HashKeccak256(len) => s
				.hash_keccak_256
				.saturating_add(s.hash_keccak_256_per_byte.saturating_mul(len.into())),
			HashBlake256(len) => s
				.hash_blake2_256
				.saturating_add(s.hash_blake2_256_per_byte.saturating_mul(len.into())),
			HashBlake128(len) => s
				.hash_blake2_128
				.saturating_add(s.hash_blake2_128_per_byte.saturating_mul(len.into())),
			EcdsaRecovery => s.ecdsa_recover,
			ChainExtension(amount) => amount,
			CallRuntime(weight) => weight.ref_time(),
			SetCodeHash => s.set_code_hash,
			EcdsaToEthAddress => s.ecdsa_to_eth_address,
			ReentrantCount => s.reentrance_count,
			AccountEntranceCount => s.account_reentrance_count,
			InstantationNonce => s.instantiation_nonce,
		};
		RuntimeToken {
			#[cfg(test)]
			_created_from: *self,
			weight: Weight::from_ref_time(weight),
		}
	}
}

/// Same as [`Runtime::charge_gas`].
///
/// We need this access as a macro because sometimes hiding the lifetimes behind
/// a function won't work out.
macro_rules! charge_gas {
	($runtime:expr, $costs:expr) => {{
		let token = $costs.token(&$runtime.ext.schedule().host_fn_weights);
		$runtime.ext.gas_meter().charge(token)
	}};
}

#[cfg_attr(test, derive(Debug, PartialEq, Eq))]
#[derive(Copy, Clone)]
struct RuntimeToken {
	#[cfg(test)]
	_created_from: RuntimeCosts,