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

Multi chain deployment script issues (Ledger, --verify) #3698

Closed
2 tasks done
sendra opened this issue Nov 16, 2022 · 3 comments
Closed
2 tasks done

Multi chain deployment script issues (Ledger, --verify) #3698

sendra opened this issue Nov 16, 2022 · 3 comments
Labels
C-forge Command: forge Cmd-forge-script Command: forge script T-bug Type: bug

Comments

@sendra
Copy link

sendra commented Nov 16, 2022

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (903a073 2022-11-15T00:06:12.539932Z)

What command(s) is the bug in?

forge script scripts/FullMultiChain.s.sol:FullMultiChainDeployment --broadcast --private-key ${PRIVATE_KEY} --verify --multi -vvvv

Operating System

macOS (Apple Silicon)

Describe the bug

While trying out the new multi chain deployments from a same script I found a few issues.

While using private key for deployment it works correctly, but when using ledger it breaks.

command: forge script scripts/FullMultiChain.s.sol:FullMultiChainDeployment --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv

error:


Script ran successfully.
Gas used: 4208925
Multi chain deployment is still under development. Use with caution.

## Setting up (2) EVMs.
==========================
Simulated On-chain Traces:

  [1670532] → new TransparentProxyFactory@0xc716bDC36D18D903FAC96D9f1491dCAe0B4A7544
    └─ ← 7505 bytes of code

  [446734] TransparentProxyFactory::createDeterministicProxyAdmin(0x6D603081563784dB3f83ef1F65Cc389D94365Ac9, 0x54db45112fa098101a2fad13c11ac68f40a4db2489b6578d89830146fa693ed8) 
    ├─ [360715] → new ProxyAdmin@0xf3EE93c92342D5FfE50BA3E4E218055Ec0778D89
    │   ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: TransparentProxyFactory: [0xc716bDC36D18D903FAC96D9f1491dCAe0B4A7544])
    │   └─ ← 1683 bytes of code
    ├─ [2371] ProxyAdmin::transferOwnership(0x6D603081563784dB3f83ef1F65Cc389D94365Ac9) 
    │   ├─ emit OwnershipTransferred(previousOwner: TransparentProxyFactory: [0xc716bDC36D18D903FAC96D9f1491dCAe0B4A7544], newOwner: 0x6D603081563784dB3f83ef1F65Cc389D94365Ac9)
    │   └─ ← ()
    ├─ emit ProxyAdminDeterministicCreated(proxyAdmin: ProxyAdmin: [0xf3EE93c92342D5FfE50BA3E4E218055Ec0778D89], adminOwner: 0x6D603081563784dB3f83ef1F65Cc389D94365Ac9, salt: 0x54db45112fa098101a2fad13c11ac68f40a4db2489b6578d89830146fa693ed8)
    └─ ← ProxyAdmin: [0xf3EE93c92342D5FfE50BA3E4E218055Ec0778D89]

  [1670532] → new TransparentProxyFactory@0xA07f8DbbB7ae008904470e10d54716baa7C73e3D
    └─ ← 7505 bytes of code

  [446734] TransparentProxyFactory::createDeterministicProxyAdmin(0x6D603081563784dB3f83ef1F65Cc389D94365Ac9, 0x54db45112fa098101a2fad13c11ac68f40a4db2489b6578d89830146fa693ed8) 
    ├─ [360715] → new ProxyAdmin@0x788A5119e3437aDA6b1B3326DdEE98eb3Bf365b4
    │   ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: TransparentProxyFactory: [0xA07f8DbbB7ae008904470e10d54716baa7C73e3D])
    │   └─ ← 1683 bytes of code
    ├─ [2371] ProxyAdmin::transferOwnership(0x6D603081563784dB3f83ef1F65Cc389D94365Ac9) 
    │   ├─ emit OwnershipTransferred(previousOwner: TransparentProxyFactory: [0xA07f8DbbB7ae008904470e10d54716baa7C73e3D], newOwner: 0x6D603081563784dB3f83ef1F65Cc389D94365Ac9)
    │   └─ ← ()
    ├─ emit ProxyAdminDeterministicCreated(proxyAdmin: ProxyAdmin: [0x788A5119e3437aDA6b1B3326DdEE98eb3Bf365b4], adminOwner: 0x6D603081563784dB3f83ef1F65Cc389D94365Ac9, salt: 0x54db45112fa098101a2fad13c11ac68f40a4db2489b6578d89830146fa693ed8)
    └─ ← ProxyAdmin: [0x788A5119e3437aDA6b1B3326DdEE98eb3Bf365b4]


==========================

Chain 5

Estimated total gas used for script: 2752445

Estimated amount required: 0.29019783444836731 ETH

==========================

==========================

Chain 43113

Estimated total gas used for script: 2752445

Estimated amount required: 0.068811125 ETH

==========================

###
Finding wallets for all the necessary addresses...

