status-im / status-go

The Status module that consumes go-ethereum
https://status.im
Mozilla Public License 2.0
728 stars 246 forks source link

Use Multicall to aggregate token checks for the member re-evaluation #5187

Open jrainville opened 4 months ago

jrainville commented 4 months ago

Problem

Right now, we call the balance check for each member as a different call to the provider. It can be slow and also counts a a different call for the limits.

Implementation

If we were to use the Multicall, we could easily reduce the number of calls we make and speed up the re-evaluation significantly.

The difficulty is mostly in first parsing all the data we have so know which addresses and tokens to ask the balances for.

Then we need to parse the result for the permissions that we have.

Acceptance Criteria

Notes

We might need a spike first to know if it's even doable and if the contract works well

Also, this might clash with the initiative to do parallel calls. We need to investigate if it's better to do parallel calls or use Multicall

supragya commented 4 months ago

I would like to pick up this investigation, should no-one else be working on it actively.

jrainville commented 4 months ago

@supragya thanks for offering!

Do note that we are still actively improving the re-evaluation function. For example, this issue will for sure conflict. So it's probably safer to check into using Multicall after https://github.com/status-im/status-desktop/issues/14914 is fixed.

If you do having insights into how Multicall works and tips, do please tell us! :smile: