From e04f5a6b1ca199f833ed04eb07d463efaa1ba993 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sat, 24 Feb 2024 13:34:26 +0800 Subject: [PATCH 1/4] this pr apply latest neo to devpack --- neo | 2 +- .../UnitTest_NativeContracts.cs | 2 +- tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Types.cs | 2 +- .../Services/ContractTest.cs | 2 +- .../Neo.SmartContract.Framework.UnitTests/TestBlockchain.cs | 2 +- tests/Neo.SmartContract.TestEngine/Extensions.cs | 2 +- tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs | 5 +++-- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/neo b/neo index febcc2153..d4564d157 160000 --- a/neo +++ b/neo @@ -1 +1 @@ -Subproject commit febcc2153ccf83ca8118a72ede4d5f05ce8b67ea +Subproject commit d4564d1570d14dd4a253a88b14910026432da42f diff --git a/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_NativeContracts.cs b/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_NativeContracts.cs index 30d5bcb39..c523fd14f 100644 --- a/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_NativeContracts.cs +++ b/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_NativeContracts.cs @@ -18,7 +18,7 @@ public class Contract_NativeContracts public void Test_Init() { snapshot = new TestDataCache(); - genesisBlock = new NeoSystem(TestProtocolSettings.Default, new MemoryStore()).GenesisBlock; + genesisBlock = new NeoSystem(TestProtocolSettings.Default).GenesisBlock; } [TestMethod] diff --git a/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Types.cs b/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Types.cs index 118db1e18..88645690c 100644 --- a/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Types.cs +++ b/tests/Neo.Compiler.CSharp.UnitTests/UnitTest_Types.cs @@ -399,7 +399,7 @@ public void tuple2_Test() [TestMethod] public void event_Test() { - var system = new NeoSystem(TestProtocolSettings.Default, new MemoryStore()); + var system = new NeoSystem(TestProtocolSettings.Default); using var testengine = new TestEngine(verificable: new Transaction() { Signers = new Signer[] { new Signer() { Account = UInt160.Parse("0xa400ff00ff00ff00ff00ff00ff00ff00ff00ff01") } }, diff --git a/tests/Neo.SmartContract.Framework.UnitTests/Services/ContractTest.cs b/tests/Neo.SmartContract.Framework.UnitTests/Services/ContractTest.cs index 7f32dd4a5..b05518240 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/Services/ContractTest.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/Services/ContractTest.cs @@ -19,7 +19,7 @@ public class ContractTest [TestInitialize] public void Init() { - var system = new NeoSystem(TestProtocolSettings.Default, new MemoryStore()); + var system = new NeoSystem(TestProtocolSettings.Default); _engine = new TestEngine.TestEngine(verificable: new Transaction() { Signers = new Signer[] { new Signer() { Account = UInt160.Parse("0xa400ff00ff00ff00ff00ff00ff00ff00ff00ff01") } }, diff --git a/tests/Neo.SmartContract.Framework.UnitTests/TestBlockchain.cs b/tests/Neo.SmartContract.Framework.UnitTests/TestBlockchain.cs index 54c308a5f..0fd8e364c 100644 --- a/tests/Neo.SmartContract.Framework.UnitTests/TestBlockchain.cs +++ b/tests/Neo.SmartContract.Framework.UnitTests/TestBlockchain.cs @@ -17,7 +17,7 @@ public static class TestBlockchain static TestBlockchain() { - TheNeoSystem = new NeoSystem(TestProtocolSettings.Default, new MemoryStore()); + TheNeoSystem = new NeoSystem(TestProtocolSettings.Default); } public static StorageKey CreateStorageKey(this NativeContract contract, byte prefix, ISerializable key = null) diff --git a/tests/Neo.SmartContract.TestEngine/Extensions.cs b/tests/Neo.SmartContract.TestEngine/Extensions.cs index c0035738c..32b732f1c 100644 --- a/tests/Neo.SmartContract.TestEngine/Extensions.cs +++ b/tests/Neo.SmartContract.TestEngine/Extensions.cs @@ -14,7 +14,7 @@ public static void ContractAdd(this DataCache snapshot, ContractState contract) public static void DeployNativeContracts(this DataCache snapshot, Block? persistingBlock = null) { - persistingBlock ??= new NeoSystem(TestProtocolSettings.Default, new MemoryStore()).GenesisBlock; + persistingBlock ??= new NeoSystem(TestProtocolSettings.Default).GenesisBlock; var method = typeof(SmartContract.Native.ContractManagement).GetMethod("OnPersist", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var engine = new TestEngine(TriggerType.OnPersist, null, snapshot, persistingBlock); diff --git a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs index d40c9b802..99ebc8c21 100644 --- a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs +++ b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs @@ -6,6 +6,7 @@ using Neo.VM.Types; using System.Collections.Generic; using System.IO; +using Neo.Persistence; namespace Neo.SmartContract.Testing.UnitTests { @@ -19,11 +20,11 @@ protected MyUndeployedContract(SmartContractInitialize initialize) : base(initia } //[TestMethod] - public void GenerateNativeArtifacts() + public void GenerateNativeArtifacts(DataCache snapshot) { foreach (var n in Neo.SmartContract.Native.NativeContract.Contracts) { - var manifest = n.Manifest; + var manifest = Neo.SmartContract.Native.NativeContract.ContractManagement.GetContract(snapshot, n.Hash).Manifest; var source = manifest.GetArtifactsSource(manifest.Name, generateProperties: true); var fullPath = Path.GetFullPath($"../../../../../src/Neo.SmartContract.Testing/Native/{manifest.Name}.cs"); From fa8540f7d6efbd006ebf1c18d3de6124b90aa10d Mon Sep 17 00:00:00 2001 From: Shargon Date: Sat, 24 Feb 2024 10:42:44 +0100 Subject: [PATCH 2/4] Update tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs --- tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs index 99ebc8c21..d0943c26f 100644 --- a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs +++ b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs @@ -24,7 +24,7 @@ public void GenerateNativeArtifacts(DataCache snapshot) { foreach (var n in Neo.SmartContract.Native.NativeContract.Contracts) { - var manifest = Neo.SmartContract.Native.NativeContract.ContractManagement.GetContract(snapshot, n.Hash).Manifest; + var manifest = n.GetContractState(ProtocolSettings.Default, uint.MaxValue).Manifest; var source = manifest.GetArtifactsSource(manifest.Name, generateProperties: true); var fullPath = Path.GetFullPath($"../../../../../src/Neo.SmartContract.Testing/Native/{manifest.Name}.cs"); From 28fecc1679be3ef08ac1e2e01b9fcf6695b41c58 Mon Sep 17 00:00:00 2001 From: Shargon Date: Sat, 24 Feb 2024 10:43:44 +0100 Subject: [PATCH 3/4] Update tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs --- tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs index d0943c26f..10db920f9 100644 --- a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs +++ b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs @@ -20,7 +20,7 @@ protected MyUndeployedContract(SmartContractInitialize initialize) : base(initia } //[TestMethod] - public void GenerateNativeArtifacts(DataCache snapshot) + public void GenerateNativeArtifacts() { foreach (var n in Neo.SmartContract.Native.NativeContract.Contracts) { From e6e4caff25f5b0e9858b42140268e0d8563f1d25 Mon Sep 17 00:00:00 2001 From: Shargon Date: Sat, 24 Feb 2024 10:44:02 +0100 Subject: [PATCH 4/4] Update tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs --- tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs index 10db920f9..046044776 100644 --- a/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs +++ b/tests/Neo.SmartContract.Testing.UnitTests/TestEngineTests.cs @@ -6,7 +6,6 @@ using Neo.VM.Types; using System.Collections.Generic; using System.IO; -using Neo.Persistence; namespace Neo.SmartContract.Testing.UnitTests {