Skip to content

Move dataSetLastProvenEpoch mutation above external call in provePossession #238

@rvagg

Description

@rvagg

Reported by @relotnek. As far as we both can see this is not critical, particularly with the gated listener deployment set up that we use exclusively with PDPVerifier today, but it would probably be good to tidy this up by the time we want to do a PDPVerifier v2 deployment.

pdp/src/PDPVerifier.sol

Lines 677 to 681 in b138bd5

PDPListener(listenerAddr).possessionProven(setId, dataSetLeafCount[setId], seed, proofs.length);
}
}
dataSetLastProvenEpoch[setId] = block.number;

dataSetLastProvenEpoch mutation happens after the call out to the listener, violating the checks-effects-interactions pattern, potentially allowing weird reentrancy problems. It probably should be done before that call. Most interesting calls are guarded with storageProvider[setId] == msg.sender so it seems hard to imagine a set up where a malicious listener could get involved here, particularly since the SP is in charge of gating who the listener is.

Recording this so it doesn't get lost, nice tidy-up at some point later, I'm not suggesting we do this now because current code represents v1 and there's currently no pressure to get a new one out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🐱 Todo

    Status

    🐱 Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions