Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

[+] bytecode updated for EIP-3855 / fixed stack value missing from comments #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/get-started/compiling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Below we outline the few steps it takes to compile a Huff contract.
#define macro MAIN() = {
// Load our numbers from calldata and add them together.
0x04 calldataload // [number1]
0x24 calldataload // [number2]
0x24 calldataload // [number2, number1]
add // [number1+number2]

// Return our new number.
Expand All @@ -30,7 +30,7 @@ Below we outline the few steps it takes to compile a Huff contract.
This will output something similar to:

```plaintext
61000f8061000d6000396000f36004356024350160005260206000f3
600d8060093d393df3600435602435015f5260205ff3
```

You can find an in-depth explanation of this contract in [The Basics](https://docs.huff.sh/tutorial/the-basics) tutorial.
8 changes: 4 additions & 4 deletions src/tutorial/the-basics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ The next thing we are going to create is the `MAIN macro`. This serves a single
```Huff
#define macro MAIN() = takes(0) returns(0) {
0x00 calldataload // [number1] // load first 32 bytes onto the stack - number 1
0x20 calldataload // [number2] // load second 32 bytes onto the stack - number 2
0x20 calldataload // [number2, number1] // load second 32 bytes onto the stack - number 2
add // [number1+number2] // add number 1 and 2 and put the result onto the stack

0x00 mstore // place [number1 + number2] in memory
0x00 mstore // place [number1+number2] in memory
0x20 0x00 return // return the result
}
```
Expand All @@ -45,10 +45,10 @@ Go ahead and copy the above macro into your `addTwo.huff` file. Run `huffc addTw

Congratulations you've just compiled your first contract!

The bytecode output of the compiler will echo the following into the console `600f8060093d393df36000356020350160005260206000f3`.
The bytecode output of the compiler will echo the following into the console `600c8060093d393df35f35602035015f5260205ff3`.

When you deploy this contract code it will have the runtime bytecode of the main macro we just created! In the above snippet you will find it after the first `f3` (the preceding bytecode is boiler plate constructor logic.)
That leaves us with this: `6000356020350160005260206000f3`
That leaves us with this: `5f35602035015f5260205ff3`
Below, this example dissembles what you have just created!

```
Expand Down