Skip to content

Commit eda1ef3

Browse files
committed
refactor: Refactor signature
1 parent 3d92231 commit eda1ef3

35 files changed

+422
-682
lines changed

Docs/docfx.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"src/Libplanet.Action/Libplanet.Action.csproj",
99
"src/Libplanet.Common/Libplanet.Common.csproj",
1010
"src/Libplanet.Crypto/Libplanet.Crypto.csproj",
11-
"src/Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
1211
"tools/Libplanet.Explorer.Cocona/Libplanet.Explorer.Cocona.csproj",
1312
"tools/Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
1413
"test/Libplanet.Mocks/Libplanet.Mocks.csproj",

Libplanet.sln

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Net", "src\Libpla
3737
EndProject
3838
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Net.Tests", "test\Libplanet.Net.Tests\Libplanet.Net.Tests.csproj", "{6D7A63C9-16AB-4B7E-B9C0-0956E1E02610}"
3939
EndProject
40-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Crypto.Secp256k1", "src\Libplanet.Crypto.Secp256k1\Libplanet.Crypto.Secp256k1.csproj", "{9F88C871-CB37-4A88-BACF-540AC253C202}"
41-
EndProject
42-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Crypto.Secp256k1.Tests", "test\Libplanet.Crypto.Secp256k1.Tests\Libplanet.Crypto.Secp256k1.Tests.csproj", "{B1A38DDE-5534-4625-A3F2-A585BA7A1198}"
43-
EndProject
4440
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Explorer.Cocona", "tools\Libplanet.Explorer.Cocona\Libplanet.Explorer.Cocona.csproj", "{8698E0C2-1A82-43E6-8A26-3D9A825CF574}"
4541
EndProject
4642
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Libplanet.Explorer.Cocona.Tests", "test\Libplanet.Explorer.Cocona.Tests\Libplanet.Explorer.Cocona.Tests.csproj", "{F782BC86-9CE6-4F69-8F77-710A399CB54F}"
@@ -81,8 +77,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Node.Executable",
8177
EndProject
8278
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Node.Tests", "sdk\node\Libplanet.Node.Tests\Libplanet.Node.Tests.csproj", "{C050C5F0-8A40-4CB1-9715-A55EBF94FBF2}"
8379
EndProject
84-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libplanet.Crypto.Nethereum", "src\Libplanet.Crypto.Nethereum\Libplanet.Crypto.Nethereum.csproj", "{42801CB6-D452-408C-B0A5-970D8D997B38}"
85-
EndProject
8680
Global
8781
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8882
Debug|Any CPU = Debug|Any CPU
@@ -393,42 +387,6 @@ Global
393387
{6D7A63C9-16AB-4B7E-B9C0-0956E1E02610}.Release|x64.Build.0 = Release|Any CPU
394388
{6D7A63C9-16AB-4B7E-B9C0-0956E1E02610}.Release|x86.ActiveCfg = Release|Any CPU
395389
{6D7A63C9-16AB-4B7E-B9C0-0956E1E02610}.Release|x86.Build.0 = Release|Any CPU
396-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
397-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|Any CPU.Build.0 = Debug|Any CPU
398-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|x64.ActiveCfg = Debug|Any CPU
399-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|x64.Build.0 = Debug|Any CPU
400-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|x86.ActiveCfg = Debug|Any CPU
401-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Debug|x86.Build.0 = Debug|Any CPU
402-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|Any CPU.ActiveCfg = Debug|Any CPU
403-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|Any CPU.Build.0 = Debug|Any CPU
404-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|x64.ActiveCfg = Debug|Any CPU
405-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|x64.Build.0 = Debug|Any CPU
406-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|x86.ActiveCfg = Debug|Any CPU
407-
{9F88C871-CB37-4A88-BACF-540AC253C202}.ReleaseMono|x86.Build.0 = Debug|Any CPU
408-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|Any CPU.ActiveCfg = Release|Any CPU
409-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|Any CPU.Build.0 = Release|Any CPU
410-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|x64.ActiveCfg = Release|Any CPU
411-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|x64.Build.0 = Release|Any CPU
412-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|x86.ActiveCfg = Release|Any CPU
413-
{9F88C871-CB37-4A88-BACF-540AC253C202}.Release|x86.Build.0 = Release|Any CPU
414-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
415-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|Any CPU.Build.0 = Debug|Any CPU
416-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|x64.ActiveCfg = Debug|Any CPU
417-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|x64.Build.0 = Debug|Any CPU
418-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|x86.ActiveCfg = Debug|Any CPU
419-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Debug|x86.Build.0 = Debug|Any CPU
420-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|Any CPU.ActiveCfg = Debug|Any CPU
421-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|Any CPU.Build.0 = Debug|Any CPU
422-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|x64.ActiveCfg = Debug|Any CPU
423-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|x64.Build.0 = Debug|Any CPU
424-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|x86.ActiveCfg = Debug|Any CPU
425-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.ReleaseMono|x86.Build.0 = Debug|Any CPU
426-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|Any CPU.ActiveCfg = Release|Any CPU
427-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|Any CPU.Build.0 = Release|Any CPU
428-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|x64.ActiveCfg = Release|Any CPU
429-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|x64.Build.0 = Release|Any CPU
430-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|x86.ActiveCfg = Release|Any CPU
431-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198}.Release|x86.Build.0 = Release|Any CPU
432390
{8698E0C2-1A82-43E6-8A26-3D9A825CF574}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
433391
{8698E0C2-1A82-43E6-8A26-3D9A825CF574}.Debug|Any CPU.Build.0 = Debug|Any CPU
434392
{8698E0C2-1A82-43E6-8A26-3D9A825CF574}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -699,24 +657,6 @@ Global
699657
{C050C5F0-8A40-4CB1-9715-A55EBF94FBF2}.Release|x64.Build.0 = Release|Any CPU
700658
{C050C5F0-8A40-4CB1-9715-A55EBF94FBF2}.Release|x86.ActiveCfg = Release|Any CPU
701659
{C050C5F0-8A40-4CB1-9715-A55EBF94FBF2}.Release|x86.Build.0 = Release|Any CPU
702-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
703-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|Any CPU.Build.0 = Debug|Any CPU
704-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|x64.ActiveCfg = Debug|Any CPU
705-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|x64.Build.0 = Debug|Any CPU
706-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|x86.ActiveCfg = Debug|Any CPU
707-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Debug|x86.Build.0 = Debug|Any CPU
708-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|Any CPU.ActiveCfg = Debug|Any CPU
709-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|Any CPU.Build.0 = Debug|Any CPU
710-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|x64.ActiveCfg = Debug|Any CPU
711-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|x64.Build.0 = Debug|Any CPU
712-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|x86.ActiveCfg = Debug|Any CPU
713-
{42801CB6-D452-408C-B0A5-970D8D997B38}.ReleaseMono|x86.Build.0 = Debug|Any CPU
714-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|Any CPU.ActiveCfg = Release|Any CPU
715-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|Any CPU.Build.0 = Release|Any CPU
716-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|x64.ActiveCfg = Release|Any CPU
717-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|x64.Build.0 = Release|Any CPU
718-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|x86.ActiveCfg = Release|Any CPU
719-
{42801CB6-D452-408C-B0A5-970D8D997B38}.Release|x86.Build.0 = Release|Any CPU
720660
EndGlobalSection
721661
GlobalSection(SolutionProperties) = preSolution
722662
HideSolutionNode = FALSE
@@ -739,8 +679,6 @@ Global
739679
{A43E44E5-F9C1-44BD-A593-419EC113117B} = {B9C00FAF-36CF-463A-83FA-43E6B974AE2E}
740680
{2E17A091-DC29-41FB-ABC8-767BD75FFB07} = {AC908E33-B856-4E23-9F81-B7F7C97A07F9}
741681
{6D7A63C9-16AB-4B7E-B9C0-0956E1E02610} = {B9C00FAF-36CF-463A-83FA-43E6B974AE2E}
742-
{9F88C871-CB37-4A88-BACF-540AC253C202} = {AC908E33-B856-4E23-9F81-B7F7C97A07F9}
743-
{B1A38DDE-5534-4625-A3F2-A585BA7A1198} = {B9C00FAF-36CF-463A-83FA-43E6B974AE2E}
744682
{8698E0C2-1A82-43E6-8A26-3D9A825CF574} = {88E7FAF4-CEEC-48B6-9114-71CFE3FC0F50}
745683
{F782BC86-9CE6-4F69-8F77-710A399CB54F} = {B9C00FAF-36CF-463A-83FA-43E6B974AE2E}
746684
{763BAD3E-3244-4E8F-8182-2BF35774262A} = {AC908E33-B856-4E23-9F81-B7F7C97A07F9}
@@ -757,7 +695,6 @@ Global
757695
{704BA731-9C70-4CBE-A607-1A2E1FB73753} = {8CA69CC9-3415-4484-9342-88D495AE2FF6}
758696
{A0EAD8F0-B7A3-4112-9F3F-2D9922A500BA} = {8CA69CC9-3415-4484-9342-88D495AE2FF6}
759697
{C050C5F0-8A40-4CB1-9715-A55EBF94FBF2} = {8CA69CC9-3415-4484-9342-88D495AE2FF6}
760-
{42801CB6-D452-408C-B0A5-970D8D997B38} = {AC908E33-B856-4E23-9F81-B7F7C97A07F9}
761698
EndGlobalSection
762699
GlobalSection(ExtensibilityGlobals) = postSolution
763700
SolutionGuid = {DB552D2A-94E1-4A1C-9F3E-E0097C6158CD}

