From c172169a4d99f19f2938a31d8dfadc4e50941d79 Mon Sep 17 00:00:00 2001 From: Maka Date: Thu, 3 Aug 2023 00:54:37 +0100 Subject: [PATCH 1/2] [+] bytecode updated for EIP-3855 / fixed stack value missing from comment --- src/get-started/compiling/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/get-started/compiling/README.md b/src/get-started/compiling/README.md index fd9c19a..60e8d79 100644 --- a/src/get-started/compiling/README.md +++ b/src/get-started/compiling/README.md @@ -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. @@ -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. From 2d6e9b23a1e52785c929f139a86c5621780bd6f0 Mon Sep 17 00:00:00 2001 From: Maka Date: Thu, 3 Aug 2023 00:59:52 +0100 Subject: [PATCH 2/2] [+] bytecode updated for EIP-3855 / fixed stack value missing from comments [+] bytecode updated for EIP-3855 / fixed stack value missing from comments [+] bytecode updated for EIP-3855 / fixed stack value missing from comments [+] bytecode updated for EIP-3855 / fixed stack value missing from comments --- src/tutorial/the-basics/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tutorial/the-basics/README.md b/src/tutorial/the-basics/README.md index 557998a..54e217b 100644 --- a/src/tutorial/the-basics/README.md +++ b/src/tutorial/the-basics/README.md @@ -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 } ``` @@ -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! ```