foundry icon indicating copy to clipboard operation
foundry copied to clipboard

forge script blocks on tx receipts

Open shaspitz opened this issue 10 months ago • 5 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (bdc04c2 2024-04-12T00:21:19.564747000Z)

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

Hey I'm running a simple deploy script, and observing behavior where the txes in the script simulate just fine, get broadcasted just fine, and actually end up on chain. However, forge script endlessly waits on the tx receipts. Example command below

    forge script \
        --priority-gas-price 2000000000 \
        --with-gas-price 5000000000 \
        "scripts/DeployScripts.s.sol:DeployValidatorRegistry \
        --rpc-url "https://chainrpc.testnet.mev-commit.xyz" \
        --private-key "$PRIVATE_KEY" \
        --broadcast \
        --chain-id "17864" \
        -vvvv \
        --use 0.8.23 \
        --via-ir

output:

[⠊] Compiling...
[⠑] Compiling 65 files with 0.8.23
[⠊] Solc 0.8.23 finished in 13.09s
Compiler run successful!
Traces:
  [3103718] DeployValidatorRegistry::run()
    ├─ [0] VM::startBroadcast()
    │   └─ ← [Return]
    ├─ [0] VM::envOr("FOUNDRY_OUT", "out") [staticcall]
    │   └─ ← [Return] <env var value>
    ├─ [0] VM::projectRoot() [staticcall]
    │   └─ ← [Return] "*redacted*"
    ├─ [0] VM::readFile("*redacted*/ValidatorRegistry.json") [staticcall]
    │   └─ ← [Return] <file>
    ├─ [0] VM::keyExistsJson("<JSON file>", ".ast") [staticcall]
    │   └─ ← [Return] true
    ├─ [0] VM::parseJsonString("<stringified JSON>", ".ast.absolutePath") [staticcall]
    │   └─ ← [Return] "contracts/ValidatorRegistry.sol"
    ├─ [0] VM::parseJsonString("<stringified JSON>", ".ast.license") [staticcall]
    │   └─ ← [Return] "BSL 1.1"
    ├─ [0] VM::parseJsonString("<stringified JSON>", ".metadata.sources.['contracts/ValidatorRegistry.sol'].keccak256") [staticcall]
    │   └─ ← [Return] "0x0e769533d98f19a2f61aa60b7fc1eac9cb48ace1b742735b7868914354f655ed"
    ├─ [0] VM::envOr("OPENZEPPELIN_BASH_PATH", "bash") [staticcall]
    │   └─ ← [Return] <env var value>
    ├─ [0] VM::tryFfi(["bash", "-c", "npx @openzeppelin/upgrades-core@^1.32.3 validate out/build-info --contract contracts/ValidatorRegistry.sol:ValidatorRegistry"])
    │   └─ ← [Return] (0, 0xe29c942020636f6e7472616374732f56616c696461746f7252656769737472792e736f6c3a56616c696461746f7252656769737472790a0a53554343455353, 0x)
    ├─ [0] VM::getCode("ValidatorRegistry.sol") [staticcall]
    │   └─ ← [Return] 0x608080604052346100b8577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009081549060ff8260401c166100a957506001600160401b036002600160401b031982821601610064575b604051610f6390816100be8239f35b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1388080610055565b63f92ee8a960e01b8152600490fd5b600080fdfe6080604081815260048036101561001557600080fd5b600092833560e01c9081631460fa8714610d2657508063375b3c0a14610d095780633c22d7a914610b645780634da6a55614610b2c5780636177fd1814610ad6578063715018a614610a6c5780638da5cb5b14610a365780639bdd94801461091e578063a6ab36f214610727578063b6c63bb9146106ee578063bd5dec9814610369578063c253f7651461034a578063d63d12171461030b578063f2fde38b146102db5763fadb2c6e146100c857600080fd5b6100d136610d75565b929091831561028d578334048554811061023357855b8581106101695750505082815191808301908352526060810191845b84811061013b5734602084015285337fea0052ec330e7b29ff95aab8408237786e5a76c40b743161c325bc67c466221085870386a280f35b909283356001600160a01b0381169190829003610165576001918152602080910194019101610103565b8680fd5b6001600160a01b0380610185610180848a8a610dc2565b610de8565b168852600290602091808352868a20546101f057918184936003936101b06101806001988e8e610dc2565b168c528252878b206101c3878254610dfc565b90556101d3610180858c8c610dc2565b168a525284882080546001600160a01b03191633179055016100e7565b865162461bcd60e51b8152808701849052601860248201527f526563697069656e7420616c7265616479207374616b656400000000000000006044820152606490fd5b506020608492519162461bcd60e51b8352820152602e60248201527f53706c697420616d6f756e74206d757374206d65657420746865206d696e696d60448201526d1d5b481c995c5d5a5c995b595b9d60921b6064820152fd5b6020608492519162461bcd60e51b83528201526024808201527f5468657265206d757374206265206174206c65617374206f6e652072656369706044820152631a595b9d60e21b6064820152fd5b8334610308576020366003190112610308576103056102f8610d5a565b610300610e93565b610e1f565b80f35b80fd5b505034610346576020366003190112610346576020916001600160a01b0390829082610335610d5a565b168152600385522054169051908152f35b5080fd5b5050346103465781600319360112610346576020906001549051908152f35b508290346103465761037a36610d75565b906002947f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f009360028554146106e05760028555855b8481106103be57866001875580f35b6001600160a01b03806103d5610180848989610dc2565b1688526020898152848920541561069e57816103f5610180858a8a610dc2565b16895260038082523383878c205416148015610686575b1561060d5782610420610180868b8b610dc2565b168a52848252610436868b205460015490610dfc565b43106105a4578261044b610180868b8b610dc2565b168a528a8252858a20549280610465610180878c8c610dc2565b168b528b8352868b2080549085820391821161059157558a80808087335af13d1561058c5767ffffffffffffffff3d81811161057957895191601f8201601f19908116603f0116830190811183821017610566578a5281528c853d92013e5b1561052357917f8108595eb6bad3acefa9da467d90cc2217686d5c5ac85460f8b7849c840645fc918594936104ff6101806001988d8d610dc2565b168c528152868b2080546001600160a01b031916905586519283523392a2016103af565b865162461bcd60e51b8152808701849052601860248201527f4661696c656420746f207769746864726177207374616b6500000000000000006044820152606490fd5b634e487b7160e01b8f5260418a5260248ffd5b634e487b7160e01b8e526041895260248efd5b6104c4565b634e487b7160e01b8d526011885260248dfd5b855162461bcd60e51b8152808601839052603760248201527f7769746864726177616c206e6f7420616c6c6f776564207965742e20426c6f6360448201527f6b7320726571756972656d656e74206e6f74206d65742e0000000000000000006064820152608490fd5b855162461bcd60e51b8152808601839052604760248201527f4e6f7420617574686f72697a656420746f2077697468647261772e204d75737460448201527f206265207374616b65206f726967696e61746f72206f7220454f412077686f73606482015266081cdd185ad95960ca1b608482015260a490fd5b503383610697610180878c8c610dc2565b161461040c565b8360649186519162461bcd60e51b8352820152601d60248201527f4e6f207374616b65642062616c616e636520746f2077697468647261770000006044820152fd5b9051633ee5aeb560e01b8152fd5b50346107235760203660031901126107235760209282916001600160a01b03610715610d5a565b168252845220549051908152f35b8280fd5b5034610723576060366003190112610723578035906044356024356001600160a01b038216820361091a577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009384549360ff85881c16159467ffffffffffffffff811680159081610912575b6001149081610908575b1590816108ff575b506108f05767ffffffffffffffff1981166001178755856108d1575b508115610882578215610831575086556001556107e8906107e0610ecc565b610300610ecc565b6107f0578280f35b805468ff00000000000000001916905551600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a138808280f35b608490602088519162461bcd60e51b8352820152602560248201527f556e7374616b6520706572696f64206d75737420626520677265617465722074604482015264068616e20360dc1b6064820152fd5b608490602088519162461bcd60e51b83528201526024808201527f4d696e696d756d207374616b65206d75737420626520677265617465722074686044820152630616e20360e41b6064820152fd5b68ffffffffffffffffff191668010000000000000001178655386107c1565b50865163f92ee8a960e01b8152fd5b905015386107a5565b303b15915061079d565b879150610793565b8580fd5b508260031936011261072357825434106109dd573383526002602052818320546109aa57503382526002602052808220610959348254610dfc565b90553382526003602052808220336bffffffffffffffffffffffff60a01b825416179055513481527f8d413953974047bf2acf82843dcb42b902604eba958fd1d2a7b4815886e89c0c60203392a280f35b6020606492519162461bcd60e51b8352820152600e60248201526d105b1c9958591e481cdd185ad95960921b6044820152fd5b6020608492519162461bcd60e51b8352820152602e60248201527f5374616b6520616d6f756e74206d757374206d65657420746865206d696e696d60448201526d1d5b481c995c5d5a5c995b595b9d60921b6064820152fd5b505034610346578160031936011261034657600080516020610f0e8339815191525490516001600160a01b039091168152602090f35b8334610308578060031936011261030857610a85610e93565b600080516020610f0e83398151915280546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b509034610723576020366003190112610723576020926001600160a01b03610afc610d5a565b1681526002845281812054815411159283610b1c575b5050519015158152f35b8293508452205415903880610b12565b5050346103465760203660031901126103465760209181906001600160a01b03610b54610d5a565b1681526002845220549051908152f35b503461072357610b7336610d75565b9190845b838110610b82578580f35b6001600160a01b0380610b99610180848887610dc2565b16875260026020918183528789205415610cce5780610bbc610180868a89610dc2565b168952600383523381898b205416148015610cb6575b15610c3e579081849392610bec6101806001978b8a610dc2565b168a5286835243898b2055610c05610180858a89610dc2565b16895281527f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75878920549188519283523392a201610b77565b875162461bcd60e51b8152808701849052604660248201527f4e6f7420617574686f72697a656420746f20756e7374616b652e204d7573742060448201527f6265207374616b65206f726967696e61746f72206f7220454f412077686f73206064820152651cdd185ad95960d21b608482015260a490fd5b503381610cc7610180878b8a610dc2565b1614610bd2565b875162461bcd60e51b815280870184905260156024820152744e6f2062616c616e636520746f20756e7374616b6560581b6044820152606490fd5b505034610346578160031936011261034657602091549051908152f35b84908434610723576020366003190112610723576020926001600160a01b03610d4d610d5a565b1681526002845220548152f35b600435906001600160a01b0382168203610d7057565b600080fd5b906020600319830112610d705760043567ffffffffffffffff92838211610d705780602383011215610d70578160040135938411610d705760248460051b83010111610d70576024019190565b9190811015610dd25760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b0381168103610d705790565b91908201809211610e0957565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03908116908115610e7a57600080516020610f0e83398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b600080516020610f0e833981519152546001600160a01b03163303610eb457565b60405163118cdaa760e01b8152336004820152602490fd5b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c1615610efb57565b604051631afcd79f60e31b8152600490fdfe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300a264697066735822122026a79b9c4f6e18b996ae11b895018db46e46cdbafead59ec664fff810d27b82864736f6c63430008170033
    ├─ [811932] → new ValidatorRegistry@0x68B1D87F95878fE05B998F19b66F4baba5De1aed
    │   ├─ emit Initialized(version: 18446744073709551615 [1.844e19])
    │   └─ ← [Return] 3939 bytes of code
    ├─ [0] VM::getCode("ERC1967Proxy.sol:ERC1967Proxy") [staticcall]
    │   └─ ← [Return] 0x60806040526102d38038038061001481610194565b92833981019060408183031261018f5780516001600160a01b03811680820361018f5760208381015190936001600160401b03821161018f570184601f8201121561018f5780519061006d610068836101cf565b610194565b9582875285838301011161018f57849060005b83811061017b57505060009186010152813b15610163577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b03191682179055604051907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28351156101455750600080848461012c96519101845af4903d1561013c573d61011c610068826101cf565b908152600081943d92013e6101ea565b505b6040516085908161024e8239f35b606092506101ea565b9250505034610154575061012e565b63b398979f60e01b8152600490fd5b60249060405190634c9c8ce360e01b82526004820152fd5b818101830151888201840152869201610080565b600080fd5b6040519190601f01601f191682016001600160401b038111838210176101b957604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116101b957601f01601f191660200190565b9061021157508051156101ff57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610244575b610222575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561021a56fe60806040527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54600090819081906001600160a01b0316368280378136915af43d82803e15604b573d90f35b3d90fdfea264697066735822122051d7c695feb1664111b20b52eda877908986b10031c2f790027ebb55ef17922f64736f6c63430008170033
    ├─ [143849] → new ERC1967Proxy@0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
    │   ├─ emit Upgraded(implementation: ValidatorRegistry: [0x68B1D87F95878fE05B998F19b66F4baba5De1aed])
    │   ├─ [92398] ValidatorRegistry::initialize(3000000000000000000 [3e18], 64, 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) [delegatecall]
    │   │   ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
    │   │   ├─ emit Initialized(version: 1)
    │   │   └─ ← [Return]
    │   └─ ← [Return] 133 bytes of code
    ├─ [0] console::log("ValidatorRegistry UUPS proxy deployed to:", ERC1967Proxy: [0x3Aa5ebB10DC797CAC828524e59A333d0A371443c]) [staticcall]
    │   └─ ← [Stop]
    ├─ [779] ERC1967Proxy::owner() [staticcall]
    │   ├─ [463] ValidatorRegistry::owner() [delegatecall]
    │   │   └─ ← [Return] 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
    │   └─ ← [Return] 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
    ├─ [0] console::log("ValidatorRegistry owner:", 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) [staticcall]
    │   └─ ← [Stop]
    ├─ [0] VM::stopBroadcast()
    │   └─ ← [Return]
    └─ ← [Return]


