Skip to content

Audit fixes#134

Open
tsudmi wants to merge 26 commits intomainfrom
audit-fixes
Open

Audit fixes#134
tsudmi wants to merge 26 commits intomainfrom
audit-fixes

Conversation

@tsudmi
Copy link
Copy Markdown
Member

@tsudmi tsudmi commented Mar 30, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 18:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Forge code coverage:

File % Lines % Statements % Branches % Funcs
contracts/base/ERC20Upgradeable.sol 100.00% (32/32) 100.00% (33/33) 100.00% (5/5) 100.00% (8/8)
contracts/base/Multicall.sol 100.00% (6/6) 100.00% (8/8) 100.00% (0/0) 100.00% (1/1)
contracts/curators/BalancedCurator.sol 100.00% (76/76) 100.00% (84/84) 100.00% (16/16) 100.00% (2/2)
contracts/curators/CuratorsRegistry.sol 100.00% (15/15) 100.00% (12/12) 100.00% (4/4) 100.00% (3/3)
contracts/libraries/EIP712Utils.sol 100.00% (3/3) 100.00% (2/2) 100.00% (0/0) 100.00% (1/1)
contracts/libraries/ExitQueue.sol 95.92% (47/49) 95.24% (60/63) 62.50% (5/8) 100.00% (5/5)
contracts/libraries/OsTokenUtils.sol 100.00% (13/13) 100.00% (14/14) 100.00% (5/5) 100.00% (1/1)
contracts/libraries/SubVaultExits.sol 100.00% (16/16) 93.75% (15/16) 75.00% (3/4) 100.00% (3/3)
contracts/libraries/ValidatorUtils.sol 100.00% (93/93) 100.00% (105/105) 100.00% (16/16) 100.00% (7/7)
contracts/misc/EthRewardSplitter.sol 100.00% (5/5) 100.00% (3/3) 100.00% (0/0) 100.00% (2/2)
contracts/misc/GnoRewardSplitter.sol 100.00% (6/6) 100.00% (3/3) 100.00% (0/0) 100.00% (3/3)
contracts/misc/RewardSplitter.sol 100.00% (86/86) 98.89% (89/90) 92.86% (13/14) 100.00% (17/17)
contracts/misc/RewardSplitterFactory.sol 100.00% (6/6) 100.00% (4/4) 100.00% (0/0) 100.00% (2/2)
contracts/nodes/EthNodesManager.sol 100.00% (14/14) 100.00% (10/10) 100.00% (1/1) 100.00% (7/7)
contracts/nodes/NodesManager.sol 99.11% (223/225) 99.23% (257/259) 95.65% (44/46) 96.00% (24/25)
contracts/tokens/EthOsTokenRedeemer.sol 100.00% (6/6) 100.00% (5/5) 100.00% (0/0) 100.00% (3/3)
contracts/tokens/EthOsTokenVaultEscrow.sol 0.00% (0/4) 0.00% (0/3) 100.00% (0/0) 0.00% (0/2)
contracts/tokens/GnoOsTokenRedeemer.sol 100.00% (11/11) 100.00% (8/8) 100.00% (1/1) 100.00% (5/5)
contracts/tokens/GnoOsTokenVaultEscrow.sol 0.00% (0/4) 0.00% (0/2) 100.00% (0/0) 0.00% (0/2)
contracts/tokens/OsToken.sol 0.00% (0/15) 0.00% (0/15) 0.00% (0/3) 0.00% (0/6)
contracts/tokens/OsTokenConfig.sol 0.00% (0/30) 0.00% (0/34) 0.00% (0/11) 0.00% (0/4)
contracts/tokens/OsTokenFlashLoans.sol 0.00% (0/13) 0.00% (0/16) 0.00% (0/2) 0.00% (0/2)
contracts/tokens/OsTokenRedeemer.sol 98.20% (164/167) 98.41% (186/189) 91.18% (31/34) 100.00% (20/20)
contracts/tokens/OsTokenVaultController.sol 0.00% (0/107) 0.00% (0/121) 0.00% (0/18) 0.00% (0/17)
contracts/tokens/OsTokenVaultEscrow.sol 0.00% (0/89) 0.00% (0/98) 0.00% (0/23) 0.00% (0/11)
contracts/tokens/PriceFeed.sol 100.00% (14/14) 100.00% (11/11) 100.00% (0/0) 100.00% (6/6)
contracts/validators/ConsolidationsChecker.sol 8.33% (2/24) 3.12% (1/32) 0.00% (0/3) 25.00% (1/4)
contracts/validators/EthValidatorsChecker.sol 83.33% (5/6) 66.67% (4/6) 0.00% (0/1) 100.00% (2/2)
contracts/validators/GnoValidatorsChecker.sol 55.56% (5/9) 57.14% (4/7) 0.00% (0/1) 66.67% (2/3)
contracts/validators/ValidatorsChecker.sol 100.00% (77/77) 100.00% (101/101) 100.00% (17/17) 100.00% (7/7)
contracts/vaults/ethereum/EthBlocklistErc20Vault.sol 100.00% (27/27) 100.00% (23/23) 100.00% (1/1) 100.00% (8/8)
contracts/vaults/ethereum/EthBlocklistVault.sol 100.00% (23/23) 100.00% (20/20) 100.00% (1/1) 100.00% (7/7)
contracts/vaults/ethereum/EthErc20MetaVault.sol 90.91% (70/77) 92.31% (60/65) 80.00% (4/5) 84.62% (22/26)
contracts/vaults/ethereum/EthErc20Vault.sol 100.00% (53/53) 100.00% (44/44) 100.00% (3/3) 100.00% (16/16)
contracts/vaults/ethereum/EthGenesisVault.sol 13.33% (6/45) 7.55% (4/53) 11.11% (1/9) 18.18% (2/11)
contracts/vaults/ethereum/EthMetaVault.sol 88.14% (52/59) 89.80% (44/49) 50.00% (2/4) 85.71% (18/21)
contracts/vaults/ethereum/EthMetaVaultFactory.sol 100.00% (9/9) 100.00% (7/7) 100.00% (0/0) 100.00% (2/2)
contracts/vaults/ethereum/EthPrivErc20MetaVault.sol 100.00% (26/26) 100.00% (22/22) 100.00% (1/1) 100.00% (8/8)
contracts/vaults/ethereum/EthPrivErc20Vault.sol 100.00% (27/27) 100.00% (23/23) 100.00% (1/1) 100.00% (8/8)
contracts/vaults/ethereum/EthPrivMetaVault.sol 100.00% (22/22) 100.00% (19/19) 100.00% (1/1) 100.00% (7/7)
contracts/vaults/ethereum/EthPrivVault.sol 100.00% (23/23) 100.00% (20/20) 100.00% (1/1) 100.00% (7/7)
contracts/vaults/ethereum/EthVault.sol 100.00% (30/30) 100.00% (24/24) 100.00% (1/1) 100.00% (10/10)
contracts/vaults/ethereum/EthVaultFactory.sol 100.00% (14/14) 100.00% (10/10) 100.00% (2/2) 100.00% (2/2)
contracts/vaults/ethereum/custom/EthCommunityVault.sol 100.00% (21/21) 100.00% (17/17) 100.00% (1/1) 100.00% (7/7)
contracts/vaults/ethereum/custom/EthFoxVault.sol 100.00% (23/23) 100.00% (22/22) 100.00% (2/2) 100.00% (7/7)
contracts/vaults/ethereum/mev/OwnMevEscrow.sol 100.00% (10/10) 100.00% (9/9) 100.00% (2/2) 100.00% (3/3)
contracts/vaults/ethereum/mev/SharedMevEscrow.sol 100.00% (8/8) 100.00% (6/6) 100.00% (1/1) 100.00% (3/3)
contracts/vaults/gnosis/GnoBlocklistErc20Vault.sol 100.00% (22/22) 100.00% (20/20) 100.00% (1/1) 100.00% (6/6)
contracts/vaults/gnosis/GnoBlocklistVault.sol 100.00% (18/18) 100.00% (17/17) 100.00% (1/1) 100.00% (5/5)
contracts/vaults/gnosis/GnoErc20Vault.sol 96.15% (50/52) 97.62% (41/42) 100.00% (3/3) 93.33% (14/15)
contracts/vaults/gnosis/GnoGenesisVault.sol 15.00% (6/40) 8.16% (4/49) 14.29% (1/7) 25.00% (2/8)
contracts/vaults/gnosis/GnoMetaVault.sol 86.00% (43/50) 89.74% (35/39) 50.00% (1/2) 82.35% (14/17)
contracts/vaults/gnosis/GnoMetaVaultFactory.sol 100.00% (12/12) 100.00% (10/10) 100.00% (0/0) 100.00% (2/2)
contracts/vaults/gnosis/GnoPrivErc20Vault.sol 100.00% (22/22) 100.00% (20/20) 100.00% (1/1) 100.00% (6/6)
contracts/vaults/gnosis/GnoPrivVault.sol 100.00% (18/18) 100.00% (17/17) 100.00% (1/1) 100.00% (5/5)
contracts/vaults/gnosis/GnoVault.sol 93.10% (27/29) 95.45% (21/22) 100.00% (1/1) 88.89% (8/9)
contracts/vaults/gnosis/GnoVaultFactory.sol 100.00% (17/17) 100.00% (13/13) 100.00% (2/2) 100.00% (2/2)
contracts/vaults/gnosis/mev/GnoOwnMevEscrow.sol 100.00% (11/11) 100.00% (9/9) 100.00% (2/2) 100.00% (3/3)
contracts/vaults/gnosis/mev/GnoSharedMevEscrow.sol 100.00% (8/8) 100.00% (6/6) 100.00% (1/1) 100.00% (3/3)
contracts/vaults/modules/VaultAdmin.sol 100.00% (16/16) 100.00% (14/14) 100.00% (3/3) 100.00% (5/5)
contracts/vaults/modules/VaultBlocklist.sol 100.00% (17/17) 100.00% (14/14) 100.00% (4/4) 100.00% (5/5)
contracts/vaults/modules/VaultEnterExit.sol 100.00% (61/61) 98.61% (71/72) 91.67% (11/12) 100.00% (8/8)
contracts/vaults/modules/VaultEthStaking.sol 100.00% (30/30) 100.00% (29/29) 100.00% (3/3) 100.00% (9/9)
contracts/vaults/modules/VaultFee.sol 100.00% (29/29) 100.00% (28/28) 100.00% (6/6) 100.00% (5/5)
contracts/vaults/modules/VaultGnoStaking.sol 100.00% (43/43) 100.00% (37/37) 100.00% (2/2) 100.00% (11/11)
contracts/vaults/modules/VaultImmutables.sol 100.00% (9/9) 100.00% (8/8) 100.00% (2/2) 100.00% (4/4)
contracts/vaults/modules/VaultMev.sol 100.00% (16/16) 100.00% (16/16) 100.00% (5/5) 100.00% (4/4)
contracts/vaults/modules/VaultOsToken.sol 100.00% (92/92) 100.00% (96/96) 100.00% (17/17) 100.00% (14/14)
contracts/vaults/modules/VaultState.sol 98.35% (119/121) 95.49% (127/133) 72.73% (16/22) 100.00% (18/18)
contracts/vaults/modules/VaultSubVaults.sol 65.08% (41/63) 57.81% (37/64) 50.00% (2/4) 85.71% (12/14)
contracts/vaults/modules/VaultToken.sol 100.00% (21/21) 100.00% (21/21) 100.00% (3/3) 100.00% (7/7)
contracts/vaults/modules/VaultValidators.sol 100.00% (70/70) 100.00% (63/63) 100.00% (12/12) 100.00% (11/11)
contracts/vaults/modules/VaultVersion.sol 100.00% (12/12) 100.00% (20/20) 100.00% (1/1) 100.00% (3/3)
contracts/vaults/modules/VaultWhitelist.sol 100.00% (17/17) 100.00% (15/15) 100.00% (4/4) 100.00% (5/5)
Total 84.13% (2216/2634) 82.13% (2202/2681) 74.68% (292/391) 85.50% (460/538)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates sub-vault asset redemption to respect each sub-vault’s OsToken LTV constraint, preventing LowLtv reverts when redeeming via osToken mint+redeem, and adds a regression test covering the scenario.

