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

Cannot deploy huff smart contract with forge script #59

Open
Linouth opened this issue Feb 18, 2024 · 2 comments
Open

Cannot deploy huff smart contract with forge script #59

Linouth opened this issue Feb 18, 2024 · 2 comments

Comments

@Linouth
Copy link

Linouth commented Feb 18, 2024

Deploying a huff contract through forge script fails with the following trace:

Traces:
  [2245499] → new Deploy@0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
    └─ ← 11154 bytes of code

  [2160044] Deploy::run()
    ├─ [2059491] → new HuffConfig@0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
    │   └─ ← 10226 bytes of code
    ├─ [679] HuffConfig::set_broadcast(true)
    │   └─ ← HuffConfig: [0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f]
    ├─ [64438] HuffConfig::deploy("flash")
    │   ├─ [0] VM::ffi(["./lib/foundry-huff/scripts/binary_check.sh"])
    │   │   └─ ← 0x01
    │   ├─ [0] VM::ffi(["./lib/foundry-huff/scripts/rand_bytes.sh"])
    │   │   └─ ← 0x79abd4fd40a5bb6ab0bf97e207a83bed
    │   ├─ [0] VM::ffi(["./lib/foundry-huff/scripts/file_writer.sh", "src/__TEMP__ihadllzrxbsnbidjjbjjfcpykjhdyjjaflash.huff", "\n"])
    │   │   └─ ← 0x
    │   ├─ [0] VM::ffi(["./lib/foundry-huff/scripts/read_and_append.sh", "src/__TEMP__ihadllzrxbsnbidjjbjjfcpykjhdyjjaflash.huff", "src/flash.huff"])
    │   │   └─ ← 0x
    │   ├─ [0] VM::ffi(["huffc", "src/__TEMP__ihadllzrxbsnbidjjbjjfcpykjhdyjjaflash.huff", "-b", "-e", "shanghai"])
    │   │   └─ ← 0x<bytecode>
    │   ├─ [0] VM::prank(HuffConfig: [0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f])
    │   │   └─ ← ()
    │   ├─ [0] VM::ffi(["rm", "src/__TEMP__ihadllzrxbsnbidjjbjjfcpykjhdyjjaflash.huff"])
    │   │   └─ ← 0x
    │   ├─ [0] VM::broadcast()
    │   │   └─ ← you have an active prank; broadcasting and pranks are not compatible
    │   └─ ← you have an active prank; broadcasting and pranks are not compatible
    └─ ← you have an active prank; broadcasting and pranks are not compatible

It seems that the VM::prank call in creation_code messes up the broadcast. Was there a recent change in forge that breaks this?

Forge version I'm using: forge 0.2.0 (7922fd5 2024-02-05T00:17:19.307849379Z)

@0xClandestine
Copy link

Here for same reason

@0xsimulacra
Copy link

0xsimulacra commented Apr 7, 2024

Same for me too. Forge version: forge 0.2.0 (0c961f742 2024-04-07T02:15:21.084882963Z)

Most what I checked is coorect. But in this assembly part:

 assembly {
       let val := sload(value.slot)
       deployedAddress := create(val, add(concatenated, 0x20), mload(concatenated))
  }

We load indeed the correct storage and it is not empty, it contains the correct bytecode. But for some reason, the code "create" doesn't put the bytecode in the contract address and we still get a success with deployed contract but that its code is empty.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants