Closed nufailTanjiro closed 3 months ago
Hi @nufailTanjiro,
"C:/Program Files/Git/bin/bash" "--version"
"C:/Program Files/Git/bin/bash" "-c" npx @openzeppelin/upgrades-core@^1.32.3 validate out/build-info --contract src/DeedX.sol:DeedX"
Hi @ericglau
-bash: C:/Program Files/Git/bin/bash: No such file or directory
bash: C:/Program Files/Git/bin/bash: No such file or directory
Do you have the bash executable available at C:/Program Files/Git/bin/bash
? Can you ensure that OPENZEPPELIN_BASH_PATH
is set to a path that contains the bash
executable?
You could try installing Git for Windows if needed.
I have already installed Git for Windows
The bash executable file is in C:/Program Files/Git/bin/bash
:
I have also added in my environment variable:
When I execute this command "C:/Program Files/Git/bin/bash" "--version"
on my Windows command prompt I got the version and bash details. But when I execute in my WSL cmd I get -bash: C:/Program Files/Git/bin/bash: No such file or directory
Can you try running the forge script from the Windows command prompt (not WSL)? Or, change OPENZEPPELIN_BASH_PATH
to the bash directory within WSL (using Linux-style paths)?
I changed OPENZEPPELIN_BASH_PATH
to the bash directory within WSL
Now I am getting
Error:
script failed: failed to execute command cd "/home/nufaileth/foundry/deedx-contracts" && "/mnt/c/Program Files/Git/bin/bash" "-c" "npx @openzeppelin/upgrades-core@^1.32.3 validate out/build-info --contract src/DeedX.sol:DeedX": No such file or directory (os error 2)
- "C:/Program Files/Git/bin/bash" "--version"
This one is solved, Now I'm facing a different issue when running:
forge script --chain sepolia script/DeployDeedX.sol:DeployDeedX --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvvv
This should be fixed if you update Foundry. See https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades/issues/51#issuecomment-2101741657
This is my foundry version after running foundryup
:
$ forge --version
forge 0.2.0 (f479e94 2024-06-01T00:21:09.122773900Z)
I am still getting the same error
This is my error
OPENZEPPELIN_BASH_PATH
?out/build-info
subdirectory of your project so that I can look into the issue further? Note that this file contains all of your contracts' source code.I ran this:
forge script --chain sepolia script/DeployDeedX.sol:DeployDeedX --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvvv
script on git bash terminal
I am running it on my git bash shell
Build info file is zipped [Uploading build-info.zip…]()
Looks like the zip file link isn't working, can you try uploading it again?
Can you access this? https://github.com/nufailTanjiro/build-info/tree/main
Thanks, I was able to access that. It looks like there may be some conflicts in your remappings. Some of the dependencies are referencing paths such as node_modules/@openzeppelin/contracts-upgradeable
while some are referencing lib/openzeppelin-contracts-upgradeable
It looks like you are using npm modules (node_modules
) for the OpenZeppelin Contracts dependencies. If this is the intention, could you try updating your remappings.txt
to use those exclusively, for example:
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
If this does not resolve the issue, would you be able to share your repository or a minimal reproducible repository with the way that your project is set up?
I changed the remappings.txt
but not resolved.
Here is the repo link: https://github.com/codinglegendsdevs/deedx-contracts
I'm not able to access that repo, can you grant me access? Thanks for your patience with this.
Sorry my bad, I've given you access now
Thanks. I tried the following with your repo:
remappings.txt
to match my previous commentforge script script/DeployDeedX.sol --force
This was able to progress to run upgrade safety validations, which failed with the following error because it looks like the variable is missing a constant
keyword.
script failed: revert: Upgrade safety validation failed:
✘ src/DeedX.sol:DeedX
src/DeedX.sol:25: Variable `DEEDX_GOVERNANCE` is assigned an initial value
Move the assignment to the initializer
https://zpl.in/upgrades/error-004
If you are still getting the error from https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades/issues/54#issuecomment-2144399825, ensure you are using --force
when running forge script
.
I'll see if I can try the above on Windows as well.
Now I am getting a new error saying:
Failed with `custom error 4c9c8ce3:00000000000000000000000034a1d3fff3958843c43ad80f30b94c510645c316`:
[2342458] → new DeployDeedX@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
├─ emit Initialized(version: 18446744073709551615 [1.844e19])
└─ ← [Return] 11582 bytes of code
[3441] → new <unknown>@0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
└─ ← [Revert] 36 bytes of code
Error:
Simulated execution failed.
The error 4c9c8ce3:00000000000000000000000034a1d3fff3958843c43ad80f30b94c510645c316
ERC1967InvalidImplementation(0x34a1d3fff3958843c43ad80f30b94c510645c316).
But these are handled by the openzeppelin foundry upgrades yea?
It looks like this is because you are running deployment on sepolia but the broadcast is not set up correctly. In your script you have
vm.startBroadcast();
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
but it should be
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
Also, minor suggestion with your implementation, I think for your DEEDX_GOVERNANCE
role, you could just make it a constant if the hash doesn't need to be changed:
bytes32 public constant DEEDX_GOVERNANCE = keccak256("DEEDX_GOVERNANCE");
If the issue is resolved for you, feel free to remove me from your repo.
Thanks, it worked. By the way, facing an issue when verifying the contract
forge script --chain 80002 script/DeployDeedX.sol:DeployDeedX --rpc-url $POLYGON_AMOYNET_RPC --broadcast --verify -vvvv --force
This command successfully deployed the contract but failed to verify since I am deploying and verifying using polygon amoy
So to verify it manually, after the deployment I ran:
forge verify-contract --compiler-version 0.8.20 --chain polygon-amoy 0x9E17cFc7AA8A067818381d8CAd35cf1AA6C1e623 src/DeedX.sol:DeedX --verifier-url $AMOY_POLYGON_VERIFIER_URL --etherscan-api-key $POLYGON_SCAN_API_KEY
The console returned success:
Start verifying contract `0x9E17cFc7AA8A067818381d8CAd35cf1AA6C1e623` deployed on amoy
Submitting verification for [src/DeedX.sol:DeedX] 0x9E17cFc7AA8A067818381d8CAd35cf1AA6C1e623.
Submitted contract for verification:
Response: `OK`
GUID: `u2nec45ryd8kwd7gfyd81eqtpshmmul75cm6clfmwvrz1qt9gm`
URL: https://amoy.polygonscan.com/address/0x9e17cfc7aa8a067818381d8cad35cf1aa6c1e623
But when I visit the amoy.polygonsacan URL, the contract not verified:
This is what I have on my foundry.toml:
[rpc_endpoints]
sepolia = "${SEPOLIA_RPC_URL}"
polygon-amoy = "${POLYGON_AMOYNET_RPC}"
[etherscan]
sepolia = { key = "${ETHERSCAN_API_KEY}" }
polygon-amoy = { key = "${POLYGON_SCAN_API_KEY}" }
I don't think I can help much as that might be a block explorer issue. But I would suggest getting your build-info file from out/build-info
, extract the input
section's contents into a standalone JSON file, for example from
{
"_format": "ethers-rs-sol-build-info-1",
"solcVersion": "0.8.26",
"solcLongVersion": "0.8.26",
"input": {
"language": "Solidity",
"sources": {
...
},
"settings": {
...
}
},
...
to
{
"language": "Solidity",
"sources": {
...
},
"settings": {
...
}
}
Then use that new file as the Solc JSON input to manually verify on the block explorer. See https://forum.openzeppelin.com/t/how-to-verify-a-contract-on-etherscan-bscscan-polygonscan/14225 for some general info on verification.
Closing this issue as it looks like the original problem is resolved. If you have further issues, feel free to post on https://forum.openzeppelin.com/c/support/upgrades or open another issue as needed.
When I run
I am getting an error saying:
I addedon my .env:
import "forge-std/Script.sol"; import {DeedX} from "../src/DeedX.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
contract DeployDeedX is Script { function run() external { vm.startBroadcast(); uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
}