Changes:

  • Cap per-sub-vault redeemAssets by convertToAssets(metaVaultShares) * ltvPercent before minting osToken shares.
  • Add a new test that configures a low sub-vault LTV and exercises redeemSubVaultsAssets through an EthOsTokenRedeemer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
contracts/vaults/SubVaultsRegistry.sol Caps redemption amounts by sub-vault LTV headroom before osToken minting to avoid LowLtv reverts.
test/SubVaultsRegistry.t.sol Adds a regression test for redeeming sub-vault assets under low LTV conditions (plus a helper harvest function).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 31, 2026 08:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings April 1, 2026 08:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings April 3, 2026 10:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

contracts/tokens/OsTokenRedeemer.sol:1

  • getExitQueueMissingAssets no longer accounts for already-available assets held by the redeemer (the previous logic subtracted availableAssets vs missingAssets). With the current implementation, callers may overestimate how much funding is actually required to cover the target. If the intended meaning of 'missing assets' has changed, consider renaming or documenting the new semantics; otherwise, reintroduce available-asset netting (and keep/restore a test that covers the 'available assets exceed missing' case).
// SPDX-License-Identifier: BUSL-1.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings April 3, 2026 10:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

contracts/tokens/OsTokenRedeemer.sol:1

  • getExitQueueMissingAssets no longer accounts for the redeemer’s already-available assets (and also stops reading _unclaimedAssets). This changes the meaning from 'net additional assets required' to 'gross assets corresponding to missing tickets'. If external callers use this for funding decisions, they may over-provision. Either restore the netting logic (available assets minus unclaimed) or rename/document the function to reflect the new semantics.
