Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(contracts-rfq): reorganise mocks, fix build script #3434

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Dec 3, 2024

Description
A clear and concise description of the features you're adding in this pull request.

Additional context
Add any other context about the problem you're solving.

Metadata

  • Fixes #[Link to Issue]

Summary by CodeRabbit

  • New Features

    • Improved organization of mock contracts by restructuring directory paths.
  • Bug Fixes

    • Adjusted import paths for various contracts to reflect the new directory structure, ensuring proper functionality in tests.
  • Documentation

    • Updated import statements across multiple test files for clarity and maintainability.

Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

Walkthrough

The pull request involves reorganizing the directory structure of the @synapsecns/contracts-rfq package. Key changes include moving the FastBridgeMock.sol file to a new mocks subdirectory and updating various import paths across multiple test files to reflect this new structure. Additionally, the package.json file's build script has been modified to include new paths for Solidity files, expanding the scope of files processed during the build process.

Changes

File Path Change Summary
packages/contracts-rfq/.solhintignore No changes.
packages/contracts-rfq/package.json Updated build:go script to include test/harnesses/*.sol and test/mocks/*.sol in addition to existing paths.
packages/contracts-rfq/test/FastBridge.t.sol Updated import path for MockERC20 from ./MockERC20.sol to ./mocks/MockERC20.sol.
packages/contracts-rfq/test/FastBridgeV2.t.sol Updated import path for MockERC20 from ./MockERC20.sol to ./mocks/MockERC20.sol.
packages/contracts-rfq/test/harnesses/UniversalTokenLibHarness.sol Updated import path for UniversalTokenLib from ../contracts/libs/UniversalToken.sol to ../../contracts/libs/UniversalToken.sol.
packages/contracts-rfq/test/integration/MulticallTarget.t.sol Updated import path for MockERC20 from ../MockERC20.sol to ../mocks/MockERC20.sol.
packages/contracts-rfq/test/integration/TokenZapV1.t.sol Updated import path for MockERC20 from ../MockERC20.sol to ../mocks/MockERC20.sol.
packages/contracts-rfq/test/libs/UniversalTokenLib.t.sol Updated multiple import paths to reflect new directory structure for TokenNotContract, MockERC20, and MockRevertingRecipient.
packages/contracts-rfq/test/mocks/FastBridgeMock.sol Updated import paths for Admin, FastBridge, and IFastBridge to point to ../../contracts/....
packages/contracts-rfq/test/zaps/TokenZapV1.GasBench.t.sol Updated import path for MockERC20 from ../MockERC20.sol to ../mocks/MockERC20.sol.
packages/contracts-rfq/test/zaps/TokenZapV1.t.sol Updated import path for MockERC20 from ../MockERC20.sol to ../mocks/MockERC20.sol.

Possibly related PRs

Suggested labels

M-ci, size/xs

Suggested reviewers

  • aureliusbtc
  • parodime
  • trajan0x

🐰 In the code, we hop and play,
With mocks and paths, we clear the way.
From tests to builds, we shift and mold,
A tidy structure, bright and bold!
So let us leap, with joy and cheer,
For better code is finally here! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9fe5765 and 72acda2.

📒 Files selected for processing (11)
  • packages/contracts-rfq/.solhintignore (1 hunks)
  • packages/contracts-rfq/package.json (1 hunks)
  • packages/contracts-rfq/test/FastBridge.t.sol (1 hunks)
  • packages/contracts-rfq/test/FastBridgeV2.t.sol (1 hunks)
  • packages/contracts-rfq/test/harnesses/UniversalTokenLibHarness.sol (1 hunks)
  • packages/contracts-rfq/test/integration/MulticallTarget.t.sol (1 hunks)
  • packages/contracts-rfq/test/integration/TokenZapV1.t.sol (1 hunks)
  • packages/contracts-rfq/test/libs/UniversalTokenLib.t.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/FastBridgeMock.sol (1 hunks)
  • packages/contracts-rfq/test/zaps/TokenZapV1.GasBench.t.sol (1 hunks)
  • packages/contracts-rfq/test/zaps/TokenZapV1.t.sol (1 hunks)
✅ Files skipped from review due to trivial changes (9)
  • packages/contracts-rfq/.solhintignore
  • packages/contracts-rfq/test/harnesses/UniversalTokenLibHarness.sol
  • packages/contracts-rfq/test/integration/MulticallTarget.t.sol
  • packages/contracts-rfq/test/integration/TokenZapV1.t.sol
  • packages/contracts-rfq/test/FastBridgeV2.t.sol
  • packages/contracts-rfq/test/mocks/FastBridgeMock.sol
  • packages/contracts-rfq/test/zaps/TokenZapV1.GasBench.t.sol
  • packages/contracts-rfq/test/FastBridge.t.sol
  • packages/contracts-rfq/test/zaps/TokenZapV1.t.sol
🔇 Additional comments (2)
packages/contracts-rfq/test/libs/UniversalTokenLib.t.sol (1)

4-4: LGTM! Import paths updated to reflect new directory structure.

The reorganization of imports aligns well with the PR objectives of restructuring mock and test-related files into dedicated directories.

Let's verify the new directory structure:

Also applies to: 6-8

✅ Verification successful

Import paths correctly updated to match new directory structure

The verification confirms that:

  • New dedicated directories mocks/ and harnesses/ exist under packages/contracts-rfq/test/
  • All referenced files are present in their new locations:
    • UniversalTokenLibHarness.sol in test/harnesses/
    • MockERC20.sol and MockRevertingRecipient.sol in test/mocks/
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of new directories and files

# Check if the new directories exist
fd -t d "mocks|harnesses" packages/contracts-rfq/test/

# Verify the moved files exist in their new locations
fd -t f "Mock(ERC20|RevertingRecipient).sol|UniversalTokenLibHarness.sol" packages/contracts-rfq/test/

Length of output: 411

packages/contracts-rfq/package.json (1)

29-29: LGTM - Build script update aligns with mock reorganization

The updated build script properly reflects the new directory structure where mocks have been moved to dedicated subdirectories, making the codebase more organized.

packages/contracts-rfq/package.json Show resolved Hide resolved
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@9fe5765). Learn more about missing BASE report.
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master       #3434   +/-   ##
============================================
  Coverage          ?   98.61432%           
============================================
  Files             ?           9           
  Lines             ?         433           
  Branches          ?           0           
============================================
  Hits              ?         427           
  Misses            ?           6           
  Partials          ?           0           
Flag Coverage Δ
solidity 98.61432% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 72acda2
Status: ✅  Deploy successful!
Preview URL: https://e218f9d6.sanguine-fe.pages.dev
Branch Preview URL: https://chore-fbv2-move-mocks.sanguine-fe.pages.dev

View logs

@ChiTimesChi ChiTimesChi merged commit a946376 into master Dec 5, 2024
51 of 53 checks passed
@ChiTimesChi ChiTimesChi deleted the chore/FbV2-move-mocks branch December 5, 2024 19:30
ChiTimesChi added a commit that referenced this pull request Dec 5, 2024
ChiTimesChi added a commit that referenced this pull request Dec 10, 2024
* feat: scaffold IntentRouter

* feat: initial implementation

* test: single step

* feat: scaffold checked/unchecked `completeIntent`

* feat: implement balance checks

* test: add cases where TokenZap has non-zero initial amount

* test: double step cases (erc20 and/or native combos)

* feat: SIR, TokenZap deployment script

* deploy: test deploys for SIR

* test: update to #3434 changes

* feat: scaffold SIP

* test: coverage for SIP

* feat: Synapse Intent Previewer

* feat: update deploy script, deploy SIP

* fix(contracts-rfq): add `forwardTo` to ZapData for Zap Actions that don't forward assets to the user (#3451)

* feat: scaffold finalToken, forwardTo in ZapDataV1

* feat: add finalToken, forwardTo

* feat: scaffold TokenZap.encodeZapData

* test: update existing tests

* test: forwardTo scenarios

* feat: token zeor address checks

* feat:scaffold token forwarding

* test: more revert cases

* feat: final token forwarding

* test: forwardTo behaviour in SIP

* feat: support optional `forwardTo` in SIP

* deploy: redeploy SIP, TokenZap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant