From 4d249c75ce86842a3d180206e96874913ecb7985 Mon Sep 17 00:00:00 2001 From: Chris Heaney Date: Sat, 6 Jan 2024 13:47:25 -0500 Subject: [PATCH 1/2] sdk: fix tests not building --- sdk/tests/dlob/test.ts | 4 ++-- sdk/tests/tx/priorityFeeStrategy.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/tests/dlob/test.ts b/sdk/tests/dlob/test.ts index 541d3fdcc..4270167a3 100644 --- a/sdk/tests/dlob/test.ts +++ b/sdk/tests/dlob/test.ts @@ -76,7 +76,7 @@ function insertOrderToDLOB( auctionEndPrice, maxTs, }, - userAccount, + userAccount.toString(), slot.toNumber() ); } @@ -127,7 +127,7 @@ function insertTriggerOrderToDLOB( auctionEndPrice, maxTs, }, - userAccount, + userAccount.toString(), slot.toNumber() ); } diff --git a/sdk/tests/tx/priorityFeeStrategy.ts b/sdk/tests/tx/priorityFeeStrategy.ts index f4b21d554..1296e0a89 100644 --- a/sdk/tests/tx/priorityFeeStrategy.ts +++ b/sdk/tests/tx/priorityFeeStrategy.ts @@ -66,7 +66,7 @@ describe('PriorityFeeStrategy', () => { }); it('MaxOverSlotsStrategy should calculate the max prioritization fee over slots', () => { - const maxOverSlotsStrategy = new MaxOverSlotsStrategy(5); + const maxOverSlotsStrategy = new MaxOverSlotsStrategy(); const samples = [ { slot: 6, prioritizationFee: 432 }, { slot: 3, prioritizationFee: 543 }, @@ -80,7 +80,7 @@ describe('PriorityFeeStrategy', () => { }); it('AverageOverSlotsStrategy should calculate the average prioritization fee over slots', () => { - const averageOverSlotsStrategy = new AverageOverSlotsStrategy(5); + const averageOverSlotsStrategy = new AverageOverSlotsStrategy(); const samples = [ { slot: 6, prioritizationFee: 432 }, { slot: 3, prioritizationFee: 543 }, From 7645c5b251a235f06f0674d6df392744886f3e39 Mon Sep 17 00:00:00 2001 From: Chris Heaney Date: Mon, 8 Jan 2024 16:46:42 -0500 Subject: [PATCH 2/2] sdk: tweak polling tx confirmation --- sdk/src/tx/baseTxSender.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/src/tx/baseTxSender.ts b/sdk/src/tx/baseTxSender.ts index 42d9ad2b9..e1f5f905d 100644 --- a/sdk/src/tx/baseTxSender.ts +++ b/sdk/src/tx/baseTxSender.ts @@ -247,9 +247,11 @@ export abstract class BaseTxSender implements TxSender { commitment: Commitment = 'finalized' ): Promise | undefined> { let totalTime = 0; - let backoffTime = 250; + let backoffTime = 400; // approx block time while (totalTime < this.timeout) { + await new Promise((resolve) => setTimeout(resolve, backoffTime)); + const response = await this.connection.getSignatureStatus(signature); const result = response && response.value?.[0]; @@ -257,7 +259,6 @@ export abstract class BaseTxSender implements TxSender { return { context: result.context, value: { err: null } }; } - await new Promise((resolve) => setTimeout(resolve, backoffTime)); totalTime += backoffTime; backoffTime = Math.min(backoffTime * 2, 5000); }