Astaria contest - delfin454000's results

On a mission is to build a highly liquid NFT lending market.

General Information

Platform: Code4rena

Start Date: 05/01/2023

Pot Size: $90,500 USDC

Total HM: 55

Participants: 103

Period: 14 days

Judge: Picodes

Total Solo HM: 18

Id: 202

League: ETH

Astaria

Findings Distribution

Researcher Performance

Rank: 72/103

Findings: 1

Award: $51.32

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Summary

Low risk findings

IssueDescriptionInstances
1Outdated Open Zeppelin versions5
Total5

Non-critical findings

IssueDescriptionInstances
1Constant value definitions that include call to keccak256 should use immutable13
2Remove references to pragma experimental ABIEncoderV22
3Some comments could be converted to Natspec statements3 + multiple
4Long single-line comments32
5Incorrect comment syntax1
6Update sensitive term1
7Typos6
Total58 + multiple

Low risk findings

No.Description
1Outdated Open Zeppelin versions
The versions used have known vulnerabilties, all of which have been patched by version 4.7.3. See Security Advisories.

IERC165.sol: L2

// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

IERC721Receiver.sol: L2

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

IERC1155Receiver.sol: L2

// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

IERC20.sol: L2

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

IERC1155.sol: L2

// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)


Non-critical findings

No.Description
1Constant value definitions that include call to keccak256 should use immutable
Constant value definitions including a call to keccak256 should use immutable instead of constant

ClearingHouse.sol: L40-41

  uint256 private constant CLEARING_HOUSE_STORAGE_SLOT =
    uint256(keccak256("xyz.astaria.ClearingHouse.storage.location")) - 1;

WithdrawProxy.sol: L49-50

  uint256 private constant WITHDRAW_PROXY_SLOT =
    uint256(keccak256("xyz.astaria.WithdrawProxy.storage.location")) - 1;

CollateralToken.sol: L73-74

  uint256 private constant COLLATERAL_TOKEN_SLOT =
    uint256(keccak256("xyz.astaria.CollateralToken.storage.location")) - 1;

PublicVault.sol: L53-54

  uint256 private constant PUBLIC_VAULT_SLOT =
    uint256(keccak256("xyz.astaria.PublicVault.storage.location")) - 1;

AstariaRouter.sol: L62-63

  uint256 private constant PUBLIC_VAULT_SLOT =
    uint256(keccak256("xyz.astaria.PublicVault.storage.location")) - 1;

LienToken.sol: L50-51

  uint256 private constant LIEN_SLOT =
    uint256(keccak256("xyz.astaria.LienToken.storage.location")) - 1;

ERC20-Cloned.sol: L13-14

  uint256 constant ERC20_SLOT =
    uint256(keccak256("xyz.astaria.ERC20.storage.location")) - 1;

ERC20-Cloned.sol: L15-18

  bytes32 private constant PERMIT_TYPEHASH =
    keccak256(
      "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
    );

ERC721.sol: L15-16

  uint256 private constant ERC721_SLOT =
    uint256(keccak256("xyz.astaria.ERC721.storage.location")) - 1;

VaultImplementation.sol: L44-45

  bytes32 public constant STRATEGY_TYPEHASH =
    keccak256("StrategyDetails(uint256 nonce,uint256 deadline,bytes32 root)");

VaultImplementation.sol: L47-50

  bytes32 constant EIP_DOMAIN =
    keccak256(
      "EIP712Domain(string version,uint256 chainId,address verifyingContract)"
    );

VaultImplementation.sol: L51

  bytes32 constant VERSION = keccak256("0");

VaultImplementation.sol: L57-58

  uint256 private constant VI_SLOT =
    uint256(keccak256("xyz.astaria.VaultImplementation.storage.location")) - 1;

No.Description
2Remove references to pragma experimental ABIEncoderV2
Remove references to pragma experimental ABIEncoderV2, which has been depreciated. As of Solidity v0.8.0, ABI coder v2 is it is activated by default by the compiler.

CollateralToken.sol: L16

pragma experimental ABIEncoderV2;

LienToken.sol: L16

pragma experimental ABIEncoderV2;

No.Description
3Some comments could be converted to Natspec statements
Some comment lines that explain the purpose of functions could appropriately be converted into Natspec statements, in particular, @notice or @dev. Below are just a few examples:

IWithdrawProxy.sol: L74

   * Returns the end timestamp of the last auction tracked by this WithdrawProxy. After this timestamp has passed, claim() can be called.

Suggestion:

   * @notice Returns the end timestamp of the last auction tracked by this WithdrawProxy.
   *   After this timestamp has passed, claim() can be called.

Note that I have wrapped the @notice statement above and @dev statement below since they exceed 120 characters


IPublicVault.sol: L79

   * The rate for the LienToken is subtracted from the total slope of the PublicVault, and recalculated in afterPayment().

