Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/scripts/create-upgrade-announcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ function generateBody(timeEstimate) {
const deployChecklist = contracts
.map((c) => {
if (c === "FilecoinWarmStorageService") {
return "- [ ] Deploy FWSS implementation: `./deploy-warm-storage-implementation-only.sh`";
return "- [ ] Deploy FWSS implementation: `./warm-storage-deploy-implementation.sh`";
} else if (c === "ServiceProviderRegistry") {
return "- [ ] Deploy Registry implementation: `./deploy-registry.sh`";
return "- [ ] Deploy Registry implementation: `./service-provider-registry-deploy.sh`";
} else if (c === "FilecoinWarmStorageServiceStateView") {
return "- [ ] Deploy StateView: `./deploy-warm-storage-view.sh`";
return "- [ ] Deploy StateView: `./warm-storage-deploy-view.sh`";
}
return `- [ ] Deploy ${c}`;
})
Expand All @@ -247,9 +247,9 @@ function generateBody(timeEstimate) {
const announceChecklist = contracts
.map((c) => {
if (c === "FilecoinWarmStorageService") {
return "- [ ] Announce FWSS upgrade: `./announce-planned-upgrade.sh`";
return "- [ ] Announce FWSS upgrade: `./warm-storage-announce-upgrade.sh`";
} else if (c === "ServiceProviderRegistry") {
return "- [ ] Announce Registry upgrade: `./announce-planned-upgrade-registry.sh`";
return "- [ ] Announce Registry upgrade: `./service-provider-registry-announce-upgrade.sh`";
}
return null;
})
Expand All @@ -259,9 +259,9 @@ function generateBody(timeEstimate) {
const executeChecklist = contracts
.map((c) => {
if (c === "FilecoinWarmStorageService") {
return "- [ ] Execute FWSS upgrade: `./upgrade.sh`";
return "- [ ] Execute FWSS upgrade: `./warm-storage-execute-upgrade.sh`";
} else if (c === "ServiceProviderRegistry") {
return "- [ ] Execute Registry upgrade: `./upgrade-registry.sh`";
return "- [ ] Execute Registry upgrade: `./service-provider-registry-execute-upgrade.sh`";
}
return null;
})
Expand Down
4 changes: 2 additions & 2 deletions service_contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ This directory contains the smart contracts for different Filecoin services usin
- `FilecoinWarmStorageService.t.sol` - Tests for the service contract
- `tools/` - Deployment and utility scripts
- `create_data_set_with_payments.sh` - Script to create data sets with payments
- `deploy-warm-storage-calibnet.sh` - Deployment script for Warm Storage service on Calibnet
- `deploy-all-warm-storage-calibnet.sh` - Deployment script for all Warm Storage contracts on Calibnet
- `warm-storage-deploy-calibnet.sh` - Deployment script for Warm Storage service on Calibnet
- `warm-storage-deploy-all.sh` - Deployment script for all Warm Storage contracts
- Note: deployment scripts now deploy and link `SignatureVerificationLib` when deploying `FilecoinWarmStorageService`.
The scripts will deploy `src/lib/SignatureVerificationLib.sol` (or simulate it in dry-run) and pass the library address
to `forge create` via the `--libraries` flag so the service implementation is correctly linked.
Expand Down
55 changes: 35 additions & 20 deletions service_contracts/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,47 @@ This directory contains scripts for deploying and upgrading the FilecoinWarmStor

## Scripts Overview

### Deployment Scripts
Scripts are organized with prefixes for better discoverability:

- `deploy-warm-storage-calibnet.sh` - Deploy FilecoinWarmStorageService only (requires existing PDPVerifier and FilecoinPayV1 contracts)
- `deploy-warm-storage-implementation-only.sh` - Deploy FWSS implementation only; loads defaults from `deployments.json` and writes back new implementation + metadata (reuses existing signature lib unless redeployed)
- `deploy-all-warm-storage.sh` - Deploy all contracts to either Calibnet or Mainnet
### Warm Storage Scripts

### Upgrade Scripts
| Script | Description |
|--------|-------------|
| `warm-storage-deploy-all.sh` | Deploy all contracts (PDPVerifier, FilecoinPayV1, FWSS, etc.) |
| `warm-storage-deploy-implementation.sh` | Deploy FWSS implementation only (for upgrades) |
| `warm-storage-deploy-view.sh` | Deploy FilecoinWarmStorageServiceStateView |
| `warm-storage-deploy-calibnet.sh` | Deploy FWSS only (requires existing dependencies) |
| `warm-storage-announce-upgrade.sh` | Announce a planned FWSS upgrade |
| `warm-storage-execute-upgrade.sh` | Execute a previously announced FWSS upgrade |
| `warm-storage-set-view.sh` | Set the StateView address on FWSS |

For the [two step upgrade process](#contract-upgrade-process):
- `announce-planned-upgrade.sh` - Announce a planned FWSS upgrade (two-step process)
- `upgrade.sh` - Execute a previously announced FWSS upgrade
- `announce-planned-upgrade-registry.sh` - Announce a planned ServiceProviderRegistry upgrade
- `upgrade-registry.sh` - Execute a previously announced registry upgrade
### Service Provider Registry Scripts

| Script | Description |
|--------|-------------|
| `service-provider-registry-deploy.sh` | Deploy ServiceProviderRegistry |
| `service-provider-registry-announce-upgrade.sh` | Announce a planned registry upgrade |
| `service-provider-registry-execute-upgrade.sh` | Execute a previously announced registry upgrade |

### Other Scripts

| Script | Description |
|--------|-------------|
| `session-key-registry-deploy.sh` | Deploy SessionKeyRegistry |
| `provider-id-set-deploy.sh` | Deploy ProviderIdSet |

### Usage

```bash
# Deploy to Calibnet
./tools/deploy-warm-storage-calibnet.sh

# Deploy all contracts
./tools/deploy-all-warm-storage.sh
./tools/warm-storage-deploy-all.sh

# Deploy to Calibnet (FWSS only)
./tools/warm-storage-deploy-calibnet.sh

# Upgrade existing deployment (see UPGRADE-PROCESS.md for details)
./tools/announce-planned-upgrade.sh # Step 1: Announce
./tools/upgrade.sh # Step 2: Execute (after AFTER_EPOCH)
./tools/warm-storage-announce-upgrade.sh # Step 1: Announce
./tools/warm-storage-execute-upgrade.sh # Step 2: Execute (after AFTER_EPOCH)
```

## Deployment Parameters
Expand Down Expand Up @@ -126,11 +141,11 @@ These scripts now follow forge/cast's environment variable conventions. Set the
- `ETH_FROM` - Optional: address to use as deployer (forge/cast default is taken from the keystore)

### Required for specific scripts:
- `deploy-warm-storage-calibnet.sh` requires:
- `warm-storage-deploy-calibnet.sh` requires:
- `PDP_VERIFIER_PROXY_ADDRESS` - Address of deployed PDPVerifier contract
- `FILECOIN_PAY_ADDRESS` - Address of deployed FilecoinPayV1 contract

- `deploy-all-warm-storage.sh` requires:
- `warm-storage-deploy-all.sh` requires:
- `CHALLENGE_FINALITY` - Challenge finality parameter for PDPVerifier

- Upgrade scripts - see [UPGRADE-PROCESS.md](./UPGRADE-PROCESS.md) for complete environment variable reference
Expand All @@ -151,7 +166,7 @@ export CHALLENGE_FINALITY="10" # Use "150" for mainnet
export MAX_PROVING_PERIOD="240" # 240 epochs for calibnet, 2880 for mainnet
export CHALLENGE_WINDOW_SIZE="20" # 20 epochs for calibnet, 60 for mainnet

./deploy-all-warm-storage.sh
./warm-storage-deploy-all.sh
```

### Deploy FilecoinWarmStorageService Only
Expand All @@ -163,7 +178,7 @@ export ETH_RPC_URL="https://api.calibration.node.glif.io/rpc/v1"
export PDP_VERIFIER_PROXY_ADDRESS="0x123..."
export FILECOIN_PAY_ADDRESS="0x456..."

./deploy-warm-storage-calibnet.sh
./warm-storage-deploy-calibnet.sh
```

### Upgrade Existing Contract
Expand Down
22 changes: 11 additions & 11 deletions service_contracts/tools/UPGRADE-PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Always test the upgrade on Calibnet before mainnet.
cd service_contracts/tools
export ETH_RPC_URL="https://api.calibration.node.glif.io/rpc/v1"

./deploy-warm-storage-implementation-only.sh
./warm-storage-deploy-implementation.sh
```

The script updates `deployments.json` automatically. Commit the changes.
Expand All @@ -80,7 +80,7 @@ export WARM_STORAGE_PROXY_ADDRESS="0x..."
export NEW_WARM_STORAGE_IMPLEMENTATION_ADDRESS="0x..."
export AFTER_EPOCH="123456"

./announce-planned-upgrade.sh
./warm-storage-announce-upgrade.sh
```

### Execute Upgrade
Expand All @@ -91,7 +91,7 @@ After `AFTER_EPOCH` passes:
export WARM_STORAGE_PROXY_ADDRESS="0x..."
export NEW_WARM_STORAGE_IMPLEMENTATION_ADDRESS="0x..."

./upgrade.sh
./warm-storage-execute-upgrade.sh
```

Verify the upgrade on [Calibnet Blockscout](https://calibration.filfox.info/).
Expand All @@ -102,7 +102,7 @@ Verify the upgrade on [Calibnet Blockscout](https://calibration.filfox.info/).
cd service_contracts/tools
export ETH_RPC_URL="https://api.node.glif.io/rpc/v1"

./deploy-warm-storage-implementation-only.sh
./warm-storage-deploy-implementation.sh
```

Commit the updated `deployments.json`.
Expand All @@ -115,7 +115,7 @@ export WARM_STORAGE_PROXY_ADDRESS="0x..."
export NEW_WARM_STORAGE_IMPLEMENTATION_ADDRESS="0x..."
export AFTER_EPOCH="123456"

./announce-planned-upgrade.sh
./warm-storage-announce-upgrade.sh
```

Notify stakeholders (see [Stakeholder Communication](#stakeholder-communication)).
Expand All @@ -129,7 +129,7 @@ export ETH_RPC_URL="https://api.node.glif.io/rpc/v1"
export WARM_STORAGE_PROXY_ADDRESS="0x..."
export NEW_WARM_STORAGE_IMPLEMENTATION_ADDRESS="0x..."

./upgrade.sh
./warm-storage-execute-upgrade.sh
```

## Phase 6: Verify and Release
Expand Down Expand Up @@ -178,7 +178,7 @@ The registry uses the same two-step upgrade mechanism as FWSS. Only upgrade it w

**Deploy new implementation:**
```bash
./deploy-registry.sh
./service-provider-registry-deploy.sh
```

**Announce upgrade:**
Expand All @@ -187,15 +187,15 @@ export REGISTRY_PROXY_ADDRESS="0x..."
export NEW_REGISTRY_IMPLEMENTATION_ADDRESS="0x..."
export AFTER_EPOCH="123456"

./announce-planned-upgrade-registry.sh
./service-provider-registry-announce-upgrade.sh
```

**Execute upgrade (after AFTER_EPOCH):**
```bash
export SERVICE_PROVIDER_REGISTRY_PROXY_ADDRESS="0x..."
export NEW_REGISTRY_IMPLEMENTATION_ADDRESS="0x..."

./upgrade-registry.sh
./service-provider-registry-execute-upgrade.sh
```

**Environment variables:**
Expand All @@ -215,13 +215,13 @@ StateView is a helper contract (not upgradeable). Redeploy it when:

**Deploy new StateView:**
```bash
./deploy-warm-storage-view.sh
./warm-storage-deploy-view.sh
```

**Update FWSS to use new StateView (during upgrade):**
```bash
export NEW_WARM_STORAGE_VIEW_ADDRESS="0x..."
./upgrade.sh
./warm-storage-execute-upgrade.sh
```

### Immutable Dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# deploy-provider-id-set deploys a ProviderIdSet contract
# provider-id-set-deploy.sh deploys a ProviderIdSet contract
# Assumption: ETH_KEYSTORE, PASSWORD, ETH_RPC_URL env vars are set to an appropriate eth keystore path and password
# Assumption: forge, cast, jq are in the PATH
# Assumption: called from contracts directory so forge paths work out
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# announce-planned-upgrade-registry.sh: Announces a planned upgrade for ServiceProviderRegistry
# service-provider-registry-announce-upgrade.sh: Announces a planned upgrade for ServiceProviderRegistry
# Required args: ETH_RPC_URL, SERVICE_PROVIDER_REGISTRY_PROXY_ADDRESS, ETH_KEYSTORE, PASSWORD, NEW_SERVICE_PROVIDER_REGISTRY_IMPLEMENTATION_ADDRESS, AFTER_EPOCH

if [ -z "$ETH_RPC_URL" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# deploy-registry deploys the Service Provider Registry contract to a target network
# service-provider-registry-deploy.sh deploys the Service Provider Registry contract to a target network
# Assumption: ETH_KEYSTORE, PASSWORD, ETH_RPC_URL env vars are set to an appropriate eth keystore path and password
# and to a valid ETH_RPC_URL for the target network.
# Assumption: forge, cast, jq are in the PATH
Expand Down Expand Up @@ -190,7 +190,7 @@ if [ "$WITH_PROXY" = "true" ]; then
echo "5. The registry is ready for provider registrations"
else
echo "1. Save the implementation address for upgrade announcement"
echo "2. Proceed with announce-planned-upgrade-registry.sh"
echo "2. Proceed with service-provider-registry-announce-upgrade.sh"
fi
echo ""
if [ "$WITH_PROXY" = "true" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# upgrade-registry.sh: Completes a pending upgrade for ServiceProviderRegistry
# service-provider-registry-execute-upgrade.sh: Completes a pending upgrade for ServiceProviderRegistry
# Required args: ETH_RPC_URL, SERVICE_PROVIDER_REGISTRY_PROXY_ADDRESS, ETH_KEYSTORE, PASSWORD, NEW_SERVICE_PROVIDER_REGISTRY_IMPLEMENTATION_ADDRESS
# Optional args: NEW_VERSION
# Calculated if unset: CHAIN
Expand Down Expand Up @@ -91,13 +91,13 @@ if [ $CAST_CALL_EXIT_CODE -eq 0 ] && [ -n "$UPGRADE_PLAN_OUTPUT" ]; then
# Method exists but returns zero - no planned upgrade or already completed
# On new contracts, _authorizeUpgrade requires a planned upgrade, so one-step will fail
echo "No planned upgrade detected (nextUpgrade returns zero)"
echo "Error: This contract requires a planned upgrade. Please call announce-planned-upgrade-registry.sh first."
echo "Error: This contract requires a planned upgrade. Please call service-provider-registry-announce-upgrade.sh first."
exit 1
fi
else
# Method doesn't exist (old contract without nextUpgrade) or call failed
echo "nextUpgrade() method not found or call failed, using one-step mechanism (direct upgrade)"
echo "WARNING: This is the legacy upgrade path. For new deployments, use announce-planned-upgrade-registry.sh first."
echo "WARNING: This is the legacy upgrade path. For new deployments, use service-provider-registry-announce-upgrade.sh first."
fi

if [ -n "$NEW_VERSION" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# announce-planned-upgrade.sh: Completes a pending upgrade
# warm-storage-announce-upgrade.sh: Completes a pending upgrade
# Required args: ETH_RPC_URL, FWSS_PROXY_ADDRESS, ETH_KEYSTORE, PASSWORD, NEW_FWSS_IMPLEMENTATION_ADDRESS, AFTER_EPOCH

if [ -z "$ETH_RPC_URL" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/bash
# deploy-all-warm-storage deploys the PDP verifier, FilecoinPayV1 contract, and Warm Storage service
# warm-storage-deploy-all.sh deploys the PDP verifier, FilecoinPayV1 contract, and Warm Storage service
# Auto-detects network based on RPC chain ID and sets appropriate configuration
# Assumption: KEYSTORE, PASSWORD, ETH_RPC_URL env vars are set to an appropriate eth keystore path and password
# and to a valid ETH_RPC_URL for the target network.
Expand Down Expand Up @@ -271,7 +271,7 @@ deploy_proxy_if_needed() {
echo
}

# Deploy session key registry if needed (uses ./deploy-session-key-registry.sh)
# Deploy session key registry if needed (uses ./session-key-registry-deploy.sh)
deploy_session_key_registry_if_needed() {
if [ -n "$SESSION_KEY_REGISTRY_ADDRESS" ]; then
echo -e "${BOLD}SessionKeyRegistry${RESET}"
Expand All @@ -287,7 +287,7 @@ deploy_session_key_registry_if_needed() {
echo " 🧪 Using dummy address: $SESSION_KEY_REGISTRY_ADDRESS"
else
echo " 🔧 Using external deployment script..."
source "$SCRIPT_DIR/deploy-session-key-registry.sh"
source "$SCRIPT_DIR/session-key-registry-deploy.sh"
NONCE=$(expr $NONCE + "1")
echo " ✅ Deployed at: $SESSION_KEY_REGISTRY_ADDRESS"

Expand All @@ -299,7 +299,7 @@ deploy_session_key_registry_if_needed() {
echo
}

# Deploy endorsements ProviderIdSet contract if needed (uses ./deploy-provider-id-set.sh)
# Deploy endorsements ProviderIdSet contract if needed (uses ./provider-id-set-deploy.sh)
deploy_endorsements_if_needed() {
if [ -n "$ENDORSEMENT_SET_ADDRESS" ]; then
echo -e "${BOLD}Endorsements ProviderIdSet${RESET}"
Expand All @@ -318,7 +318,7 @@ deploy_endorsements_if_needed() {
AUTO_VERIFY_BEFORE=${AUTO_VERIFY:-true}
AUTO_VERIFY=false # override so as to set last
# This also updates deployments.json
source "$SCRIPT_DIR/deploy-provider-id-set.sh"
source "$SCRIPT_DIR/provider-id-set-deploy.sh"
AUTO_VERIFY=$AUTO_VERIFY_BEFORE
NONCE=$(expr $NONCE + "1")
echo " ✅ Deployed at: $ENDORSEMENT_SET_ADDRESS"
Expand Down Expand Up @@ -486,7 +486,7 @@ if [ "$DRY_RUN" = "true" ]; then
echo " ✅ Deployment planned (dummy: $FWSS_VIEW_ADDRESS)"
else
echo " 🔧 Using external deployment script..."
source "$SCRIPT_DIR/deploy-warm-storage-view.sh"
source "$SCRIPT_DIR/warm-storage-deploy-view.sh"
echo " ✅ Deployed at: $FWSS_VIEW_ADDRESS"
NONCE=$(expr $NONCE + "1")

Expand All @@ -503,7 +503,7 @@ if [ "$DRY_RUN" = "true" ]; then
echo " 🔍 Would set view contract address on main contract (skipping in dry-run)"
else
echo " 🔧 Setting view address on FilecoinWarmStorageService..."
source "$SCRIPT_DIR/set-warm-storage-view.sh"
source "$SCRIPT_DIR/warm-storage-set-view.sh"
echo " ✅ View address set"
NONCE=$(expr $NONCE + "1")
fi
Expand All @@ -517,7 +517,7 @@ if [ "$DRY_RUN" = "true" ]; then
echo "✅ Dry run completed successfully!"
echo "🔍 All contract compilations and simulations passed"
echo
echo "To perform actual deployment, run with: DRY_RUN=false ./tools/deploy-all-warm-storage.sh"
echo "To perform actual deployment, run with: DRY_RUN=false ./tools/warm-storage-deploy-all.sh"
echo
echo "# DRY-RUN SUMMARY ($NETWORK_NAME)"
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/bash
# deploy-warm-storage-calibnet deploys the Warm Storage service contract to calibration net
# warm-storage-deploy-calibnet.sh deploys the Warm Storage service contract to calibration net
# Assumption: ETH_KEYSTORE, PASSWORD, ETH_RPC_URL env vars are set to an appropriate eth keystore path and password
# and to a valid ETH_RPC_URL for the calibnet.
# Assumption: forge, cast, jq are in the PATH
Expand Down Expand Up @@ -109,7 +109,7 @@ if [ "$MAX_PROVING_PERIOD" -lt "$MIN_REQUIRED" ]; then
echo " MAX_PROVING_PERIOD must be at least $MIN_REQUIRED (CHALLENGE_FINALITY + CHALLENGE_WINDOW_SIZE/2)"
echo " To fix: Set MAX_PROVING_PERIOD to at least $MIN_REQUIRED"
echo ""
echo " Example: MAX_PROVING_PERIOD=$MIN_REQUIRED CHALLENGE_WINDOW_SIZE=$CHALLENGE_WINDOW_SIZE ./deploy-warm-storage-calibnet.sh"
echo " Example: MAX_PROVING_PERIOD=$MIN_REQUIRED CHALLENGE_WINDOW_SIZE=$CHALLENGE_WINDOW_SIZE ./warm-storage-deploy-calibnet.sh"
exit 1
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# deploy-warm-storage-implementation-only.sh - Deploy only FilecoinWarmStorageService implementation (no proxy)
# warm-storage-deploy-implementation.sh - Deploy only FilecoinWarmStorageService implementation (no proxy)
# This allows updating an existing proxy to point to the new implementation
# Assumption: ETH_KEYSTORE, PASSWORD, ETH_RPC_URL env vars are set
# Assumption: forge, cast are in the PATH
Expand Down
Loading
Loading