git.delta.rocks / unique-network / refs/commits / 5d7779211ba3

difftreelog

fix gas limit

Trubnikov Sergey2023-05-22parent: #55817c2.patch.diff
in: master

2 files changed

modifiedpallets/balances-adapter/src/lib.rsdiffbeforeafterboth
--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -20,6 +20,11 @@
 		Self(SubstrateRecorder::new(u64::MAX))
 	}
 
+	/// Creates a handle
+	pub fn new_with_gas_limit(gas_limit: u64) -> NativeFungibleHandle<T> {
+		Self(SubstrateRecorder::new(gas_limit))
+	}
+
 	/// Check if the collection is internal
 	pub fn check_is_internal(&self) -> DispatchResult {
 		Ok(())
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
122122
123 fn dispatch(collection_id: CollectionId) -> Result<Self, DispatchError> {123 fn dispatch(collection_id: CollectionId) -> Result<Self, DispatchError> {
124 if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {124 if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {
125 return Ok(Self::NativeFungible(NativeFungibleHandle::new()));125 return Ok(Self::NativeFungible(
126 NativeFungibleHandle::new_with_gas_limit(u64::MAX),
127 ));
126 }128 }
127129
188 fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {190 fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
189 if let Some(collection_id) = map_eth_to_id(&handle.code_address()) {191 if let Some(collection_id) = map_eth_to_id(&handle.code_address()) {
190 if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {192 if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {
191 <NativeFungibleHandle<T>>::new().call(handle)193 <NativeFungibleHandle<T>>::new_with_gas_limit(handle.remaining_gas()).call(handle)
192 } else {194 } else {
193 let collection = <CollectionHandle<T>>::new_with_gas_limit(195 let collection = <CollectionHandle<T>>::new_with_gas_limit(
194 collection_id,196 collection_id,