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

fix(gnovm): don't print to stdout by default #3076

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented Nov 6, 2024

Attempt to fix #3075

cc/ @zivkovicmilos @sw360cab

@thehowl thehowl added the 📦 🤖 gnovm Issues or PRs gnovm related label Nov 6, 2024
@thehowl thehowl self-assigned this Nov 6, 2024
@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Nov 6, 2024
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Project coverage is 63.32%. Comparing base (81a88a2) to head (ab12b41).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
gno.land/pkg/sdk/vm/keeper.go 61.53% 4 Missing and 1 partial ⚠️
gno.land/pkg/gnoland/node_inmemory.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3076      +/-   ##
==========================================
- Coverage   63.33%   63.32%   -0.01%     
==========================================
  Files         548      548              
  Lines       78646    78652       +6     
==========================================
+ Hits        49807    49809       +2     
- Misses      25478    25479       +1     
- Partials     3361     3364       +3     
Flag Coverage Δ
contribs/gnodev 61.16% <100.00%> (+0.04%) ⬆️
contribs/gnofaucet 14.82% <ø> (ø)
gno.land 67.13% <60.00%> (-0.05%) ⬇️
gnovm 67.88% <100.00%> (ø)
misc/genstd 79.72% <ø> (ø)
tm2 62.41% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moul
Copy link
Member

moul commented Nov 6, 2024

By default or with a flag?

@moul
Copy link
Member

moul commented Nov 6, 2024

@gfanton what about gnodev?

@thehowl
Copy link
Member Author

thehowl commented Nov 6, 2024

By default or with a flag?

By default. I think this shouldn't be configurable on the gnoland node per se?

@gfanton what about gnodev?

This was also a concern of mine, but I was eager to get a fix out asap as from what I understood this was a show-stopper bug, but seems like it wasn't too much after all.

I went back and added an option so that gnodev can set os.Stdout as the output.

@moul
Copy link
Member

moul commented Nov 6, 2024

By default. I think this shouldn't be configurable on the gnoland node per se?

I agree.

@gfanton gfanton self-requested a review November 6, 2024 23:57
Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

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

You can keep gnodev this way for now; it's partially fine. Just remember that gnodev operates in raw term mode, which means newlines should be written as \r\n. As a result, outputting directly to stdout will not display as expected. These logs are infrequent on gnodev during local development, so it's manageable, but it remains a temporary solution.

This issue is part of a larger problem: gnodev currently cannot display node logs. We need to implement a proper method for displaying both node logs and this type of output without affecting the readability of gnodev logs. It's important to note that node logs are rarely needed for a lambda user, as they tend to be excessively verbose.

@thehowl
Copy link
Member Author

thehowl commented Nov 7, 2024

This issue is part of a larger problem: gnodev currently cannot display node logs. We need to implement a proper method for displaying both node logs and this type of output without affecting the readability of gnodev logs. It's important to note that node logs are rarely needed for a lambda user, as they tend to be excessively verbose.

I think we can simply restrict it to errors, so avoiding all the debug messages; and then maybe these ones printed to stdout. We can make it work also by putting, as the output, a Writer that replaces all \n into \r\n...

Anyhow, this is for you to figure out in gnoweb if you have the time. Merging for now.

@thehowl thehowl merged commit 9129e4e into gnolang:master Nov 7, 2024
134 checks passed
@thehowl thehowl deleted the dev/morgan/no-stdout branch November 7, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in focus Core team is prioritizing this work 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix println DoS vector
4 participants