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

Feat: Export data via cheatcode #5525

Closed
wants to merge 13 commits into from

Conversation

odyslam
Copy link
Contributor

@odyslam odyslam commented Aug 2, 2023

Draft PR for a new cheatcode that enables to export of structured data from the testing environment.

This is not very useful for Foundry as-is (since users can already do that via writeFile + serialiseJson), but it's useful for libraries that consume Foundry.

I am already using this in my fork of foundry (I have removed some ledger, etherscan functionality that makes Forge test not Send), so feel free not to accept the PR.

Happy to do any work that needs to be done in order to accept it though (the less diff my fork has from upstream, the better)

@odyslam
Copy link
Contributor Author

odyslam commented Aug 8, 2023

cc @Evalir @mattsse to make sure you saw this. Just lmk whether I should work to get this merged or just close it. It's cool eitherway.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

sorry missed this one

Draft PR for a new cheatcode that enables to export of structured data from the testing environment.

what exactly does export do and how is this different from writing to files?

@odyslam
Copy link
Contributor Author

odyslam commented Oct 24, 2023

So, returning to this fossil @mattsse because managing my fork is a pain in the ass.

This aims to enable the foundry to export structured data when used as a dependency. I am using it in phylax, which I plan to ship by the end of the month (a monitoring tool). We could use the same machinery for more cheatcodes, but the general gist is to enable structured data export so that other consumers can use it. More specifically, I use this to enable a cheatcode where a user can easily expose data of a test over a Prometheus endpoint.

I understand that it's a very low priority, and we try to keep the code as simple as possible, but is there a way we can get this merged (once conflicts have been resolved, etc. )

@DaniPopes
Copy link
Member

Hey @odyslam, we recently refactored how cheatcodes are implemented in #6131. You can read more about it in the dev docs. Please let me know if you have any problems rebasing!

@Evalir
Copy link
Member

Evalir commented Dec 19, 2023

Closing as stale, plus would need a full rewrite. @odyslam feel free to reopen / open a new PR with a modern cheatode impl, and we could probably get this merged

@Evalir Evalir closed this Dec 19, 2023
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.

4 participants