Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Jan 3, 2025
1 parent 38bd82b commit e6d7ce8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/modes/routeProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ export async function findOpp({
} catch (e: any) {
// the fail reason can only be no route in case all hops fail reasons are no route
if (e.reason !== RouteProcessorDryrunHaltReason.NoRoute) noRoute = false;
delete e.spanAttributes["rawtx"];
allNoneNodeErrors.push(e?.value?.noneNodeError);
extendSpanAttributes(spanAttributes, e.spanAttributes, "partial");
}
Expand Down
33 changes: 18 additions & 15 deletions test/findOpp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const testData = require("./data");
const { findOpp } = require("../src/modes");
const { orderbookAbi } = require("../src/abis");
const { errorSnapshot } = require("../src/error");
const { clone, estimateProfit } = require("../src/utils");
const { clone, estimateProfit, withBigintSerializer } = require("../src/utils");
const {
ethers,
utils: { formatUnits },
Expand Down Expand Up @@ -323,7 +323,7 @@ describe("Test find opp", async function () {
assert.deepEqual(result, expected);
});

it("should NOT find opp", async function () {
it.only("should NOT find opp", async function () {
const err = ethers.errors.UNPREDICTABLE_GAS_LIMIT;
signer.estimateGas = async () => {
return Promise.reject(err);
Expand Down Expand Up @@ -351,7 +351,7 @@ describe("Test find opp", async function () {
} catch (error) {
const expectedTakeOrdersConfigStruct = {
minimumInput: ethers.constants.One,
maximumInput: vaultBalance,
maximumInput: ethers.constants.MaxUint256,
maximumIORatio: ethers.constants.MaxUint256,
orders: [orderPairObject.takeOrders[0].takeOrder],
data: expectedRouteData,
Expand All @@ -370,16 +370,19 @@ describe("Test find opp", async function () {
},
signedContext: [],
};
const rawtx = JSON.stringify({
data: arb.interface.encodeFunctionData("arb3", [
orderPairObject.orderbook,
expectedTakeOrdersConfigStruct,
task,
]),
to: arb.address,
gasPrice,
from: signer.account.address,
});
const rawtx = JSON.stringify(
{
data: arb.interface.encodeFunctionData("arb3", [
orderPairObject.orderbook,
expectedTakeOrdersConfigStruct,
task,
]),
to: arb.address,
gasPrice: gasPrice,
from: signer.account.address,
},
withBigintSerializer,
);
const opposingMaxInput = vaultBalance
.mul(orderPairObject.takeOrders[0].quote.ratio)
.div(`1${"0".repeat(36 - orderPairObject.buyTokenDecimals)}`);
Expand All @@ -398,7 +401,7 @@ describe("Test find opp", async function () {
]);
const expectedTakeOrdersConfigStruct2 = {
minimumInput: ethers.constants.One,
maximumInput: vaultBalance,
maximumInput: ethers.constants.MaxUint256,
maximumIORatio: ethers.constants.MaxUint256,
orders: [orderPairObject.takeOrders[0].takeOrder],
data: ethers.utils.defaultAbiCoder.encode(
Expand Down Expand Up @@ -456,7 +459,7 @@ describe("Test find opp", async function () {
[`interOrderbook.againstOrderbooks.${opposingOrderbookAddress}.blockNumber`]:
oppBlockNumber,
[`interOrderbook.againstOrderbooks.${opposingOrderbookAddress}.rawtx`]:
JSON.stringify(rawtx2),
JSON.stringify(rawtx2, withBigintSerializer),
[`interOrderbook.againstOrderbooks.${opposingOrderbookAddress}.maxInput`]:
vaultBalance.toString(),
[`interOrderbook.againstOrderbooks.${opposingOrderbookAddress}.error`]:
Expand Down

0 comments on commit e6d7ce8

Please sign in to comment.