feat: limit size of the machine string #2385
Draft
+135
−47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1981
Currently, it is possible to block machine execution by submitting a transaction that results in an error which produces a massive string due to it stringing together all of the Machine's contents. This PR limits the amount of data that is stringed together. It isn't very useful anyway.
Another solution that was considered
I had experimented with some concurrent solutions to retain the full contents of the string, but while the building of the string was rendered more efficient, the printing of it was not, as expected. A possible solution to this is to write it to a file -- far more performant -- but then there is the issue of these types of logs taking up a lot of disk space if someone continues to submit transactions that produce them.
I am aware that #2145 is a WIP to improve this, but even that does not limit the amount of data printed (I will comment on that PR); it also needs some additional work before it is merged and the intention for this PR is to fix the issue ASAP to avoid this causing a problem during the Challenge Series at Gophercon US.
Here is an example of something that blocks the machine before the changes in this PR are applied. You can run it with and without the changes to compare. Run with
gnokey maketx run
: