Skip to content
Open
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
1 change: 1 addition & 0 deletions service_contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ check-layout:
# Core contracts we publish ABIs for.
ABI_CONTRACTS := \
FilecoinWarmStorageService \
FilecoinWarmStorageServiceMetadataModule \
FilecoinWarmStorageServiceProviderManagementModule \
IFilecoinServiceMetadata \
FilecoinWarmStorageServiceStateLibrary \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[
{
"type": "function",
"name": "VERSION",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "description",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "homepage",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "name",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "pure"
}
]
23 changes: 2 additions & 21 deletions service_contracts/src/FilecoinWarmStorageService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IER
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {FilecoinPayV1, IValidator} from "@fws-payments/FilecoinPayV1.sol";
import {FilecoinWarmStorageServiceMetadataModule} from "./modules/FilecoinWarmStorageServiceMetadataModule.sol";
import {FWSSStorage} from "./storage/FWSSStorage.sol";
import {Errors} from "./Errors.sol";
import {IFilecoinServiceMetadata} from "./IFilecoinServiceMetadata.sol";

import {ServiceProviderRegistry} from "./ServiceProviderRegistry.sol";

Expand Down Expand Up @@ -74,7 +74,7 @@ uint256 constant MAX_TERMINATE_SERVICE_EXTRA_DATA_SIZE = 1024; // 1KiB
/// and adjusts payment rates based on storage size. Also implements validation
/// to reduce payments for faulted epochs.
contract FilecoinWarmStorageService is
IFilecoinServiceMetadata,
FilecoinWarmStorageServiceMetadataModule,
PDPListener,
IValidator,
Initializable,
Expand All @@ -84,13 +84,6 @@ contract FilecoinWarmStorageService is
EIP712Upgradeable,
FWSSStorage
{
// Version tracking
string public constant VERSION = "1.4.0";
string private constant SERVICE_NAME = "Filecoin Warm Storage Service";
string private constant SERVICE_DESCRIPTION =
"Warm storage service for the Filecoin Onchain Cloud. Manages PDP-backed datasets, Filecoin Pay storage rails, lifecycle fees, and optional CDN payment rails.";
string private constant SERVICE_HOMEPAGE = "https://github.com/FilOzone/filecoin-services";

using Rails for FilecoinPayV1;

// Events
Expand Down Expand Up @@ -319,18 +312,6 @@ contract FilecoinWarmStorageService is
challengeWindowSize = _challengeWindowSize;
}

function name() external pure override returns (string memory) {
return SERVICE_NAME;
}

function description() external pure override returns (string memory) {
return SERVICE_DESCRIPTION;
}

function homepage() external pure override returns (string memory) {
return SERVICE_HOMEPAGE;
}

function announceUpgradePlan(address nextImplementation, uint96 delayEpochs) external {
if (delayEpochs == 0) {
delayEpochs = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
pragma solidity 0.8.30;

import {IFilecoinServiceMetadata} from "../IFilecoinServiceMetadata.sol";

/// @title FilecoinWarmStorageServiceMetadataModule
/// @notice Exposes static FWSS service metadata.
contract FilecoinWarmStorageServiceMetadataModule is IFilecoinServiceMetadata {
// Version tracking
string public constant VERSION = "1.4.0";
string internal constant SERVICE_NAME = "Filecoin Warm Storage Service";
string internal constant SERVICE_DESCRIPTION =
"Warm storage service for the Filecoin Onchain Cloud. Manages PDP-backed datasets, Filecoin Pay storage rails, lifecycle fees, and optional CDN payment rails.";
string private constant SERVICE_HOMEPAGE = "https://github.com/FilOzone/filecoin-services";

function name() external pure override returns (string memory) {
return SERVICE_NAME;
}

function description() external pure override returns (string memory) {
return SERVICE_DESCRIPTION;
}

function homepage() external pure override returns (string memory) {
return SERVICE_HOMEPAGE;
}
}
17 changes: 0 additions & 17 deletions service_contracts/test/FilecoinWarmStorageService.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -565,23 +565,6 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
assertTrue(found, "FilecoinServiceDeployed event should be emitted");
}

function testServiceMetadata() public view {
IFilecoinServiceMetadata metadata = IFilecoinServiceMetadata(address(pdpServiceWithPayments));
string memory serviceName = metadata.name();
string memory serviceDescription = metadata.description();
string memory serviceHomepage = metadata.homepage();

assertEq(serviceName, "Filecoin Warm Storage Service", "Service name should match");
assertEq(
serviceDescription,
"Warm storage service for the Filecoin Onchain Cloud. Manages PDP-backed datasets, Filecoin Pay storage rails, lifecycle fees, and optional CDN payment rails.",
"Service description should match"
);
assertEq(serviceHomepage, "https://github.com/FilOzone/filecoin-services", "Service homepage should match");
assertLe(bytes(serviceDescription).length, 256, "Service description should not exceed 256 bytes");
assertLe(bytes(serviceHomepage).length, 256, "Service homepage should not exceed 256 bytes");
}

function testAnnounceUpgradePlan() public {
FilecoinWarmStorageService firstServiceImpl = new FilecoinWarmStorageService(
address(mockPDPVerifier),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test} from "forge-std/Test.sol";
import {FilecoinWarmStorageServiceMetadataModule} from "../../src/modules/FilecoinWarmStorageServiceMetadataModule.sol";
import {IFilecoinServiceMetadata} from "../../src/IFilecoinServiceMetadata.sol";

contract FilecoinWarmStorageServiceMetadataModuleTest is Test {
FilecoinWarmStorageServiceMetadataModule public metadataModule;

function setUp() public {
metadataModule = new FilecoinWarmStorageServiceMetadataModule();
}

function testServiceMetadata() public view {
IFilecoinServiceMetadata metadata = IFilecoinServiceMetadata(address(metadataModule));
string memory serviceName = metadata.name();
string memory serviceDescription = metadata.description();
string memory serviceHomepage = metadata.homepage();

assertEq(serviceName, "Filecoin Warm Storage Service", "Service name should match");
assertEq(
serviceDescription,
"Warm storage service for the Filecoin Onchain Cloud. Manages PDP-backed datasets, Filecoin Pay storage rails, lifecycle fees, and optional CDN payment rails.",
"Service description should match"
);
assertEq(serviceHomepage, "https://github.com/FilOzone/filecoin-services", "Service homepage should match");
assertLe(bytes(serviceDescription).length, 256, "Service description should not exceed 256 bytes");
assertLe(bytes(serviceHomepage).length, 256, "Service homepage should not exceed 256 bytes");
}
}
Loading