From 9ed6cac3786ef598715537f650018c7a7da35cec Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 23 Oct 2024 12:08:51 +0200 Subject: [PATCH] Expose `GetInteropDescriptor` (#3545) * Expose GetInteropDescriptor * Update src/Neo/SmartContract/ApplicationEngine.cs --------- Co-authored-by: Jimmy Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com> --- src/Neo/SmartContract/ApplicationEngine.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Neo/SmartContract/ApplicationEngine.cs b/src/Neo/SmartContract/ApplicationEngine.cs index 38430f3632..7808baae5e 100644 --- a/src/Neo/SmartContract/ApplicationEngine.cs +++ b/src/Neo/SmartContract/ApplicationEngine.cs @@ -22,6 +22,7 @@ using System.Linq; using System.Numerics; using System.Reflection; +using System.Runtime.CompilerServices; using Array = System.Array; using VMArray = Neo.VM.Types.Array; @@ -241,9 +242,7 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction) { if (engine is ApplicationEngine app) { - uint method = instruction.TokenU32; - - app.OnSysCall(services[method]); + app.OnSysCall(GetInteropDescriptor(instruction.TokenU32)); } else { @@ -641,6 +640,17 @@ private static InteropDescriptor Register(string name, string handler, long fixe return descriptor; } + /// + /// Get Interop Descriptor + /// + /// Method Hash + /// InteropDescriptor + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static InteropDescriptor GetInteropDescriptor(uint methodHash) + { + return services[methodHash]; + } + /// /// Creates a new instance of the class, and use it to run the specified script. ///