code-423n4 / 2022-02-aave-lens-findings

0 stars 0 forks source link

QA Report #82

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Context wants _msgSender() as a replacement for msg.sender. For regular transactions it returns msg.sender and for meta transactions it can be used to return the end user rather than the relayer. So I think LensNFTBase and all the contracts that inherit from it should use _msgSender(), not msg.sender, e.g.:

LensNFTBase

  function burn(uint256 tokenId) public virtual override {
      if (!_isApprovedOrOwner(msg.sender, tokenId)) revert Errors.NotOwnerOrApproved();
      ...

CollectNFT

    function mint(address to) external override {
        if (msg.sender != HUB) revert Errors.NotHub();

FollowNFT

    function mint(address to) external override {
        if (msg.sender != HUB) revert Errors.NotHub();
        uint256 tokenId = ++_tokenIdCounter;
        _mint(to, tokenId);
    }
    function delegate(address delegatee) external override {
        _delegate(msg.sender, delegatee);
    }

And there are many usages of msg.sender in LensHub. If you really need Context there, consider replacing msg.sender with _msgSender().

FeeModuleBase

    uint16 internal constant BPS_MAX = 10000;

ModuleGlobals

    uint16 internal constant BPS_MAX = 10000;
Zer0dot commented 2 years ago

These are mostly valid, and helpful. I think a lot of this is opinion, but the sigNonces point is interesting and quite relevant. It's kept this way for simplicity but basically for streamlined actions we have the dispatcher system. Still, this is a high quality report!

0xleastwood commented 2 years ago

Great findings! The warden has shown the issues clearly and all seems to valid from the sponsor's POV.