namada icon indicating copy to clipboard operation
namada copied to clipboard

Remove `Transfer` dependency in MASP vp

Open grarco opened this issue 9 months ago • 0 comments

Currently we have one last place in the masp vp where we depend on the Transfer object, that is where we retrieve the Transaction object. This poses a hard constraint on that specific data structure that limits the validity predicate and, therefore, the transactions themselves. It also poses a problem in terms of upgradeability because, in the case we needed to upgrade the transaction, instead of just working with the allowlist we'd be forced to upgrade the protocol too.

We could try to remove that dependency while still making sure that the logic of the vp is correct and that clients can correctly query the applied masp transactions (necessary to produce valid transactions in turn). To achieve that we could modify the vp (and the transfer transaction) so that:

  • Instead of deserializing the tx data to Transfer, the vp expects the transaction to publish the hash of the MaspTx section (containing the Transaction object) as an Action (temporary write log write, dropped before committing to storage), this way we remove the dependency on the specific transaction
  • The vp loads the Transaction object from the revealed hash section and validates the changed keys based on this
  • If the transaction is valid, the masp section hash is published in the tx event logs, this is necessary so that clients can query the correct data: a tx could potentially carry more than one masp section but fetching and evaluating sections that have not been applied to the chain will lead to clients producing invalid transactions

We'd also need to modify client and SDK code to adapt to this new logic.

grarco avatar Apr 27 '24 11:04 grarco