Skip to content

core/vm: Simplify Contract.GetByte function#23974

Merged
holiman merged 1 commit intoethereum:masterfrom
ipsilon:simplify-getop
Nov 25, 2021
Merged

core/vm: Simplify Contract.GetByte function#23974
holiman merged 1 commit intoethereum:masterfrom
ipsilon:simplify-getop

Conversation

@gumb0
Copy link
Copy Markdown
Member

@gumb0 gumb0 commented Nov 25, 2021

Small cleanup to remove unneed extra helper + use STOP literal instead of 0.

Comment thread core/vm/contract.go
}

return 0
return STOP
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps a comment could help:

Suggested change
return STOP
// Reading over code is defined to return the byte 0, which is the STOP instruction
return STOP

@gumb0 gumb0 marked this pull request as ready for review November 25, 2021 14:48
Copy link
Copy Markdown
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM!

I had an identical branch which I was going to PR, but then I looked at the decompilation of the interpreter, and found that it was no practical difference at all, so I didn't bother. Nevertheless, less code is better

@holiman holiman added this to the 1.10.14 milestone Nov 25, 2021
@holiman holiman merged commit 519cf98 into ethereum:master Nov 25, 2021
@axic axic deleted the simplify-getop branch November 25, 2021 19:18
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Nov 26, 2021
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
yperbasis added a commit to erigontech/erigon that referenced this pull request Dec 19, 2022
Cherry-pick ethereum/go-ethereum#23974

Co-authored-by: Andrei Maiboroda <andrei@ethereum.org>
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Mar 1, 2024
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