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

Refactor node commands #536

Merged
merged 94 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
6855aab
Unify commands
shargon Jan 23, 2020
d8fc04d
dotnet-format
shargon Jan 23, 2020
8530c60
Fix some arguments
shargon Jan 27, 2020
525cf31
Allow to use "export blocks" with ambiguous arguments
shargon Jan 27, 2020
c268913
Fix comments
shargon Jan 27, 2020
f9f9d76
fix help
shargon Jan 27, 2020
dc9e0be
Add ut for command tokens
shargon Feb 10, 2020
57cbc0c
Update neo-cli/CLI/MainService.Blockchain.cs
shargon Feb 11, 2020
4502342
Merge branch 'master' into unify-commands
shargon Feb 11, 2020
4353277
remove public
shargon Feb 11, 2020
0d2d753
fix
shargon Feb 11, 2020
56b6faa
Some fixes
shargon Feb 11, 2020
2531cff
Indent
shargon Feb 11, 2020
6db3b55
Update neo-cli/CLI/MainService.Consensus.cs
shargon Feb 11, 2020
d6295a4
Clean partial class
shargon Feb 11, 2020
30362bd
dotnet-format
shargon Feb 11, 2020
a6c244d
Optimize
shargon Feb 11, 2020
4e20a4d
Merge branch 'master' into unify-commands
shargon Feb 13, 2020
a81dc4a
Merge conflicts
shargon Feb 13, 2020
badde29
Merge remote-tracking branch 'shargon/unify-commands' into unify-comm…
shargon Feb 13, 2020
071127e
Fix show pool
shargon Feb 14, 2020
39f53e1
Fix export key
shargon Feb 14, 2020
c505a02
User friendly Uint160
shargon Feb 14, 2020
9739db4
ImportKey wif or File
shargon Feb 14, 2020
a8d841d
Fix import multisigaddress
shargon Feb 14, 2020
32cd759
Fix invoke
shargon Feb 14, 2020
2913ace
Fix deploy
shargon Feb 14, 2020
38d6e10
Fix broadcast
shargon Feb 14, 2020
ef80ff2
Deal with Ambiguous
shargon Feb 14, 2020
1516fe7
Add Quote Token
shargon Feb 14, 2020
23d0e73
Change namespace
erikzhang Feb 16, 2020
ab4370a
Change to private
shargon Feb 16, 2020
6acb01f
Fix consume all
shargon Feb 17, 2020
625b867
Remove ambiguous broadcast calls
shargon Feb 17, 2020
95aaff3
Fix send ambiguous
shargon Feb 17, 2020
5c0a1c5
More fixes
shargon Feb 17, 2020
fc46e96
Remove one method
shargon Feb 18, 2020
93eaf18
Some fixes
shargon Feb 21, 2020
17b2a73
Merge branch 'master' into unify-commands
shargon Feb 21, 2020
f9f9493
Remove nested class
erikzhang Feb 24, 2020
4469026
Remove enum values
shargon Feb 24, 2020
39ee71c
Plugin help
shargon Feb 24, 2020
2ed613c
Optimization
shargon Feb 25, 2020
b1ba72a
Update ConsoleServiceBase.cs
erikzhang Feb 26, 2020
2b9b7bc
Apply some bettybao1209 feedback
shargon Feb 27, 2020
70656f3
Fix IsMultiSigContract
superboyiii Feb 28, 2020
e9682c5
Update nugets
shargon Feb 28, 2020
c039107
Add default value for count
shargon Feb 28, 2020
6d09172
Reduce dependency of ConsoleCommandAttribute
shargon Mar 1, 2020
272ed1e
Add error msg when invalid start height
superboyiii Mar 2, 2020
3dc7139
Add cosigner support witness
superboyiii Mar 2, 2020
b71d0c5
Support string[] in invoke params
superboyiii Mar 2, 2020
35c4a45
Fix
superboyiii Mar 2, 2020
b211da1
fix format
superboyiii Mar 2, 2020
571b656
Fix Category
superboyiii Mar 2, 2020
3edff52
Fix Invoke types
shargon Mar 2, 2020
8e760da
Add wallet check
shargon Mar 2, 2020
4a0a747
Change assetId to asset
shargon Mar 2, 2020
abc28ae
Fix
shargon Mar 2, 2020
583388f
Remove CaptureWholeArgument
shargon Mar 2, 2020
36f5c9b
Merge branch 'master' into unify-commands
shargon Mar 3, 2020
2ddfe29
Capture whole if it's the last parameter
shargon Mar 3, 2020
4c0f664
Fix empty string arrays
shargon Mar 3, 2020
a4bd0bc
format
shargon Mar 3, 2020
c65afdd
Update neo-cli/CLI/MainService.Contracts.cs
shargon Mar 10, 2020
4f87a62
Merge branch 'master' into unify-commands
shargon Mar 10, 2020
251e724
Fix array format
shargon Mar 10, 2020
c07d929
Merge remote-tracking branch 'shargon/unify-commands' into unify-comm…
shargon Mar 10, 2020
4d21459
Merge branch 'master' into unify-commands
shargon Mar 11, 2020
7e08bf0
Apply fix
shargon Mar 11, 2020
a9bd134
Apply fix
shargon Mar 11, 2020
6b8c681
Register plugin without attribute
shargon Mar 11, 2020
60f9be7
Create project for Neo.ConsoleService
erikzhang Mar 12, 2020
b8f51dd
Some fixes
shargon Mar 12, 2020
fccad60
Hide handlers
shargon Mar 12, 2020
daf4b3a
dotnet format
shargon Mar 12, 2020
dd59ffe
Use only one attribute
shargon Mar 16, 2020
8365125
Improve register command handler
shargon Mar 17, 2020
9c0cafe
Improve
shargon Mar 17, 2020
1996488
Move tests to Neo.ConsoleService.Test
shargon Mar 17, 2020
0dda380
Add tests in workflow
shargon Mar 17, 2020
2d13c35
Fix tests
shargon Mar 17, 2020
e6e33da
Update reference
shargon Mar 17, 2020
44ff383
Add test project
shargon Mar 17, 2020
e039a85
Update dotnetcore.yml
erikzhang Mar 19, 2020
520937d
Update dotnetcore.yml
erikzhang Mar 19, 2020
afbec9b
Update dotnetcore.yml
erikzhang Mar 19, 2020
b8d08c8
Update dotnetcore.yml
erikzhang Mar 19, 2020
343bae5
Update dotnetcore.yml
erikzhang Mar 19, 2020
55801eb
Update dotnetcore.yml
erikzhang Mar 19, 2020
4d711f2
Update dotnetcore.yml
erikzhang Mar 19, 2020
308f5b0
Update dotnetcore.yml
erikzhang Mar 19, 2020
875177e
Update dotnetcore.yml
erikzhang Mar 19, 2020
7f59966
Update dotnetcore.yml
erikzhang Mar 19, 2020
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
34 changes: 20 additions & 14 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ env:
jobs:

