balancer / balancer-v2-monorepo

Balancer V2 Monorepo
https://balancer.fi/
GNU General Public License v3.0
313 stars 381 forks source link

Optimize pool storage reads #2

Closed nventuro closed 3 years ago

nventuro commented 4 years ago

Pack the pool struct and access it in such a way that storage reads are minimized in high-frequency actions. For example, swap might only require reading the swap fee and token balances.

nventuro commented 4 years ago

It's been suggested to have multiple types of Trading Strategies, including one that only requires information about the pair being traded, and one that requires all balances in the pool. This information could be packed along with the Strategy's address.

nventuro commented 4 years ago

This will also apply to reading and writing cash and investment structs (see here).

nventuro commented 4 years ago

This seems to be mostly done, but it'd be good to perform some measurements to make sure we're indeed packing data correctly.

nventuro commented 3 years ago

Completed with #163.