Libplanet 0.2.0
Released on April 5, 2019.
-
PrivateKey.Decrypt()
now throws anInvalidCiphertextException
instead of returningnull
whencipherText
is invalid. [#140] -
Transaction<T>
'sSender
–Recipient
model was replaced bySigner
–UpdatedAddresses
model. Unlike cryptocurrencies, transactions in games are not necessarily a transfer of assets, so it is difficult to determine what type of asset is transferred or who will receives the asset. A more useful perspective is, like what kind of transformation is performed, or what states are changed. To be close to this perspective, we decided to get rid ofTransaction<T>.Recipient
(which is singular) and haveTransaction<T>.UpdatedAddresses
(which is plural) instead. As there is no more asset to transfer, the termSender
was also renamed toSigner
, which fits more to the new perspective. [#121]- Renamed
Transaction<T>.Sender
,RawTransaction.Signer
, andIActionContext.From
properties toSigner
. The corresponding parameter names on constructors and methods were also renamed too. - Old
Transaction<T>.Make()
factory method is replaced by newTransaction<T>.Create()
factory method. Thetimestamp
parameter became optional, and the new optionalupdatedAddresses
parameter was added. - Removed
IActionContext.To
property. Transaction<T>.Recipient
andRawTransaction.Recipient
properties were replaced byTransaction<T>.UpdatedAddresses
andRawTransaction.UpdatedAddresses
properties. The corresponding parameter names on constructors and methods were replaced too.- Since the schema of
RawTransaction
class was changed, the serialization format of transactions and blocks were also changed. It affects to the way to generateTransaction<T>.Signature
,Transaction<T>.Id
, andBlock.Hash
values as well. - Added
InvalidTxUpdatedAddressesException
exception class. - A nullary overload of
Block<T>.Validate()
method was gone so that the block validation API is always time-wise. Instead,Block<T>.Validate()
method now has only one overload:Validate(DateTimeOffset, AccountStateGetter)
returningIAccountStateDelta
. Block<T>.Validate()
andBlockChain<T>.Validate()
methods now can throw anInvalidTxUpdateAddressesException
.
- Renamed
-
The
Address
esIAction
tries to update no more need to be manually coded usingIAction.RequestStates()
method. That method was removed at all, and updatedAddress
es became automatically determined (for the most cases) by track "dirties" on rehearsal mode. This mode dry-runsIAction
s with emptyIActionContext.PreviousStates
. [#121]- Added
AccountStateGetter
delegate to provide a read-only view to account states. - Added
IAccountStateDelta
interface to replaceAddressStateMap
. The interface purposes to provide a read-write view to account states with maintainingUpdatedAddresses
(so-called "dirty"). [#98] - The type of
IActionContext.PreviousStates
property was changed fromAddressStateMap
toIAccountStateDelta
. - Added
IActionContext.Rehearsal
property. [#131, #135] - Added
UnexpectedlyTerminatedTxRehearsalException
class. [#132, #136] - The return type of
IAction.Execute()
method was changed fromAddressStateMap
toIAccountStateDelta
. - Removed
IAction.RequestStates()
method because there is no need for it and thus it is not used anymore. - Added
Transaction<T>.EvaluateActions()
method. - Added
Block<T>.EvaluateActions()
generator method.
- Added
-
The built-in subtype polymorphism of
IAction
andTransaction<T>
was moved to a separated newPolymorphicAction<T>
abstract class. Polymorphic actions now should be wrapped byPolymorphicAction<T>
. For example, the following code:public abstract class AbstractAction : IAction { ... } [ActionType("attack")] public sealed class Attack : AbstractAction { ... } [ActionType("sleep")] public sealed class Sleep : AbstractAction { ... }
var tx = Transaction<AbstractAction>.Create( ..., actions: new[] { new Attack(...), ... } );
should be changed to like:
var tx = Transaction<PolymorphicAction<AbstractAction>>.Create( ..., actions: new[] { new PolymorphicAction<AbstractAction>(new Attack(...)), ... } );
It can be simpler by implicit casting:
var tx = Transaction<PolymorphicAction<AbstractAction>>.Create( ..., actions: new PolymorphicAction<AbstractAction>[] { new Attack(...), } );
[#169]
- The type parameter
T
ofTransaction<T>
,Block<T>
, andBlockChain<T>
became to require having apublic
parameterless constructor (i.e.,new()
) besides implementingIAction
interface. This means anabstract class
or aninterface
no more can be passed toT
, but only a concreteclass
or astruct
can be passed.
- The type parameter
-
Fixed a bug that mutating a collection of
IAction
s passed to constructors or factory methods ofTransaction<T>
had affected made instances as well. The type ofTransaction<T>.Actions
property was changed fromIList<T>
toIImmutableList<T>
. The corresponding parameters on constructors and factory methods also were changed to takeIEnumerable<T>
instead ofIList<T>
. -
InvalidTxException
and its subclasses became to haveTxId
property and the corresponding constructor parameter. This can be useful when multipleTransaction<T>
objects are validated at once. -
Added
Address.Size
constant, which is fixed to theInt32
20. -
Fixed a bug that
Block<T>.Validate()
had not thrownInvalidTxException
even if there is any integrity error on itsTransactions
. -
Improved the write throughput of
BlockChain<T>
while pollingBlockChain<T>.GetStates()
-
Swarm.AddPeersAsync()
was fixed so that unreachablePeer
s are ignored. [#128] -
Swarm
became able to relay their connection via TURN (RFC 5766) to NAT traversal. To enable this, its constructor (Swarm()
) takes the newly addedIceServer
s as configuration. -
Since we decided to depend on TURN (RFC 5766) and STUN (RFC 5389) to work around NAT so that
Peer
's endpoints don't have to be multiple,Peer.Urls
was renamed toPeer.EndPoint
and its type also was changed fromIImmutableList<Uri>
toDnsEndPoint
. [#120, #123 by Yang Chun Ung, #126, #127, #165, #166] -
Swarm
became to ignore tip blocks of the same height (Index
) that it already has and deal with only longer (higher) blocks. -
Fixed a bug that occured when
Swarm
was handling multiple responses at the same time. -
Fixed a bug that the
Swarm
constructor had hanged in certain runtimes like Unity engine. -
Removed
AddressTransactionSet
which handles handleAddress
toIEnumerable<TxId>
indices, and the following methods inIStore
:IStore.IterateAddresses()
IStore.GetAddressTransactionIds()
IStore.AppendAddressTransactionId()
IStore.CountAddresses()
-
Added
IStore.ListNamespaces()
method. -
IStore.CountBlocks()
andIStore.CountTransactions()
became to returnlong
. -
Block/tx-related methods in
IStore
andBaseIndex<T>
no longer accepts@namespace
parameter. It means that even if a forking occurs, the same block/tx files are shared. -
Fixed a bug that made unnecessary fork when receiving blocks from other peer.
-
Action classes that implement
IAction
but lackActionTypeAttribute
became reported byPolymorphicAction<T>
throwingMissingActionTypeException
at runtime. [#28, #144, #169] -
Turn into parameter in
BlockPolicy
's constructor to milliseconds. [#151] -
BencodexFormatter
became able to serializeBigInteger
. [#159] -
Made
Swarm
possible to configure its networkappProtocolVersion
and, to ignore peers if their version is different. [#167], [#170] -
Renamed
Block<T>.RewardBeneficiary
toBlock<T>.Miner
. [#174] -
Added
BlockChain<T>.Blocks
property. [#176] -
Added
BlockChain<T>.Transactions
property. [#176]