Skip to content

Commit

Permalink
refactor: use constant retry delay for deposit status tracking (#1137)
Browse files Browse the repository at this point in the history
* refactor: use constant retry delay for deposit status tracking

* fix: update polling intervals
  • Loading branch information
dohaki authored Jul 30, 2024
1 parent 115112b commit 9e2cb5e
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions scripts/chain-configs/arbitrum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
"POOL",
],
enableCCTP: true,
blockTimeSeconds: 1,
swapTokens: [
{
swapInputTokenSymbol: "USDC.e",
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default {
publicRpcUrl: "https://mainnet.base.org",
tokens: ["USDC", "WETH", "ETH", "DAI", "BAL", "POOL"],
enableCCTP: true,
blockTimeSeconds: 2,
swapTokens: [
{
swapInputTokenSymbol: "USDbC",
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/linea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: getDeployedAddress("SpokePool", chainId),
chainId,
blockTimeSeconds: 2,
publicRpcUrl: "https://rpc.linea.build",
tokens: ["WETH", "ETH", "USDC.e", "USDT", "DAI", "WBTC"],
enableCCTP: false,
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/lisk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: "0x9552a0a6624A23B848060AE5901659CDDa1f83f8",
chainId,
blockTimeSeconds: 2,
publicRpcUrl: "https://rpc.api.lisk.com",
tokens: ["WETH", "ETH", "USDT", "LSK"],
enableCCTP: false,
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/mainnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default {
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: getDeployedAddress("SpokePool", chainId),
chainId,
blockTimeSeconds: 12,
publicRpcUrl: "https://mainnet.gateway.tenderly.co",
tokens: [
"WETH",
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/mode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: getDeployedAddress("SpokePool", chainId),
chainId,
blockTimeSeconds: 2,
publicRpcUrl: "https://mainnet.mode.network",
tokens: ["WETH", "ETH", "USDC.e", "USDT", "WBTC"],
enableCCTP: false,
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/optimism/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
"SNX",
"POOL",
],
blockTimeSeconds: 2,
enableCCTP: true,
swapTokens: [
{
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/polygon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
publicRpcUrl: "https://rpc.ankr.com/polygon",
tokens: ["DAI", "UMA", "WETH", "USDC", "WBTC", "BAL", "ACX", "USDT", "POOL"],
enableCCTP: true,
blockTimeSeconds: 5,
swapTokens: [
{
swapInputTokenSymbol: "USDC.e",
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/zk-sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default {
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: getDeployedAddress("SpokePool", chainId),
chainId,
blockTimeSeconds: 2,
publicRpcUrl: "https://mainnet.era.zksync.io",
tokens: ["WETH", "ETH", "USDC.e", "WBTC", "USDT", "DAI"],
enableCCTP: false,
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-ui-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function generateUiAssets() {
constructExplorerLink: (txHash: string) => \`\${${chainVarName}.explorerUrl}/tx/\${txHash}\`,
nativeCurrencySymbol: "${chainConfig.nativeToken}",
customRpcUrl: process.env.REACT_APP_CHAIN_${chainId}_PROVIDER_URL,
pollingInterval: ${chainConfig.blockTimeSeconds || 15 * 1000},
pollingInterval: ${(chainConfig.blockTimeSeconds || 15) * 1000},
};
`);
chainVarNames.push(chainVarName);
Expand Down
22 changes: 11 additions & 11 deletions src/constants/chains/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const arbitrum = {
`${arbitrum.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_42161_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 1000,
};

export const arbitrumSepolia = {
Expand Down Expand Up @@ -137,7 +137,7 @@ export const base = {
constructExplorerLink: (txHash: string) => `${base.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_8453_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const baseSepolia = {
Expand Down Expand Up @@ -171,7 +171,7 @@ export const blast = {
`${blast.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_81457_PROVIDER_URL,
pollingInterval: 2,
pollingInterval: 2000,
};

export const blastSepolia = {
Expand All @@ -188,7 +188,7 @@ export const blastSepolia = {
`${blastSepolia.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_168587773_PROVIDER_URL,
pollingInterval: 2,
pollingInterval: 2000,
};

export const linea = {
Expand All @@ -205,7 +205,7 @@ export const linea = {
`${linea.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_59144_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const lisk = {
Expand All @@ -221,7 +221,7 @@ export const lisk = {
constructExplorerLink: (txHash: string) => `${lisk.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_1135_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const liskSepolia = {
Expand Down Expand Up @@ -255,7 +255,7 @@ export const ethereum = {
`${ethereum.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_1_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 12000,
};

export const mode = {
Expand All @@ -271,7 +271,7 @@ export const mode = {
constructExplorerLink: (txHash: string) => `${mode.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_34443_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const modeSepolia = {
Expand Down Expand Up @@ -305,7 +305,7 @@ export const optimism = {
`${optimism.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_10_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const optimismSepolia = {
Expand Down Expand Up @@ -339,7 +339,7 @@ export const polygon = {
`${polygon.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "MATIC",
customRpcUrl: process.env.REACT_APP_CHAIN_137_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 5000,
};

export const polygonAmoy = {
Expand Down Expand Up @@ -390,7 +390,7 @@ export const zkSync = {
`${zkSync.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "ETH",
customRpcUrl: process.env.REACT_APP_CHAIN_324_PROVIDER_URL,
pollingInterval: 15000,
pollingInterval: 2000,
};

export const chainConfigs = [
Expand Down
3 changes: 3 additions & 0 deletions src/views/DepositStatus/hooks/useDepositTracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getDepositByTxHash,
getFillByDepositTxHash,
NoV3FundsDepositedLogError,
getChainInfo,
} from "utils";
import {
getLocalDepositByTxHash,
Expand Down Expand Up @@ -55,6 +56,7 @@ export function useDepositTracking(
{
staleTime: Infinity,
enabled: shouldRetryDepositQuery,
retryDelay: getChainInfo(fromChainId).pollingInterval || 5_000,
onSuccess: (data) => {
if (!fromBridgePagePayload || !data.parsedDepositLog) {
return;
Expand Down Expand Up @@ -106,6 +108,7 @@ export function useDepositTracking(
{
staleTime: Infinity,
retry: true,
retryDelay: getChainInfo(toChainId).pollingInterval || 5_000,
enabled: !!depositQuery.data,
onSuccess: (data) => {
if (!fromBridgePagePayload) {
Expand Down

0 comments on commit 9e2cb5e

Please sign in to comment.