Skip to content

Libplanet 0.43.0

Compare
Choose a tag to compare
@github-actions github-actions released this 14 Oct 08:50
· 3463 commits to main since this release
0.43.0
d0cbfa7

Released on October 14, 2022.

Since 0.43.0, we officially provide @planetarium/tx, an npm package for creating unsigned transactions in JavaScript/TypeScript. Although it is still in experimental stage, which can build only unsigned transactions with a system action, its features will be added more in the future.

Backward-incompatible API changes

  • Removed DateTimeOffset? type parameter that allowed a creation of a genesis Block<T> with specific timestamp from BlockChain<T>.MakeGenesisBlock(). [#2321]
  • Overhauled constructors for BlockMetadata, BlockContent<T>, PreEvaluationBlockHeader, PreEvaluationBlock<T>, BlockHeader, and Block<T>. [#2321]
    • All unsafe constructors have been removed in order to prevent instantiation of invalid block related objects.
    • BlockMetadata has constructors BlockMetadata(IBlockMetadata) and BlockMetadata(long, DateTimeOffset, PublicKey, long, BigInteger, BlockHash?, HashDigest<SHA256>).
    • BlockContent has constructors BlockContent<T>(IBlockMetadata, IEnumerable<Transaction<T>> transactions), BlockContent<T>(BlockMetadata) and BlockContent<T>(BlockMetadata, IEnumerable<Trnasaction<T>> transactions).
    • PreEvaluationBlockHeader has constructors PreEvaluationBlockHeader(IPreEvaluationBlockHeader) and PreEvaluationBlockHeader(BlockMetadata, (Nonce, ImmutableArray<byte>)).
    • PreEvaluationBlock<T> has constructors PreEvaluationBlock<T>(IPreEvaluationBlockHeader, IEnumerable<Transaction<T>>) and PreEvaluatoinBlock<T>(BlockContent<T>, (Nonce, ImmutableArray<byte>)).
    • BlockHeader has constructors BlockHeader(IBlockHeader) and BlockHeader(PreEvaluationBlockHeader, (HashDigest<SHA256>, ImmutableArray<byte>?, BlockHash)).
    • Block<T> has constructors Block<T>(IBlockHeader, IEnumerable<Transaction<T>>) and Block<T>(PreEvaluationBlock<T>, (HashDigest<SHA256>, ImmutableArray<byte>, BlockHash)).
  • BlockContent<T> no longer inherits BlockMetadata and PreEvaluationBlock<T> no longer inherits PreEvaluationBlockHeader. [#2321]
  • Both BlockMetadata and BlockContent<T> are made immutable. Their properties can no longer be assigned to. [#2321]
  • Copy extension methods for BlockMetadata and BlockContent<T> removed. [#2321]
  • (Libplanet.Extensions.Cocona) The return type of Utils.DeserializeHumanReadable<T>() static method became T? (was T). [#2322]

Added APIs

  • System actions now have methods to check equality. [#2294]
    • Mint now implements IEquatable<Mint>.
    • Mint now implements IEquatable<IAction>.
    • Transfer now implements IEquatable<Transfer>.
    • Transfer now implements IEquatable<IAction>.
  • (Libplanet.Net) Added IRoutingTable interface. [#2046, #2229]
  • (Libplanet.Net) RoutingTable now implements IRoutingTable interface. [#2046, #2229]
  • Added ActionEvaluator<T>.GenerateRandomSeed() static method. [#2131, #2236]
  • Each BlockMetadata, PreEvaluationBlockHeader, and BlockHeader can be accessed from any "larger" type object through properties. [#2321]
    • BlockMetadata can be accessed through BlockContent<T>.Metadata or PreEvaluationBlockHeader.Metadata.
    • PreEvaluationBlockHeader can be accessed through PreEvaluationBlock<T>.Header or BlockHeader.Header.
    • BlockHeader can be accessed thorugh Block<T>.Header (this has not changed, but only listed here for completeness in narrative).
  • (Libplanet.Explorer) Added updatedStates, updatedFungibleAssets, fungibleAssetsDelta GraphQL fields to TxResultType. [#2353]
  • (Libplanet.Explorer) Added nextNonce query in TransactionQuery<T>. [#2356, #2366]

Behavioral changes

  • Many types became serialized and deserialized better with System.Text.Json.JsonSerializer as they now have their own custom converters. Note that these serializations are unavailable on Unity due to its incomplete reflection support. [#2294, #2322]
    • An Address became represented as a single hexadecimal string in JSON. [#2322]
    • A BlockHash became represented as a single hexadecimal string in JSON. [#2322]
    • A Currency became represented as an object with values in JSON. Note that it contains its Hash and it throws JsonException if a JSON object to deserialize has an inconsistent Hash with other field values. [#2322]
    • A FungibleAssetValue became represented as an object with its Currency object and Quantity string. [#2322]
    • A HashDigest<T> became represented as a single hexadecimal string in JSON. [#2322]
    • A Transaction<T> became represented as an object with values in JSON. [#2294]
    • A TxId became represented as a single hexadecimal string in JSON. [#2322]
    • System actions became represented as a Bencodex JSON Representation of their PlainValue with type_id field. [#2294]
  • System actions' GetHashCode() and Equals(object) methods now check value equality (rather than reference equality). [#2294]
  • A ValidateAppProtocolVersion became allow validation of different extra. [#2380]

Bug fixes

  • Interface methods IComparable.CompareTo() and IComparable<T>.CompareTo() for Address are now accessible. [#2384]

Dependencies

CLI tools

  • Added planet tx subcommand group. [#2294]
    • Added planet tx analyze subcommand.
    • Added planet tx help subcommand.