Released on October 27, 2020.
Backward-incompatible API changes
- Extracted rendering methods from
IAction
toIRenderer<T>
, which is introduced in this version. From now on, rendering logic needs to be injected from outside throughBlockChain<T>.Renderers
, rather thanIAction
s knowing how to render themselves.IRenderer<T>
also unifiedBlockChain<T>.TipChanged
event, and introduced new events likeIActionRenderer<T>.RenderActionError()
,IActionRenderer<T>.RenderBlockEnd()
,IRenderer<T>.RenderReorg()
, andIRenderer<T>.RenderReorgEnd()
. [#860, #875, #959, #963]- Removed
IAction.Render()
method, which was replaced byIActionRenderer<T>.RenderAction()
. - Removed
IAction.Unrender()
method, which was replaced byIActionRenderer<T>.UnrenderAction()
. - Removed
BlockChain<T>.TipChanged
event, which was replaced byIRenderer<T>.RenderBlock()
. - Removed
PolymorphicAction<T>.Render()
andUnrender()
methods. - Removed
BlockChain<T>.TipChangedEventArgs
class.
- Removed
- Added methods related fungible asset states to
IAccountStateDelta
: [#861, #900, #954]UpdatedFungibleAssetsAccounts
propertyMintAsset(Address, Currency, BigInteger)
methodTransferAsset(Address, Address, Currency, BigInteger)
methodBurnAsset(Address, Currency, BigInteger)
methodGetBalance(Address, Currency)
method
- Added
IAccountStateDelta.StateUpdatedAddresses
property in order to distinguish state updates from asset states. [#861, #900] - Added an optional parameter
AccountBalanceGetter accountBalanceGetter
toBlock<T>.EvaluateActionsPerTx()
method. [#861, #900] BlockChain<T>.StageTransaction()
became to throwInvalidTxGenesisHashException
when it takes aTransaction<T>
from a heterogeneousBlockChain<T>
with a different genesis block. [#796, #878]- Added
renderers
optional parameter toBlockChain<T>()
constructor. [#883, #959, #963] - Added
BigInteger
-typedtotalDifficulty
parameter toBlock<T>()
constructor. [#666, #917] - Added
BigInteger
-typedpreviousTotalDifficulty
parameter toBlock<T>.Mine()
static method. [#666, #917] - Added
options
optional parameter toSwarm<T>()
constructor. [#926] ICryptoBackend
became toICryptoBackend<T>
. [#932]ICryptoBackend.Verify(HashDigest<SHA256>, byte[], PublicKey)
became toICryptoBackend<T>.Verify(HashDigest<T>, byte[], PublicKey)
[#932]- Added
ICryptoBackend<T>.Sign(HashDigest<T>, PrivateKey)
method. [#932] DefaultCryptoBackend
became toDefaultCryptoBackend<T>
. [#932]- Added
ImmutableArray<byte>
-typedpreEvaluationHash
parameter toBlockHeader
constructor. [#931, #935] - Added
HashDigest<SHA256>
-typedpreEvaluationHash
parameter toBlock<T>()
constructor. [#931, #935] - Replaced
SerializationInfoExtensions.GetValueOrDefault<T>()
toSerializationInfoExtensions.TryGetValue<T>()
. [#940] - Added
bool append = true
option to bothBlockChain<T>.MineBlock()
overloaded methods. Although this breaks ABI-level backward compatibility (i.e., you need to rebuild your assemblies), still is backward-compatible at API-level as the option is turned on by default. [#946] - Added
int? maxTransactions
option to bothBlockChain<T>.MineBlock()
overloaded methods. Although this breaks ABI-level backward compatibility (i.e., you need to rebuild your assemblies), still is backward-compatible at API-level as the option is turned on by default. [#1037, #1039, #1050] - Added
StateCompleterSet<T>? stateCompleters
option to twoBlockChain<T>.Append()
overloaded methods. Although this breaks ABI-level backward compatibility (i.e., you need to rebuild your assemblies), still is backward-compatible at API-level as the option has the default value (StateCompleterSet<T>.Recalculate
). [#946] - Added
CancellationToken cancellationToken = default(CancellationToken)
option toBlockChain<T>.MineBlock(Address miner)
overloaded method. Although this breaks ABI-level backward compatibility (i.e., you need to rebuild your assemblies), still is backward-compatible at API-level as the option has the default value. [#946] - Added
IImmutableSet<Address> trustedStateValidators = null
option to bothSwarm<T>.StartAsync()
overloaded methods. Although this breaks ABI-level backward compatibility (i.e., you need to rebuild your assemblies), still is backward-compatible at API-level as the option is turned on by default. [#946] - Removed
Peer.AppProtocolVersion
property. [#949] - Removed
Peer.IsCompatibleWith()
method. [#949] - Replaced
Peer(PublicKey, AppProtocolVersion)
constructor withPeer(PublicKey)
constructor. [#949] - Replaced
BoundPeer(PublicKey, DnsEndPoint, AppProtocolVersion)
constructor withPeer(PublicKey, DnsEndPoint)
constructor. [#949] - Extracted
IStore
's some methods dedicated to block states intoIBlockStatesStore
. [#950]ListStateKeys()
method.ListAllStateReferences()
method.LookupStateReference()
method.IterateStateReferences()
method.StoreStateReference()
method.ForkStateReferences()
method.GetBlockStates()
method.SetBlockStates()
method.PruneBlockStates()
method.
- The signature of
IStore.LookupStateReference<T>(Guid, string, Block<T>)
method was changed toLookupStateReference(Guid, string, long)
. [#950] - Added
IStateStore
-typedstateStore
toBlockChain<T>
constructor. [#950] - Replaced
Swarm<T>.FindSpecificPeerAsync(Address, Address, int, BoundPeer, TimeSpan?, CancellationToken)
method withSwarm<T>.FindSpecificPeerAsync(Address, int, TimeSpan?, CancellationToken)
. [#981] - Added
IActionContext.GetUnconsumedContext()
method. [#980] - Added
ImmutableArray<byte>
-typedstateRootHash
parameter toBlockHeader
constructor. [#986] - Added
HashDigest<SHA256>
-typedstateRootHash
parameter toBlock<T>()
constructor. [#986] - Added
IBlockPolicy<T>.MaxTransactionsPerBlock
property. [#1037, #1050] - Added
IBlockPolicy<T>.GetMaxBlockBytes()
method. [#201, #1050] IBlockPolicy<T>.DoesTransactionFollowPolicy()
method became to take additionalBlockChain<T>
parameter as its context. [#1012]- Methods in
BlockPolicy<T>
class becamevirtual
. [#1010] - Added
int maxTransactionsPerBlock
option to bothBlockPolicy<T>()
overloaded constructors. [#1037, #1050] - Added
int maxBlockBytes
andint maxGenesisBytes
options to bothBlockPolicy<T>()
overloaded constructors. [#201, #1050] BlockPolicy<T>()
constructor'sdoesTransactionFollowPolicy
parameter becameFunc<Transaction<T>, BlockChain<T>, bool>
on . [#1012]- Added
cacheSize
optional parameter toBlockSet<T>()
constructor. [#1013] - Removed
Address(SerializationInfo, StreamingContext)
constructor. [#1022] - Removed constructors from
InvalidMessageException
class. [#1021]
Backward-incompatible network protocol changes
- The message field
RecentStates.StateReferences
became toIImmutableDictionary<string, IImmutableList<HashDigest<SHA256>>>
fromIImmutableDictionary<Address, IImmutableList<HashDigest<SHA256>>>
. [#912] - The existing
RecentStates
message type (with the type number0x0f
) was replaced by a newRecentStates
message type (with the type number0x13
). [#912] - Added
BlockHeader.TotalDifficulty
property. [#666, #917] - The existing
Pong
message type (with the type number0x02
) was replaced by a newPong
message type (with the type number0x14
). [#459, #919, #920, #930] - The
TimestampThreshold
betweenBlock<T>
s was changed from 15 minutes to 15 seconds. [#922, #925] Swarm<T>
became to have 5 more message types:- Every message now contains app protocol version in its header. [#949]
- The existing
BlockHeaderMessage
message type (with the type number0x0d
) was replaced by a newBlockHeaderMessage
message type (with the type number0x0c
). [#1003, #1004] - Removed
PreloadBlockDownloadFailEventArgs
class. [#1002] - Removed
blockDownloadFailed
parameter fromSwarm<T>.PreloadAsync()
method. UseSwarmOptions.BlockDownloadTimeout
instead. [#1002]
Backward-incompatible storage format changes
- Added
RawTransaction<T>.GenesisHash
property. [#796, #878] - Added
BlockHeader.TotalDifficulty
property. [#666, #917]
Added APIs
- Added
Currency
struct. [#861, #900, #954] - Added
FungibleAssetValue
struct. [#861, #944, #954] - Added
AccountBalanceGetter
delegate. [#861, #900, #954] - Added
TurnClient.BindProxies()
method. [#756, #868] - Added
ActionEvaluation.Exception
property. [#860, [#875]] - Added
InvalidTxGenesisHashException
class. [#796, #878] - Added
InvalidBlockBytesLengthException
class. [#201, #1050] - Added
CurrencyPermissionException
class. [#861, #900] - Added
InsufficientBalanceException
class. [#861, #900, #954] - Added
BlockChain<T>.GetBalance()
method. [#861, #900] - Added
Block<T>.TotalDifficulty
property. [#666, #917] - Added
Block<T>.BytesLength
property. [#201, #1050] - Added
SwarmOptions
class. [#926] - Added
PeerChainState
struct. [#936] - Added
Swarm<T>.GetPeerChainStateAsync()
method. [#936] - Added
Swarm<T>.LastMessageTimestamp
property. [#964] - Added
Block<T>.PreEvaluationHash
property. [#931, #935] - Added
BlockHeader.PreEvaluationHash
property. [#931, #935] - Added
Transaction<T>.BytesLength
property. [#201, #1050] - Added
HashDigest(ImmutableArray<byte>)
constructor. [#931, #935] - Incomplete block states became able to be handled in more flexible way. [#929, #934, #946, #954]
- Replaced
BlockChain<T>.GetState(Address, HashDigest<SHA256>?, bool)
method withGetState(Address, HashDigest<SHA256>?, StateCompleter<T>)
method. SpecifyingcompleteStates: true
andfalse
can be replaced bystateCompleter: StateCompleters<T>.Recalculate
andStateCompleters<T>.Reject
, respectively. - Replaced
BlockChain<T>.GetBalance(Address, Currency, HashDigest<SHA256>?, bool)
method withGetState(Address, Currency, HashDigest<SHA256>?, StateCompleter<T>)
method. SpecifyingcompleteStates: true
andfalse
can be replaced bystateCompleter: FungibleAssetStateCompleters<T>.Recalculate
andFungibleAssetStateCompleters<T>.Reject
, respectively. - Added
StateCompleter<T>
delegate. - Added
FungibleAssetStateCompleter<T>
delegate. - Added
StateCompleterSet<T>
struct. - Added
StateCompleters<T>
static class. - Added
FungibleAssetStateCompleters<T>
static class. - Added
Swarm<T>.GetTrustedStateCompleterAsync()
method.
- Replaced
- Added
IRenderer<T>
interface. [#959, #963] - Added
IActionRenderer<T>
interface. [#959, #967, #970] - Added
AnonymousRenderer<T>
class. [#959, #963] - Added
AnonymousActionRenderer<T>
interface. [#959, #967, #970] - Added
DelayedRenderer<T>
class. [#980, #1029] - Added
DelayedActionRenderer<T>
class. [#980, #1029] - Added
LoggedRenderer<T>
class. [#959, #963] - Added
LoggedActionRenderer<T>
interface. [#959, #967, #970] - Added
BlockChain<T>.Renderers
property. [#945, #959, #963] - Added
BlockChain<T>.ActionRenderers
property. [#959, #967, #970] - Added
Swarm<T>.AppProtocolVersion
property. [#949] DefaultStore
became to implementIBlockStatesStore
. [#950]- Added
IStateStore
interface. [#950] - Added
IBlockStatesStore
interface. [#950] - Added
TrieStateStore
class. [#939] - Added
ITrie
interface. [#939, #1023] - Added
MerkleTrie
class. [#939, #1023] - Added
IKeyValueStore
interface. [#939] - Added
DefaultKeyValueStore
class. [#939] - Added
CacheableKeyValueStore
class. [#939] - (Libplanet.RocksDBStore)
RocksDBStore
became to implementIBlockStatesStore
. [#950] - (Libplanet.RocksDBStore) Added
RocksDBKeyValueStore
. [#939] - Added
InvalidBlockStateRootHashException
class. [#986] - Added
Block<T>.StateRootHash
property. [#986] - Added
BlockHeader.StateRootHash
property. [#986] - Added
MerkleTrieExtensions
static class. [#1023] - Added
IAccountStateDelta.PreviousStateRootHash
property to calculate states until previous action as state root hash. [#1030] - Added
UnexpectedlyTerminatedActionException.PreviousStateRootHash
property. [#1032]
Behavioral changes
- Improved performance of
Swarm<T>
. Transaction<T>.Create()
,Transaction<T>.EvaluateActions()
andTransaction<T>.EvaluateActionsGradually()
no longer throwUnexpectedlyTerminatedActionException
directly. Instead, it records an exception toActionEvaluation
s. [#860, #875]- Added
Transaction<T>.GenesisHash
property. [#796, #878] - Added
IAccountStateDelta.UpdatedAddresses
property contains asset updates besides state updates. [#861, #900] BlockChain<T>.Append()
method became to throwInvalidBlockBytesLengthException
if the given block's serialized bytes is longer than the limitation configured byIBlockPolicy.GetMaxBlockBytes()
. [#201, #1050]BlockChain<T>.MineBlock()
method became to cut off transactions to include to fit into the limitation configured byIBlockPolicy.GetMaxBlockBytes()
. [#201, #1050]Swarm<T>
became to ignore received transaction with different genesis hash. [#796, #878]Swarm<T>
became to ignore invalidBlockHeader
s immediately. [#898]Swarm<T>.PreloadAsync()
became to clean up only temporary chains. [#902]BlockPolicy<T>
became to validateBlock<T>.TotalDifficulty
property of aBlock<T>
. [#666, #917]Swarm<T>
became to preload from peer that has the most difficult chain. [#459, #919]Swarm<T>
became to promote the most difficult chain as a canonical chain instead of the longest chain. [#459, #919]Swarm<T>.BootstrapAsync()
method became not to throwTimeoutException
when it fails to connect to all neighbors. [#933]Swarm<T>
became to respond to the messages with different app protocol version. [#949]Swarm<T>.PreloadAsync()
became to execute the actions from the branchpoint rather than the genesis block when there is a branch point. [#991]BlockPolicy<T>
became to validateBlock<T>.StateRootHash
property of aBlock<T>
. [#986]Swarm<T>
became not to syncBlock<T>
s from the peers with different genesis block. [#1003, #1004]Swarm<T>
became to ignoreBlockHeaderMessage
from the peers with different genesis block. [#1003, #1004]BlockChain<T>
instead ofBlockPolicy<T>
became to validateBlock<T>
s to append so that even if an empty implementation ofIBlockPolicy<T>
is usedBlock<T>
s are unable to be appended toBlockChain<T>
. [#1010]BlockSet<T>[HashDigest<SHA256>]
andBlockChain<T>.Genesis
became cached so that they become faster to get. [#1013]Swarm<T>.PreloadAsync()
became to do not render blocks. [#1029]
Bug fixes
- Fixed a bug that
Swarm<T>
had failed to receive a request from TURN relay connections. [#404, #871, #890] - Fixed a bug where
Swarm<T>
had been terminated and never reconnected when it had been once disconnected from TURN (mostly due to sleep mode, etc.). [#909] - Fixed a bug in which pre-computed state delivery had failed when a state key is not an
Address
when preloading. [#912] - Fixed a bug where
UnexpectedlyTerminatedException
hadn't been serialized withBinaryFormatter
. [#913] - Fixed a bug where
TurnClient
hadn't applied cancellation token to its connections. [#916] - Fixed a bug where
BlockChain<T>.GetRawState()
had overwritten block states without read lock. [#927] - Fixed a bug that
Swarm<T>
had not respond toGetRecentStates
message when the target block does not exist in the chain. [#941] - Fixed a bug that
Swarm<T>.StartAsync()
had not worked afterSwarm<T>.StopAsync()
was once called. [#965] - Fixed a bug that
TurnClient
had thrownInvalidOperationException
when reconnecting. [#957, #972] - Fixed a bug that
Swarm<T>
had not received block headers after failing to receive previous blocks. [#996] - Fixed a bug that
Swarm<T>
had thrownInvalidGenesisBlockException
when reorg its chain repeatedly. [#996] - Fixed a bug that
Swarm<T>
had propagated invalid transactions. [#1043]
Static analyzer
- Introduced the Libplanet.Analyzers package, a Roslyn Analyzer, which checks if code has common mistakes prone to made with Libplanet-powered game apps, e.g., breaking determinism in
IAction
implementations. [#1034]
CLI tools
- The
planet
command became installable usingnpm
. [#923, #982] - Fixed a bug that ^H had not removed the rightmost character in passphrase prompts. [#983, #984]
- Added a new sub-command
planet mpt
. [#1023, #1026] - Introduced a configuration file. It's placed in: [#1023, #1026]
- Linux/macOS: $XDG_CONFIG_HOME/planetarium/cli.json
- Windows: %AppData%\planetarium\cli.json