Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Tests #4

Open
wants to merge 14 commits into
base: tests-set-up
Choose a base branch
from
Open

CI Tests #4

wants to merge 14 commits into from

Conversation

ajimeno04
Copy link
Owner

@ajimeno04 ajimeno04 commented Aug 16, 2024

Description by Korbit AI

What change is being made?

Refactor Jest configuration to update test paths, add new dependencies, and introduce comprehensive tests for relay process and monitoring.

Why are these changes being made?

The changes are necessary to improve the test coverage for the relay process and monitoring functionalities, ensuring robustness and reliability. Additionally, the updates to dependencies and configuration streamline the testing process and enhance compatibility with the latest tools and libraries.

Repository owner deleted a comment from korbit-ai bot Aug 16, 2024
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed your code and found 2 potential issues.

Comment on lines +39 to +45
while (true) {
const logs = await provider.getLogs(filter);
if (logs.length > 0) {
return logs[0];
}
await wait(retryInterval);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

category Error Handling severity potentially major

The queryLogsByBlock and queryLogsByMessageIdentifier functions have potential error handling issues. The code contains infinite loops without proper error handling mechanisms. If an error occurs during the execution of these functions, the code will continue to retry indefinitely without any way to break out of the loop or handle the error gracefully. To improve the robustness of the code, consider adding appropriate error handling within the loop. Catch any errors that occur, log them for debugging purposes, and decide whether to continue retrying or break out of the loop based on the nature of the error. Additionally, consider adding a maximum retry limit to prevent the loop from running indefinitely in case of persistent errors.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.


const runTest = async (eventType: string, expectedStructure: Partial<RelayState>, transactOpts: Transaction = validTransactOpts) => {
const wallet = new Wallet(privateKey, provider);
const tx = await performSwap(wallet, transactOpts);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

category Error Handling

Consider adding error handling around the performSwap function call in the runTest function. If an error occurs during the swap transaction, it should be caught, logged, and handled appropriately to provide clear error information and prevent the test from failing abruptly.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant