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

Huff contract deploy with (os error 2) #21

Open
paulatsydney opened this issue Sep 5, 2023 · 1 comment
Open

Huff contract deploy with (os error 2) #21

paulatsydney opened this issue Sep 5, 2023 · 1 comment

Comments

@paulatsydney
Copy link

Hi @refcell ,

When I use below forge script to deploy the contract, error occurs with (os error 2). I found you replied in other's github repo that this should be fixed by upgrading to huff-rs. But how can I deploy the huff contract here, is it possible to still deploy it with foundry-huff?

forge script script/Deploy.s.sol:Deploy 

[2115877] Deploy::run()
├─ [1897993] HuffDeployer::config() [delegatecall]
│ ├─ [1863762] → new HuffConfig@0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
│ │ └─ ← 9309 bytes of code
│ └─ ← 0x0000000000000000000000005615deb798bb3e4dfa0139dfa1b3d433cc23b72f
├─ [131299] HuffConfig::with_addr_constant(USER, 0x00000000000000000000000000000000bEefbabe)
│ └─ ← HuffConfig: [0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f]
├─ [61672] HuffConfig::deploy(Sandwich)
│ ├─ [0] VM::ffi([./lib/foundry-huff/scripts/binary_check.sh])
│ │ └─ ← 0x01
│ ├─ [0] VM::ffi([./lib/foundry-huff/scripts/rand_bytes.sh])
│ │ └─ ← 0x24936a96e60a720cb0f2811f4dee97ea
│ ├─ [0] VM::ffi([./lib/foundry-huff/scripts/file_writer.sh, src/__TEMP__tfbqbqftksfopwpjdurgtwfyuymqdfloSandwich.huff,
])
│ │ └─ ← 0x
│ ├─ [0] VM::ffi([./lib/foundry-huff/scripts/read_and_append.sh, src/__TEMP__tfbqbqftksfopwpjdurgtwfyuymqdfloSandwich.huff, src/Sandwich.huff])
│ │ └─ ← 0x
│ ├─ [0] VM::ffi([huffc, src/__TEMP__tfbqbqftksfopwpjdurgtwfyuymqdfloSandwich.huff, -b, -c, USER=0x00000000000000000000000000000000beefbabe])
│ │ └─ ← "Failed to execute command: No such file or directory (os error 2)"
│ └─ ← "Failed to execute command: No such file or directory (os error 2)"
└─ ← "Failed to execute command: No such file or directory (os error 2)"

@repo-gardener
Copy link

Hello. I was having this issue today. Use the forge arguments I provide below then run your command after you have followed the steps below.

forge create --rpc-url https://goerli.infura.io/v3/123ykurinfuraapikey --private-key 123reallylongprivatekeyfromwallet lib/foundry-huff/src/HuffDeployer.sol:HuffDeployer
then the terminal will output

ry-huff/src/HuffDeployer.sol:HuffDeployer
[⠊] Compiling...
No files changed, compilation skipped
Deployer: 0xe643fbF45e297Ab7C39111111fdEcDD59618d55
Deployed to: 0x4555f567a033fF8D26BC0c5A1Ec9cB245fd9CA54
Transaction hash: 0x8179ff0cb2a22aea77bcdfcc2b25e1fbb55cc9265447aced2f9deed2e6850067
then go to your foundry.toml and paste the deployed to contract address at the bottom like this

[profile.compiler]
link = [
"HuffDeployer=0x3065EB33B7A68629542258Ae94016C66CD66E"
]

then go back to the terminal and run your command forge script script/Deploy.s.sol:Deploy

you will see this output.

[⠊] Compiling...
No files changed, compilation skipped
2023-09-09T23:00:04.299299Z ERROR apply:ext: evm::cheatcodes: non-empty stderr args=["./lib/foundry-huff/scripts/binary_check.sh"] stderr="warning package.json: No license field\n"
Script ran successfully.

== Return ==
sandwich: contract Sandwich 0x104fBc016F4b1111118A6510109AC63E00

the contract has now deployed successfully but the error you see is explained as this"To fix this error, you need to add a license field to the package.json file of the foundry-huff library, with a valid value. You can use any OSI-approved license identifier from this list2 as the value for the license field. For example, if you want to use the MIT license, you can add this line to the package.json file:
"license": "MIT"
Alternatively, you can use "private": true as the value for the license field, if you do not want to publish or share the project as a package. This will tell npm that the project is private and not intended for distribution.
After you add the license field to the package.json file, you can try to run the script again and see if the error goes away. You can also check out the README file3 or the reference documentation4 of foundry-huff for more details on how to use it."

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

No branches or pull requests

2 participants