Test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
Expand All @@ -17,26 +20,29 @@ jobs:
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Check format
if: runner.os == 'Linux'
run: |
dotnet tool install --version 3.2.111002 --tool-path ./ dotnet-format --add-source https://dotnet.myget.org/F/format/api/v3/index.json
./dotnet-format --check --dry-run -v diagnostic
- name: Build
- name: Build CLI
if: runner.os == 'Linux'
run: |
dotnet publish -o ./out -c Release neo-cli
find ./out -name 'config.json' | xargs perl -pi -e 's|LevelDBStore|MemoryStore|g'
- name: Install dependencies
if: runner.os == 'Linux'
run: sudo apt-get install libleveldb-dev expect
- name: Run tests with expect
if: runner.os == 'Linux'
run: expect ./.github/workflows/test-neo-cli.expect

Test_GUI:
runs-on: windows-latest
steps:
- name: Chectout
uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build
run: dotnet build -c Release neo-gui
- name: Run Unit Tests
if: runner.os == 'Windows'
run: |
forfiles /p tests /m *.csproj /s /c "cmd /c dotnet add @PATH package coverlet.msbuild"
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov
- name: Coveralls
if: runner.os == 'Windows'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: \coverage\lcov.info
43 changes: 43 additions & 0 deletions Neo.ConsoleService/CommandQuoteToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Diagnostics;

