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

Playground: do not cut values on the stack #179

Open
elawbek opened this issue Oct 1, 2022 · 7 comments
Open

Playground: do not cut values on the stack #179

elawbek opened this issue Oct 1, 2022 · 7 comments
Labels
improvement Improvement

Comments

@elawbek
Copy link

elawbek commented Oct 1, 2022

I think it would be more convenient if the values in the stack will not be truncated, e.g. PUSH1 0x42 would output in stack not just 42 but 0000000000000000000000000000000000000000000000000000000000000042, i.e. with a size of 32 bytes.

If my suggestion does not suit you, let me know.

@dorlevi
Copy link
Contributor

dorlevi commented Oct 4, 2022

Personally, I like the current behavior, but if other users feel strongly on it please speak up here; WDYT @thevaizman

@dorlevi dorlevi added the improvement Improvement label Oct 4, 2022
@thevaizman
Copy link
Contributor

From an aesthetic POV I'm with @dorlevi on this one, even though I understand @elawbek's point that the values shown do not replicate how they're really stored on the stack.
I personally do not see much value in "expanding" the stack values and I'd rather keep the view less cluttered and maybe just add a disclaimer/reminder next to the STACK header that all items are 32 bytes long.

Having said that, if there's a large demand from the community, we should go with them :)

@elawbek
Copy link
Author

elawbek commented Oct 5, 2022

If you add a flag to show or not show the full size of the stack value?

I just don't know how to check if there is a demand from the community.

@dorlevi
Copy link
Contributor

dorlevi commented Oct 5, 2022

I don't expect you to go and gauge it, I think we can leave it as an improvement here and see if some other frequent users voice in, I wouldn't want to add a flag in, less code is better here, but I am interested to better understand your motivation and maybe we should do what you propose and not truncate it.

When you say "more convenient" what do you mean? I personally believe that it's more convenient to trim/truncate the values as it's a clearer UXand (assume) that a user that got to the playground and investigated the stack assumes that it's truncated, I didn't expect people to copy-paste/use these values other than just exploring in the tool

thanks again

@elawbek
Copy link
Author

elawbek commented Oct 5, 2022

As a frequent user, I am used to the fact that when

PUSH1 0x42
PUSH1 0x00
MSTORE 

there is just the number 42 in the stack, but in the memory is shifted and the number is actually written not to the first byte but to the 32nd (I understand that by definition MSTORE writes 32 bytes into memory and this should be clear anyway), but I think that new users will have a better understanding of the 32-byte number in the stack and why it is written to memory this way.
Also, when learning how bit shifts work, it will be very handy to see how far to the left or right the number has shifted, without having to count in your mind the zeros that must be in front of the significant part of the value.

That's all. If you think these reasons aren't enough, let me know.
Thank you.

@SovaSlava
Copy link

I agree with @elawbek that its interesting feature and I'd like to see real view of variables in stack.

@Lucienest
Copy link

I agree with @elawbek there should be a way to toggle between aesthetic and actual view.

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

No branches or pull requests

5 participants