Skip to content

Commit f1f13ed

Browse files
Update README.md
Add Client contract troubleshoot message
1 parent b81a753 commit f1f13ed

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,20 @@ Creates a new instance of an upgradeable contract.
281281

282282
- **Parameters:**
283283
- `manager_`: Address of the contract manager.
284+
285+
### Troubleshooting
286+
If the client contract is reverting this is usually caused by one of the following things:
287+
- client doesn't have enough DC allowance on the contract
288+
- contract doesn't have enough DC
289+
- client tries to use SP that's not whitelisted
290+
- allocation to this SP would exceed "fair DC distribution" limits (a.k.a. if Client got 1 PiB of DC and there are 5 whitelisted SPs, max 200 TiB +/- 10% can be allocated to each one of them)
291+
292+
**How to verify what's the cause**
293+
1. Install https://getfoundry.sh/introduction/installation
294+
2. Check if contract has enough DC: `curl 'https://api.node.glif.io/' -X POST --data-raw '{"jsonrpc":"2.0","method":"Filecoin.StateVerifiedClientStatus","params":["f410fdfrfh3jhrys2w5rsjpdin3hab47gp4qy2z4fsdy",null],"id":0}'` (replace f410... with your contract address). **Result should be higher than the allocation you're trying to do.**
295+
3. Check if client has enough DC allowance on the contract: `cast call --rpc-url https://api.node.glif.io/rpc/v1 0xCONTRACT_ADDRESS 'allowances(address)(uint256)' 0xCLIENT_ADDRESS`. _Use https://beryx.io/address_converter to convert to 0x addresses._ **Result should be higher than the allocation you're trying to do.**
296+
4. Check if SP is whitelisted: `cast call --rpc-url https://api.node.glif.io/rpc/v1 0xCONTRACT_ADDRESS 'clientSPs(address)(uint256[])' 0xCLIENT_ADDRESS` . **SP ID you're using should be on this list (list doesn't include f0 prefix)**
297+
5. Fair distribution - **total amount of DC used by this client for given SP can't exceed total DC the client got allocated divided by the number of whitelisted SPs (+10%).**
284298

285299
### [ABIs](https://github.com/fidlabs/contract-metaallocator/tree/main/abis)
286300

0 commit comments

Comments
 (0)