diff --git a/contracts/libraries/Errors.sol b/contracts/libraries/Errors.sol index 7bd8180..bc17f36 100644 --- a/contracts/libraries/Errors.sol +++ b/contracts/libraries/Errors.sol @@ -58,7 +58,6 @@ library Errors { error CannotCommentOnSelf(); error NotWhitelisted(); error CallerInvalid(); - error ExecutorInvalid(); // Module Errors error InitParamsInvalid(); diff --git a/contracts/libraries/helpers/GeneralHelpers.sol b/contracts/libraries/helpers/GeneralHelpers.sol index 9a67c9e..a714fd8 100644 --- a/contracts/libraries/helpers/GeneralHelpers.sol +++ b/contracts/libraries/helpers/GeneralHelpers.sol @@ -169,6 +169,6 @@ library GeneralHelpers { let slot := keccak256(0, 64) invalidExecutor := iszero(sload(slot)) } - if (invalidExecutor) revert Errors.ExecutorInvalid(); + if (invalidExecutor) revert Errors.CallerInvalid(); } } diff --git a/test/foundry/CollectTest.t.sol b/test/foundry/CollectTest.t.sol index 6863ee1..6bef87d 100644 --- a/test/foundry/CollectTest.t.sol +++ b/test/foundry/CollectTest.t.sol @@ -115,9 +115,10 @@ contract CollectTest is BaseTest { uint256 nonce = 0; uint256 deadline = type(uint256).max; bytes32 digest = _getCollectTypedDataHash(firstProfileId, 1, '', nonce, deadline); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.collectWithSig( DataTypes.CollectWithSigData({ + delegatedSigner: address(0), collector: profileOwner, profileId: firstProfileId, pubId: 1, @@ -134,6 +135,7 @@ contract CollectTest is BaseTest { bytes32 digest = _getCollectTypedDataHash(firstProfileId, 1, '', nonce, deadline); uint256 nftId = hub.collectWithSig( DataTypes.CollectWithSigData({ + delegatedSigner: address(0), collector: otherSigner, profileId: firstProfileId, pubId: 1, @@ -166,6 +168,7 @@ contract CollectTest is BaseTest { uint256 nftId = hub.collectWithSig( DataTypes.CollectWithSigData({ + delegatedSigner: address(0), collector: otherSigner, profileId: firstProfileId, pubId: 2, @@ -192,6 +195,7 @@ contract CollectTest is BaseTest { bytes32 digest = _getCollectTypedDataHash(firstProfileId, 1, '', nonce, deadline); uint256 nftId = hub.collectWithSig( DataTypes.CollectWithSigData({ + delegatedSigner: profileOwner, collector: otherSigner, profileId: firstProfileId, pubId: 1, @@ -227,6 +231,7 @@ contract CollectTest is BaseTest { uint256 nftId = hub.collectWithSig( DataTypes.CollectWithSigData({ + delegatedSigner: profileOwner, collector: otherSigner, profileId: firstProfileId, pubId: 2, diff --git a/test/foundry/FollowTest.t.sol b/test/foundry/FollowTest.t.sol index 9c54bc3..9cccd74 100644 --- a/test/foundry/FollowTest.t.sol +++ b/test/foundry/FollowTest.t.sol @@ -59,9 +59,10 @@ contract FollowTest is BaseTest { uint256 deadline = type(uint256).max; bytes32 digest = _getFollowTypedDataHash(profileIds, datas, nonce, deadline); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.followWithSig( DataTypes.FollowWithSigData({ + delegatedSigner: address(0), follower: profileOwner, profileIds: profileIds, datas: datas, @@ -84,6 +85,7 @@ contract FollowTest is BaseTest { uint256[] memory nftIds = hub.followWithSig( DataTypes.FollowWithSigData({ + delegatedSigner: address(0), follower: otherSigner, profileIds: profileIds, datas: datas, @@ -118,6 +120,7 @@ contract FollowTest is BaseTest { uint256[] memory nftIds = hub.followWithSig( DataTypes.FollowWithSigData({ + delegatedSigner: profileOwner, follower: otherSigner, profileIds: profileIds, datas: datas, diff --git a/test/foundry/Misc.t.sol b/test/foundry/Misc.t.sol index cad8df8..8612534 100644 --- a/test/foundry/Misc.t.sol +++ b/test/foundry/Misc.t.sol @@ -12,7 +12,7 @@ contract MiscTest is BaseTest { function testSetDefaultProfileInvalidCallerFails() public { vm.expectRevert(Errors.CallerInvalid.selector); - + hub.setDefaultProfile(profileOwner, firstProfileId); } // Positives @@ -37,9 +37,10 @@ contract MiscTest is BaseTest { deadline ); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.setFollowModuleWithSig( DataTypes.SetFollowModuleWithSigData({ + delegatedSigner: address(0), profileId: firstProfileId, followModule: address(0), followModuleInitData: '', @@ -65,6 +66,7 @@ contract MiscTest is BaseTest { hub.setFollowModuleWithSig( DataTypes.SetFollowModuleWithSigData({ + delegatedSigner: otherSigner, profileId: firstProfileId, followModule: address(0), followModuleInitData: '', diff --git a/test/foundry/PublishingTest.t.sol b/test/foundry/PublishingTest.t.sol index 4d1a88f..4347898 100644 --- a/test/foundry/PublishingTest.t.sol +++ b/test/foundry/PublishingTest.t.sol @@ -74,9 +74,10 @@ contract PublishingTest is BaseTest { deadline ); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.postWithSig( DataTypes.PostWithSigData({ + delegatedSigner: address(0), profileId: firstProfileId, contentURI: mockURI, collectModule: address(freeCollectModule), @@ -108,9 +109,10 @@ contract PublishingTest is BaseTest { deadline ); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.commentWithSig( DataTypes.CommentWithSigData({ + delegatedSigner: address(0), profileId: firstProfileId, contentURI: mockURI, profileIdPointed: firstProfileId, @@ -142,9 +144,10 @@ contract PublishingTest is BaseTest { deadline ); - vm.expectRevert(Errors.CallerInvalid.selector); + vm.expectRevert(Errors.SignatureInvalid.selector); hub.mirrorWithSig( DataTypes.MirrorWithSigData({ + delegatedSigner: address(0), profileId: firstProfileId, profileIdPointed: firstProfileId, pubIdPointed: 1, @@ -176,13 +179,14 @@ contract PublishingTest is BaseTest { uint256 pubId = hub.postWithSig( DataTypes.PostWithSigData({ + delegatedSigner: otherSigner, profileId: firstProfileId, contentURI: mockURI, collectModule: address(freeCollectModule), collectModuleInitData: abi.encode(false), referenceModule: address(0), referenceModuleInitData: '', - sig: _getSigStruct(profileOwnerKey, digest, deadline) + sig: _getSigStruct(otherSignerKey, digest, deadline) }) ); assertEq(pubId, 1); @@ -212,6 +216,7 @@ contract PublishingTest is BaseTest { uint256 pubId = hub.commentWithSig( DataTypes.CommentWithSigData({ + delegatedSigner: otherSigner, profileId: firstProfileId, contentURI: mockURI, profileIdPointed: firstProfileId, @@ -248,6 +253,7 @@ contract PublishingTest is BaseTest { uint256 pubId = hub.mirrorWithSig( DataTypes.MirrorWithSigData({ + delegatedSigner: otherSigner, profileId: firstProfileId, profileIdPointed: firstProfileId, pubIdPointed: 1,