Libplanet changelog
Version 0.3.0
Released on May 31, 2019.
Backward-incompatible interface changes
- Added
IAction.Render(IActionContext, IAccountStateDelta)method. [#31, #212] - Added
IAction.Unrender(IActionContext, IAccountStateDelta)method. [#31, #212] BlockChain<T>.Validate()method became to receiveIReadOnlyList<Block<<T>>instead ofIEnumerable<Block<T>>. [#205]IBlockPolicy<T>.GetNextBlockDifficulty()method became to receiveIReadOnlyList<Block<<T>>instead ofIEnumerable<Block<T>>. [#205]- Added
IBlockPolicy<T>.ValidateNextBlock(IReadOnlyList<Block<T>>, Block<T>)method. [#210] - Removed
IBlockPolicy<T>.ValidateBlocks()method. [#210] BlockChain<T>[int]became to throwArgumentOutOfRangeExceptioninstead ofIndexOutOfRangeException. [#210]- Removed
KeyEquals()methods from all classes and structs. [#216] Swarmclass now does not implementIEquatable<Swarm>anymore and itsEquals(object)method andGetHashCode()method became to have default behavior ofobjectclass. [#216]- Also,
Swarmclass now does not implementIDisposabletoo. ThusSwarm.Dispose()was removed too. [#218] Swarmbecame to use a queue to maintain internal messages. [#218]- The broadcasting methods are no more
async, so they are renamed as below.Swarm.BroadcastBlocksAsync()→Swarm.BroadcastBlocks()Swarm.BroadcastTxsAsync()→Swarm.BroadcastTxs()
- The broadcasting methods are no more
- The type of
Block<T>.Difficultyis changed tolonginstead ofint, and related classes method parameters and field types have changed accordingly. - Removed
HashDigest.HasLeadingZeroBits()method. [#213] - The signature of
IStore.PutBlock<T>(Block<T>)method was changed toPutBlock<T>(Block<T>, Address). [#189, #197] Block<T>.Hashis no longer calculated using the full data of theTransaction<T>, but is calculated using only theTransaction<T>.Id. [#234]- Added
IStore.LookupStateReference<T>(string, Address, Block<T>)method. [#232] - Added
IStore.StoreStateReference<T>(string, Block<T>)method. [#232] - Added
IStore.ForkStateReferences<T>(string, string, Block<T>, IImmutableSet<Address>method. [#232] - Removed
Block<T>.Validate()andBlock<T>.EvaluateActions()method. [#243] - Added
Transaction<T>.NonceandRawTransaction.Nonceproperties. [#246] - Added
IStore.GetTxNonce(string, Address)method. [#246] - Added
IStore.IncreaseTxNonce<T>(string, Block<T>)method. [#246] - Added
IStore.ForkTxNonce<T>(string, string, Block<T>, IImmutableSet<Address>method. [#246]
Added interfaces
BlockChain<T>became to implementIReadOnlyList<Block<T>>. [#205]- Added
Swarm.DifferentVersionPeerEncounteredevent handler that can handle events when a different version of a peer is discovered. [#167], [#185] - Added
Peer.AppProtocolVersionproperty. [#185] - Added
Swarm.PreloadAsync()method to explicitly and preemptively download initial blocks beforeSwarm.StartAsync<T>()being called. [#204], [#206] - Added
BlockDownloadStateclass to represent a block downloading state. [#204], [#206] - Added
BlockPolicyExtension.ValidateBlocks<T>(IBlockPolicy<T>, IReadOnlyList<Block<T>>, DateTimeOffset)method. [#210] - Added
Transaction<T>.EvaluateActionsGradually(HashDigest<SHA256>, long, IAccountStateDelta, Address, bool)method. [#31, #212] - Added
Block<T>.EvaluateActionsPerTx(AccountStateGetter)method. [#31, #212] - Added
HashDigest.Satisfies()method. [#213] BlockPolicy<T>constructor became to receive theminimumDifficultyand the miningdifficultyBoundDivisor. [#213]- Added
BlockChain<T>.UnstageTransactions()method. [#223] Swarmconstructor became to receive alinger(ormillisecondsLinger) parameter. This purposes to determine how long to wait for pending messages when aSwarminstance is requested to terminate.- Added
NamespaceNotFoundExceptionclass. [#232] - Added
Block<T>.Evaluate()method. [#243] - Made
InvalidBlockTimestampExceptionclasspublicso that it can be caught. [#133, #251] - Added
InvalidTxNonceExceptionclass. [#246]
Behavioral changes
Swarm.StartAsync()now receives the height of blocks (tipIndex) from other known peers and synchronizes the blocks if necessary before propagating/receiving pinpointed recent blocks to prevent inefficient round-trips. [#187, #190]- The calculation algorithm of
BlockPolicy<T>.GetNextBlockDifficulty()method was changed to the Ethereum Homestead algorithm except for the difficulty bomb. [#213] - The difficulty was changed from representing the number of leading zeros of target number to representing a divisor to obtain the target number. [#213]
BlockSet<T>[int]changed so as not to validate a block. [#231]- Improved read performance of
Block<T>.HashandTransaction<T>.Id. [#228, #234] Swarm.StartAsync()now does not callSwarm.StopAsync()anymore, thereforeSwarm.StopAsync()should be explicitly called. [#236]Transaction<T>.EvaluateActionsGradually()became to recordIAccountStateDelta.SetState()calls even if its argument is the same to the previous state. [#241]Block<T>.Validate()andBlock<T>.EvaluateActions()are integrated intoBlock<T>.Evaluate(). [#243]BlockChain<T>.Append()became to executeAction.Execute()only once per action in theBlock<T>. [#243]BlockChain<T>.Append()method became to throwInvalidTxNonceExceptionwhen theTransaction<T>.Noncedoes not correspond to itsSigner's current nonce. [#246]Swarmbecame to enforceForceDotNet.Force()in AsyncIO while it's running on Mono runtime. [#247]
Bug fixes
- Fixed a bug that TURN relay had been disconnected when being connected for longer than 5 minutes. [#198]
- Fixed a bug that
Swarmhad attempted to use TURN relay even if thehostargument was given. [#198] - Improved the read throughput of
BlockChain<T>.Append(). - Improved overall read throughput of
BlockChain<T>while blocks are being mined byBlockChain<T>.MineBlock(). [#191] - Fixed a bug that
TurnClientExceptionhad been thrown by Swarm when a STUN nonce is stale. [#193] - Fixed
BlockChain<T>.GetStates()had descended to the bottom (i.e., the genesis block) where a givenAddressrefers to a nonexistent account (i.e., never used before). [#189, #192] - Fixed a bug that a TURN connection had turned unavailable after it once failed to parse a message (due to a corrupted packet). [#215]
- Instead of validating the entire blocks,
BlockChain<T>.Append()method became to validate only the next block to be appended. [#210] - Improved
BlockChain<T>.Fork()performance by avoiding double validation of already validated blocks. [#215] - Removed unnecessary writer locks on
BlockChain<T>.StageTransactions(). [#217] - Improved concurrency of
BlockChain<T>.Append()method by removing unnecessary race conditions. [#217] - Fixed a bug that
Swarmcould not properly communicate withPeerbehind NAT. [#240] - Fixed a bug that
BlockChain<T>.FindNextHashes()throwsArgumentOutOfRangeExceptionwhen chain is empty. - Fixed a bug that
TurnClient.AcceptRelayedStreamAsync()didn't handle concurrent connections correctly. [#256]
Version 0.2.2
Released on April 12, 2019.
- Fixed a bug that
BlockChain<T>.GetStates()had returned slower than necessary for many addresses. [#189, #192]
Version 0.2.1
Released on April 7, 2019.
This version purposes to entirely replace 0.2.0, because a wrong .nupkg file was uploaded to 0.2.0 on NuGet Gallery. Note that 0.2.0 on NuGet Gallery was unlisted.
Version 0.2.0
Released on April 5, 2019.
PrivateKey.Decrypt()now throws anInvalidCiphertextExceptioninstead of returningnullwhencipherTextis invalid. [#140]Transaction<T>'sSender–Recipientmodel was replaced bySigner–UpdatedAddressesmodel. Unlike cryptocurrencies, transactions in games are not necessarily a transfer of assets, so it is difficult to determine what type of assert 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 termSenderwas also renamed toSigner, which fits more to the new perspective. [#121]- Renamed
Transaction<T>.Sender,RawTransaction.Signer, andIActionContext.Fromproperties 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. Thetimestampparameter became optional, and the new optionalupdatedAddressesparameter was added. - Removed
IActionContext.Toproperty. Transaction<T>.RecipientandRawTransaction.Recipientproperties were replaced byTransaction<T>.UpdatedAddressesandRawTransaction.UpdatedAddressesproperties. The corresponding parameter names on constructors and methods were replaced too.- Since the schema of
RawTransactionclass 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.Hashvalues as well. - Added
InvalidTxUpdatedAddressesExceptionexception 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
AddressesIActiontries to update no more need to be manually coded usingIAction.RequestStates()method. That method was removed at all, and updatedAddresses became automatically determined (for the most cases) by track "dirties" on rehearsal mode. This mode dry-runsIActions with emptyIActionContext.PreviousStates. [#121]- Added
AccountStateGetterdelegate to provide a read-only view to account states. - Added
IAccountStateDeltainterface to replaceAddressStateMap. The interface purposes to provide a read-write view to account states with maintainingUpdatedAddresses(so-called "dirty"). [#98] - The type of
IActionContext.PreviousStatesproperty was changed fromAddressStateMaptoIAccountStateDelta. - Added
IActionContext.Rehearsalproperty. [#131, #135] - Added
UnexpectedlyTerminatedTxRehearsalExceptionclass. [#132, #136] - The return type of
IAction.Execute()method was changed fromAddressStateMaptoIAccountStateDelta. - 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
IActionandTransaction<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
TofTransaction<T>,Block<T>, andBlockChain<T>became to require having apublicparameterless constructor (i.e.,new()) besides implementingIActioninterface. This means anabstract classor aninterfaceno more can be passed toT, but only a concreteclassor astructcan be passed.
- The type parameter
Fixed a bug that mutating a collection of
IActions passed to constructors or factory methods ofTransaction<T>had affected made instances as well. The type ofTransaction<T>.Actionsproperty was changed fromIList<T>toIImmutableList<T>. The corresponding parameters on constructors and factory methods also were changed to takeIEnumerable<T>instead ofIList<T>.InvalidTxExceptionand its subclasses became to haveTxIdproperty and the corresponding constructor parameter. This can be useful when multipleTransaction<T>objects are validated at once.Added
Address.Sizeconstant, which is fixed to theInt3220.Fixed a bug that
Block<T>.Validate()had not thrownInvalidTxExceptioneven 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 unreachablePeers are ignored. [#128]Swarmbecame able to relay their connection via TURN (RFC 5766) to NAT traversal. To enable this, its constructor (Swarm()) takes the newly addedIceServers 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.Urlswas renamed toPeer.EndPointand its type also was changed fromIImmutableList<Uri>toDnsEndPoint. [#120, #123 by Yang Chun Ung, #126, #127, #165, #166]Swarmbecame 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
Swarmwas handling multiple responses at the same time.Fixed a bug that the
Swarmconstructor had hanged in certain runtimes like Unity engine.Removed
AddressTransactionSetwhich handles handleAddresstoIEnumerable<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
IStoreandBaseIndex<T>no longer accepts@namespaceparameter. 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
IActionbut lackActionTypeAttributebecame reported byPolymorphicAction<T>throwingMissingActionTypeExceptionat runtime. [#28, #144, #169]Turn into parameter in
BlockPolicy's constructor to milliseconds. [#151]BencodexFormatterbecame able to serializeBigInteger. [#159]Made
Swarmpossible to configure its networkappProtocolVersionand, to ignore peers if their version is different. [#167], [#170]Renamed
Block<T>.RewardBeneficiarytoBlock<T>.Miner. [#174]Added
BlockChain<T>.Blocksproperty. [#176]Added
BlockChain<T>.Transactionsproperty. [#176]
Version 0.1.1
Released on March 5, 2019.
- Improved stability of
SwarmandSwarmTest.
Version 0.1.0
Initial release. Released on February 26, 2019.