Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a #34

Closed
wants to merge 8 commits into from
Closed

a #34

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
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
sudo apt-get --assume-yes install libleveldb-dev libsnappy-dev libc6-dev
find tests -name *.csproj | xargs -I % dotnet add % package coverlet.msbuild
dotnet test tests/Neo.Network.RPC.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/
dotnet test tests/Neo.Plugins.RpcServer.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:CoverletOutputFormat=lcov
dotnet test tests/Neo.Plugins.Storage.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:CoverletOutputFormat=lcov
dotnet test tests/Neo.Plugins.StateService.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:CoverletOutputFormat=lcov
dotnet test tests/Neo.Plugins.OracleService.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/lcov /p:MergeWith=${GITHUB_WORKSPACE}/coverage/coverage.json /p:CoverletOutputFormat=lcov
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
34 changes: 31 additions & 3 deletions neo-modules.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Expand All @@ -24,9 +24,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Network.RPC.Tests", "te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.Storage.Tests", "tests\Neo.Plugins.Storage.Tests\Neo.Plugins.Storage.Tests.csproj", "{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateService", "src\StateService\StateService.csproj", "{A0F4A66F-6F87-4B99-B8BE-A779BC002F47}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OracleService", "src\OracleService\OracleService.csproj", "{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Plugins.StateService.Tests", "tests\Neo.Plugins.StateService.Tests\Neo.Plugins.StateService.Tests.csproj", "{149822EC-4E0C-425F-A032-4196B615BFEB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Plugins.OracleService.Tests", "tests\Neo.Plugins.OracleService.Tests\Neo.Plugins.OracleService.Tests.csproj", "{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StateService", "src\StateService\StateService.csproj", "{A0F4A66F-6F87-4B99-B8BE-A779BC002F47}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Plugins.StateService.Tests", "tests\Neo.Plugins.StateService.Tests\Neo.Plugins.StateService.Tests.csproj", "{149822EC-4E0C-425F-A032-4196B615BFEB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dBFT", "src\dBFT\dBFT.csproj", "{90185D3E-4813-4BC1-98FE-26FD34311403}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Plugins.RpcServer.Tests", "tests\Neo.Plugins.RpcServer.Tests\Neo.Plugins.RpcServer.Tests.csproj", "{0DDAF738-0FD3-40A7-A433-C514BCDDF542}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -70,6 +78,10 @@ Global
{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C}.Release|Any CPU.Build.0 = Release|Any CPU
{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}.Release|Any CPU.Build.0 = Release|Any CPU
{A0F4A66F-6F87-4B99-B8BE-A779BC002F47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0F4A66F-6F87-4B99-B8BE-A779BC002F47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0F4A66F-6F87-4B99-B8BE-A779BC002F47}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -78,6 +90,18 @@ Global
{149822EC-4E0C-425F-A032-4196B615BFEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{149822EC-4E0C-425F-A032-4196B615BFEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{149822EC-4E0C-425F-A032-4196B615BFEB}.Release|Any CPU.Build.0 = Release|Any CPU
{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF}.Release|Any CPU.Build.0 = Release|Any CPU
{90185D3E-4813-4BC1-98FE-26FD34311403}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90185D3E-4813-4BC1-98FE-26FD34311403}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90185D3E-4813-4BC1-98FE-26FD34311403}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90185D3E-4813-4BC1-98FE-26FD34311403}.Release|Any CPU.Build.0 = Release|Any CPU
{0DDAF738-0FD3-40A7-A433-C514BCDDF542}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DDAF738-0FD3-40A7-A433-C514BCDDF542}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DDAF738-0FD3-40A7-A433-C514BCDDF542}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DDAF738-0FD3-40A7-A433-C514BCDDF542}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -92,8 +116,12 @@ Global
{1403FFE9-4265-4269-8E3D-5A79EFD108CA} = {97E81C78-1637-481F-9485-DA1225E94C23}
{D52460B3-AB5C-4D07-B400-9E7ADCB01FF5} = {59D802AB-C552-422A-B9C3-64D329FBCDCC}
{9E7EA895-302A-4C0C-BA9B-54F9A67AD75C} = {59D802AB-C552-422A-B9C3-64D329FBCDCC}
{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E} = {97E81C78-1637-481F-9485-DA1225E94C23}
{A0F4A66F-6F87-4B99-B8BE-A779BC002F47} = {97E81C78-1637-481F-9485-DA1225E94C23}
{149822EC-4E0C-425F-A032-4196B615BFEB} = {59D802AB-C552-422A-B9C3-64D329FBCDCC}
{DCEBBF09-C26B-47C8-A024-F1FF7601BEAF} = {59D802AB-C552-422A-B9C3-64D329FBCDCC}
{90185D3E-4813-4BC1-98FE-26FD34311403} = {97E81C78-1637-481F-9485-DA1225E94C23}
{0DDAF738-0FD3-40A7-A433-C514BCDDF542} = {59D802AB-C552-422A-B9C3-64D329FBCDCC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61D3ADE6-BBFC-402D-AB42-1C71C9F9EDE3}
Expand Down
9 changes: 1 addition & 8 deletions src/ApplicationLogs/LogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,7 @@ void IPersistencePlugin.OnPersist(Block block, StoreView snapshot, IReadOnlyList

static string GetExceptionMessage(Exception exception)
{
if (exception == null) return null;

if (exception.InnerException != null)
{
return GetExceptionMessage(exception.InnerException);
}

return exception.Message;
return exception?.GetBaseException().Message;
}
}
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

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

</Project>
41 changes: 41 additions & 0 deletions src/OracleService/Helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Linq;
using System.Net;

namespace Neo.Plugins
{
static class Helper
{
public static bool IsInternal(this IPHostEntry entry)
{
return entry.AddressList.Any(p => IsInternal(p));
}

/// <summary>
/// ::1 - IPv6 loopback
/// 10.0.0.0 - 10.255.255.255 (10/8 prefix)
/// 127.0.0.0 - 127.255.255.255 (127/8 prefix)
/// 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
/// 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
/// </summary>
/// <param name="ipAddress">Address</param>
/// <returns>True if it was an internal address</returns>
public static bool IsInternal(this IPAddress ipAddress)
{
if (IPAddress.IsLoopback(ipAddress)) return true;
if (IPAddress.Broadcast.Equals(ipAddress)) return true;
if (IPAddress.Any.Equals(ipAddress)) return true;
if (IPAddress.IPv6Any.Equals(ipAddress)) return true;
if (IPAddress.IPv6Loopback.Equals(ipAddress)) return true;

var ip = ipAddress.GetAddressBytes();
switch (ip[0])
{
case 10:
case 127: return true;
case 172: return ip[1] >= 16 && ip[1] < 32;
case 192: return ip[1] == 168;
default: return false;
}
}
}
}
Loading