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
20 Self(SubstrateRecorder::new(u64::MAX))20 Self(SubstrateRecorder::new(u64::MAX))
21 }21 }
22
23 /// Creates a handle
24 pub fn new_with_gas_limit(gas_limit: u64) -> NativeFungibleHandle<T> {
25 Self(SubstrateRecorder::new(gas_limit))
26 }
2227
23 /// Check if the collection is internal28 /// Check if the collection is internal
24 pub fn check_is_internal(&self) -> DispatchResult {29 pub fn check_is_internal(&self) -> DispatchResult {
modifiedruntime/common/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/dispatch.rs
+++ b/runtime/common/dispatch.rs
@@ -122,7 +122,9 @@
 
 	fn dispatch(collection_id: CollectionId) -> Result<Self, DispatchError> {
 		if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {
-			return Ok(Self::NativeFungible(NativeFungibleHandle::new()));
+			return Ok(Self::NativeFungible(
+				NativeFungibleHandle::new_with_gas_limit(u64::MAX),
+			));
 		}
 
 		let handle = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -188,7 +190,7 @@
 	fn call(handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
 		if let Some(collection_id) = map_eth_to_id(&handle.code_address()) {
 			if collection_id == pallet_common::NATIVE_FUNGIBLE_COLLECTION_ID {
-				<NativeFungibleHandle<T>>::new().call(handle)
+				<NativeFungibleHandle<T>>::new_with_gas_limit(handle.remaining_gas()).call(handle)
 			} else {
 				let collection = <CollectionHandle<T>>::new_with_gas_limit(
 					collection_id,