Script ran successfully.

== Logs ==
  ValidatorRegistry UUPS proxy deployed to: 0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
  ValidatorRegistry owner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

## Setting up 1 EVM.
==========================
Simulated On-chain Traces:

  [811932] → new ValidatorRegistry@0x68B1D87F95878fE05B998F19b66F4baba5De1aed
    ├─ emit Initialized(version: 18446744073709551615 [1.844e19])
    └─ ← [Return] 3939 bytes of code

  [146349] → new ERC1967Proxy@0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
    ├─ emit Upgraded(implementation: ValidatorRegistry: [0x68B1D87F95878fE05B998F19b66F4baba5De1aed])
    ├─ [92398] ValidatorRegistry::initialize(3000000000000000000 [3e18], 64, 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) [delegatecall]
    │   ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
    │   ├─ emit Initialized(version: 1)
    │   └─ ← [Return]
    └─ ← [Return] 133 bytes of code


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

Chain 17864

Estimated gas price: 5 gwei

Estimated total gas used for script: 1484996

Estimated amount required: 0.00742498 ETH

==========================
##
Sending transactions [0 - 1].
⠉ [00:00:00] [#############################################################################################################################################] 2/2 txes (0.0s)##
Waiting for receipts.
⠁ [00:00:00] [-----------------------------------------------------------------------------------------------------------------------------------------] 0/2 receipts (0.0s)

the forge script command will continue to hang on the Waiting for receipts message, even after the tx is included in a block. This is a tx on our testnet that was produced from the example output. You can see the contract created in that tx aligns with the given output.

Thanks for help!

shaspitz avatar Apr 12 '24 05:04 shaspitz

probably https://github.com/alloy-rs/alloy/issues/389

klkvr avatar Apr 12 '24 09:04 klkvr

encoutering the same problem when trying to deploy on arbitrum one (block time 250ms), the tx is mined (it shows on arbiscan) but the scripts hangs on Waiting for receipts

eswak avatar Apr 18 '24 06:04 eswak

@eswak this might have to do with shorter block times. I'm facing this issue on a 200ms block time sidechain

shaspitz avatar Apr 19 '24 08:04 shaspitz

Also experiencing the same issue when deploying on Arbitrum One. Transaction shows as having been mined in Arbiscan but CLI continue to hang onto 'Waiting for receipts'

No issue with deploying on Sepolia testnet.

SheeranJL avatar Apr 22 '24 15:04 SheeranJL

@Evalir

0xTimepunk avatar Apr 23 '24 16:04 0xTimepunk

Fixed by https://github.com/alloy-rs/alloy/pull/614

klkvr avatar May 14 '24 20:05 klkvr