// SPDX-License-Identifier: BUSL-1.1

test/gnosis/GnoErc20Vault.t.sol:1

  • This assertion hard-codes the expected Transfer amount to sharesBefore (the sender’s full share balance). But the production code emits the delta actually consumed (i.e., exitShares = sharesBefore - sharesAfter), which may be less than the full balance depending on how many shares are required to escrow the specified osTokenShares. To make the test robust, assert on the emitted amount equal to the actual balance delta (e.g., by recording logs and decoding the Transfer event), or compute the expected queued shares based on the same conversion logic used in transferOsTokenPositionToEscrow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tsudmi tsudmi changed the title Fix MetaVault's redeem assets calculation does not account for sub-va… Audit fixes Apr 3, 2026
Copilot AI review requested due to automatic review settings April 3, 2026 10:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

contracts/tokens/OsTokenRedeemer.sol:1

  • getExitQueueMissingAssets no longer accounts for assets already available in the redeemer contract (the previous logic subtracted available/unclaimed assets). As written, it will report a positive missingAssets even if address(this) already holds enough assets to cover the gap, which can cause unnecessary swaps/funding and break callers that rely on it returning the net missing amount. Consider restoring the “availableAssets vs missingAssets” offset (or explicitly renaming/documenting the function and updating all call sites if the semantic intentionally changed).
// SPDX-License-Identifier: BUSL-1.1

test/gnosis/GnoErc20Vault.t.sol:1

  • This expectation hard-codes the Transfer amount to sharesBefore (entire balance). The production change emits exitShares computed as the delta in _balances[msg.sender], which may differ from sharesBefore if only part of the position is queued/consumed or if internal rounding affects share consumption. To make the test robust to legitimate internal accounting changes, compute the expected event amount based on the pre/post balance delta (or assert that the emitted amount equals sharesBefore - sharesAfter).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings April 3, 2026 11:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

contracts/tokens/OsTokenRedeemer.sol:1

  • getExitQueueMissingAssets no longer accounts for assets already available in the redeemer (previously: availableAssets = _getAssets(address(this)) - _unclaimedAssets). As a result, it can overestimate missing assets and drive unnecessary swaps/funding even when the contract already has enough free assets to cover the delta. Consider restoring the available-assets adjustment (or, if semantics intentionally changed, rename/document the function to reflect that it returns a gross requirement rather than net missing assets).
// SPDX-License-Identifier: BUSL-1.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants