From 6a38f0166de242ab26abfef378e07bf33e9ca3f1 Mon Sep 17 00:00:00 2001 From: rouzwelt Date: Thu, 16 Jan 2025 21:39:33 +0000 Subject: [PATCH] init --- src/modes/interOrderbook.ts | 14 ++++++++++++++ src/modes/intraOrderbook.ts | 14 ++++++++++++++ src/modes/routeProcessor.ts | 15 +++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/src/modes/interOrderbook.ts b/src/modes/interOrderbook.ts index 93a48c1f..7860caa6 100644 --- a/src/modes/interOrderbook.ts +++ b/src/modes/interOrderbook.ts @@ -214,6 +214,20 @@ export async function dryrun({ return Promise.reject(result); } } + if (gasLimit.isZero()) { + spanAttributes["stage"] = 2; + spanAttributes["isNodeError"] = true; + spanAttributes["error"] = + "Failed to estimated gas, rpc returned 0 for gasEstimate call without rejection"; + spanAttributes["rawtx"] = JSON.stringify( + { + ...rawtx, + from: signer.account.address, + }, + withBigintSerializer, + ); + return Promise.reject(result); + } rawtx.gas = gasLimit.toBigInt(); // if reached here, it means there was a success and found opp diff --git a/src/modes/intraOrderbook.ts b/src/modes/intraOrderbook.ts index ac7c8853..4f525112 100644 --- a/src/modes/intraOrderbook.ts +++ b/src/modes/intraOrderbook.ts @@ -225,6 +225,20 @@ export async function dryrun({ return Promise.reject(result); } } + if (gasLimit.isZero()) { + spanAttributes["stage"] = 2; + spanAttributes["isNodeError"] = true; + spanAttributes["error"] = + "Failed to estimated gas, rpc returned 0 for gasEstimate call without rejection"; + spanAttributes["rawtx"] = JSON.stringify( + { + ...rawtx, + from: signer.account.address, + }, + withBigintSerializer, + ); + return Promise.reject(result); + } rawtx.gas = gasLimit.toBigInt(); // if reached here, it means there was a success and found opp diff --git a/src/modes/routeProcessor.ts b/src/modes/routeProcessor.ts index 37c05fc8..1a16f8bf 100644 --- a/src/modes/routeProcessor.ts +++ b/src/modes/routeProcessor.ts @@ -281,6 +281,21 @@ export async function dryrun({ return Promise.reject(result); } } + if (gasLimit.isZero()) { + spanAttributes["stage"] = 2; + spanAttributes["isNodeError"] = true; + spanAttributes["error"] = + "Failed to estimated gas, rpc returned 0 for gasEstimate call without rejection"; + spanAttributes["rawtx"] = JSON.stringify( + { + ...rawtx, + from: signer.account.address, + }, + withBigintSerializer, + ); + result.reason = RouteProcessorDryrunHaltReason.NoOpportunity; + return Promise.reject(result); + } rawtx.gas = gasLimit.toBigInt(); // if reached here, it means there was a success and found opp