###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 1].
⠉ [00:00:13] [####################################################################################################################################################] 2/2 txes (0.0s)##
Waiting for receipts.
⠙ [00:00:07] [################################################################################################################################################] 2/2 receipts (0.0s)
##### fuji
✅ Hash: 0xf75011fcada9978aeeb3cec7fd45ea921a4e7bea9056d9c268a6b37bb05e0b7e
Contract Address: 0xa07f8dbbb7ae008904470e10d54716baa7c73e3d
Block: 15859350
Paid: 0.0417633 ETH (1670532 gas * 25 gwei)


##### fuji
✅ Hash: 0x18d82180d5136fda63947ec674fa532ec9ea68537ba50995ca3056fe294f7f71
Block: 15859352
Paid: 0.0105114 ETH (420456 gas * 25 gwei)



==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Total Paid: 0.0522747 ETH (2090988 gas * avg 25 gwei)

Transactions saved to: /Users/user/bgd/project/broadcast/multi/FullMultiChain.s.sol-latest/run.json

Error: 
[Err(
Ledger device not available.

Context:
- hidapi error: hid_error is not implemented yet)]
make: *** [deploy-full-flow-ledger] Error 1

So I can sign the transactions on fuji, but when its time to sign on a different network (goerli) it breaks.

Also verification does not work with private key or ledger. I am adding the expected --verify flag, and have set up on foundry.toml the etherscan vars so i guess there should not be any need to add them to the command:

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY_ETH}" }
avalanche= { key = "${ETHERSCAN_API_KEY_AVAX}" }
optimism= { key = "${ETHERSCAN_API_KEY_OP}" }

Don't know if i am missing some flag or maybe the toml config nees something else?

Thx for the help

@sendra sendra added the T-bug Type: bug label Nov 16, 2022
@rkrasiuk rkrasiuk added C-forge Command: forge Cmd-forge-script Command: forge script labels Nov 18, 2022
@mds1
Copy link
Collaborator

mds1 commented Apr 11, 2023

Can you confirm if this is still an issue? I believe there's been some ledger fixes since this was created

@anna-carroll
Copy link

anna-carroll commented Sep 26, 2023

Hey!

I can confirm I just ran into this same issue. Using Ledger to sign, the multichain deploy script successfully submits the transactions on the first chain, but throws the same error as above once the script reaches the point of switching to the second chain:

Error: 
[Err(
Ledger device not available.

I can also confirm that I tested using Ledger to run a single-chain deploy script that submitted multiple transactions, and it worked perfectly fine. However, once trying a multi-chain script, the Ledger integration fails at the point of switching chains.

I also tried using a .env EOA for multichain deploy script, and that worked fine. So, it seems like the issue is pinpointed to Ledger + multichain script


Full Logs

forge script DummyScriptMulti --sig "dummy()" --multi --sender REDACTED --broadcast -l
[⠢] Compiling...
No files changed, compilation skipped
Script ran successfully.
Gas used: 3668662
Multi chain deployment is still under development. Use with caution.

## Setting up (2) EVMs.

==========================

Chain 11155111

Estimated gas price: 22.704449182 gwei

Estimated total gas used for script: 2576000

Estimated amount required: 0.058 ETH

==========================

==========================

Chain 5

Estimated gas price: 3.000000044 gwei

Estimated total gas used for script: 2576000

Estimated amount required: 0.0077 ETH

==========================

###
Finding wallets for all the necessary addresses...

###
Finding wallets for all the necessary addresses...
##
Sending transactions [0 - 0].
⠁ [00:00:05] [###############################################################################################################] 1/1 txes (0.0s)##
Waiting for receipts.
⠉ [00:00:06] [###########################################################################################################] 1/1 receipts (0.0s)
##### sepolia
✅  [Success]Hash: REDACTED
Contract Address: REDACTED
Block: REDACTED
Paid: 0.0288 ETH (1982354 gas * 14.528 gwei)



==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Total Paid: 0.0288 ETH (1982354 gas * avg 14.528 gwei)

Transactions saved to: /Users/REDACTED/git/app/broadcast/multi/DummyScriptMulti.s.sol-latest/dummy.json

Error:
[Err(
Ledger device not available.

Context:
- hidapi error: hid_error is not implemented yet)]

Reproduce error

Here's an example forge script to repro:

pragma solidity ^0.8.13;

import {Script} from "forge-std/Script.sol";

contract MyContract {
    function hi() external pure returns (string memory) {
        return "hi";
    }
}

contract DummyScriptMulti is Script {
    /// @notice SCRIPT ENTRYPOINT.
    // forge script DummyScriptMulti --sig "dummy()" --multi --sender [LEDGER_ADDRESS] --broadcast --verify
    function dummy() public {
        vm.createSelectFork("goerli");
        vm.startBroadcast();
        new MyContract();
        vm.stopBroadcast();

        vm.createSelectFork("sepolia");
        vm.startBroadcast();
        new MyContract();
        vm.stopBroadcast();
    }
}

with foundry.toml including

[rpc_endpoints]
goerli = "${GOERLI_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"

[etherscan]
goerli = { key = "${ETHERSCAN_API_KEY}", chain = "goerli" }
sepolia = { key = "${ETHERSCAN_API_KEY}", chain = "sepolia" }

and .env populated with

GOERLI_RPC_URL=
SEPOLIA_RPC_URL=
ETHERSCAN_API_KEY=

@zerosnacks
Copy link
Member

Marking as resolved

Unable to replicate the issue with the given instructions with minor modifications (holesky instead of goerli)

forge script DummyScriptMulti --sig "dummy()" --multi --broadcast --sender $SENDER --ledger succeeds

We've also since moved from Ethers to Alloy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-script Command: forge script T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

5 participants