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

update tstore_bug-2 #141

Merged
merged 1 commit into from
Apr 12, 2024
Merged

Conversation

gurukamath
Copy link
Contributor

No description provided.

{
bb.Op(ops.ISZERO)
bb.Push(24576) // MAX_CODE_SIZE 0x6000
bb.Op(ops.MUL)
Copy link
Owner

Choose a reason for hiding this comment

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

Interesting. This looks like a hack to avoid jumping, is that so? Instead of branching on 1/0, you multiply it by 0x6000 and add 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Still figuring out JumpIf in goevmlab but this effectively accomplishes what I intended to do in the init code :)

Copy link
Owner

Choose a reason for hiding this comment

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

Nah jumpif isn't any good for this. Backward jumps are easy, forward jumps are a bit more tedious in goevmlab. It's not a proper "compiler", just some tooling to construct evm bytecode very minimalistically.

What one can do is basically note the size, add the jump to 0, yada yada, then later on, replace the 0-byte with the actual destinatoin.

I made a different/simpler fix though, returning code of size 0x600a - tstore(1)

Copy link
Owner

@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.

Awesome, nice work! I'll merge it and then push some minor changes

@holiman holiman merged commit 4a93c62 into holiman:more_examples Apr 12, 2024
1 check failed
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.

2 participants