File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 14491449 ],
14501450 "anonymous" : false
14511451 },
1452- {
1453- "type" : " error" ,
1454- "name" : " AddressAlreadySet" ,
1455- "inputs" : [
1456- {
1457- "name" : " field" ,
1458- "type" : " uint8" ,
1459- "internalType" : " enum Errors.AddressField"
1460- }
1461- ]
1462- },
14631452 {
14641453 "type" : " error" ,
14651454 "name" : " AddressEmptyCode" ,
Original file line number Diff line number Diff line change @@ -431,8 +431,16 @@ contract FilecoinWarmStorageService is
431431 * @param _viewContract Address of the view contract
432432 */
433433 function setViewContract (address _viewContract ) external onlyOwner {
434+ // Ensure the view contract address is not the zero address
434435 require (_viewContract != address (0 ), Errors.ZeroAddress (Errors.AddressField.View));
435- require (viewContractAddress == address (0 ), Errors.AddressAlreadySet (Errors.AddressField.View));
436+
437+ // Require that the existing set address is still zero (one-time setup only)
438+ // NOTE: This check is commented out to allow setting the view contract easily during migrations prior to GA
439+ // GH ISSUE: https://github.com/FilOzone/filecoin-services/issues/303
440+ // This check needs to be re-enabled before mainnet deployment to prevent changing the view contract later.
441+
442+ // require(viewContractAddress == address(0), Errors.AddressAlreadySet(Errors.AddressField.View));
443+
436444 viewContractAddress = _viewContract;
437445 emit ViewContractSet (_viewContract);
438446 }
Original file line number Diff line number Diff line change @@ -4114,10 +4114,14 @@ contract FilecoinWarmStorageServiceUpgradeTest is Test {
41144114 warmStorageService.setViewContract (address (0x456 ));
41154115
41164116 // Test that it cannot be set again (one-time only)
4117- FilecoinWarmStorageServiceStateView newViewContract =
4118- new FilecoinWarmStorageServiceStateView (warmStorageService);
4119- vm.expectRevert (abi.encodeWithSelector (Errors.AddressAlreadySet.selector , Errors.AddressField.View));
4120- warmStorageService.setViewContract (address (newViewContract));
4117+ // NOTE: This check is commented out to allow setting the view contract easily during migrations prior to GA
4118+ // GH ISSUE: https://github.com/FilOzone/filecoin-services/issues/303
4119+ // This check needs to be re-enabled before mainnet deployment to prevent changing the view contract later.
4120+
4121+ // FilecoinWarmStorageServiceStateView newViewContract =
4122+ // new FilecoinWarmStorageServiceStateView(warmStorageService);
4123+ // vm.expectRevert(abi.encodeWithSelector(Errors.AddressAlreadySet.selector, Errors.AddressField.View));
4124+ // warmStorageService.setViewContract(address(newViewContract));
41214125
41224126 // Test that zero address is rejected (would need a new contract to test this properly)
41234127 // This is now unreachable in this test since view contract is already set
You can’t perform that action at this time.
0 commit comments