huff-language / huff-project-template

Foundry Repository Template that supports writing contracts in Huff using the foundry-huff library.
The Unlicense
212 stars 45 forks source link

bugfix: don't return the value on `setValue` #19

Closed alcueca closed 1 year ago

alcueca commented 1 year ago

I might be wrong, but given the function interface, setValue is not expected to return a value.

If we don't return on setValue, then getValue gets executed afterwards, returning value.

To test, you can do this:

image
devtooligan commented 1 year ago

Thanks for opening this.

Great catch!

However, this solution using the stop opcode here is preferred. That one was just merg ed.

What your solution does is to actually return whatever is stored at 0x00 (which in this case will be 0x0 so it doesn't really matter but we should still be using stop).

alcueca commented 1 year ago

Thank you, I hadn't got yet to the stop opcode in the tutorial :D