From 5e61a31b2ac6a71baa68c2268fa11f92215e33c1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 2 Jan 2024 17:10:58 +0800 Subject: [PATCH] Fix: ban notify from contract developer (#845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ban notify from contract developer * fix ut * Update src/Neo.SmartContract.Framework/Services/Runtime.cs --------- Co-authored-by: Vitor Nazário Coelho Co-authored-by: Shargon --- src/Neo.SmartContract.Framework/Services/Runtime.cs | 5 +++-- tests/Neo.SmartContract.Framework.UnitTests/SyscallTest.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Neo.SmartContract.Framework/Services/Runtime.cs b/src/Neo.SmartContract.Framework/Services/Runtime.cs index d8c5e96b7..18338c3c7 100644 --- a/src/Neo.SmartContract.Framework/Services/Runtime.cs +++ b/src/Neo.SmartContract.Framework/Services/Runtime.cs @@ -95,8 +95,9 @@ public static class Runtime [Syscall("System.Runtime.Log")] public static extern void Log(string message); - [Syscall("System.Runtime.Notify")] - public static extern void Notify(string eventName, object[] state); + // Events not present in the ABI were disabled in HF_Basilisk + // [Syscall("System.Runtime.Notify")] + // public static extern void Notify(string eventName, object[] state); [Syscall("System.Runtime.BurnGas")] public static extern void BurnGas(long gas); diff --git a/tests/Neo.SmartContract.Framework.UnitTests/SyscallTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/SyscallTest.cs index 6c49dc079..981989e92 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/SyscallTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/SyscallTest.cs @@ -81,7 +81,7 @@ public void TestAllSyscalls() HashSet fwSyscalls = visitor.Visit(compilation.GlobalNamespace).ToHashSet(); fwSyscalls.SymmetricExceptWith(neoSyscalls); - if (fwSyscalls.Count > 0) + if (fwSyscalls.Count > 0 && fwSyscalls.All(p => !p.Equals("System.Runtime.Notify"))) { Assert.Fail($"Unknown or unimplemented syscalls: {string.Join("\n", fwSyscalls)}"); }