diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 30baaac568..c107e19bfa 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,7 +3,7 @@ 2015-2022 The Neo Project - 3.4.0 + 3.5.0 The Neo Project net6.0 https://github.com/neo-project/neo diff --git a/src/Neo/Neo.csproj b/src/Neo/Neo.csproj index d24abf4249..a671c484ad 100644 --- a/src/Neo/Neo.csproj +++ b/src/Neo/Neo.csproj @@ -10,10 +10,10 @@ - + - + diff --git a/src/Neo/Plugins/Plugin.cs b/src/Neo/Plugins/Plugin.cs index fa8818d8ec..c3c66ced8a 100644 --- a/src/Neo/Plugins/Plugin.cs +++ b/src/Neo/Plugins/Plugin.cs @@ -73,10 +73,12 @@ static Plugin() { EnableRaisingEvents = true, IncludeSubdirectories = true, - NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.Size, + NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.Size, }; configWatcher.Changed += ConfigWatcher_Changed; configWatcher.Created += ConfigWatcher_Changed; + configWatcher.Renamed += ConfigWatcher_Changed; + configWatcher.Deleted += ConfigWatcher_Changed; AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } @@ -102,20 +104,8 @@ private static void ConfigWatcher_Changed(object sender, FileSystemEventArgs e) switch (GetExtension(e.Name)) { case ".json": - try - { - Plugins.FirstOrDefault(p => p.ConfigFile == e.FullPath)?.Configure(); - } - catch (FormatException) { } - break; case ".dll": - if (e.ChangeType != WatcherChangeTypes.Created) return; - if (GetDirectoryName(GetDirectoryName(e.FullPath)) != PluginsDirectory) return; - try - { - LoadPlugin(Assembly.Load(File.ReadAllBytes(e.FullPath))); - } - catch { } + Utility.Log(nameof(Plugin), LogLevel.Warning, $"File {e.Name} is {e.ChangeType}, please restart node."); break; } } diff --git a/src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs b/src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs index 8681b3df7a..68f9568155 100644 --- a/src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs +++ b/src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs @@ -26,6 +26,8 @@ partial class ApplicationEngine [OpCode.PUSHINT64] = 1 << 0, [OpCode.PUSHINT128] = 1 << 2, [OpCode.PUSHINT256] = 1 << 2, + [OpCode.PUSHT] = 1 << 0, + [OpCode.PUSHF] = 1 << 0, [OpCode.PUSHA] = 1 << 2, [OpCode.PUSHNULL] = 1 << 0, [OpCode.PUSHDATA1] = 1 << 3, diff --git a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs index ad20031195..9fba368b20 100644 --- a/src/Neo/SmartContract/ApplicationEngine.Runtime.cs +++ b/src/Neo/SmartContract/ApplicationEngine.Runtime.cs @@ -206,7 +206,7 @@ protected internal void RuntimeLoadScript(byte[] script, CallFlags callFlags, Ar throw new ArgumentOutOfRangeException(nameof(callFlags)); ExecutionContextState state = CurrentContext.GetState(); - ExecutionContext context = LoadScript(script, configureState: p => + ExecutionContext context = LoadScript(new Script(script, true), configureState: p => { p.CallingContext = CurrentContext; p.CallFlags = callFlags & state.CallFlags & CallFlags.ReadOnly; diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index ba2678873c..734a0f50c6 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -7,11 +7,11 @@ - - + + - + diff --git a/tests/Neo.UnitTests/Neo.UnitTests.csproj b/tests/Neo.UnitTests/Neo.UnitTests.csproj index b199f84c04..b415956da2 100644 --- a/tests/Neo.UnitTests/Neo.UnitTests.csproj +++ b/tests/Neo.UnitTests/Neo.UnitTests.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/tests/Neo.UnitTests/SmartContract/Native/UT_StdLib.cs b/tests/Neo.UnitTests/SmartContract/Native/UT_StdLib.cs index 8879c828b5..8342e15824 100644 --- a/tests/Neo.UnitTests/SmartContract/Native/UT_StdLib.cs +++ b/tests/Neo.UnitTests/SmartContract/Native/UT_StdLib.cs @@ -290,7 +290,7 @@ public void Json_Serialize() Assert.IsTrue(engine.ResultStack.Pop().GetString() == "{\"key\":\"value\"}"); Assert.IsTrue(engine.ResultStack.Pop().GetString() == "null"); Assert.IsTrue(engine.ResultStack.Pop().GetString() == "\"test\""); - Assert.IsTrue(engine.ResultStack.Pop().GetString() == "1"); + Assert.IsTrue(engine.ResultStack.Pop().GetString() == "true"); Assert.IsTrue(engine.ResultStack.Pop().GetString() == "5"); } diff --git a/tests/Neo.UnitTests/VM/UT_Helper.cs b/tests/Neo.UnitTests/VM/UT_Helper.cs index 444584cd8e..539c5df028 100644 --- a/tests/Neo.UnitTests/VM/UT_Helper.cs +++ b/tests/Neo.UnitTests/VM/UT_Helper.cs @@ -137,7 +137,7 @@ public void TestEmitAppCall3() ScriptBuilder sb = new ScriptBuilder(); sb.EmitDynamicCall(UInt160.Zero, "AAAAA", true); byte[] tempArray = new byte[38]; - tempArray[0] = (byte)OpCode.PUSH1; + tempArray[0] = (byte)OpCode.PUSHT; tempArray[1] = (byte)OpCode.PUSH1;//arg.Length tempArray[2] = (byte)OpCode.PACK; tempArray[3] = (byte)OpCode.PUSH15;//(byte)CallFlags.All; @@ -344,7 +344,7 @@ private void TestEmitPush2Boolean() ScriptBuilder sb = new ScriptBuilder(); sb.EmitPush(new ContractParameter(ContractParameterType.Boolean)); byte[] tempArray = new byte[1]; - tempArray[0] = (byte)OpCode.PUSH0; + tempArray[0] = (byte)OpCode.PUSHF; CollectionAssert.AreEqual(tempArray, sb.ToArray()); } @@ -531,7 +531,7 @@ private void TestEmitPush3Bool() ScriptBuilder sb = new ScriptBuilder(); sb.EmitPush(true); byte[] tempArray = new byte[1]; - tempArray[0] = (byte)OpCode.PUSH1; + tempArray[0] = (byte)OpCode.PUSHT; CollectionAssert.AreEqual(tempArray, sb.ToArray()); } @@ -541,7 +541,7 @@ public void TestEmitSysCall() ScriptBuilder sb = new ScriptBuilder(); sb.EmitSysCall(0, true); byte[] tempArray = new byte[6]; - tempArray[0] = (byte)OpCode.PUSH1; + tempArray[0] = (byte)OpCode.PUSHT; tempArray[1] = (byte)OpCode.SYSCALL; tempArray[2] = 0x00; tempArray[3] = 0x00;