Compare commits

...

2 Commits

Author SHA1 Message Date
Jacob Evans
532653711f CHANGELOG 2022-02-11 15:26:09 +10:00
Jacob Evans
f75b4a24c7 fix: Prevent BalancerV2/BeethovenX pool explosion 2022-02-11 15:23:53 +10:00
2 changed files with 18 additions and 1 deletions

View File

@@ -1,4 +1,13 @@
[
{
"version": "16.49.5",
"changes": [
{
"note": "Fix BalancerV2/BeethovenX loading too many pools on startup",
"pr": 420
}
]
},
{
"version": "16.49.4",
"changes": [

View File

@@ -130,7 +130,13 @@ export class BalancerV2PoolsCache extends PoolsCache {
);
// Cache this as we progress through
const expiresAt = Date.now() + this._cacheTimeMs;
this._cachePoolsForPair(from, to, fromToPools[from][to], expiresAt);
this._cachePoolsForPair(
from,
to,
// Clamp the amount of pools in this pair direction to the max
fromToPools[from][to].slice(0, this.maxPoolsFetched),
expiresAt,
);
} catch (err) {
this._warningLogger(err, `Failed to load Balancer V2 top pools`);
// soldier on
@@ -144,6 +150,8 @@ export class BalancerV2PoolsCache extends PoolsCache {
query getPools {
pools(
first: ${this.maxPoolsFetched},
orderBy: swapsCount
orderDirection: desc
where: {
tokensList_contains: ["${takerToken}", "${makerToken}"]
}