Libplanet 0.18.0
Released on October 13, 2021.
Backward-incompatible API changes
Hashcash.Stamp(Nonce)
delegate's return type becameIEnumerable<byte[]>
(wasbyte[]
). [#1492]- Moved
BlockDigest
struct toLibplanet.Store
namespace (fromLibplanet.Blocks
namespace). [#1492] - Removed
Block<T>.ToBlockDigest()
method. UseBlockDigest.FromBlock<T>()
static method instead. [#1492] ActionEvaluator<T>.Evaluate()
method'sblock
parameter became to takeIPreEvaluationBlock<T>
(wasIBlock<T>
). [#1146, #1164, #1492]Block<T>
andBlockHeader
now guarantees that their every instance has integrity. [#1164, #1492]Block<T>
became unable to be subclassed.- Remove
Block<T>(long, long, BigInteger, Nonce, Address, BlockHash?, DateTimeOffset, IReadOnlyList<Transaction<T>>, HashAlgorithmType, HashDigest<SHA256>, ImmutableArray<byte>?, int)
overloaded constructor. Use other overloaded constructors instead. - Added
Block<T>(IBlockHeader header, IEnumerable<Transaction<T>>)
overloaded constructor. - Added
Block<T>(PreEvaluationBlock<T>, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1457, #1507] BlockHeader
is no more readonly struct, but a sealed class.- Removed
BlockHeader(int, long, string, ImmutableArray<byte>, ImmutableArray<byte>, long, BigInteger, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>, ImmutableArray<byte>)
constructor. Use other overloaded constructors instead. - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1457, #1507] - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?, BlockHash)
overloaded constructor. [#1457, #1507]
Block<T>
andBlockHeader
have no more marshaling/unmarshaling methods.- Removed
Block<T>(Bencodex.Types.Dictionary)
overloaded constructor. UseBlockMarshaler.UnmarshalBlock()
static method instead. - Removed
Block<T>.Deserialize()
static method. Instead, useBlockMarshaler.UnmarshalBlock()
static method andBencodex.Codec
together. - Removed
Block<T>.ToBencodex()
method. UseBlockMarshaler.MarshalBlock()
static method instead. - Removed
Block<T>.Serialize()
method. Instead, useBlockMarshaler.MarshalBlock()
static method andBencodex.Codec
together. - Removed
BlockHeader(Bencodex.Types.Dictionary)
overloaded constructor. UseBlockMarshaler.UnmarshalBlockHeader()
static method instead. - Removed
BlockHeader.Deserialize()
static method. Instead, useBlockMarshaler.UnmarshalBlockHeader()
static method andBencodex.Codec
together. - Removed
BlockHeader.ToBencodex()
method. UseBlockMarshaler.MarshalBlockHeader()
static method instead. - Removed
BlockHeader.Serialize()
method. Instead, useBlockMarshaler.MarshalBlockHeader()
static method andBencodex.Codec
together.
- Removed
Block<T>
andBlockHeader
now guarantee that their every instance has itsStateRootHash
. [#1128, #1146, #1492]Block<T>.StateRootHash
property's type becameHashDigest<SHA256>
(wasHashDigest<SHA256>?
).- Removed
Block<T>(Block<T>, HashDigest<SHA256>)
overloaded constructor. UseBlock<T>(PreEvaluationBlock<T>, HashDigest<SHA256>)
overloaded constructor instead. - Removed
Block<T>.Mine()
static method. UseBlockContent<T>.Mine()
andPreEvaluationBlock<T>.Evaluate()
methods instead. BlockHeader.StateRootHash
property's type becameHashDigest<SHA256>
(wasHashDigest<SHA256>?
).- The type of
InvalidBlockStateRootHashException()
constructor'sexpectedStateRootHash
parameter becameHashDigest<SHA256>
(wasHashDigest<SHA256>?
). [#1507] InvalidBlockStateRootHashException.ExpectedStateRootHash
property's type becameHashDigest<SHA256>
(wasHashDigest<SHA256>?
). [#1507]
Block<T>
andBlockHeader
became aware ofHashAlgorithmType
used for proof-of-work mining. [#1492]- Added
Block<T>.HashAlgorithm
property. - Added
BlockHeader.HashAlgorithm
property. - Removed
BlockHeader(int, long, DateTimeOffset, Nonce, Address, long, BigInteger, BlockHash?, HashDigest<SHA256>?, BlockHash, ImmutableArray<byte>, HashDigest<SHA256>?)
constructor. UseBlockHeader(int, long, DateTimeOffset, Nonce, Address, long, BigInteger, BlockHash?, HashDigest<SHA256>?, BlockHash, ImmutableArray<byte>, HashDigest<SHA256>, HashAlgorithmType)
constructor instead. - Added
HashAlgorithmGetter hashAlgorithmGetter
parameter toIStore.GetBlock<T>()
method. - Removed
BlockDigest.Header
property. UseBlockDigest.GetHeader()
method instead. - Added
BlockDigest.GetHeader()
method. - Added
HashAlgorithmGetter hashAlgorithmGetter
parameter toDelayedRenderer<T>()
constructor. - Added
HashAlgorithmGetter hashAlgorithmGetter
parameter toDelayedActionRenderer<T>()
constructor. - Added
DelayedRenderer<T>.HashAlgorithmGetter
property.
- Added
- Blocks became signed by the miner since the protocol version 2. [#1457, #1507]
- Added
Block<T>(PreEvaluationBlock<T>, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1164, #1492] - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1164, #1492] - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?, BlockHash)
overloaded constructor. [#1164, #1492] - Added
Block<T>.Signature
property. - Added
Block<T>.PublicKey
property. - Added
BlockHeader.Signature
property. - Added
BlockHeader.PublicKey
property. - Added
InvalidBlockPublicKeyException
class. - Added
InvalidBlockSignatureException
class.
- Added
IStateStore
now requires implementations to be trie. [#1128, #1146, #1492]- Added
IStateStore.GetStateRoot()
method. - Added
IStateStore.PruneStates()
method. - Removed
IStateStore.SetStates<T>()
method. - Removed
IStateStore.GetState()
method. - Removed
IStateStore.ContainsBlockStates()
method. - Removed
IStateStore.ForkStates<T>()
method.
- Added
TrieStateStore
no more stores associations betweenBlock<T>.Hash
/Block<T>.PreEvaluationHash
andBlock<T>.StateRootHash
, becauseBlock<T>.StateRootHash
became mandatory. [#1128, #1146, #1492]- Added
ITrie.Recorded
property. - Removed
IKeyValueStore stateHashKeyValueStore
parameter fromTrieStateStore()
constructor. - Removed
TrieStateStore.GetTrie()
method. - Removed
TrieStateStore.GetRootHash()
method. - Replaced
TrieStateStore.PruneStates(IImmutableSet<BlockHash>)
method withTrieStateStore.PruneStates(IImmutableSet<HashDigest<SHA256>>)
method.
- Added
- The types of
BlockChain<T>.MineBlock()
overloaded methods'miner
parameter becamePrivateKey
(wereAddress
). [#1457, #1507]
Backward-incompatible network protocol changes
- The
Block<T>.CurrentProtocolVersion
is bumped from 1 to 2: [#1507]- Block's total difficulty value became included to the input of block hashes and pre-evaluation hashes since the protocol version 2.
- Blocks became to have miner's public key as well since the protocol version 2. [#1457]
- Blocks became to have no miner's address since the protocol version 2, because it can be derived from miner's public key. [#1457]
- Blocks became to have a signature made using miner's private key since the protocol version 2. Block signatures affect block hashes. [#1457]
Added APIs
- Added
BlockMetadata
class. [#1164, #1457, #1492, #1507] - Added
BlockContent<T>
class. [#1164, #1492] - Added
PreEvaluationBlockHeader
class. [#1146, #1164, #1457, #1492, #1507] - Added
PreEvaluationBlock<T>
class. [#1146, #1164, #1457, #1492, #1507] - Added
BlockDigest.FromBlock<T>()
static method. [#1492] - Added
Block<T>(PreEvaluationBlock<T>, HashDigest<SHA256>)
overloaded constructor. [#1146, #1164, #1492] - Added
Block<T>.HashAlgorithm
property. [#1492] - Added
Block<T>.PublicKey
property. [#1457, #1507] - Added
Block<T>.Signature
property. [#1457, #1507] - Added
Block<T>(PreEvaluationBlock<T>, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1164, #1457, #1492, #1507] - Added
Block<T>(IBlockHeader, IEnumerable<Transaction<T>>)
overloaded constructor. [#1164, #1492] - Added
BlockHeader.HashAlgorithm
property. [#1492] - Added
BlockHeader.PublicKey
property. [#1457, #1507] - Added
BlockHeader.Signature
property. [#1457, #1507] - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?)
overloaded constructor. [#1164, #1457, #1492, #1507] - Added
BlockHeader(PreEvaluationBlockHeader, HashDigest<SHA256>, ImmutableArray<byte>?, BlockHash)
overloaded constructor. [#1164, #1457, #1492, #1507] - Added
IBlockMetadata
interface. [#1164, #1457, #1492, #1507]Block<T>
became to implementIBlockMetadata
interface.BlockHeader
became to implementIBlockMetadata
interface.BlockMetadata
became to implementIBlockMetadata
interface.BlockContent<T>
became to implementIBlockMetadata
interface.PreEvaluationBlockHeader
became to implementIBlockMetadata
interface.PreEvaluationBlock<T>
became to implementIBlockMetadata
interface.BlockDigest
became to implementIBlockMetadata
interface.
- Added
IBlockContent<T>
interface. [#1164, #1492]Block<T>
became to implementIBlockContent<T>
interface.BlockContent<T>
became to implementIBlockContent<T>
interface.PreEvaluationBlock<T>
became to implementIBlockContent<T>
interface.
- Added
IPreEvaluationBlockHeader
interface. [#1164, #1492]Block<T>
became to implementIPreEvaluationBlockHeader
interface.BlockHeader
became to implementIPreEvaluationBlockHeader
interface.PreEvaluationBlockHeader
became to implementIPreEvaluationBlockHeader
interface.PreEvaluationBlock<T>
became to implementIPreEvaluationBlockHeader
interface.
- Added
IPreEvaluationBlock<T>
interface. [#1164, #1492]Block<T>
became to implementIPreEvaluationBlock<T>
interface.PreEvaluationBlock<T>
became to implementIPreEvaluationBlock<T>
interface.ActionEvaluator<T>.Evaluate()
method'sblock
parameter became to takeIPreEvaluationBlock<T>
(wasIBlock<T>
).
- Added
IBlockHeader
interface. [#1146, #1164, #1492]Block<T>
became to implementIBlockHeader
interface.BlockHeader
became to implementBlockHeader
interface.
- Added
BlockMetadataExtensions
static class. [#1164, #1492] - Added
BlockContentExtensions
static class. [#1164, #1492] - Added
BlockMarshaler
static class. [#1164, #1492] - Added
BlockDigest.GetHeader()
method. [#1492] - Added
StateStoreExtensions
static class. [#1128, #1146, #1492] - Added
StoreExtensions.GetStateRootHash()
extension method. [#1128, #1146, #1492] - Added
DelayedRenderer<T>.HashAlgorithmGetter
property. [#1492] BlockDigest
became to implementIBlockExcerpt
. [#1492]- Added
InvalidBlockPublicKeyException
class. [#1457, #1507] - Added
InvalidBlockSignatureException
class. [#1457, #1507]
Behavioral changes
Block<T>.Transactions
property is now ordered byTransaction<T>.Id
so that it's consistent withIBlockContent<T>
's other implementations. As this behavior can be changed in the later releases, do not depend on its ordering, but explicitly sort them before use when the order needs to b guaranteed. [#1492]- Blocks and block metadata became to have their miners' public keys too. Although it is backward compatible to the earlier protocol version than 2, blocks with the protocol version 2 or later must have public keys. If a block lacks public key,
InvalidBlockPublicKeyException
is thrown. [#1457, #1507] PublicKey.ToString()
method now returns its hexadecimal representation in compressed form. [#1507]