Skip to content

Libplanet 0.17.0

Compare
Choose a tag to compare
@github-actions github-actions released this 28 Sep 08:14
· 5605 commits to main since this release
0.17.0
26f0797

Released on September 28, 2021.

Backward-incompatible API changes

  • Added StateCompleterSet<T>.ComplementAll property. [#1358, #1386]
  • Added StateCompleterSet<T>.ComplementLatest property. [#1358, #1386]
  • BlockPerception now implements IBlockExcerpt interface. [#1440]
    • BlockPerception.Excerpt property removed.
  • TotalDifficultyComparer now implements IComparer<IBlockExcerpt> interface. [#1442]
  • Return type for BlockDemandTable.Add() is now void. [#1435, #1443]
  • Added BlockInsufficientTxsException. [#1445]
  • PrivateKey() constructor's parameter type became IReadOnlyList<byte> (was byte[]). [#1464]
  • PrivateKey.ByteArray property's type became ImmutableArray<byte> (was byte[]). To get a mutable one, use PrivateKey.ToByteArray() method instead. [#1464]
  • PublicKey() constructor's parameter type became IReadOnlyList<byte> (was byte[]). [#1464]
  • PublicKey.Verify() method's both parameter types became IReadOnlyList<byte> (were both byte[]). [#1464]
  • HashDigest<T>.DeriveFrom() method's parameter type became IReadOnlyList<byte> (was byte[]). [#1464]
  • IBlockPolicy<T>.GetMaxBlockBytes() description changed for 0 and negative values. [#1449, #1463]
    • Returned values from these will now be taken literally by BlockChain<T>.
  • Removed IBlockPolicy<T>.MaxTransactionsPerBlock property. It is replaced by IBlockPolicy<T>.GetMaxTransactionsPerBlock(long index) method. [#1447]
  • Added IBlockPolicy<T>.GetMaxTransactionsPerBlock(long index) method. [#1447]
  • Added IBlockPolicy<T>.GetMinTransactionsPerBlock(long index) method. [#1479]
  • Added IBlockPolicy<T>.GetMaxTransactionsPerSignerPerBlock(long index) method. [#1449, #1463]
  • Unused parameter currentTime removed from BlockChain<T>.Append(). [#1462, #1465]
  • Added an optional maxTransactionsPerSigner parameter to BlockChain<T>.MineBlock() method. [#1449, #1463]
  • Added an optional txPriority parameter to BlockChain<T>.MineBlock() method. [#1477]
  • BlockHeader's properties are now represented as richer types than before. [#1470]
    • BlockHeader.Timestamp property's type became DateTimeOffset (was string).
    • BlockHeader.Nonce property's type became Nonce (was ImmutableArray<byte>).
    • BlockHeader.Miner property's type became Address (was ImmutableArray<byte>).
    • BlockHeader.PreviousHash property's type became BlockHash? (was ImmutableArray<byte>).
    • BlockHeader.TxHash property's type became HashDigest<SHA256>? (was ImmutableArray<byte>).
    • BlockHeader.Hash property's type became BlockHash (was ImmutableArray<byte>).
    • BlockHeader.StateRootHash property's type became HashDigest<SHA256>? (was ImmutableArray<byte>).
    • Removed BlockHeader(int, long, string, ImmutableArray<byte>, ImmutableArray<byte>, long, BigInteger, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>) constructor. Use BlockHeader(int, long, DateTimeOffset, Nonce, Address, long, BigInteger, BlockHash?, HashDigest<SHA256>?, BlockHash, ImmutableArray<byte>, HashDigest<SHA256>?) constructor instead.
  • IStore, IStateStore, and IKeyValueStore interfaces now inherit IDisposable. [#1448, #1474]
  • Multiple changes for IBlockPolicy<T> interface. [#1485]
    • bool DoesTransactionFollowsPolicy(BlockChain<T>, Transaction<T>) changed to TxPolicyViolationException? ValidateNextBlockTx( BlockChain<T>, Transaction<T>).
    • InvalidBlockException ValidateNextBlock(BlockChain<T>, Block<T>) changed to BlockPolicyViolationException? ValidateNextBlock( BlockChain<T>, Block<T>).
    • BlockPolicy<T>, the default implementation for IBlockPolicy<T>, has been updated accordingly.
  • Removed BlockPolicy<T>() constructor with int blockIntervalMilliseconds parameter. Use the one with TimeSpan? blockInterval instead. [#1485]
  • Replaced int maxBlockBytes and int maxGenesisBytes parameters from BlockPolicy<T>() constructor with Func<long, int>? getMaxBlockBytes. [#1485]
  • Removed TxViolatingBlockPolicyException class. [#1485]
  • Optional parameter name difficultyBoundDivisor for BlockPolicy<T>() constructor changed to difficultyStability. [#1495]
  • Type for optional parameter difficultyStability for BlockPolicy<T>() constructor changed to long? from int?. [#1495]

Backward-incompatible network protocol changes

  • Message became to serialize peer with Bencodex instead of BinaryFormatter. [#1455]

Added APIs

  • IBlockExcerpt.ExcerptEquals extension method added. [#1440]
  • Added PrivateKey.FromString() method. [#1475]
  • Added PrivateKey.Sign(ImmutableArray<byte>) overloaded method. [#1464]
  • Added PrivateKey.Decrypt(ImmutableArray<byte>) overloaded method. [#1464]
  • Added PrivateKey.ToByteArray() method. [#1464]
  • Added PublicKey.Encrypt(ImmutableArray<byte>) overloaded method. [#1464]
  • Added PublicKey.ToImmutableArray() method. [#1464]
  • Added Nonce(ImmutableArray<byte>) overloaded constructor. [#1464]
  • Added HashAlgorithmType.Digest(IEnumerable<byte[]>) overloaded method. [#1480]
  • Added HashAlgorithmType.Digest(IEnumerable<ImmutableArray<byte>>) overloaded method. [#1480]
  • Added BlockHeader(int, long, DateTimeOffset, Nonce, Address, long, BigInteger, BlockHash?, HashDigest<SHA256>?, BlockHash, ImmutableArray<byte>, HashDigest<SHA256>?) constructor. [#1470]
  • Added TxCompletion<TPeer, TAction> class. [#1420, #1478]
  • Added BlockPolicyViolationException and TxPolicyViolationException classes. [#1485]
  • Added DifficultyAdjustment static class. [#1495]
  • Added BlockPolicy<T>.DifficultyStability and BlockPolicy<T>.MinimumDifficulty properties. [#1495]

Behavioral changes

  • StateCompleterSet<T>.Recalculate now evaluates states even for those already in IStateStore. Moreover, it also terminates early if possible after reaching the BlockHash provided with a call. [#1358, #1386]
  • TotalDifficultyComparer no longer considers perceived time when comparing IBlockExcerpts. [#1442]
  • General logic for determining the canonical chain has been updated. [#1435, #1443]
    • Perceived time is only used for marking a received header in BlockDemandTable in order to decide whether BlockDemand is stale or not. This should prevent a tip regression for a local node, as the tip of a chain is never considered as stale.
  • Block sync using BlockDemand became not to fill blocks from multiple peers. [#1459]
  • BlockChain<T>.MineBlock() now uses maxTransactions literally. [#1449, #1463]
    • Before, maxTransactions were internally automatically set to a value between 1 and BlockChain<T>.Policy.MaxTransactionsPerBlock.
  • Similarly, BlockChain<T>.MineBlock() now internally uses BlockChain<T>.Policy.GetMaxBlockBytes() literally. [#1449, #1463]
  • NetMQTransport became to no more send CreatePermission to TURN client and require permission-less TURN server. See coturn's relevant configuration as well. [#1423]
  • Swarm<T> became to sync transactions from multiple peers at the same time. [#1420, #1478]

Bug fixes

  • Improper sanity checks for targetBlockInterval (changed from the old name blockInterval), minimumDifficulty, and difficultyStability (changed from the old name difficultyBoundDivisor) arguments given to BlockPolicy<T>() constructor fixed. [#1495]
    • It was possible for targetBlockInterval to be zero, which would result in division by zero, when this makes no sense.
    • It was possible for difficultyStability not to be positive when this makes no sense.
    • Wrongly threw an ArgumentOutOfRangeException for the case where minimumDifficulty would equal difficultyStability.
    • It was possible for minimumDifficulty to be zero, which would allow difficulty to be stuck at zero indefinitely, when this does not make sense.