Skip to content

Commit 18ea826

Browse files
authored
docs: consolidate deployment docs to eliminate duplication (#253)
Closes: #221 Consolidate deployment docs to eliminate duplication, and document the different deployment parameters for Calibration and Mainnet.
1 parent 8afeda1 commit 18ea826

File tree

3 files changed

+55
-46
lines changed

3 files changed

+55
-46
lines changed

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,9 @@ Run `make help` to see all available targets:
122122
make help
123123
```
124124

125-
### Deployment
125+
## 🚀 Deployment
126126

127-
Use the provided deployment scripts in the `tools/` directory:
128-
129-
```bash
130-
# Deploy to Calibnet
131-
./tools/deploy-warm-storage-calibnet.sh
132-
133-
# Deploy all contracts
134-
./tools/deploy-all-warm-storage-calibnet.sh
135-
136-
# Upgrade existing deployment
137-
./tools/upgrade-warm-storage-calibnet.sh
138-
```
127+
For comprehensive deployment instructions, parameters, and scripts, see [service_contracts/tools/README.md](./service_contracts/tools/README.md).
139128

140129
## 🔗 Dependencies
141130

service_contracts/tools/README.md

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,54 @@
11
# FilecoinWarmStorageService Deployment Scripts
22

3-
This directory contains scripts for deploying and upgrading the FilecoinWarmStorageService contract on Calibration testnet.
3+
This directory contains scripts for deploying and upgrading the FilecoinWarmStorageService contract on Calibration testnet and Mainnet.
44

55
## Scripts Overview
66

7+
### Available Scripts
8+
79
- `deploy-warm-storage-calibnet.sh` - Deploy FilecoinWarmStorageService only (requires existing PDPVerifier and Payments contracts)
8-
- `deploy-all-warm-storage-calibnet.sh` - Deploy all contracts (PDPVerifier, Payments, and FilecoinWarmStorageService)
10+
- `deploy-all-warm-storage.sh` - Deploy all contracts to either Calibnet or Mainnet
911
- `upgrade-warm-storage-calibnet.sh` - Upgrade existing FilecoinWarmStorageService contract with new proving period parameters
1012

13+
### Usage
14+
15+
```bash
16+
# Deploy to Calibnet
17+
./tools/deploy-warm-storage-calibnet.sh
18+
19+
# Deploy all contracts
20+
./tools/deploy-all-warm-storage.sh
21+
22+
# Upgrade existing deployment
23+
./tools/upgrade-warm-storage-calibnet.sh
24+
```
25+
26+
## Deployment Parameters
27+
28+
The following parameters are critical for proof generation and validation. They differ between **Mainnet** (production) and **Calibnet** (testing/iteration).
29+
30+
| Parameter | Mainnet (Production) | Calibnet (Testing) | Notes |
31+
|-----------|----------------------|---------------------|-------|
32+
| `DEFAULT_CHALLENGE_FINALITY` | `150` | `10` | **Security parameter.** Always set to `150` in production. Enforces that the challenge epoch is far enough in the future to prevent reorg-based attacks. See [PDP Implementation Design Doc](https://filoznotebook.notion.site/PDP-Implementation-Design-Doc-64a66516416441c69b9d8e5d63120f1c?pvs=21). |
33+
| `DEFAULT_MAX_PROVING_PERIOD` | `2880` | `240` | **Product parameter.** Defines how often proofs must be submitted. Mainnet default is 2880 epochs ≈ 24h (one proof/day). On Calibnet we use shorter proving periods for faster iteration. See [Simple PDP Service Fault Model](https://filoznotebook.notion.site/Simple-PDP-Service-Fault-Model-1a9dc41950c180c4bdc7ef2d91db73b6?pvs=21). |
34+
| `DEFAULT_CHALLENGE_WINDOW_SIZE` | `60` | `30` | **Security parameter.** Defines the grace window within the proving period. Typically ~2% of the proving period. On Mainnet: 60 epochs (≈2% of 2880). On Calibnet: 30 epochs. See [Simple PDP Service Fault Model](https://filoznotebook.notion.site/Simple-PDP-Service-Fault-Model-1a9dc41950c180c4bdc7ef2d91db73b6?pvs=21). |
35+
36+
### Quick Reference
37+
38+
- **Mainnet**
39+
```bash
40+
DEFAULT_CHALLENGE_FINALITY="150" # Production security value
41+
DEFAULT_MAX_PROVING_PERIOD="2880" # 2880 epochs (≈1 proof per day)
42+
DEFAULT_CHALLENGE_WINDOW_SIZE="60" # 60 epochs grace period
43+
```
44+
45+
- **Calibnet**
46+
```bash
47+
DEFAULT_CHALLENGE_FINALITY="10" # Low value for fast testing (should be 150 in production)
48+
DEFAULT_MAX_PROVING_PERIOD="240" # 240 epochs
49+
DEFAULT_CHALLENGE_WINDOW_SIZE="30" # 30 epochs
50+
```
51+
1152
## Environment Variables
1253

1354
### Required for all scripts:
@@ -20,16 +61,12 @@ This directory contains scripts for deploying and upgrading the FilecoinWarmStor
2061
- `PDP_VERIFIER_ADDRESS` - Address of deployed PDPVerifier contract
2162
- `PAYMENTS_CONTRACT_ADDRESS` - Address of deployed Payments contract
2263

23-
- `deploy-all-warm-storage-calibnet.sh` requires:
64+
- `deploy-all-warm-storage.sh` requires:
2465
- `CHALLENGE_FINALITY` - Challenge finality parameter for PDPVerifier
2566

2667
- `upgrade-warm-storage-calibnet.sh` requires:
2768
- `WARM_STORAGE_SERVICE_PROXY_ADDRESS` - Address of existing FilecoinWarmStorageService proxy to upgrade
2869

29-
### Optional proving period configuration:
30-
- `MAX_PROVING_PERIOD` - Maximum epochs between proofs (default: 30 epochs = 15 minutes on calibnet)
31-
- `CHALLENGE_WINDOW_SIZE` - Challenge window size in epochs (default: 15 epochs)
32-
3370
## Usage Examples
3471

3572
### Fresh Deployment (All Contracts)
@@ -38,13 +75,13 @@ This directory contains scripts for deploying and upgrading the FilecoinWarmStor
3875
export KEYSTORE="/path/to/keystore.json"
3976
export PASSWORD="your-password"
4077
export RPC_URL="https://api.calibration.node.glif.io/rpc/v1"
41-
export CHALLENGE_FINALITY="900"
78+
export CHALLENGE_FINALITY="10" # Use "150" for mainnet
4279

4380
# Optional: Custom proving periods
44-
export MAX_PROVING_PERIOD="60" # 30 minutes instead of default 15 minutes
45-
export CHALLENGE_WINDOW_SIZE="20" # 20 epochs instead of default 15
81+
export MAX_PROVING_PERIOD="240" # 240 epochs for calibnet, 2880 for mainnet
82+
export CHALLENGE_WINDOW_SIZE="30" # 30 epochs for calibnet, 60 for mainnet
4683

47-
./deploy-all-warm-storage-calibnet.sh
84+
./deploy-all-warm-storage.sh
4885
```
4986

5087
### Deploy FilecoinWarmStorageService Only
@@ -67,9 +104,9 @@ export PASSWORD="your-password"
67104
export RPC_URL="https://api.calibration.node.glif.io/rpc/v1"
68105
export WARM_STORAGE_SERVICE_PROXY_ADDRESS="0x789..."
69106

70-
# Optional: Set new proving period parameters
71-
export MAX_PROVING_PERIOD="120" # 1 hour
72-
export CHALLENGE_WINDOW_SIZE="30" # 30 epochs
107+
# Optional: Custom proving periods
108+
export MAX_PROVING_PERIOD="240" # 240 epochs for calibnet, 2880 for mainnet
109+
export CHALLENGE_WINDOW_SIZE="30" # 30 epochs for calibnet, 60 for mainnet
73110

74111
./upgrade-warm-storage-calibnet.sh
75112
```
@@ -81,23 +118,6 @@ The FilecoinWarmStorageService contract uses OpenZeppelin's upgradeable pattern.
81118
1. **Deploy new implementation**: The script deploys a new implementation contract
82119
2. **Upgrade proxy**: Uses `upgradeToAndCall` to point the proxy to the new implementation
83120

84-
### Important Notes for Upgrades:
85-
86-
- The original `initialize` function can only be called once during initial deployment
87-
- Use `configureProvingPeriod` to set the new proving period parameters
88-
- Storage layout is preserved - new variables are added at the end of existing storage
89-
90-
## Proving Period Parameters
91-
92-
- **Max Proving Period**: Maximum number of epochs between consecutive proofs
93-
- Calibnet default: 30 epochs (≈15 minutes, since calibnet has ~30 second epochs)
94-
- Mainnet typical: 2880 epochs (≈24 hours, since mainnet has ~30 second epochs)
95-
96-
- **Challenge Window Size**: Number of epochs at the end of each proving period during which proofs can be submitted
97-
- Calibnet default: 15 epochs
98-
- Must be less than Max Proving Period
99-
- Must be greater than 0
100-
101121
## Testing
102122

103123
Run the upgrade tests:

service_contracts/tools/deploy-all-warm-storage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ if [ -z "$CHAIN_ID" ]; then
3939
fi
4040

4141
# Set network-specific configuration based on chain ID
42-
# NOTE: CHALLENGE_FINALITY should always be 150 in production for security.
43-
# Calibnet uses lower values for faster testing and development.
42+
# See service_contracts/tools/README.md for deployment parameter documentation
4443
case "$CHAIN_ID" in
4544
"314159")
4645
NETWORK_NAME="calibnet"
@@ -128,6 +127,7 @@ if [ "$MAX_PROVING_PERIOD" -lt "$MIN_REQUIRED" ]; then
128127
echo "Error: MAX_PROVING_PERIOD ($MAX_PROVING_PERIOD) is too small for CHALLENGE_FINALITY ($CHALLENGE_FINALITY)"
129128
echo " MAX_PROVING_PERIOD must be at least $MIN_REQUIRED (CHALLENGE_FINALITY + CHALLENGE_WINDOW_SIZE/2)"
130129
echo " Either increase MAX_PROVING_PERIOD or decrease CHALLENGE_FINALITY"
130+
echo " See service_contracts/tools/README.md for deployment parameter guidelines."
131131
exit 1
132132
fi
133133

0 commit comments

Comments
 (0)