-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bump sor to 4.7.5 - fix: cached routes cache invalidation (#869)
* sor 4.7.1 from local * fix: we roll out new cached routes fix with percent * fix: we roll out new cached routes fix with percent * add more comments on per-chain rollout percent * fix injector.ts to pass in alpha-router params * make BLOCKS_TO_LIVE to index key on ChainId enum * remove filter expired cached routes * 10 minutes blocks-to-live for every chain * INTENT enum * npm install SOR * sdk-core 5.9.0 * fix cachedRoutesCacheInvalidationFixRolloutPercentage * fix v4PoolParams * do not tap compare during caching intent quote handler * 1 hour cached routes refresh
- Loading branch information
Showing
8 changed files
with
134 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ChainId } from '@uniswap/sdk-core' | ||
|
||
// This is not being used in production today anyway, due to below filterExpiredCachedRoutes method not really filtering on the blocks-to-live | ||
// heuristic is initially within 30 seconds we find a route. (but we are changing to every 1 hour now) | ||
// For the Ratio we are approximating Phi (Golden Ratio) by creating a fraction with 2 consecutive Fibonacci numbers | ||
|
||
// changing to this way with ChainId enum as key indexing, so that we wont forgot to add new chain tuned blocks-to-live | ||
// those are only gonna be enabled with DynamoRouteCachingProvider.newCachedRoutesRolloutPercent anyway | ||
export const DEFAULT_BLOCKS_TO_LIVE_ROUTES_DB: { [chain in ChainId]: number } = { | ||
// (60 minutes) / (12 seconds)= 300 | ||
[ChainId.MAINNET]: 300, | ||
[ChainId.GOERLI]: 300, | ||
[ChainId.SEPOLIA]: 300, | ||
// (60 minutes) / (2 seconds) = 1800 | ||
[ChainId.OPTIMISM]: 1800, | ||
[ChainId.OPTIMISM_GOERLI]: 1800, | ||
[ChainId.OPTIMISM_SEPOLIA]: 1800, | ||
[ChainId.BASE]: 1800, | ||
[ChainId.ZORA]: 1800, | ||
[ChainId.BASE_GOERLI]: 1800, | ||
[ChainId.ZORA_SEPOLIA]: 1800, | ||
[ChainId.BLAST]: 1800, | ||
[ChainId.WORLDCHAIN]: 1800, | ||
// (60 minutes) / (1 seconds) = 3600 | ||
[ChainId.ASTROCHAIN_SEPOLIA]: 3600, | ||
// (60 minutes) / (250 milliseconds) = 14400 | ||
[ChainId.ARBITRUM_ONE]: 14400, | ||
[ChainId.ARBITRUM_GOERLI]: 14400, | ||
[ChainId.ARBITRUM_SEPOLIA]: 14400, | ||
// (60 minutes) / (2 seconds) = 1800 | ||
[ChainId.POLYGON]: 1800, | ||
[ChainId.POLYGON_MUMBAI]: 1800, | ||
// (60 minutes) / (5 seconds) = 720 | ||
[ChainId.CELO]: 720, | ||
[ChainId.CELO_ALFAJORES]: 720, | ||
// (60 minutes) / (5 seconds) = 720 | ||
[ChainId.GNOSIS]: 720, | ||
// (60 minutes) / (6 seconds) = 600 | ||
[ChainId.MOONBEAM]: 600, | ||
// (60 minutes) / (3 seconds) = 1200 | ||
[ChainId.BNB]: 1200, | ||
// (60 minutes) / (3 seconds) = 1200 | ||
[ChainId.AVALANCHE]: 1200, | ||
// (60 minutes) / (33 seconds) = 148 | ||
[ChainId.ROOTSTOCK]: 148, | ||
// (60 minutes) / (1 seconds) = 3600 | ||
[ChainId.ZKSYNC]: 3600, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ChainId } from '@uniswap/sdk-core' | ||
|
||
// percent is between 0% - 100%, defined in SOR | ||
// testnets all go to 100% directly | ||
// production nets depending on revenue/quote traffic volume, if it's medium/high 1%, otherwise super low traffic (< 100 quotes per 5 minutes) 100% | ||
// so zora and blast go to 100% directly. rootstock is not supported by uniswap labs product or protocol layer, go to 100% directly. | ||
export const NEW_CACHED_ROUTES_ROLLOUT_PERCENT: { [chain in ChainId]: number } = { | ||
[ChainId.MAINNET]: 1, | ||
[ChainId.GOERLI]: 100, | ||
[ChainId.SEPOLIA]: 100, | ||
[ChainId.OPTIMISM]: 1, | ||
[ChainId.OPTIMISM_GOERLI]: 100, | ||
[ChainId.OPTIMISM_SEPOLIA]: 100, | ||
[ChainId.ARBITRUM_ONE]: 1, | ||
[ChainId.ARBITRUM_GOERLI]: 100, | ||
[ChainId.ARBITRUM_SEPOLIA]: 100, | ||
[ChainId.POLYGON]: 1, | ||
[ChainId.POLYGON_MUMBAI]: 100, | ||
[ChainId.CELO]: 1, | ||
[ChainId.CELO_ALFAJORES]: 100, | ||
[ChainId.GNOSIS]: 1, | ||
[ChainId.MOONBEAM]: 1, | ||
[ChainId.BNB]: 1, | ||
[ChainId.AVALANCHE]: 1, | ||
[ChainId.BASE_GOERLI]: 100, | ||
[ChainId.BASE]: 1, | ||
[ChainId.ZORA]: 100, | ||
[ChainId.ZORA_SEPOLIA]: 100, | ||
[ChainId.ROOTSTOCK]: 100, | ||
[ChainId.BLAST]: 100, | ||
[ChainId.ZKSYNC]: 1, | ||
[ChainId.WORLDCHAIN]: 1, | ||
[ChainId.ASTROCHAIN_SEPOLIA]: 100, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters