Skip to content

Commit

Permalink
Merge tag '0.47.0' into merge/main-to-pbft-0.47.0
Browse files Browse the repository at this point in the history
Libplanet 0.47.0
  • Loading branch information
limebell committed Feb 22, 2023
2 parents 7a7faba + 1ee05f8 commit b4ce9de
Show file tree
Hide file tree
Showing 103 changed files with 1,934 additions and 742 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"docfx": {
"version": "2.60.2",
"commands": [
"docfx"
]
}
}
}
1 change: 1 addition & 0 deletions .github/bin/constants.sh
Expand Up @@ -7,6 +7,7 @@ projects=(
"Libplanet.Stun"
"Libplanet.Net"
"Libplanet.Node"
"Libplanet.Crypto.Secp256k1"
"Libplanet.RocksDBStore"
"Libplanet.Analyzers"
"Libplanet.Tools"
Expand Down
2 changes: 1 addition & 1 deletion @planetarium/tx/package.json
Expand Up @@ -9,7 +9,7 @@
"build": "bunchee --target es2020 --dts src/index.ts",
"prepack": "npm run build",
"dev": "bunchee --target es2020 --watch src/index.ts",
"test": "dotnet build ../../Libplanet.Tools && vitest run",
"test": "npm run prebuild && dotnet build ../../Libplanet.Tools && vitest run",
"coverage": "vitest run --coverage"
},
"types": "dist/src/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion @planetarium/tx/test/tx/unsigned.test.ts
Expand Up @@ -57,7 +57,8 @@ test("encodeUnsignedTxWithSystemAction", async () => {
},
},
timestamp: "2022-05-23T01:02:00+00:00",
publicKey: {},
publicKey:
"0200e02709cc0c051dc105188c454a2e7ef7b36b85da34529d3abc1968167cf54f",
genesisHash: null,
});
}, 30_000);
129 changes: 118 additions & 11 deletions CHANGES.md
Expand Up @@ -123,34 +123,120 @@ Version PBFT
Version 0.47.0
--------------

To be released.

### Deprecated APIs
Released on February 6, 2023.

### Backward-incompatible API changes

