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

debug: increase logs of simulateBundle endpoint #105

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

yvesfracari
Copy link
Contributor

No description provided.

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

I would also add some error handling in the repository. Handle and retrow logic.

At minimum we can log the payload and relevant response HTTP parameters
https://github.com/cowprotocol/bff/blob/main/libs/repositories/src/SimulationRepository/SimulationRepositoryTenderly.ts#L36

Alternativelly, and probably better, is to model some Error (ApiCallError) that incorporates all the relevant data we want to handle, and then the controllers handles and logs this error properly. This approach is nicer cause you don't marry to the specific logging methon, and then other similar repositories can do the same

);

if (simulationResult === null) {
reply.code(400).send({ message: 'Build simulation error' });
Copy link
Contributor

Choose a reason for hiding this comment

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

This was here before, but what does null mean, and why is a 400 is an issue from the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means that the Tenderly couldn't simulate the transaction. This happens often on the "build your own hook" where the user manually encodes the tx data.

We used a general 400 error but maybe we could change it to 422.

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

Thanks!

@alfetopito alfetopito merged commit 48a5255 into cowprotocol:main Jan 22, 2025
2 of 6 checks passed
formatters: {
level: (label) => ({ level: label }),
},
});
Copy link
Contributor

Choose a reason for hiding this comment

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

@yvesfracari why do we add the log config here, shouldn't we use the same one as https://github.com/cowprotocol/bff/blob/main/apps/api/src/main.ts#L5 ?

Copy link
Contributor

@anxolin anxolin Feb 25, 2025

Choose a reason for hiding this comment

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

I address it, cause I want to deploy a new release of bff with some fixes for the logging and I want to fix this small detail. Let me know if it makes sense #107

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

Successfully merging this pull request may close these issues.

3 participants