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

OracleService #326

Merged
merged 176 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
05f9e74
init
Tommo-L Aug 18, 2020
78944c6
move
Tommo-L Aug 21, 2020
c033672
Merge branch 'master' into async-oracle
shargon Aug 26, 2020
6760302
Clean code
shargon Aug 26, 2020
76bee8c
Update src/Oracle/Oracle.cs
shargon Aug 26, 2020
68a2f4d
fix
Tommo-L Sep 1, 2020
9101194
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Sep 1, 2020
1cd3843
Update src/Oracle/Oracle.cs
shargon Sep 1, 2020
c31654a
fix oracle
Tommo-L Sep 8, 2020
a7b3d5f
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Sep 8, 2020
2d53f13
format
Tommo-L Sep 8, 2020
22edae9
fix
Tommo-L Sep 8, 2020
79630a6
Merge branch 'master' into async-oracle
Tommo-L Sep 8, 2020
2e64c1e
optimize
Tommo-L Sep 8, 2020
de131c4
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Sep 8, 2020
19053d2
optimize
Tommo-L Sep 9, 2020
49abda8
fix
Tommo-L Sep 15, 2020
66a5497
format
Tommo-L Sep 15, 2020
379e732
fix
Tommo-L Sep 16, 2020
a2b3f5f
add CheckOracleAccount
Tommo-L Sep 16, 2020
ffba962
fix
Tommo-L Sep 16, 2020
7aaf41b
resolve
Tommo-L Sep 17, 2020
1af31e5
Update src/Oracle/Protocol/OracleHttpProtocol.cs
shargon Sep 17, 2020
d8ec4c8
Update src/Oracle/Oracle.cs
shargon Sep 17, 2020
cc230bd
fix
Tommo-L Sep 18, 2020
0aec6db
format
Tommo-L Sep 18, 2020
60b7744
fix
Tommo-L Sep 18, 2020
ff2c4ca
Update Oracle.cs
shargon Sep 18, 2020
f51d9c0
fix timeout
Tommo-L Sep 18, 2020
3d9efc7
fix timeout2
Tommo-L Sep 18, 2020
d91f5ae
optimze
Tommo-L Sep 21, 2020
0d78083
format
Tommo-L Sep 21, 2020
6e41bc4
Apply OracleHttpProtocol.cs
Tommo-L Sep 21, 2020
91f693c
optimize
Tommo-L Sep 21, 2020
6d9e5ab
fix
Tommo-L Sep 23, 2020
4439d8c
remove
Tommo-L Sep 23, 2020
bf70455
fix
Tommo-L Sep 23, 2020
2463e84
optimize
Tommo-L Sep 24, 2020
b97ff6c
Merge branch 'master' into async-oracle
Tommo-L Sep 27, 2020
270a2c7
Apply recommmendations
Tommo-L Sep 27, 2020
41d7532
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Sep 27, 2020
11f4d51
fix
Tommo-L Sep 27, 2020
359ca79
Merge branch 'master' into async-oracle
superboyiii Oct 15, 2020
db4f0ce
Merge branch 'master' into async-oracle
superboyiii Oct 19, 2020
b190152
Merge remote-tracking branch 'upstream/master' into async-oracle
Tommo-L Oct 20, 2020
237ef4b
Merge branch 'master' into async-oracle
superboyiii Oct 21, 2020
6758e36
add backupTx
Tommo-L Oct 23, 2020
1446f3f
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Oct 23, 2020
129bd1d
sort public key
Tommo-L Oct 23, 2020
2b50e71
avoid two txs
Tommo-L Oct 23, 2020
035b894
send backup sign after timeout
Tommo-L Oct 23, 2020
db2d56a
exchange arguments of AddResponseTxSign
Tommo-L Oct 23, 2020
9406e88
format
Tommo-L Oct 23, 2020
560d7a1
format
Tommo-L Oct 23, 2020
7b04c4c
add cache
Tommo-L Oct 26, 2020
e8185ac
fix
Tommo-L Oct 28, 2020
fdc173e
optimize password
Tommo-L Oct 29, 2020
7d8ca71
up error code
Tommo-L Oct 30, 2020
6f39602
format
Tommo-L Oct 30, 2020
e25af79
Merge branch 'master' into async-oracle
superboyiii Nov 2, 2020
756161a
fix and add lock
Tommo-L Nov 4, 2020
a221d1c
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 4, 2020
bc427a3
fix
Tommo-L Nov 4, 2020
5321fd8
optimize
Tommo-L Nov 4, 2020
4e4c3fc
Merge branch 'master' into async-oracle
superboyiii Nov 9, 2020
ba7f5ca
up oracle response code
Tommo-L Nov 9, 2020
93e4f98
Merge branch 'master' into async-oracle
superboyiii Nov 11, 2020
685e1e0
use base64
Tommo-L Nov 12, 2020
81e892c
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 12, 2020
55dc212
Merge branch 'master' into async-oracle
shargon Nov 12, 2020
b842450
fix
Tommo-L Nov 12, 2020
9927512
Merge branch 'master' into async-oracle
shargon Nov 13, 2020
a67ffac
remove useless library
Tommo-L Nov 16, 2020
5c76239
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 16, 2020
df3b851
Merge branch 'master' into async-oracle
superboyiii Nov 16, 2020
d49eb3a
fix
Tommo-L Nov 17, 2020
fcd680d
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 17, 2020
d4cf93a
optimize
Tommo-L Nov 18, 2020
4c3ca6a
optimize
Tommo-L Nov 18, 2020
9e1e424
Merge branch 'master' into async-oracle
erikzhang Nov 19, 2020
77dc6a7
rename to OracleService
Tommo-L Nov 20, 2020
62e1e14
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 20, 2020
868f195
Merge branch 'master' into async-oracle
shargon Nov 23, 2020
14d9423
avoid duplicate request
Tommo-L Nov 25, 2020
4a24565
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Nov 25, 2020
4750aee
fix conflicts
Tommo-L Nov 25, 2020
023784b
Replace HashsetCache by ConcurrentDictionary
Tommo-L Nov 30, 2020
b16904b
fix
Tommo-L Nov 30, 2020
0e15809
fix conflicts
Tommo-L Nov 30, 2020
27077d5
fix conflicts
Tommo-L Dec 14, 2020
f6da41e
fix
Tommo-L Dec 14, 2020
98c931a
fix
Tommo-L Dec 14, 2020
bc3d7b7
Merge branch 'master' into async-oracle
Tommo-L Dec 15, 2020
b5d0999
clean code
Tommo-L Dec 15, 2020
3f74781
rename Designate to Designation
Tommo-L Dec 15, 2020
befb3a3
Update src/Oracle/OracleService.cs
Tommo-L Dec 17, 2020
395a312
fix
Tommo-L Dec 17, 2020
36f44c9
Update projects
erikzhang Dec 17, 2020
047482e
Rename
erikzhang Dec 17, 2020
66df414
optimize code
Tommo-L Dec 17, 2020
fff4f88
static AllowPrivateHost/Timeout
Tommo-L Dec 17, 2020
9929856
Update src/OracleService/Protocols/OracleHttpProtocol.cs
Tommo-L Dec 17, 2020
3c1d6ad
apply erik's suggestion
Tommo-L Dec 17, 2020
a19940c
fix
Tommo-L Dec 17, 2020
55c770d
fix
Tommo-L Dec 17, 2020
84634ab
fix 2/2
Tommo-L Dec 17, 2020
f18a4da
Merge branch 'master' into async-oracle
Tommo-L Dec 18, 2020
348b184
Update OracleService.cs
erikzhang Dec 18, 2020
9a01b54
CI01118
erikzhang Dec 18, 2020
2c630c0
Merge branch 'master' into async-oracle
erikzhang Dec 18, 2020
b6e6bd4
add Process
Tommo-L Dec 18, 2020
074620e
Optimize
erikzhang Dec 18, 2020
01fbc3f
Remove unused parameter
erikzhang Dec 18, 2020
f7dda23
readonly
erikzhang Dec 18, 2020
ff63668
Use System.Threading.Timer
erikzhang Dec 18, 2020
8a8cb80
Rename
erikzhang Dec 18, 2020
fb0dbed
Update OracleService.cs
erikzhang Dec 18, 2020
fb1cff7
Update OracleService.cs
erikzhang Dec 18, 2020
5d85f8e
Rename
erikzhang Dec 18, 2020
92a7fa0
Add Settings.cs
erikzhang Dec 18, 2020
919df58
Move IsInternal to Helper.cs
erikzhang Dec 18, 2020
42105bf
Update OracleService.cs
erikzhang Dec 18, 2020
dd2798d
Remove Utility alias
erikzhang Dec 18, 2020
f88a750
Use a single HttpClient
erikzhang Dec 18, 2020
7b5817f
Use HttpCompletionOption.ResponseContentRead
erikzhang Dec 18, 2020
478ce59
private class
erikzhang Dec 18, 2020
a9a8c49
Simplify OracleService.cs
erikzhang Dec 18, 2020
f33c969
Use Interlocked
erikzhang Dec 18, 2020
9b5cd31
fix
Tommo-L Dec 19, 2020
05524e4
Using lock in OnTimer method
Tommo-L Dec 19, 2020
4422506
Replace lock by concurrentdictionary
Tommo-L Dec 22, 2020
cd058c5
Merge branch 'master' into async-oracle
erikzhang Dec 22, 2020
6bc6b46
Optimize
erikzhang Dec 22, 2020
253bc72
Simplify
erikzhang Dec 22, 2020
30aa901
async
erikzhang Dec 22, 2020
7883937
Prevent reentry
erikzhang Dec 22, 2020
ce78551
Optimize
erikzhang Dec 22, 2020
6572a85
private
erikzhang Dec 22, 2020
2c82d96
Prevent multiple starts
erikzhang Dec 22, 2020
a6bf504
fix
erikzhang Dec 22, 2020
f63a81a
fix
erikzhang Dec 22, 2020
dfbd954
Optimize CheckOracleAccount
erikzhang Dec 22, 2020
878b3ba
Fix OnStop
erikzhang Dec 22, 2020
1eba58d
Reorder methods
erikzhang Dec 22, 2020
3d8a9da
Optimize CreateResponseTx
erikzhang Dec 22, 2020
f7e1505
fix
Tommo-L Dec 25, 2020
470254f
Remove WithTimeout
erikzhang Dec 27, 2020
a552748
Merge branch 'master' into async-oracle
shargon Dec 28, 2020
294e620
Add check
erikzhang Dec 28, 2020
eaed2ee
add oracle ut
Tommo-L Dec 30, 2020
fab735c
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Dec 30, 2020
16185cc
Delete Neo.Plugins.OracleService.Tests.csproj
Tommo-L Dec 30, 2020
cd98a45
Delete OracleServiceTest.cs
Tommo-L Dec 30, 2020
4330353
Merge branch 'master' into async-oracle
shargon Dec 30, 2020
ca1368c
add try-catch when call Filter
Tommo-L Dec 30, 2020
ed20cac
Merge branch 'async-oracle' of https://github.com/Tommo-L/neo-modules…
Tommo-L Dec 30, 2020
4ba236d
fix and add UT
Tommo-L Jan 4, 2021
ea272c7
Remove empty line
erikzhang Jan 4, 2021
b173638
Merge branch 'master' into async-oracle
superboyiii Jan 5, 2021
973ca66
Merge branch 'master' into async-oracle
erikzhang Jan 10, 2021
f13d895
Merge branch 'master' into async-oracle
shargon Jan 11, 2021
b9ffecc
Fix OnPersist
shargon Jan 11, 2021
df70225
Optimize iteration
shargon Jan 11, 2021
10e7c2b
more optimize
erikzhang Jan 11, 2021
89a16ba
fix ut
Tommo-L Jan 12, 2021
883f779
fix
Tommo-L Jan 14, 2021
6803733
Merge branch 'master' into async-oracle
erikzhang Jan 14, 2021
e88be60
fix conflicts
Tommo-L Jan 14, 2021
3139d80
Optimize
erikzhang Jan 14, 2021
12ef99c
use random
Tommo-L Jan 14, 2021
e51a1a3
Json un-indented
shargon Jan 14, 2021
31c0d98
Replace nonce for deterministic value
shargon Jan 14, 2021
f1d5e67
Replace nonce
shargon Jan 14, 2021
15e4c49
Add UT for filters
shargon Jan 14, 2021
c4ec4fe
Merge branch 'master' into async-oracle
Tommo-L Jan 15, 2021
0acf93b
Merge branch 'master' into async-oracle
Tommo-L Jan 15, 2021
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
dotnet test tests/Neo.Network.RPC.Tests /p:CollectCoverage=true /p:CoverletOutput=${GITHUB_WORKSPACE}/coverage/
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
14 changes: 14 additions & 0 deletions neo-modules.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ 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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OracleService", "src\OracleService\OracleService.csproj", "{9ABE9097-94AE-4B63-90DD-C20A0BC4D78E}"
EndProject
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}"
Expand Down Expand Up @@ -72,6 +76,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 @@ -80,6 +88,10 @@ 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
Expand All @@ -98,8 +110,10 @@ 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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
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