Skip to content

refactor(contracts): internal M0 and Sherlock audit changes#55

Merged
johnletey merged 19 commits intonoble-assets:contractsfrom
m0-foundation:contracts
Oct 2, 2025
Merged

refactor(contracts): internal M0 and Sherlock audit changes#55
johnletey merged 19 commits intonoble-assets:contractsfrom
m0-foundation:contracts

Conversation

@mesozoic-technology
Copy link
Copy Markdown

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 28, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesozoic-technology mesozoic-technology force-pushed the contracts branch 2 times, most recently from dcfc6b8 to f1170e4 Compare August 29, 2025 19:13
// NOTE: We don't want to perform any principal updates in the case of yield accrual.
if (to == address(this)) {

if ($.totalPrincipal == 0) return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have doubts this is needed, getIndexRoundedDown should revert with DivisionByZero

Copy link
Copy Markdown

@toninorair toninorair Sep 3, 2025

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If we were to revert, we'd be doing this on a cross chain message. In that case, what would happen to the yield the message intended to send? By returning instead, there is no ambiguity here, the yield is received by the contract, and the next time there is principal present to avoid a division by zero, the index is still updated to the correct value.

Maybe this would not be a problem given how Hyperlane works, but I chose this as I am not 100% familiar with that - would be good to know that, though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fair take, worth adding comment for auditors, just in case

@mesozoic-technology mesozoic-technology changed the title Added tests, fix to index division by 0, calling _disableInitializer() Sherlock Fixes & added tests, fix to index division by 0, calling _disableInitializer() Sep 22, 2025
Copy link
Copy Markdown
Member

@johnletey johnletey left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @mesozoic-technology! Left two comments!

Comment thread contracts/test/NobleDollar.t.sol Outdated
Comment thread contracts/src/NobleDollar.sol Outdated
@johnletey johnletey changed the title Sherlock Fixes & added tests, fix to index division by 0, calling _disableInitializer() refactor(contracts): internal M0 and Sherlock audit changes Sep 26, 2025
@johnletey johnletey merged commit 8785241 into noble-assets:contracts Oct 2, 2025
6 checks passed
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.

3 participants