Overview
We need to update the claim-rewards
wasm tx in the Namada on-chain storage. But first, we need to also increase the max_block_gas
in the protocol parameters, which restricts the maximum allowable combined gas of all txs in a block.
Why
The new new claim-rewards
tx simply has the addition that it will emit an event containing the claimed token amount in the tx that can then be consumed by an indexer. Some service providers and custodians are relying on this in order to easily track reward amounts claimed. It is more difficult to change this at the protocol level and would likely require an upgrade if done so, so this is the easiest and most effective solution.
However, because the wasm code in the governance proposal is large (due to contaning the bytes of code for the new wasm to write into storage), it currently requires ~4.3M gas in order to execute the init-proposal
tx to initialize the proposal. The current maximum allowed gas in a block is 3M gas, though. Thus, we must first raise the max block gas.
Proposal details
- Increase the
max_block_gas
from 3M to 5M. - Initialize proposal to write the new
claim-rewards
tx into storage. The code that executes this step can be viewed here.
Validation
Both of these proposals have already been successfully executed and tested on Campfire and Housefire testnets.
To quickly see the changes in action, one may claim rewards with claim-rewards
on either of these testnets currently, and then observe in the output logs of the tx that there are now Events provided with the claimed amount in the source-accounts
and target-accounts
data fields.
Here is an example workflow that I just executed on Campfire testnet:
> namadac rewards --source b0 --validator tnam1q8r4z80f8m4czksdawczf4wgvdtk8jegdg4kzh73 --node $NODE
Current rewards available for claim: 129.616768 NAM
> namadac claim-rewards --source b0 --validator tnam1q8r4z80f8m4czksdawczf4wgvdtk8jegdg4kzh73 --node $NODE
Transaction added to mempool.
Transaction hash: A4B3633CDDDC0E5C8C9A774C0DA3B82C11312AA08E6164D6D2F7FF9446C36E5E
Transaction batch A4B3633CDDDC0E5C8C9A774C0DA3B82C11312AA08E6164D6D2F7FF9446C36E5E was applied at height 648007.
Batch results:
Transaction 89AFDCFCDCD73B2D4FDC2F1F94CCD35E410A8918DE3F9397B1CCBF638B9A11E7 was successfully applied.
Events:
- tx - token/transfer:
- post-balances: [[["internal-address/tnam1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8j2fp","tnam1qy440ynh9fwrx8aewjvvmu38zxqgukgc259fzp6h"],"2001145044243206"],[["internal-address/tnam1qz2yvfzgwzy52r68xm9jtjfyywqaecwpxvx8fs02","tnam1qy440ynh9fwrx8aewjvvmu38zxqgukgc259fzp6h"],"403546356900"]]
- source-accounts: [[["internal-address/tnam1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8j2fp","tnam1qy440ynh9fwrx8aewjvvmu38zxqgukgc259fzp6h"],"129616768"]]
- target-accounts: [[["internal-address/tnam1qz2yvfzgwzy52r68xm9jtjfyywqaecwpxvx8fs02","tnam1qy440ynh9fwrx8aewjvvmu38zxqgukgc259fzp6h"],"129616768"]]
- token-event-descriptor: pos-claim-rewards
The batch consumed 18573 gas units.
> namadac rewards --source b0 --validator tnam1q8r4z80f8m4czksdawczf4wgvdtk8jegdg4kzh73 --node $NODE
Current rewards available for claim: 0.000000 NAM