Closed kasparkallas closed 5 months ago
test failing. is it related?
test failing. is it related?
Yep, it's related. It's caused by the fact that when AccountTokenSnapshot
is initialized then the updatedAt
is immediately set.
Even though every time the entity is initialized, later on the balance function is called outside of it. There are 3 ways to solve it:
updatedAt
update from the initializationIt's probably best to do 3 as it's the safest and is needed anyway if we are to add more RPC optimizations.
I'll not add this to the next deployment because of this, so I'll close this PR for now and continue with the other optimization PR.
Why?
To speed up indexing and to reduce indexing time.
What?
Tried to massively reduce RPC calls in the following branch: https://github.com/superfluid-finance/protocol-monorepo/pull/1948 but it needs more testing. This is the lowest hanging fruit fix that struck out from that endeavour, which is to not do an RPC call for a balance if it has already been done in the same block.
How?
Add a simple condition to check whether the entity has been updated in the same block.
Other
The fix might not have much effect if the
balanceOf
calls are somehow efficiently cached in the RPC, although it would still reduce I/O.