Skip to content

Commit

Permalink
Improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Apr 24, 2024
1 parent 8fbc151 commit 8455f0d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/gas-price/gas-price.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ describe(getRecommendedGasPrice.name, () => {
expect(logger.warn).toHaveBeenCalledTimes(1);
expect(logger.warn).toHaveBeenNthCalledWith(1, 'Sanitizing gas price.', {
gasPrice: '120000000000',
ratio: '6.98',
sanitizationGasPriceCap: '17200000000',
});
});
Expand Down Expand Up @@ -298,6 +299,7 @@ describe(getRecommendedGasPrice.name, () => {
});
expect(logger.warn).toHaveBeenNthCalledWith(2, 'Sanitizing gas price.', {
gasPrice: '20900000000',
ratio: '1.08',
sanitizationGasPriceCap: '19400000000',
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/gas-price/gas-price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const getRecommendedGasPrice = (chainId: string, providerName: string, sp
logger.warn('Sanitizing gas price.', {
gasPrice: gasPriceToUse.toString(),
sanitizationGasPriceCap: sanitizationGasPriceCap.toString(),
percentage: (Number(gasPriceToUse) / Number(sanitizationGasPriceCap)).toFixed(2),
ratio: (Number(gasPriceToUse) / Number(sanitizationGasPriceCap)).toFixed(2),
});
return sanitizationGasPriceCap;
}
Expand Down
5 changes: 4 additions & 1 deletion src/update-feeds-loops/submit-transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ describe(submitTransactionsModule.submitTransaction.name, () => {
jest.spyOn(gasPriceModule, 'getRecommendedGasPrice').mockReturnValue(BigInt(100_000_000));
jest.spyOn(updatabilityTimestampModule, 'isAlreadyUpdatable').mockReturnValue(false);
const api3ServerV1 = generateMockApi3ServerV1();
jest.spyOn(api3ServerV1.tryMulticall, 'send').mockReturnValue({ hash: '0xTransactionHash' });
jest.spyOn(api3ServerV1, 'connect').mockReturnValue(api3ServerV1);
jest.spyOn(stateModule, 'getState').mockReturnValue(
allowPartial<stateModule.State>({
Expand Down Expand Up @@ -434,7 +435,9 @@ describe(submitTransactionsModule.submitTransaction.name, () => {
nonce: 0,
sponsorWalletAddress: '0xA772F7b103BBecA3Bb6C74Be41fCc2c192C8146c',
});
expect(logger.info).toHaveBeenNthCalledWith(2, 'Successfully submitted the multicall transaction.');
expect(logger.info).toHaveBeenNthCalledWith(2, 'Successfully submitted the multicall transaction.', {
txHash: '0xTransactionHash',
});

// Verify the flow of the update process via the debug logs. Note, that some debug log calls are not here because
// many functions are mocked.
Expand Down

0 comments on commit 8455f0d

Please sign in to comment.