[go: up one dir, main page]

SDK/rust: remove WithDefaultValue from TransactionContent.parameters

What

This MR changes the type of TransactionContent.parameters from WithDefaultValue<Parameters> to Parameters.

Why

The purpose of wrapper WithDefaultValue is to define how parameters are encoded in TransactionContent.parameters.
But when this parameters is used, what we want is a Parameters directly. WithDefaultValue is not part of our business logic but only for (de/)encoding purposes.

How

This MR introduces a new internal type InternalTransactionContent that will hold how TransactionContent are (de/)encoded.
The new implementations of NomReader and BinWriter of TransactionContent are simply mapping InternalTransactionContent implementation using conversion functions.

The introduced InternalTransactionContent have parameter types constraint with AsRef to allow the right conversion:

  • conversion from InternalTransactionContent<Narith, Contract, Parameters> for NomReader
  • conversion to InternalTransactionContent<&'a Narith, &'a Contract, &'a Parameters> for BinWriter

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading