Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Sync Neo 3.2.1-CI01365 (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang authored May 26, 2022
1 parent 5565c98 commit 5178f45
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
7 changes: 4 additions & 3 deletions neo-cli/CLI/MainService.Wallet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2021 The Neo Project.
// Copyright (C) 2016-2022 The Neo Project.
//
// The neo-cli is free software distributed under the MIT software
// license, see the accompanying file LICENSE in the main directory of
Expand All @@ -24,6 +24,7 @@
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using static Neo.SmartContract.Helper;

namespace Neo.CLI
{
Expand Down Expand Up @@ -392,11 +393,11 @@ private void OnListAddressCommand()
{
type = "WatchOnly";
}
else if (contract.Script.IsMultiSigContract())
else if (IsMultiSigContract(contract.Script))
{
type = "MultiSignature";
}
else if (contract.Script.IsSignatureContract())
else if (IsSignatureContract(contract.Script))
{
type = "Standard";
}
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private void SendTransaction(byte[] script, UInt160 account = null, long gas = T
try
{
Transaction tx = CurrentWallet.MakeTransaction(snapshot, script, account, signers, maxGas: gas);
ConsoleHelper.Info("Invoking script with: ", $"'{Convert.ToBase64String(tx.Script)}'");
ConsoleHelper.Info("Invoking script with: ", $"'{Convert.ToBase64String(tx.Script.Span)}'");

using (ApplicationEngine engine = ApplicationEngine.Run(tx.Script, snapshot, container: tx, settings: NeoSystem.Settings, gas: gas))
{
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.2.1-CI01355" />
<PackageReference Include="Neo" Version="3.2.1-CI01365" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions neo-gui/GUI/ElectionDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2021 The Neo Project.
// Copyright (C) 2016-2022 The Neo Project.
//
// The neo-gui is free software distributed under the MIT software
// license, see the accompanying file LICENSE in the main directory of
Expand All @@ -10,13 +10,13 @@

using Neo.Cryptography.ECC;
using Neo.IO;
using Neo.SmartContract;
using Neo.SmartContract.Native;
using Neo.VM;
using System;
using System.Linq;
using System.Windows.Forms;
using static Neo.Program;
using static Neo.SmartContract.Helper;

namespace Neo.GUI
{
Expand All @@ -37,7 +37,7 @@ public byte[] GetScript()

private void ElectionDialog_Load(object sender, EventArgs e)
{
comboBox1.Items.AddRange(Service.CurrentWallet.GetAccounts().Where(p => !p.WatchOnly && p.Contract.Script.IsSignatureContract()).Select(p => p.GetKey().PublicKey).ToArray());
comboBox1.Items.AddRange(Service.CurrentWallet.GetAccounts().Where(p => !p.WatchOnly && IsSignatureContract(p.Contract.Script)).Select(p => p.GetKey().PublicKey).ToArray());
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions neo-gui/GUI/InvokeContractDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2021 The Neo Project.
// Copyright (C) 2016-2022 The Neo Project.
//
// The neo-gui is free software distributed under the MIT software
// license, see the accompanying file LICENSE in the main directory of
Expand Down Expand Up @@ -38,7 +38,7 @@ public InvokeContractDialog(Transaction tx) : this()
{
this.tx = tx;
tabControl1.SelectedTab = tabPage2;
textBox6.Text = tx.Script.ToHexString();
textBox6.Text = tx.Script.Span.ToHexString();
textBox6.ReadOnly = true;
}

Expand Down
8 changes: 4 additions & 4 deletions neo-gui/GUI/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2021 The Neo Project.
// Copyright (C) 2016-2022 The Neo Project.
//
// The neo-gui is free software distributed under the MIT software
// license, see the accompanying file LICENSE in the main directory of
Expand All @@ -12,7 +12,6 @@
using Neo.IO;
using Neo.IO.Actors;
using Neo.Ledger;
using Neo.Network.P2P;
using Neo.Network.P2P.Payloads;
using Neo.Properties;
using Neo.SmartContract;
Expand All @@ -34,6 +33,7 @@
using System.Windows.Forms;
using System.Xml.Linq;
using static Neo.Program;
using static Neo.SmartContract.Helper;
using VMArray = Neo.VM.Types.Array;

namespace Neo.GUI
Expand Down Expand Up @@ -76,7 +76,7 @@ private void AddAccount(WalletAccount account, bool selected = false)
}
if (item == null)
{
string groupName = account.WatchOnly ? "watchOnlyGroup" : account.Contract.Script.IsSignatureContract() ? "standardContractGroup" : "nonstandardContractGroup";
string groupName = account.WatchOnly ? "watchOnlyGroup" : IsSignatureContract(account.Contract.Script) ? "standardContractGroup" : "nonstandardContractGroup";
item = listView1.Items.Add(new ListViewItem(new[]
{
new ListViewItem.ListViewSubItem
Expand Down Expand Up @@ -424,7 +424,7 @@ private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
查看私钥VToolStripMenuItem.Enabled =
listView1.SelectedIndices.Count == 1 &&
!((WalletAccount)listView1.SelectedItems[0].Tag).WatchOnly &&
((WalletAccount)listView1.SelectedItems[0].Tag).Contract.Script.IsSignatureContract();
IsSignatureContract(((WalletAccount)listView1.SelectedItems[0].Tag).Contract.Script);
viewContractToolStripMenuItem.Enabled =
listView1.SelectedIndices.Count == 1 &&
!((WalletAccount)listView1.SelectedItems[0].Tag).WatchOnly;
Expand Down
10 changes: 4 additions & 6 deletions neo-gui/GUI/Wrappers/TransactionAttributeWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2021 The Neo Project.
// Copyright (C) 2016-2022 The Neo Project.
//
// The neo-gui is free software distributed under the MIT software
// license, see the accompanying file LICENSE in the main directory of
Expand All @@ -8,10 +8,9 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO;
using Neo.Network.P2P.Payloads;
using System.ComponentModel;
using System.IO;
using System.Text;

namespace Neo.GUI.Wrappers
{
Expand All @@ -23,9 +22,8 @@ internal class TransactionAttributeWrapper

public TransactionAttribute Unwrap()
{
using var reader = new BinaryReader(new MemoryStream(Data), Encoding.UTF8, false);

return TransactionAttribute.DeserializeFrom(reader);
MemoryReader reader = new(Data);
return TransactionAttribute.DeserializeFrom(ref reader);
}
}
}

0 comments on commit 5178f45

Please sign in to comment.