feat: emit explicit warning message when non-initialized contract is used #7562
Labels
A-internals
Area: internals
C-forge
Command: forge
Cmd-forge-test
Command: forge test
T-feature
Type: feature
Component
Forge
Describe the feature you would like
Proposal: Enhanced Error Handling for Calls to Uninitialized Contracts
Managing multiple contracts can occasionally lead to an oversight where one contract is not initialized. This oversight typically results in a
EvmError: Revert;
error, which is often detected only at the end of the execution stack. This not only makes debugging challenging but also time-consuming.I propose to implement a mechanism that specifically catches this type of error and, in response, provides a more explicit and informative error message, such as
Error: Contract not initialized.
By doing so, we aim to alert developers to the precise nature of the issue more quickly, making it easier to identify and rectify the oversight of not initializing a contract.Additional context
Here's a revised version of your message for clarity and correctness:
Additional Context
During ETH Oxford, I encountered an issue that took me a while to resolve due to the lack of an explicit error message.
How it Occurred:
The issue arises when executing
forge test
and calling a function within your contract that triggers another contract. If you specify the contract but forget to initialize it, you encounter a non-explicit error:EvmError: Revert;
.Reproducible Error:
Note: I have simplified the implementation to get a short reproductible code
The text was updated successfully, but these errors were encountered: