-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use batch distribute_rewards for cross-chain distribution efficiency #77
Comments
The function to optimise is this mesh-security/contracts/consumer/converter/src/contract.rs Lines 305 to 329 in 8e520df
Basically by creating a batch variant of the |
@maurolacy Do we want to keep events in the current form (N events emitted for N validators having rewards distributed)? I guess this makes it easier for some hypothetical future indexer to index these txes? |
I think so, yes. Let's keep the events in their current form. |
The converter contract has distribute_reward, which we use now, which is called once per each validator getting rewards and then issues an ibc packet. This is N contract calls and N ibc packets every epoch.
There is also a distribute_rewards method that takes a batch of validators (all N?). This means only one contract call (saving N-1 * 60k gas). We could also use this to make one ibc packet with all distribution info.
This requires much more complex withdraw logic in the virtual-staking contract, and first we need to be able to cover that with unit tests. This in turn is blocked on some sylvia updates, and likely some cw-multi-test updates.
But when we have those dependencies ready, this would be a nice optimization to tackle.
The text was updated successfully, but these errors were encountered: