anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 945 forks source link

Reduce masp events #3824

Open grarco opened 4 days ago

grarco commented 4 days ago

Right now, if a transaction contains at least a valid masp transfer, we emit two attributes in the tx event:

  1. masp_tx_block_index to point to the transaction in the block
  2. masp_tx_batch_refs to point to the the section(s) containing the masp data

These two attributes always go together, they are either both present or non of them is. We should try to collapse them into a single attribute.

Also, we should try to see if it is possible to manage this attribute in a batch without the need for ExtendedTxResult.

grarco commented 4 days ago

After some attempts, I concluded that the last part of this issue cannot be achieved. We want to emit a single masp attribute per tx event (also because we don't have support to build dynamic attribute identifiers): so we cannot emit the event for every tx in a batch (using the ´event´ field of BatchedTxResult). At the same time, we don't have an already available support structure where to dump the masp data coming from every inner transaction: to create one would simply mean to circle back to something similar to the ExtendedTxResult type we wanted to remove.

brentstone commented 4 days ago

Thx, so what is the priority level of accomplishing the first part of this issue would you say?

grarco commented 2 days ago

Actually, I'm reopening this as it is possible to achieve the last part of this issue by emitting a separate MASP event instead of adding it as an attribute of the Tx event. We could keep the current code in protocol and push an extra event to the write log if the tx is successful or we could also leave the tx itself push the event directly from wasm. Once we've done this we can remove the ExtendedTxResult type. The depending tools (such as the masp indexer) should be updated though