sdk/node/Libplanet.Node.Executable/Libplanet.Node.Executable.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
<ItemGroup>
2929
<ProjectReference Include="..\..\..\tools\Libplanet.Explorer.Executable\Libplanet.Explorer.Executable.csproj" />
30-
<ProjectReference Include="..\..\..\src\Libplanet.Crypto.Secp256k1\Libplanet.Crypto.Secp256k1.csproj" />
3130
<ProjectReference Include="..\Libplanet.Node.Extensions\Libplanet.Node.Extensions.csproj" />
3231
<ProjectReference Include="..\Libplanet.Node\Libplanet.Node.csproj" />
3332
</ItemGroup>

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
44

55
<PropertyGroup>
6-
<TargetFrameworks Condition="'$(_IsPacking)'=='true'">$(TargetFrameworks);netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
6+
<TargetFrameworks Condition="'$(_IsPacking)'=='true'">$(TargetFrameworks);netstandard2.0;netstandard2.1</TargetFrameworks>
77
<LangVersion>9</LangVersion>
88
<IsPackable>true</IsPackable>
99
<IsTestProject>false</IsTestProject>

src/Libplanet.Common/ByteUtil.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
using System.Collections.Immutable;
77
using System.Diagnostics.Contracts;
88
using System.Globalization;
9+
using System.IO;
910
using System.Linq;
1011
using System.Numerics;
1112
using System.Runtime.CompilerServices;
13+
using System.Text;
14+
using System.Text.Json;
15+
using Bencodex.Json;
16+
using Bencodex.Types;
1217

