namada icon indicating copy to clipboard operation
namada copied to clipboard

Murisi/denominated fee amount on 0.28.0

Open murisi opened this issue 6 months ago • 0 comments

Describe your changes

Made changes necessary to enable hardware wallets to first correctly display amounts in different tokens and second sign over them. Specifically, the following changes were made:

  • Converted WrapperTx::amount_per_gas_unit from Amount to DenominatedAmount to enable the hardware wallet to display amount with correct precision regardless of the token.
  • Modified the protocol to always align the DenominatedAmount::denom field before extracting the DenominatedAmount::admount field so that hardware wallet users cannot be tricked into signing unrelated amounts.
  • Added checked high level operations (like add, subtract, and multiply) to DenominatedAmount to reduce the potential for arithmetic mistakes when manipulating the significand and denomination.
  • Fixed the redacting of Transfer::amount and Transfer::token for fully shielded transactions. Also fixed the bug where Transfer::amount and its denomination did not correspond to Transfer::token.

The following are known omissions from this PR:

  • Ethereum bridge pool transactions: EthereumBridgePool::amount and EthereumBridgePool::fee_amount should probably be converted from Amount to DenominatedAmount to allow the hardware wallet to display quantities properly, and the protocol should safely convert them back to Amounts.

Indicate on which release or other PRs this topic is based on

Namada v0.28.0

Checklist before merging to draft

  • [x] I have added a changelog
  • [x] Git history is in acceptable state

murisi avatar Dec 09 '23 14:12 murisi