You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a test uses a contract label that matches a key in the address stubs, the test framework will:
110
+
When a test deploys a contract using `pre.deploy_contract(..., stub="NAME")` and the stub name matches a key in the address stubs, the test framework will:
111
111
112
112
1. Use the pre-deployed contract at the specified address instead of deploying a new contract
113
113
2. Skip the contract deployment transaction, saving gas and time
114
114
3. Use the existing contract's code and state for the test
115
115
116
116
This is particularly useful when testing interactions with well-known contracts that are expensive to deploy or when you want to test against the actual deployed versions of contracts.
117
117
118
+
If the address is _not_ present in the stubbed addresses list, the test will fail to execute.
119
+
120
+
If the address contained in the stubbed addresses list does not contain code on the remote chain, the test will fail.
121
+
122
+
The pre-alloc will be populated with live information from the chain, so the following lines will result in up-to-date information:
pre[my_stubbed_contract].nonce # Actual nonce of the contract on chain
127
+
pre[my_stubbed_contract].balance # Actual balance of the contract on chain
128
+
```
129
+
118
130
### Bloat-net Testing
119
131
120
132
Address stubs are especially valuable when testing on **bloat-net**, a specialized network that contains pre-existing contracts with extensive storage history. On bloat-net:
0 commit comments