1318
namespace Libplanet.Common
1419
{
@@ -23,6 +28,16 @@ public static class ByteUtil
2328
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
2429
};
2530

31+
private static readonly BencodexJsonConverter BencodexJsonConverter = new ();
32+
private static readonly JsonSerializerOptions SerializerOptions = new ()
33+
{
34+
WriteIndented = true,
35+
Converters =
36+
{
37+
BencodexJsonConverter,
38+
},
39+
};
40+
2641
/// <summary>
2742
/// Converts a hexadecimal string to a mutable <see cref="byte"/> array.
2843
/// </summary>
@@ -232,5 +247,15 @@ public static bool Satisfies(IReadOnlyList<byte> hashDigest, long difficulty)
232247
var result = new BigInteger(digestArray);
233248
return result < target;
234249
}
250+
251+
public static byte[] CreateMessage(IValue value)
252+
{
253+
using var ms = new MemoryStream();
254+
using var writer = new Utf8JsonWriter(ms, new JsonWriterOptions { Indented = true });
255+
BencodexJsonConverter.Write(writer, value, SerializerOptions);
256+
ms.Position = 0;
257+
using var sr = new StreamReader(ms);
258+
return Encoding.UTF8.GetBytes(sr.ReadToEnd());
259+
}
235260
}
236261
}

src/Libplanet.Common/Libplanet.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<PackageReference Include="System.Collections.Immutable" Version="1.*" />
55
<PackageReference Include="System.Text.Json" Version="6.0.*" />
66
<PackageReference Include="Bencodex" Version="0.16.0" />
7+
<PackageReference Include="Bencodex.Json" Version="0.16.0" />
78
</ItemGroup>
89

910
<ItemGroup Condition="'$(SkipSonar)' != 'true'">

src/Libplanet.Crypto.Nethereum/Libplanet.Crypto.Nethereum.csproj

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Libplanet.Crypto.Nethereum/NethereumCryptoBackend.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Libplanet.Crypto.Secp256k1/Secp256k1CryptoBackend.cs

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)