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

Sync to Neo 3.0.0-CI01148 #709

Merged
merged 4 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions neo-cli/CLI/MainService.Consensus.cs

This file was deleted.

6 changes: 3 additions & 3 deletions neo-cli/CLI/MainService.Vote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void OnRegisterCandidateCommand(UInt160 account)
byte[] script;
using (ScriptBuilder scriptBuilder = new ScriptBuilder())
{
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "registerCandidate", true, publicKey);
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "registerCandidate", publicKey);
script = scriptBuilder.ToArray();
}

Expand Down Expand Up @@ -83,7 +83,7 @@ private void OnUnregisterCandidateCommand(UInt160 account)
byte[] script;
using (ScriptBuilder scriptBuilder = new ScriptBuilder())
{
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "unregisterCandidate", true, publicKey);
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "unregisterCandidate", publicKey);
script = scriptBuilder.ToArray();
}

Expand All @@ -107,7 +107,7 @@ private void OnVoteCommand(UInt160 senderAccount, ECPoint publicKey)
byte[] script;
using (ScriptBuilder scriptBuilder = new ScriptBuilder())
{
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "vote", true, senderAccount, publicKey);
scriptBuilder.EmitDynamicCall(NativeContract.NEO.Hash, "vote", senderAccount, publicKey);
script = scriptBuilder.ToArray();
}

Expand Down
13 changes: 2 additions & 11 deletions neo-cli/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ private byte[] LoadDeploymentScript(string nefFilePath, string manifestFilePath,

using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", true, nef.ToArray(), manifest.ToJson().ToString());
sb.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", nef.ToArray(), manifest.ToJson().ToString());
return sb.ToArray();
}
}
Expand Down Expand Up @@ -391,10 +391,6 @@ public async void Start(string[] args)
{
Console.WriteLine($"Failed to open file \"{Settings.Default.UnlockWallet.Path}\"");
}
if (Settings.Default.UnlockWallet.StartConsensus && CurrentWallet != null)
vncoelho marked this conversation as resolved.
Show resolved Hide resolved
{
OnStartConsensusCommand();
}
Comment on lines -395 to -397
Copy link
Member

@superboyiii superboyiii Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should reserve this, it will implement Plugin.GetService<IConsensusProvider>()?.Start(CurrentWallet); from dBFT plugin, MainService.Consensus.cs should be reserved as well. Wait for GetService to be modified from protected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should start the consensus with a new command, registered in the plugin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @shargon

}
}

Expand Down Expand Up @@ -525,7 +521,6 @@ private bool OnInvokeWithResult(UInt160 scriptHash, string operation, out StackI
}
}

bool hasReturnValue;
var snapshot = Blockchain.Singleton.GetSnapshot();
ContractState contract = NativeContract.ContractManagement.GetContract(snapshot, scriptHash);
if (contract == null)
Expand All @@ -542,17 +537,13 @@ private bool OnInvokeWithResult(UInt160 scriptHash, string operation, out StackI
result = StackItem.Null;
return false;
}
else
{
hasReturnValue = contract.Manifest.Abi.GetMethod(operation).ReturnType != ContractParameterType.Void;
}
}

byte[] script;

using (ScriptBuilder scriptBuilder = new ScriptBuilder())
{
scriptBuilder.EmitDynamicCall(scriptHash, operation, hasReturnValue, parameters.ToArray());
scriptBuilder.EmitDynamicCall(scriptHash, operation, parameters.ToArray());
script = scriptBuilder.ToArray();
Console.WriteLine($"Invoking script with: '{script.ToBase64String()}'");
}
Expand Down
2 changes: 0 additions & 2 deletions neo-cli/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public class UnlockWalletSettings
{
public string Path { get; }
public string Password { get; }
public bool StartConsensus { get; }
public bool IsActive { get; }

public UnlockWalletSettings(IConfigurationSection section)
Expand All @@ -105,7 +104,6 @@ public UnlockWalletSettings(IConfigurationSection section)
{
this.Path = section.GetValue("Path", "");
this.Password = section.GetValue("Password", "");
this.StartConsensus = bool.Parse(section.GetValue("StartConsensus", "false"));
this.IsActive = bool.Parse(section.GetValue("IsActive", "false"));
}
}
Expand Down
1 change: 0 additions & 1 deletion neo-cli/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"StartConsensus": false,
"IsActive": false
},
"PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip"
Expand Down
1 change: 0 additions & 1 deletion neo-cli/config.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"StartConsensus": false,
"IsActive": false
},
"PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip"
Expand Down
1 change: 0 additions & 1 deletion neo-cli/config.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"StartConsensus": false,
"IsActive": false
},
"PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip"
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 @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI01133" />
<PackageReference Include="Neo" Version="3.0.0-CI01148" />
</ItemGroup>

<ItemGroup>
Expand Down