namespace Neo.ConsoleService
{
[DebuggerDisplay("Value={Value}, Value={Value}")]
internal class CommandQuoteToken : CommandToken
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="offset">Offset</param>
/// <param name="value">Value</param>
public CommandQuoteToken(int offset, char value) : base(CommandTokenType.Quote, offset)
{
if (value != '\'' && value != '"')
{
throw new ArgumentException("Not valid quote");
}

Value = value.ToString();
}

/// <summary>
/// Parse command line quotes
/// </summary>
/// <param name="commandLine">Command line</param>
/// <param name="index">Index</param>
/// <returns>CommandQuoteToken</returns>
internal static CommandQuoteToken Parse(string commandLine, ref int index)
{
var c = commandLine[index];

if (c == '\'' || c == '"')
{
index++;
return new CommandQuoteToken(index - 1, c);
}

throw new ArgumentException("No quote found");
}
}
}
54 changes: 54 additions & 0 deletions Neo.ConsoleService/CommandSpaceToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Diagnostics;

namespace Neo.ConsoleService
{
[DebuggerDisplay("Value={Value}, Count={Count}")]
internal class CommandSpaceToken : CommandToken
{
/// <summary>
/// Count
/// </summary>
public int Count { get; }

/// <summary>
/// Constructor
/// </summary>
/// <param name="offset">Offset</param>
/// <param name="count">Count</param>
public CommandSpaceToken(int offset, int count) : base(CommandTokenType.Space, offset)
{
Value = "".PadLeft(count, ' ');
Count = count;
}

/// <summary>
/// Parse command line spaces
/// </summary>
/// <param name="commandLine">Command line</param>
/// <param name="index">Index</param>
/// <returns>CommandSpaceToken</returns>
internal static CommandSpaceToken Parse(string commandLine, ref int index)
{
int offset = index;
int count = 0;

for (int ix = index, max = commandLine.Length; ix < max; ix++)
{
if (commandLine[ix] == ' ')
{
count++;
}
else
{
break;
}
}

if (count == 0) throw new ArgumentException("No spaces found");

index += count;
return new CommandSpaceToken(offset, count);
}
}
}
80 changes: 80 additions & 0 deletions Neo.ConsoleService/CommandStringToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Diagnostics;

namespace Neo.ConsoleService
{
[DebuggerDisplay("Value={Value}, RequireQuotes={RequireQuotes}")]
internal class CommandStringToken : CommandToken
{
/// <summary>
/// Require quotes
/// </summary>
public bool RequireQuotes { get; }

/// <summary>
/// Constructor
/// </summary>
/// <param name="offset">Offset</param>
/// <param name="value">Value</param>
public CommandStringToken(int offset, string value) : base(CommandTokenType.String, offset)
{
Value = value;
RequireQuotes = value.IndexOfAny(new char[] { '\'', '"' }) != -1;
}

/// <summary>
/// Parse command line spaces
/// </summary>
/// <param name="commandLine">Command line</param>
/// <param name="index">Index</param>
/// <param name="quote">Quote (could be null)</param>
/// <returns>CommandSpaceToken</returns>
internal static CommandStringToken Parse(string commandLine, ref int index, CommandQuoteToken quote)
{
int end;
int offset = index;

if (quote != null)
{
var ix = index;

do
{
end = commandLine.IndexOf(quote.Value[0], ix + 1);

if (end == -1)
{
throw new ArgumentException("String not closed");
}

if (IsScaped(commandLine, end - 1))
{
ix = end;
end = -1;
}
}
while (end < 0);
}
else
{
end = commandLine.IndexOf(' ', index + 1);
}

if (end == -1)
{
end = commandLine.Length;
}

var ret = new CommandStringToken(offset, commandLine.Substring(index, end - index));
index += end - index;
return ret;
}

private static bool IsScaped(string commandLine, int index)
{
// TODO: Scape the scape

return (commandLine[index] == '\\');
}
}
}
Loading