- The signature of `Address(ImmutableArray<byte>)` constructor became
`Address(in ImmutableArray<byte>)`. [[#2756]]
- The signature of `BlockHash(ImmutableArray<byte>)` constructor became
`BlockHash(in ImmutableArray<byte>)`. [[#2756]]
- The signature of `Nonce(ImmutableArray<byte>)` constructor became
`Nonce(in ImmutableArray<byte>)`. [[#2756]]
- Removed `IAccountStateView.GetValidatorSet()` method. [[#2733]]
- Removed `IAccountStateDelta.SetValidator(Validator)` method. [[#2733]]
- (Libplanet.Extensions.Cocona) Dropped .NET Standard 2.0 and .NET Core 3.1
target assemblies. [[#2732]]
- (Libplanet.Extensions.Cocona) Added .NET 6 target assembly. [[#2732]]

### Backward-incompatible network protocol changes

### Backward-incompatible storage format changes
- (Libplanet.Net) Added `ITransport.AppProtocolVersion`,
`ITransport.TrustedAppProtocolVersionSigners`,
and `ITransport.DifferentAppProtocolVersionEncountered` properties.
[[#2743]]
- (Libplanet.Net) Changed `Swarm<T>(BlockChain<T>, PrivateKey,
AppProtocolVersionOptions, HostOptions, SwarmOptions)` to
`Swarm<T>(BlockChain<T>, PrivateKey, ITransport, SwarmOptions)`. [[#2743]]
- (Libplanet.Net) Changed the type for
`AppProtocolVersionOptions.TrustedAppProtocolVersionSigners` from
`IImmutableHashSet<PublicKey>?` to `IImmutableHashSet<PublicKey>`.
[[#2759]]
- (Libplanet.Net) Changed `BoundPeer` to implement `IBencodable` interface
and removed `[Serializable]` attribute from `BoundPeer`. [[#2778]]
- (Libplanet.Net) Changed `BoundPeer(Dictionary)` constructor's signature to
`BoundPeer(IValue)`. [[#2778]]
- Changed `Address` to implement `IBencodable` interface and removed
`[Serializable]` attribute from `Address`. [[#2778]]
- Changed `Address(Binary)` constructor's signature to `Address(IValue)`.
[[#2778]]

### Added APIs

### Behavioral changes
- Introduced *Libplanet.Crypto.Secp256k1* package. [[#2780]]
- Many more types became serialized and deserialized better with
[`System.Text.Json.JsonSerializer`] as they now have their own
[custom converters]. Note that these serializations are unavailable
on Unity due to its incomplete reflection support. [[#2756]]
- A `Nonce` became represented as a single hexadecimal string in JSON.
- A `PublicKey` became represented as a single hexadecimal string in
JSON.
- A `Block<T>` became represented as an object with values in JSON.
- Added `TxId(in ImmutableArray<byte>)` constructor. [[#2756]]
- Added `ByteUtil.ParseHexToImmutable()` static method. [[#2756]]

### Bug fixes

- Fixed a JSON serializer bug where a `Transaction<T>` serialized into JSON
had lacked the content of its `PublicKey`. [[#2756]]
- (Libplanet.Explorer) Fixed a bug where the query `stateQuery` hadn't work
correctly. [[#2757]]
- Fixed a bug of `DefaultStore.PutTxExecution()` where sometimes `TxExecution`
data is in undefined state due to data corruption. [[#2761]]
- (Libplanet.Node) Fixed a bug of `NodeUtils<T>.CreateGenesisBlock()` where
sometimes block data is in undefined state due to data corruption.
[[#2761]]
- Fixed where `Address(string)` could accept 42 chars with a wrong prefix.
[[#2781]]
- Fixed where `VolatileStagePolicy<T>(TimeSpan)` created with
`TimeSpan.MaxValue` as its argument would not behave properly and throw an
`ArgumentOutOfRangeException`. [[#2783], [#2784]]

### Dependencies

- Upgrade *Bencodex* from
[0.7.0-dev.20220923062845][Bencodex 0.7.0-dev.20220923062845] to
[0.8.0][Bencodex 0.8.0]. [[#2294]]
- Upgrade *Bencodex.Json* from
[0.7.0-dev.20220923062845][Bencodex.Json 0.7.0-dev.20220923062845] to
[0.8.0][Bencodex.Json 0.8.0]. [[#2294]]
- Upgrade *System.Text.Json* from [6.0.6][System.Text.Json 6.0.6] to
[6.0.7][System.Text.Json 6.0.7]. [[#2322]]

### CLI tools

[[#2732]]: https://github.com/planetarium/libplanet/pull/2732
[[#2733]]: https://github.com/planetarium/libplanet/pull/2733
- Added `planet block` subcommand group. [[#2758]]
- Added `planet block analyze` subcommand.
- Added `planet block generate-genesis` subcommand.
- Fixed a bug of `planet tx analyze` subcommand where a serialized transaction
had lacked the content of its `"publicKey"`. [[#2756]]

[#2732]: https://github.com/planetarium/libplanet/pull/2732
[#2733]: https://github.com/planetarium/libplanet/pull/2733
[#2743]: https://github.com/planetarium/libplanet/pull/2743
[#2747]: https://github.com/planetarium/libplanet/pull/2747
[#2756]: https://github.com/planetarium/libplanet/pull/2756
[#2757]: https://github.com/planetarium/libplanet/pull/2757
[#2758]: https://github.com/planetarium/libplanet/pull/2758
[#2759]: https://github.com/planetarium/libplanet/pull/2759
[#2761]: https://github.com/planetarium/libplanet/pull/2761
[#2778]: https://github.com/planetarium/libplanet/pull/2778
[#2780]: https://github.com/planetarium/libplanet/pull/2780
[#2781]: https://github.com/planetarium/libplanet/pull/2781
[#2783]: https://github.com/planetarium/libplanet/issues/2783
[#2784]: https://github.com/planetarium/libplanet/pull/2784
[Bencodex 0.8.0]: https://www.nuget.org/packages/Bencodex/0.8.0
[Bencodex.Json 0.8.0]: https://www.nuget.org/packages/Bencodex.Json/0.8.0
[System.Text.Json 6.0.7]: https://www.nuget.org/packages/System.Text.Json/6.0.7


Version 0.46.1
--------------

Released on February 3th, 2023.

- Ported changes from [Libplanet 0.45.5] release.
- General changes to log output for readability. [[#2769]]

[Libplanet 0.45.5]: https://www.nuget.org/packages/Libplanet/0.45.5
[#2769]: https://github.com/planetarium/libplanet/pull/2769


Version 0.46.0
Expand Down Expand Up @@ -274,10 +360,31 @@ Released on Janurary 18th, 2023.
[#2701]: https://github.com/planetarium/libplanet/pull/2701
[#2704]: https://github.com/planetarium/libplanet/pull/2704
[#2705]: https://github.com/planetarium/libplanet/pull/2705
[#2708]: https://github.com/planetarium/libplanet/pull/2708
[#2718]: https://github.com/planetarium/libplanet/pull/2718
[#2716]: https://github.com/planetarium/libplanet/pull/2716


Version 0.45.5
--------------

Released on January 19, 2023.

- Fixed a bug when `Web3KeyStore.Get()` hadn't worked properly on IL2CPP
environment. [[#2727]]
- Back-ported below changes from [Libplanet 0.46.0] release.
- (Libplanet.Net) Fixed a bug `NetMQTransport` log shows socket count
wrongly. [[#2708]]
- (Libplanet.Net) Fixed a bug where `NetMQTransport.SendMessageAsync()`
method hadn't disposed of internal sockets properly when connecting
failed. [[#2719]]
- (Libplanet.Net) `BoundPeer()` constructor became to validate a hostname
of `endPoint` parameter. [[#2721]]

[Libplanet 0.46.0]: https://www.nuget.org/packages/Libplanet/0.46.0
[#2708]: https://github.com/planetarium/libplanet/pull/2708
[#2719]: https://github.com/planetarium/libplanet/pull/2719
[#2721]: https://github.com/planetarium/libplanet/pull/2721
[#2727]: https://github.com/planetarium/libplanet/pull/2727


Version 0.45.4
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -99,6 +99,11 @@ on GitHub consists of several projects:
- *Libplanet.Stun*: The project dedicated to implement [TURN & STUN].
This is distributed as a distinct NuGet package: *[Libplanet.Stun]*.

- *Libplanet.Crypto.Secp256k1*: The `ICryptoBackend<T>` implementation built
on native [libsecp256k1]. As this depends on a platform-dependent library
(which is written in C), this is distributed as a distinct NuGet package:
*[Libplanet.Crypto.Secp256k1]*.

- *Libplanet.RocksDBStore*: The `IStore` implementation built on [RocksDB].
As this depends on platform-dependent libraries (which is written in C/C++),
this is distributed as a distinct NuGet package: *[Libplanet.RocksDBStore]*.
Expand Down Expand Up @@ -137,6 +142,9 @@ on GitHub consists of several projects:

- *Libplanet.Stun.Tests*: Unit tests of the *Libplanet.Stun* project.

- *Libplanet.Crypto.Secp256k1.Tests*: Unit tests of
the *Libplanet.Crypto.Secp256k1* project.

- *Libplanet.RocksDBStore.Tests*: Unit tests of the *Libplanet.RocksDBStore*
project.

Expand All @@ -154,8 +162,10 @@ on GitHub consists of several projects:
[Libplanet.Net]: https://www.nuget.org/packages/Libplanet.Net/
[Libplanet.Node]: https://www.nuget.org/packages/Libplanet.Node/
[TURN & STUN]: https://snack.planetarium.dev/eng/2019/06/nat_traversal_2/
[libsecp256k1]: https://github.com/bitcoin-core/secp256k1
[RocksDB]: https://rocksdb.org/
[Libplanet.Stun]: https://www.nuget.org/packages/Libplanet.Stun/
[Libplanet.Crypto.Secp256k1]: https://www.nuget.org/packages/Libplanet.Crypto.Secp256k1/
[Libplanet.RocksDBStore]: https://www.nuget.org/packages/Libplanet.RocksDBStore/
[Libplanet.Analyzers]: https://www.nuget.org/packages/Libplanet.Analyzers/
[Cocona]: https://www.nuget.org/packages/Cocona
Expand Down
64 changes: 3 additions & 61 deletions Docs/build.ps1
Expand Up @@ -26,39 +26,8 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
$BaseDir = Split-Path -Path $MyInvocation.MyCommand.Source
Set-Location $BaseDir

# https://github.com/PowerShell/PowerShell/pull/1901#issuecomment-240847078
if (Get-Alias Curl -ErrorAction SilentlyContinue) {
Remove-Item Alias:Curl
}
if (Get-Alias WGet -ErrorAction SilentlyContinue) {
Remove-Item Alias:WGet
}

function Download-File ($From, $To) {
# Why we prefer curl/wget here? Because in some environments
# (e.g., Travis CI) .NET's root certificates are seemingly outdated,
# or at least, an error "Could not create SSL/TLS secure channel" occurs.
if (Get-Command wget -ErrorAction SilentlyContinue) {
wget -O "$To" "$From"
} elseif (Get-Command curl -ErrorAction SilentlyContinue) {
curl -L -o "$To" "$From"
} else {
Invoke-WebRequest -OutFile "$To" "$From"
}
}

# Download docfx if not exist yet.
if (-not (Test-Path "$BaseDir/docfx")) {
Download-File `
"https://github.com/dotnet/docfx/releases/download/v2.58.2/docfx.zip" `
-To "$BaseDir/docfx.zip"
New-Item -ItemType directory -Path "$BaseDir/docfx"
[System.IO.Compression.ZipFile]::ExtractToDirectory(
"$BaseDir/docfx.zip",
"$BaseDir/docfx"
)
Remove-Item "$BaseDir/docfx.zip"
}
# Install docfx with `dotnet tool`.
dotnet tool restore

# As DocFX requires the Git remote named "origin", which is hard-coded in
# the DocFX internals (see also: # https://github.com/dotnet/docfx/issues/5547),
Expand All @@ -76,34 +45,7 @@ try {
# the native way on Windows, it should be interpreted by Mono VM on other POSIX
# systems.
Set-Location $BaseDir
if (Get-Command mono -ErrorAction SilentlyContinue) {
mono "$BaseDir/docfx/docfx.exe" "$BaseDir/docfx.json" @args
} else {
$platform = [System.Environment]::OSVersion.Platform;
$unix = [System.PlatformId]::Unix;
$macos = [System.PlatformId]::MacOSX;
if (@($unix, $macos).Contains($platform)) {
if (Get-Command docker -ErrorAction SilentlyContinue) {
$DocsDir = Split-Path -Leaf $BaseDir
$RepoDir = Split-Path -Parent $BaseDir
docker run `
-v "${RepoDir}:/app" `
-v "$HOME/.nuget:/root/.nuget" `
-w "/app/$DocsDir" `
mono `
mono "docfx/docfx.exe" "docfx.json" @args
} else {
Write-Error @"
Failed to find the command: mono
You need to install Mono on your system.
See also: https://www.mono-project.com/
"@
exit 127
}
} else {
& "$BaseDir\docfx\docfx.exe" "$BaseDir/docfx.json" @args
}
}
dotnet tool run docfx docfx.json @args

if (-not (Test-Path "$BaseDir/_site/api/Libplanet.html")) {
Write-Error @"
Expand Down
3 changes: 2 additions & 1 deletion Docs/docfx.json
Expand Up @@ -7,6 +7,7 @@
"Libplanet/Libplanet.csproj",
"Libplanet.Net/Libplanet.Net.csproj",
"Libplanet.Node/Libplanet.Node.csproj",
"Libplanet.Crypto.Secp256k1/Libplanet.Crypto.Secp256k1.csproj",
"Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj",
"Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj",
"Libplanet.Stun/Libplanet.Stun.csproj"
Expand Down Expand Up @@ -96,7 +97,7 @@
"_appTitle": "Libplanet",
"_appLogoPath": "images/logo.svg",
"_appFaviconPath": "images/favicon.ico",
"_appFooter": "Copyright © 2018\u20132022 <a href=\"https://planetariumhq.com/\">Planetarium</a>"
"_appFooter": "Copyright © 2018\u20132023 <a href=\"https://planetariumhq.com/\">Planetarium</a>"
},
"globalMetadataFiles": [],
"fileMetadataFiles": [],
Expand Down
@@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<RootNamespace>Libplanet.Crypto.Secp256k1.Tests</RootNamespace>
<LangVersion>10</LangVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TestsTargetFramework)'!='' ">
<TargetFramework>$(TestsTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\Menees.Analyzers.Settings.xml">
<Link>Menees.Analyzers.Settings.xml</Link>
</AdditionalFiles>
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup Condition=" '$(TestsTargetFramework)'!='' ">
<TargetFramework>$(TestsTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\Libplanet.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.98" />
<PackageReference Include="Menees.Analyzers.2017" Version="2.0.3">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Collections.Immutable" Version="1.7.*" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>

<ItemGroup Condition="'$(SkipSonar)' != 'true'">
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.51.0.59060">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Libplanet\Libplanet.csproj" />
<ProjectReference Include="..\Libplanet.Crypto.Secp256k1\Libplanet.Crypto.Secp256k1.csproj" />
</ItemGroup>
</Project>

0 comments on commit b4ce9de

Please sign in to comment.