From 9ac72fb1d032e6020fd06566be61124f7f3dc97a Mon Sep 17 00:00:00 2001 From: preethamr Date: Fri, 15 Mar 2024 11:22:43 -0700 Subject: [PATCH 1/2] fix: increase relayer fee to reduce low relayer fee errors --- packages/agents/sdk-wrapper/src/lib/helpers/shared.ts | 2 +- packages/agents/sdk/src/lib/helpers/shared.ts | 2 +- packages/utils/src/peripherals/relayer.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/agents/sdk-wrapper/src/lib/helpers/shared.ts b/packages/agents/sdk-wrapper/src/lib/helpers/shared.ts index fb8ab34264..a42cabbfdb 100644 --- a/packages/agents/sdk-wrapper/src/lib/helpers/shared.ts +++ b/packages/agents/sdk-wrapper/src/lib/helpers/shared.ts @@ -16,7 +16,7 @@ import { providers } from "ethers"; import { UriInvalid, ApiRequestFailed, ParseConnextLogFailed } from "../errors/index"; -export const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee +export const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee export const getChainData = _getChainData; export const domainToChainId = _domainToChainId; diff --git a/packages/agents/sdk/src/lib/helpers/shared.ts b/packages/agents/sdk/src/lib/helpers/shared.ts index cbd5cc2850..0190aa4f80 100644 --- a/packages/agents/sdk/src/lib/helpers/shared.ts +++ b/packages/agents/sdk/src/lib/helpers/shared.ts @@ -16,7 +16,7 @@ import { providers } from "ethers"; import { UriInvalid, ApiRequestFailed, ParseConnextLogFailed } from "../errors/index"; -export const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee +export const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee export const getChainData = _getChainData; export const domainToChainId = _domainToChainId; diff --git a/packages/utils/src/peripherals/relayer.ts b/packages/utils/src/peripherals/relayer.ts index cf3506bced..99a510d276 100644 --- a/packages/utils/src/peripherals/relayer.ts +++ b/packages/utils/src/peripherals/relayer.ts @@ -8,7 +8,7 @@ import { Logger, createLoggingContext, RequestContext } from "../logging"; import { ChainData } from "./chainData"; import { safeGetConversionRate, getGelatoEstimatedFee } from "./gelato"; -const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee +const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee export const calculateRelayerFee = async ( params: { From 116aaf0632941aa4b6d9a174fc897c6df2822e56 Mon Sep 17 00:00:00 2001 From: just-a-node Date: Fri, 15 Mar 2024 11:52:27 -0700 Subject: [PATCH 2/2] test: fix tests with fee bump --- packages/utils/test/peripherals/relayer.spec.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/utils/test/peripherals/relayer.spec.ts b/packages/utils/test/peripherals/relayer.spec.ts index a2fb4c08f5..6547f3b57f 100644 --- a/packages/utils/test/peripherals/relayer.spec.ts +++ b/packages/utils/test/peripherals/relayer.spec.ts @@ -42,8 +42,8 @@ describe("Peripherals:Relayer", () => { logger, ); // estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice ) - // ==> (10000 + 10000 x 20 / 100) x ( 1.5 / 1 ) = 18000 - expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000")); + // ==> (10000 + 10000 x 40 / 100) x ( 1.5 / 1 ) = 18000 + expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000")); }); it("should return correct value when provided token prices", async () => { @@ -59,8 +59,8 @@ describe("Peripherals:Relayer", () => { logger, ); // estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice ) - // ==> (10000 + 10000 x 20 / 100) x ( 1500 / 1000 ) = 18000 - expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000")); + // ==> (10000 + 10000 x 40 / 100) x ( 1500 / 1000 ) = 18000 + expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000")); }); it("should return correct value when provided gas price", async () => { @@ -79,8 +79,8 @@ describe("Peripherals:Relayer", () => { // fallbackRelayerFee = gasPrice x executeGasAmount // ==> 50 x 400000 = 20000000 // estimatedRelayerFee = (fallbackRelayerFee + fallbackRelayerFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice ) - // ==> (20000000 + 20000000 x 20 / 100) x ( 1.5 / 1 ) = 36000000 - expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("36000000")); + // ==> (20000000 + 20000000 x 40 / 100) x ( 1.5 / 1 ) = 36000000 + expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("42000000")); }); it("should add l1Gas for optimism network", async () => { @@ -133,8 +133,8 @@ describe("Peripherals:Relayer", () => { logger, ); // estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice ) - // ==> (10000 + 10000 x 20 / 100) x ( 1.5 / 1 ) = 108000 - expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000")); + // ==> (10000 + 10000 x 40 / 100) x ( 1.5 / 1 ) = 108000 + expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000")); }); }); });