@@ -808,7 +808,7 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
808808
809809 function appendIndexUpdateByPool (ISuperfluidToken token , BasicParticle memory p , Time t )
810810 external
811- senderIsTrustedPool (token)
811+ senderIsTrustedPool
812812 returns (bool )
813813 {
814814 address poolAddress = msg .sender ;
@@ -821,7 +821,7 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
821821
822822 function poolSettleClaim (ISuperfluidToken token , address claimRecipient , int256 amount )
823823 external
824- senderIsTrustedPool (token)
824+ senderIsTrustedPool
825825 returns (bool )
826826 {
827827 address poolAddress = msg .sender ;
@@ -982,9 +982,17 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
982982 );
983983 }
984984
985- modifier senderIsTrustedPool (ISuperfluidToken token ) {
986- address untrustedPoolAddress = msg .sender ;
987- if (token.isPool (this , untrustedPoolAddress) == false ) {
985+ // This check passing means that either the pool is legitimate, or the associated token is not legitimate.
986+ // if the token is legitimate, `token.isPool()` can return true only if the pool was created by this agreement.
987+ // The following "false positives" could occur if the associated token:
988+ // 1. is lying (claims the pool was registered by this agreement when it was not)
989+ // or
990+ // 2. is not associated to the same host (and agreements).
991+ // In both cases, pre-conditions are not met and no state this agreement is responsible for can be manipulated.
992+ modifier senderIsTrustedPool () {
993+ ISuperfluidPool pool = ISuperfluidPool (msg .sender );
994+
995+ if (pool.superToken ().isPool (this , address (pool)) == false ) {
988996 revert GDA_ONLY_SUPER_TOKEN_POOL ();
989997 }
990998 _;
0 commit comments