From cbe16b125ce79a7cce8113231f22f770b1b6fd0e Mon Sep 17 00:00:00 2001 From: Shuai Date: Sat, 8 May 2021 10:07:19 +0800 Subject: [PATCH] rc2 --- neo | 2 +- .../neo3-gui/Common/Consoles/CliSettings.cs | 2 +- .../neo3-gui/Common/Consoles/MainService.cs | 6 +- .../Storage/LevelDBModules/LevelDbContext.cs | 2 +- .../Storage/SQLiteModules/SQLiteContext.cs | 2 +- neo3-gui/neo3-gui/Common/Storage/TrackDB.cs | 2 +- neo3-gui/neo3-gui/Helpers.cs | 2 +- .../Models/Contracts/ManifestModel.cs | 2 +- neo3-gui/neo3-gui/Plugins/LevelDBStore.dll | Bin 19968 -> 19968 bytes .../ApiServices/ContractApiService.cs | 65 ++++++++++++++++++ neo3-gui/neo3-gui/config.private.json | 18 ++--- neo3-gui/neo3-gui/config.testnet.json | 9 +-- neo3-gui/neo3-gui/neo3-gui.csproj | 3 +- 13 files changed, 90 insertions(+), 25 deletions(-) diff --git a/neo b/neo index 28f874a..c2d2629 160000 --- a/neo +++ b/neo @@ -1 +1 @@ -Subproject commit 28f874a0d4c786dedbf26d1ae1cd092c4c4f9f1f +Subproject commit c2d26291cb1dc4523fd43a19302bbfb7d10e4a21 diff --git a/neo3-gui/neo3-gui/Common/Consoles/CliSettings.cs b/neo3-gui/neo3-gui/Common/Consoles/CliSettings.cs index 73995da..f222fc2 100644 --- a/neo3-gui/neo3-gui/Common/Consoles/CliSettings.cs +++ b/neo3-gui/neo3-gui/Common/Consoles/CliSettings.cs @@ -57,7 +57,7 @@ public class LoggerSettings public LoggerSettings(IConfigurationSection section) { - this.Path = string.Format(section.GetValue("Path", "Logs_{0}"), CliSettings.Default.Protocol.Magic.ToString("X8")); + this.Path = section.GetValue("Path", "Logs_{0}"); this.ConsoleOutput = section.GetValue("ConsoleOutput", false); this.Active = section.GetValue("Active", false); } diff --git a/neo3-gui/neo3-gui/Common/Consoles/MainService.cs b/neo3-gui/neo3-gui/Common/Consoles/MainService.cs index a2e339d..ad411a5 100644 --- a/neo3-gui/neo3-gui/Common/Consoles/MainService.cs +++ b/neo3-gui/neo3-gui/Common/Consoles/MainService.cs @@ -345,7 +345,7 @@ private bool SignAndSendTx(Transaction tx) ContractParametersContext context; try { - context = new ContractParametersContext(NeoSystem.StoreView, tx); + context = new ContractParametersContext(NeoSystem.StoreView, tx, CliSettings.Default.Protocol.Network); } catch (InvalidOperationException ex) { @@ -982,7 +982,7 @@ private bool OnSendCommand(string[] args) return true; } - ContractParametersContext context = new ContractParametersContext(snapshot, tx); + ContractParametersContext context = new ContractParametersContext(snapshot, tx, CliSettings.Default.Protocol.Network); CurrentWallet.Sign(context); if (context.Completed) { @@ -1272,7 +1272,7 @@ public void OpenWallet(string path, string password) } } - + private void WriteBlocks(uint start, uint count, string path, bool writeStart) { uint end = start + count - 1; diff --git a/neo3-gui/neo3-gui/Common/Storage/LevelDBModules/LevelDbContext.cs b/neo3-gui/neo3-gui/Common/Storage/LevelDBModules/LevelDbContext.cs index ed13333..7332060 100644 --- a/neo3-gui/neo3-gui/Common/Storage/LevelDBModules/LevelDbContext.cs +++ b/neo3-gui/neo3-gui/Common/Storage/LevelDBModules/LevelDbContext.cs @@ -42,7 +42,7 @@ static LevelDbContext() Directory.CreateDirectory("Data_Track"); } } - public LevelDbContext() : this(Path.Combine("Data_Track", $"TransactionLog_LevelDB_{CliSettings.Default.Protocol.Magic}")) + public LevelDbContext() : this(Path.Combine("Data_Track", $"TransactionLog_LevelDB_{CliSettings.Default.Protocol.Network}")) { } diff --git a/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs index dc8c7f3..c562050 100644 --- a/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs +++ b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs @@ -39,7 +39,7 @@ static SQLiteContext() } } - public SQLiteContext() : this(Path.Combine($"Data_Track", $"track.{CliSettings.Default.Protocol.Magic}.db")) + public SQLiteContext() : this(Path.Combine($"Data_Track", $"track.{CliSettings.Default.Protocol.Network}.db")) { } diff --git a/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs b/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs index a278dc1..f5a005c 100644 --- a/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs +++ b/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs @@ -38,7 +38,7 @@ static TrackDB() public TrackDB() { - _magic = CliSettings.Default.Protocol.Magic; + _magic = CliSettings.Default.Protocol.Network; _sqldb = new SQLiteContext(Path.Combine($"Data_Track", $"track.{_magic}.db")); _leveldb = new LevelDbContext(Path.Combine("Data_Track", $"TransactionLog_LevelDB_{_magic}")); diff --git a/neo3-gui/neo3-gui/Helpers.cs b/neo3-gui/neo3-gui/Helpers.cs index de086da..990bbc8 100644 --- a/neo3-gui/neo3-gui/Helpers.cs +++ b/neo3-gui/neo3-gui/Helpers.cs @@ -346,7 +346,7 @@ public static bool SignContext(this Wallet wallet, ContractParametersContext sig /// public static (bool, ContractParametersContext) TrySignTx(this Wallet wallet, Transaction tx) { - var context = new ContractParametersContext(GetDefaultSnapshot(), tx); + var context = new ContractParametersContext(GetDefaultSnapshot(), tx, CliSettings.Default.Protocol.Network); var signResult = wallet.SignContext(context); if (signResult) { diff --git a/neo3-gui/neo3-gui/Models/Contracts/ManifestModel.cs b/neo3-gui/neo3-gui/Models/Contracts/ManifestModel.cs index 1fa1e85..bf06a7e 100644 --- a/neo3-gui/neo3-gui/Models/Contracts/ManifestModel.cs +++ b/neo3-gui/neo3-gui/Models/Contracts/ManifestModel.cs @@ -42,7 +42,7 @@ public ManifestModel(ContractManifest manifest) /// The trusts field is an array containing a set of contract hashes or group public keys. It can also be assigned with a wildcard *. If it is a wildcard *, then it means that it trusts any contract. /// If a contract is trusted, the user interface will not give any warnings when called by the contract. /// - public WildcardContainer Trusts { get; set; } + public WildcardContainer Trusts { get; set; } public string[] SupportedStandards diff --git a/neo3-gui/neo3-gui/Plugins/LevelDBStore.dll b/neo3-gui/neo3-gui/Plugins/LevelDBStore.dll index 128735b96409c03ebc2f5a84514af26d24645fa5..16ffc3a998755ff7ba3388ed74e3e90bad5f504f 100644 GIT binary patch delta 8631 zcmbtad3Y67vafTxZ{PhUAuEuOgb)cyh(Q9fCxaj-(qbc2vQR^zB`p z6~1Cs=xp`%20iZUYPs4@nsrG|A;xsj9aK?2D2Mz-H}V+kc2DDGYppuRiTN)Kv!2g) z_pIxS3Z2XSCFot~A8vO?Z=r51;>Kv~!HwC7d4vjmjV0W~%*Il*#n0#dQrD9^bYmGe zM&r5Mn2pFMEBE3C%1CVp<0TP&&_+44m;$eOVd5s8ln> zERA`6C_Ti`$3yJA$iPjhCBmX=_$@MlGk(#jz7$_+#8X5iVp#QWhkhBR@vGRgyx0#9 zY|D#GR}8g_FV#x1dTykQPzg%x0=TEc0bMlAxh1K)q}x?Z#LwX<%#u8!k>7AsJXwqW9TD#FH(=~2PZiNjI1 z)DJlBe9@shcG_rarkd^)rVh7H`*EA&vMAHnIc(8uLenkg?>GMuN~M7)aEp$bM=Xm@ z`Su4aS}L?y=un|8LZ35PI$G$CKvu+}8+=R`nUoTu8G)a|A$mB-l#J8LqM2rA8*a8l zk}>RgN)CkRRFnl9H1o-#^n?UdLle=zO>~X~SmzD!2n(7P?K3&tj-d)TTP~V^(#)U6 z1Y#5oRtGKWA7IT7WYm74J)+40+oF>e3#K554s@@shw8^6?l~m%7C*sRZ|G#uCjY5W zC-O_UcZi8bp&f(CQavq_Nrl%Dh0K4iv-J?+c^xuh*?J-nS6ec5G#L3PVvFj}betw4 z$?3EJ6}dae$WL8Gwj$)BLP4hj$LU_wYB?#a+sFDitp(~O<7Qf{83t;Cm6yaym~NDD zvm>soM$k|}QEH$|Ins<63zKMp2(R!nN})x9#*1nPx|59jWEuyj6A|X}b|{lpy2#m` z-rXLpqAH(e#&+p^s*j{F@81KS`xQN<_rWSt%ZjLd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8r^n)X2$Il&Gy9P(7e(L2J_ubDM4)==87qV=dKw@$d#x<1gX$Xu1Tzyr7Jc sl;!++Y*qFGYNaN+f#!nVi03;w*%u!Q&vgG? DeployContract(string nefPath, string manifestPath = n return result; } + + + public async Task UpdateContract(UInt160 contractHash, string nefPath, string manifestPath = null, bool sendTx = false, UInt160 sender = null) + { + if (CurrentWallet == null) + { + return Error(ErrorCode.WalletNotOpen); + } + if (nefPath.IsNull()) + { + return Error(ErrorCode.ParameterIsNull, "nefPath is empty."); + } + if (manifestPath.IsNull()) + { + manifestPath = Path.ChangeExtension(nefPath, ".manifest.json"); + } + // Read nef + NefFile nefFile = ReadNefFile(nefPath); + // Read manifest + ContractManifest manifest = ReadManifestFile(manifestPath); + // Basic script checks + await CheckBadOpcode(nefFile.Script); + + // Build script + using ScriptBuilder sb = new ScriptBuilder(); + sb.EmitDynamicCall(contractHash, "update", nefFile.ToArray(), manifest.ToJson().ToString(), null); + var script = sb.ToArray(); + + var singers = new Signer[] { new Signer() { Account = sender, Scopes = WitnessScope.Global } }; + Transaction tx; + try + { + tx = CurrentWallet.MakeTransaction(Helpers.GetDefaultSnapshot(), script, sender, singers); + } + catch (InvalidOperationException ex) + { + return Error(ErrorCode.EngineFault, ex.GetExMessage()); + } + catch (Exception ex) + { + if (ex.Message.Contains("Insufficient GAS")) + { + return Error(ErrorCode.GasNotEnough); + } + throw; + } + + var result = new DeployResultModel + { + ContractHash = contractHash, + GasConsumed = new BigDecimal((BigInteger)tx.SystemFee, NativeContract.GAS.Decimals) + }; + if (sendTx) + { + var (signSuccess, context) = CurrentWallet.TrySignTx(tx); + if (!signSuccess) + { + return Error(ErrorCode.SignFail, context.SafeSerialize()); + } + await tx.Broadcast(); + result.TxId = tx.Hash; + } + return result; + } + public async Task InvokeContract(InvokeContractParameterModel para) { if (CurrentWallet == null) diff --git a/neo3-gui/neo3-gui/config.private.json b/neo3-gui/neo3-gui/config.private.json index 7409c17..e5116c0 100644 --- a/neo3-gui/neo3-gui/config.private.json +++ b/neo3-gui/neo3-gui/config.private.json @@ -1,5 +1,10 @@ { "ApplicationConfiguration": { + "Logger": { + "Path": "Logs", + "ConsoleOutput": false, + "Active": false + }, "Storage": { "Engine": "LevelDBStore", "Path": "Data_LevelDB_55555" @@ -8,24 +13,19 @@ "Port": 30333, "WsPort": 30334 }, - "UnlockWallet": { - "Path": "", - "Password": "", - "IsActive": false - }, "PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip" }, "ProtocolConfiguration": { - "Magic": 55555, + "Network": 55555, "MillisecondsPerBlock": 15000, "MaxTraceableBlocks": 2102400, "ValidatorsCount": 1, "StandbyCommittee": [ - "021b3f15c2c98e99794c2121a0f3683803edcf488e621480f6050fd6b01432e18b" + "021821807f923a3da004fb73871509d7635bcc05f41edef2a3ca5c941d8bbc1231" ], "SeedList": [ //"127.0.0.1:10333" - "128.1.61.238:30333" + "20.198.249.57:30333" ] } -} +} \ No newline at end of file diff --git a/neo3-gui/neo3-gui/config.testnet.json b/neo3-gui/neo3-gui/config.testnet.json index 8ffc58a..470a2ee 100644 --- a/neo3-gui/neo3-gui/config.testnet.json +++ b/neo3-gui/neo3-gui/config.testnet.json @@ -7,11 +7,11 @@ }, "Storage": { "Engine": "LevelDBStore", - "Path": "Data_LevelDB_827601742" + "Path": "Data_LevelDB_844378958" }, "P2P": { - "Port": 30333, - "WsPort": 30334 + "Port": 20333, + "WsPort": 20334 }, "UnlockWallet": { "Path": "", @@ -21,7 +21,7 @@ "PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip" }, "ProtocolConfiguration": { - "Magic": 827601742, + "Network": 844378958, "MillisecondsPerBlock": 15000, "MaxTraceableBlocks": 2102400, "ValidatorsCount": 7, @@ -43,3 +43,4 @@ ] } } + diff --git a/neo3-gui/neo3-gui/neo3-gui.csproj b/neo3-gui/neo3-gui/neo3-gui.csproj index 578a7c2..bcf1055 100644 --- a/neo3-gui/neo3-gui/neo3-gui.csproj +++ b/neo3-gui/neo3-gui/neo3-gui.csproj @@ -24,12 +24,11 @@ - + -