diff --git a/CHANGES.md b/CHANGES.md index ff6e43773ea..722f0cbaddf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,10 +26,19 @@ To be released. ### Dependencies + - Upgrade *Bencodex* from [0.14.0][Bencodex 0.14.0] to + [0.16.0][Bencodex 0.16.0]. [[#3461]] + - Upgrade *Bencodex.Json* from [0.11.0][Bencodex.Json 0.11.0] to + [0.16.0][Bencodex.Json 0.16.0]. [[#3461]] + ### CLI tools [#3454]: https://github.com/planetarium/libplanet/pull/3454 [#3455]: https://github.com/planetarium/libplanet/pull/3455 +[#3461]: https://github.com/planetarium/libplanet/pull/3461 +[Bencodex 0.16.0]: https://www.nuget.org/packages/Bencodex/0.16.0 +[Bencodex.Json 0.11.0]: https://www.nuget.org/packages/Bencodex.json/0.11.0 +[Bencodex.Json 0.16.0]: https://www.nuget.org/packages/Bencodex.json/0.16.0 Version 3.6.0 diff --git a/Libplanet.Action/Libplanet.Action.csproj b/Libplanet.Action/Libplanet.Action.csproj index f746792ca18..20cfb0d6389 100644 --- a/Libplanet.Action/Libplanet.Action.csproj +++ b/Libplanet.Action/Libplanet.Action.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/Libplanet.Common/Libplanet.Common.csproj b/Libplanet.Common/Libplanet.Common.csproj index 601c9994491..1bf2f25da71 100644 --- a/Libplanet.Common/Libplanet.Common.csproj +++ b/Libplanet.Common/Libplanet.Common.csproj @@ -34,7 +34,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + all diff --git a/Libplanet.Crypto/Libplanet.Crypto.csproj b/Libplanet.Crypto/Libplanet.Crypto.csproj index 683cb035d6f..8b75ba8fddb 100644 --- a/Libplanet.Crypto/Libplanet.Crypto.csproj +++ b/Libplanet.Crypto/Libplanet.Crypto.csproj @@ -22,7 +22,7 @@ - + all diff --git a/Libplanet.Explorer.Tests/GraphTypes/TransactionTypeTest.cs b/Libplanet.Explorer.Tests/GraphTypes/TransactionTypeTest.cs index aef02f91173..a611b73c21b 100644 --- a/Libplanet.Explorer.Tests/GraphTypes/TransactionTypeTest.cs +++ b/Libplanet.Explorer.Tests/GraphTypes/TransactionTypeTest.cs @@ -63,7 +63,7 @@ await ExecuteQueryAsync( var actions = Assert.IsType>( ((object[])resultData["actions"])[0]); Assert.Equal( - transaction.Actions[0].Inspect(true), + transaction.Actions[0].Inspect(), actions["inspection"]); } } diff --git a/Libplanet.Explorer/GraphTypes/ActionType.cs b/Libplanet.Explorer/GraphTypes/ActionType.cs index 331b92d016c..ed38496a340 100644 --- a/Libplanet.Explorer/GraphTypes/ActionType.cs +++ b/Libplanet.Explorer/GraphTypes/ActionType.cs @@ -50,7 +50,7 @@ public ActionType() Field>( name: "Inspection", description: "A readable representation for debugging.", - resolve: ctx => ctx.Source.Inspect(true) + resolve: ctx => ctx.Source.Inspect() ); Field>( diff --git a/Libplanet.Explorer/Libplanet.Explorer.csproj b/Libplanet.Explorer/Libplanet.Explorer.csproj index 1eab798521f..db9fc35cf26 100644 --- a/Libplanet.Explorer/Libplanet.Explorer.csproj +++ b/Libplanet.Explorer/Libplanet.Explorer.csproj @@ -63,7 +63,7 @@ - + diff --git a/Libplanet.Extensions.Cocona/Commands/ApvCommand.cs b/Libplanet.Extensions.Cocona/Commands/ApvCommand.cs index e9fad943ac4..a50994fef9a 100644 --- a/Libplanet.Extensions.Cocona/Commands/ApvCommand.cs +++ b/Libplanet.Extensions.Cocona/Commands/ApvCommand.cs @@ -250,7 +250,7 @@ void TreeIntoTable(IValue tree, List<(string, string)> table, string key) { string k = kv.Key switch { - Binary bk => ByteUtil.Hex(bk), + Binary bk => ByteUtil.Hex(bk.ToArray()), Text txt => txt.Value, _ => kv.Key.ToString() ?? string.Empty, }; diff --git a/Libplanet.Store/BaseStore.cs b/Libplanet.Store/BaseStore.cs index 6faca3dca3e..b5674055965 100644 --- a/Libplanet.Store/BaseStore.cs +++ b/Libplanet.Store/BaseStore.cs @@ -191,7 +191,7 @@ ILogger logger { const string msg = nameof(TxExecution) + " must be serialized as a Bencodex dictionary, not {ActualValue}"; - logger?.Error(msg, decoded.Inspect(false)); + logger?.Error(msg, decoded.Inspect()); return null; } diff --git a/Libplanet.Store/Libplanet.Store.csproj b/Libplanet.Store/Libplanet.Store.csproj index 5e4e37ed799..42a72b0ec76 100644 --- a/Libplanet.Store/Libplanet.Store.csproj +++ b/Libplanet.Store/Libplanet.Store.csproj @@ -21,7 +21,7 @@ - + diff --git a/Libplanet.Store/Trie/MerkleTrie.Path.cs b/Libplanet.Store/Trie/MerkleTrie.Path.cs index 1ef133c199f..fc1f27510f3 100644 --- a/Libplanet.Store/Trie/MerkleTrie.Path.cs +++ b/Libplanet.Store/Trie/MerkleTrie.Path.cs @@ -24,7 +24,7 @@ public partial class MerkleTrie cursor), HashNode hashNode => ResolveToValue(UnhashNode(hashNode), cursor), _ => throw new InvalidTrieNodeException( - $"Invalid node value: {node.ToBencodex().Inspect(false)}"), + $"Invalid node value: {node.ToBencodex().Inspect()}"), }; private INode? ResolveToNode(INode? node, in PathCursor cursor) diff --git a/Libplanet.Store/Trie/MerkleTrie.cs b/Libplanet.Store/Trie/MerkleTrie.cs index 8cf59da1fbe..c5b0317d242 100644 --- a/Libplanet.Store/Trie/MerkleTrie.cs +++ b/Libplanet.Store/Trie/MerkleTrie.cs @@ -308,7 +308,7 @@ private INode Insert( default: throw new InvalidTrieNodeException( - $"Unsupported node value: {node.ToBencodex().Inspect(false)}"); + $"Unsupported node value: {node.ToBencodex().Inspect()}"); } } diff --git a/Libplanet.Store/Trie/Nodes/NodeDecoder.cs b/Libplanet.Store/Trie/Nodes/NodeDecoder.cs index 16764607eca..d1d70855787 100644 --- a/Libplanet.Store/Trie/Nodes/NodeDecoder.cs +++ b/Libplanet.Store/Trie/Nodes/NodeDecoder.cs @@ -62,7 +62,7 @@ public enum NodeType : short return (allowed & NodeType.Full) == NodeType.Full ? DecodeFull(list) : throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } else if (list.Count == 2) { @@ -71,25 +71,25 @@ public enum NodeType : short return (allowed & NodeType.Short) == NodeType.Short ? DecodeShort(list) : throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } else if (list[0] is Null) { return (allowed & NodeType.Value) == NodeType.Value ? DecodeValue(list) : throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } else { throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } } else { throw new InvalidTrieNodeException( - $"Can't decode a node from the bencodex value: {value.Inspect(false)}"); + $"Can't decode a node from the bencodex value: {value.Inspect()}"); } } else if (value is Binary binary) @@ -97,19 +97,19 @@ public enum NodeType : short return (allowed & NodeType.Hash) == NodeType.Hash ? DecodeHash(binary) : throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } else if (value is Null) { return (allowed & NodeType.Null) == NodeType.Null ? (INode?)null : throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } else { throw new InvalidTrieNodeException( - $"Can't decode a node from value {value.Inspect(false)}"); + $"Can't decode a node from value {value.Inspect()}"); } } diff --git a/Libplanet.Tests/Blocks/BlockMarshalerTest.cs b/Libplanet.Tests/Blocks/BlockMarshalerTest.cs index e039001868c..80792064ba6 100644 --- a/Libplanet.Tests/Blocks/BlockMarshalerTest.cs +++ b/Libplanet.Tests/Blocks/BlockMarshalerTest.cs @@ -179,7 +179,7 @@ public void UnmarshalBlock() _output.WriteLine( "{0} = {1}", nameof(_marshaledGenesis), - _marshaledGenesis.Inspect(true)); + _marshaledGenesis.Inspect()); Assert.Equal( _fx.Genesis, BlockMarshaler.UnmarshalBlock(_marshaledGenesis) @@ -187,7 +187,7 @@ public void UnmarshalBlock() _output.WriteLine( "{0} = {1}", nameof(_marshaledNext), - _marshaledNext.Inspect(true)); + _marshaledNext.Inspect()); Assert.Equal( _fx.Next, BlockMarshaler.UnmarshalBlock(_marshaledNext) @@ -195,7 +195,7 @@ public void UnmarshalBlock() _output.WriteLine( "{0} = {1}", nameof(_marshaledHasTx), - _marshaledHasTx.Inspect(true)); + _marshaledHasTx.Inspect()); Assert.Equal( _fx.HasTx, BlockMarshaler.UnmarshalBlock(_marshaledHasTx) diff --git a/Libplanet.Types/Libplanet.Types.csproj b/Libplanet.Types/Libplanet.Types.csproj index c30e1550bd3..e0dced942c2 100644 --- a/Libplanet.Types/Libplanet.Types.csproj +++ b/Libplanet.Types/Libplanet.Types.csproj @@ -22,8 +22,8 @@ - - + + all diff --git a/Libplanet.Types/Tx/TxMarshaler.cs b/Libplanet.Types/Tx/TxMarshaler.cs index 6103790fcbe..ccae2700e4e 100644 --- a/Libplanet.Types/Tx/TxMarshaler.cs +++ b/Libplanet.Types/Tx/TxMarshaler.cs @@ -15,16 +15,16 @@ namespace Libplanet.Types.Tx public static class TxMarshaler { private const string TimestampFormat = "yyyy-MM-ddTHH:mm:ss.ffffffZ"; - private static readonly Binary UpdatedAddressesKey = new byte[] { 0x75 }; // 'u' - private static readonly Binary TimestampKey = new byte[] { 0x74 }; // 't' - private static readonly Binary GenesisHashKey = new byte[] { 0x67 }; // 'g' - private static readonly Binary MaxGasPriceKey = new byte[] { 0x6d }; // 'm' - private static readonly Binary GasLimitKey = new byte[] { 0x6c }; // 'l' - private static readonly Binary NonceKey = new byte[] { 0x6e }; // 'n' - private static readonly Binary SignerKey = new byte[] { 0x73 }; // 's' - private static readonly Binary PublicKeyKey = new byte[] { 0x70 }; // 'p' - private static readonly Binary SignatureKey = new byte[] { 0x53 }; // 'S' - private static readonly Binary ActionsKey = new byte[] { 0x61 }; // 'a' + private static readonly Binary UpdatedAddressesKey = new Binary(new byte[] { 0x75 }); // 'u' + private static readonly Binary TimestampKey = new Binary(new byte[] { 0x74 }); // 't' + private static readonly Binary GenesisHashKey = new Binary(new byte[] { 0x67 }); // 'g' + private static readonly Binary MaxGasPriceKey = new Binary(new byte[] { 0x6d }); // 'm' + private static readonly Binary GasLimitKey = new Binary(new byte[] { 0x6c }); // 'l' + private static readonly Binary NonceKey = new Binary(new byte[] { 0x6e }); // 'n' + private static readonly Binary SignerKey = new Binary(new byte[] { 0x73 }); // 's' + private static readonly Binary PublicKeyKey = new Binary(new byte[] { 0x70 }); // 'p' + private static readonly Binary SignatureKey = new Binary(new byte[] { 0x53 }); // 'S' + private static readonly Binary ActionsKey = new Binary(new byte[] { 0x61 }); // 'a' private static readonly Codec Codec = new Codec(); [Pure] @@ -139,8 +139,8 @@ public static UnsignedTx UnmarshalUnsignedTx(Bencodex.Types.Dictionary dictionar public static ImmutableArray? UnmarshalTransactionSignature( Bencodex.Types.Dictionary dictionary ) => - dictionary.TryGetValue(SignatureKey, out IValue v) - ? (Binary)v + dictionary.TryGetValue(SignatureKey, out IValue v) && v is Binary bin + ? bin.ToImmutableArray() : (ImmutableArray?)null; [Pure] @@ -182,8 +182,8 @@ public static Transaction UnmarshalTransactionWithoutVerification( { ImmutableArray sig = dictionary.TryGetValue(SignatureKey, out IValue s) && s is Binary bin - ? bin - : new Binary(Array.Empty()); + ? bin.ToImmutableArray() + : ImmutableArray.Empty; return UnmarshalUnsignedTx(dictionary).CombineWithoutVerification(sig); } diff --git a/Libplanet/Libplanet.csproj b/Libplanet/Libplanet.csproj index 5f002332417..4fc69f5c4c8 100644 --- a/Libplanet/Libplanet.csproj +++ b/Libplanet/Libplanet.csproj @@ -64,7 +64,7 @@ https://docs.libplanet.io/ - +