Suggestion:

   * @dev The rate for the LienToken is subtracted from the total slope of
   *   the PublicVault, and recalculated in afterPayment().

ILienToken.sol: L272

   * Calculates the debt accrued by all liens against a CollateralToken, assuming no payments are made until the provided timestamp.

Suggestion:

   * @notice Calculates the debt accrued by all liens against a CollateralToken, 
   *   assuming no payments are made until the provided timestamp.

No.Description
4Long single-line comments
In theory, comments over 80 characters should wrap using multi-line comment syntax. Even if longer comments (up to 120 characters) are becoming acceptable and a scroll bar is provided, very long comments can interfere with readability.
Many of the long comments in Astoria do wrap. However, below are instances of extra-long comments (over 120 characters) whose readability could be improved by wrapping, as shown.
Note that a small indentation is used in each continuation line (which flags for the reader that the comment is ongoing), along with a period at the close (to signal the end of the comment). In addition, if a line containing both code and a comment is longer than 120 characters, it makes sense to put the comment in the line above.

LienToken.sol: L42

 * @notice This contract handles the creation, payments, buyouts, and liquidations of tokenized NFT-collateralized debt (liens). Vaults which originate loans against supported collateral are issued a LienToken representing the right to loan repayments and auctioned funds on liquidation.

Suggestion:

 * @notice This contract handles the creation, payments, buyouts, and liquidations of tokenized  
 *   NFT-collateralized debt (liens). Vaults which originate loans against supported collateral are
 *   issued a LienToken representing the right to loan repayments and auctioned funds on liquidation.

VaultImplementation.sol: L226

   * @param params The Commitment information containing the loan parameters and the merkle proof for the strategy supporting the requested loan.

Suggestion:

 * @param params The Commitment information containing the loan parameters and  
 *   the merkle proof for the strategy supporting the requested loan.

IPublicVault.sol: L146

   * @return withdrawProxyIfNearBoundary The address of the WithdrawProxy to set the payee to if the liquidation is triggered near an epoch boundary.

Suggestion:

 * @return withdrawProxyIfNearBoundary The address of the WithdrawProxy to set  
 *   the payee to if the liquidation is triggered near an epoch boundary.

Similarly for the following extra-long lines:

WithdrawProxy.sol: L54

WithdrawProxy.sol: L56

WithdrawProxy.sol: L256

CollateralToken.sol: L349

PublicVault.sol: L476

AstariaRouter.sol: L75

LienToken.sol: L804

VaultImplementation.sol: L363

VaultImplementation.sol: L376

IWithdrawProxy.sol: L27

IWithdrawProxy.sol: L33

IWithdrawProxy.sol: L35

IWithdrawProxy.sol: L52

IWithdrawProxy.sol: L64

IUniswapV3PoolState.sol: L34

IUniswapV3PoolState.sol: L38

IUniswapV3PoolState.sol: L58

IUniswapV3PoolState.sol: L60

IUniswapV3PoolState.sol: L104

IUniswapV3PoolState.sol: L105

IERC4626RouterBase.sol: L10

IERC4626RouterBase.sol: L15

IPublicVault.sol: L145

ICollateralToken.sol: L100

ICollateralToken.sol: L161

IAstariaRouter.sol: L224

IAstariaRouter.sol: L232

ILienToken.sol: L181

ILienToken.sol: L193


No.Description
5Incorrect comment syntax

LienToken: L831

      //      // slope does not need to be updated if paying off the rest, since we neutralize slope in beforePayment()

Change to:

      // slope does not need to be updated if paying off the rest, since we neutralize slope in beforePayment()

No.Description
6Update sensitive term
Terms incorporating "black," "white," "slave" or "master" are potentially problematic. Substituting more neutral terminology is becoming common practice and this practice appears to have been adopted in Astaria. In fact, allowlist and its variants are used throughout instead of whitelist, with the exception of the comment below, which appears to be an inadvertant leftover.

AstariaRouter.sol: L709

   * @param allowListEnabled Whether or not the Vault has an LP whitelist.

Suggestion: Change whitelist to allowList


No.Description
7Typos

Vault.sol: L90

    //invalid action private vautls can only be the owner or strategist

Change vautls to vaults


PublicVault.sol: L307

    // reset liquidationWithdrawRatio to prepare for re calcualtion

Change re calcualtion to recalculation


PublicVault.sol: L374

      // prevent transfer of more assets then are available

Change then to than


LienToken.sol: L315

        // update the public vault state and get the liquidation accountant back if any

Change accountant to amount, if that was what was intended


The same typo (acheive) occurs in both lines below:

IV3PositionManager.sol: L122-123

  /// @return amount0 The amount of token0 to acheive resulting liquidity
  /// @return amount1 The amount of token1 to acheive resulting liquidity

Change acheive to achieve in both cases



#0 - c4-judge

2023-01-22T17:04:58Z

Picodes marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter