synapsecns / sanguine

Synapse Monorepo
MIT License
41 stars 30 forks source link

feat(rfq-api): check both relayer role and quoter role #3398

Closed dwasse closed 4 days ago

dwasse commented 4 days ago

null 913658fd48bb0e4a8f7f472315398b6c06043c75: explorer-ui preview link 913658fd48bb0e4a8f7f472315398b6c06043c75: synapse-interface preview link

Summary by CodeRabbit

coderabbitai[bot] commented 4 days ago

[!CAUTION]

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request involve updates across multiple files, primarily focusing on the introduction of a new AdminV2 contract, enhancements to the FastBridgeV2 contract, and modifications to the handling of bridge and swap operations in the API. Key updates include the addition of cancellation functionality, updates to the .gitattributes file to manage generated files, and enhancements to the API endpoints to accommodate new parameters. The changelog has also been updated to reflect these changes, ensuring comprehensive documentation of the package's evolution.

Changes

File Change Summary
.gitattributes Added rule for *.contractinfo.json as generated; clarified Go file handling.
packages/contracts-rfq/CHANGELOG.md Updated for version 0.13.0, added release notes for permissionless cancellation feature.
packages/contracts-rfq/contracts/AdminV2.sol Introduced AdminV2 contract with access control roles and fee management functions.
packages/contracts-rfq/contracts/FastBridgeV2.sol Replaced Admin with AdminV2, added cancel function, modified access control for prove.
packages/contracts-rfq/contracts/interfaces/IAdminV2.sol Added IAdminV2 interface with events and functions for admin tasks.
packages/contracts-rfq/contracts/interfaces/IAdminV2Errors.sol Introduced IAdminV2Errors interface with custom error types.
packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol Added cancel function to interface for bridge transactions.
packages/contracts-rfq/package.json Updated version to 0.13.0.
packages/contracts-rfq/test/FastBridgeV2.GasBench.Src.t.sol Renamed refund tests to cancellation tests, updated logic accordingly.
packages/contracts-rfq/test/FastBridgeV2.Management.t.sol Enhanced management tests with new cancellation delay features and error handling.
packages/contracts-rfq/test/FastBridgeV2.Src.Base.t.sol Updated role assignments and renamed refund functions to cancellation.
packages/contracts-rfq/test/FastBridgeV2.Src.t.sol Renamed refund functions to cancellation and updated related logic.
packages/rest-api/src/controllers/bridgeController.ts Added optional destAddress parameter to requests, updated response handling.
packages/rest-api/src/controllers/swapController.ts Added optional address parameter to swap requests.
packages/rest-api/src/routes/bridgeRoute.ts Updated API documentation to include destAddress, added validation.
packages/rest-api/src/routes/swapRoute.ts Updated API documentation to include address, added validation.
services/explorer/graphql/client/client.go Added BridgeModule field to GraphQL response types.
services/explorer/types/fastbridge/eventtype.go Added new event types for bridge transactions.
services/rfq/api/config/config.go Updated defaultMaxQuoteAge from 1 hour to 5 minutes.

Possibly related PRs

Suggested labels

size/m, needs-go-generate-services/rfq

Suggested reviewers

Poem

In the fields where rabbits play,
New contracts hop, brightening the day.
With cancellation now in sight,
We leap for joy, oh what a delight!
Hopping through code, with roles anew,
A world of bridges, just for you! 🐇✨

[!WARNING]

Rate limit exceeded

@github-actions[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue? After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work? CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://docs.coderabbit.ai/faq) for further information.
📥 Commits Reviewing files that changed from the base of the PR and between 83cef1de2ceb886958ccda1a9a12f161d0e05e5d and 13d978c6a5236e2ea564804b23f10ad79fe5620e.

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint > If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
services/explorer/graphql/client/queries/queries.graphql Oops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser '@babel/eslint-parser' declared in '.eslintrc.js': Cannot find module '@babel/core/package.json' Require stack: - /node_modules/@babel/eslint-parser/lib/parse.cjs - /node_modules/@babel/eslint-parser/lib/index.cjs - /node_modules/@eslint/eslintrc/dist/eslintrc.cjs at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15) at Function.resolve (node:internal/modules/helpers:145:19) at Object. (/node_modules/@babel/eslint-parser/lib/parse.cjs:14:19) at Module._compile (node:internal/modules/cjs/loader:1546:14) at Module._extensions..js (node:internal/modules/cjs/loader:1691:10) at Module.load (node:internal/modules/cjs/loader:1317:32) at Module._load (node:internal/modules/cjs/loader:1127:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Module.require (node:internal/modules/cjs/loader:1339:12)
🔧 golangci-lint level=warning msg="[config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`." level=warning msg="[config_reader] The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`." level=warning msg="[config_reader] The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`." level=warning msg="[lintersdb] The linter \"maligned\" is deprecated (step 2) and deactivated. It should be removed from the list of disabled linters. https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle" level=warning msg="[lintersdb] The linter \"exhaustivestruct\" is deprecated (step 2) and deactivated. It should be removed from the list of disabled linters. https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle" level=warning msg="[lintersdb] The linter \"ifshort\" is deprecated (step 2) and deactivated. It should be removed from the list of disabled linters. https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle" level=warning msg="[lintersdb] The linter \"interfacer\" is deprecated (step 2) and deactivated. It should be removed from the list of disabled linters. https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle" level=warning msg="[lintersdb] The linter \"nosnakecase\" is deprecated (step 2) and deactivated. It should be removed from the list of disabled linters. https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle" level=warning msg="[lintersdb] The name \"goerr113\" is deprecated. The linter has been renamed to: err113." level=warning msg="The linter 'execinquery' is deprecated (since v1.58.0) due to: The repository of the linter has been archived by the owner. " level=warning msg="The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar."

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 4 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 26.69992%. Comparing base (83cef1d) to head (13d978c). Report is 9 commits behind head on feat/relayer-arb-call.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feat/relayer-arb-call #3398 +/- ## =============================================================== + Coverage 26.60645% 26.69992% +0.09346% =============================================================== Files 214 215 +1 Lines 13617 13633 +16 Branches 82 82 =============================================================== + Hits 3623 3640 +17 + Misses 9711 9710 -1 Partials 283 283 ``` | [Flag](https://app.codecov.io/gh/synapsecns/sanguine/pull/3398/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | Coverage Δ | | |---|---|---| | [opbot](https://app.codecov.io/gh/synapsecns/sanguine/pull/3398/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `0.18337% <ø> (ø)` | | | [packages](https://app.codecov.io/gh/synapsecns/sanguine/pull/3398/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `90.44834% <ø> (ø)` | | | [promexporter](https://app.codecov.io/gh/synapsecns/sanguine/pull/3398/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `6.81642% <ø> (ø)` | | | [solidity](https://app.codecov.io/gh/synapsecns/sanguine/pull/3398/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `98.73418% <100.00000%> (+0.08097%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

github-actions[bot] commented 4 days ago

Changes to gas cost

Generated at commit: 913658fd48bb0e4a8f7f472315398b6c06043c75, compared to commit: 83cef1de2ceb886958ccda1a9a12f161d0e05e5d

🧾 Summary (50% most significant diffs)

Contract Method Avg (+/-) %
FastBridgeV2 bridgeProofs
bridgeRelayDetails
bridgeStatuses
getBridgeTransaction
getBridgeTransactionV2
grantRole
senderNonces
+22 ❌
-22 ✅
+22 ❌
-64 ✅
+23 ❌
-4,527 ✅
-22 ✅
+3.26%
-3.27%
+1.84%
-1.49%
+0.91%
-3.95%
-1.96%

Full diff report 👇
| Contract | Deployment Cost (+/-) | Method | Min (+/-) | % | Avg (+/-) | % | Median (+/-) | % | Max (+/-) | % | # Calls (+/-) | |:-|-:|:-|-:|-:|-:|-:|-:|-:|-:|-:|-:| | **FastBridgeV2** | 3,469,866 (+47,031) | _GOVERNOR_ROLE_
_GUARD_ROLE_
_bridge_
_bridgeProofs_
_bridgeRelayDetails_
_bridgeStatuses_
_claim(bytes)_
_claim(bytes,address)_
_dispute_
_getBridgeTransaction_
_getBridgeTransactionV2_
_grantRole_
_nonce_
_prove(bytes,bytes32)_
_prove(bytes32,bytes32,address)_
_relay(bytes)_
_relay(bytes,address)_
_senderNonces_
_setProtocolFeeRate_ | 339 (+45)
286 (+22)
69,002 (-44)
696 (+22)
650 (-22)
638 (+22)
40,032 (+66)
42,961 (+22)
31,167 (+45)
4,233 (-64)
1,130 (+23)
29,395 (-72,010)
307 (+45)
34,534 (+22)
32,063 (+45)
61,362 (+22)
61,814 (+67)
603 (-22)
47,398 (-23) | **+15.31%**
**+8.33%**
**-0.06%**
**+3.26%**
**-3.27%**
**+3.57%**
**+0.17%**
**+0.05%**
**+0.14%**
**-1.49%**
**+2.08%**
**-71.01%**
**+17.18%**
**+0.06%**
**+0.14%**
**+0.04%**
**+0.11%**
**-3.52%**
**-0.05%** | 339 (+45)
286 (+22)
80,380 (-44)
696 (+22)
650 (-22)
1,220 (+22)
46,943 (+66)
48,622 (+22)
31,177 (+45)
4,233 (-64)
2,557 (+23)
110,010 (-4,527)
307 (+45)
34,847 (+22)
32,071 (+45)
67,816 (+22)
68,268 (+67)
1,103 (-22)
47,398 (-23) | **+15.31%**
**+8.33%**
**-0.05%**
**+3.26%**
**-3.27%**
**+1.84%**
**+0.14%**
**+0.05%**
**+0.14%**
**-1.49%**
**+0.91%**
**-3.95%**
**+17.18%**
**+0.06%**
**+0.14%**
**+0.03%**
**+0.10%**
**-1.96%**
**-0.05%** | 339 (+45)
286 (+22)
81,081 (-44)
696 (+22)
650 (-22)
638 (+22)
47,527 (+66)
49,206 (+22)
31,179 (+45)
4,233 (-64)
3,194 (+23)
118,484 (-21)
307 (+45)
34,558 (+22)
32,075 (+45)
67,740 (+23)
68,192 (+68)
603 (-22)
47,398 (-23) | **+15.31%**
**+8.33%**
**-0.05%**
**+3.26%**
**-3.27%**
**+3.57%**
**+0.14%**
**+0.04%**
**+0.14%**
**-1.49%**
**+0.73%**
**-0.02%**
**+17.18%**
**+0.06%**
**+0.14%**
**+0.03%**
**+0.10%**
**-3.52%**
**-0.05%** | 339 (+45)
286 (+22)
93,185 (-43)
696 (+22)
650 (-22)
2,638 (+22)
54,986 (+66)
55,415 (+22)
31,179 (+45)
4,233 (-64)
3,347 (+23)
118,484 (-21)
307 (+45)
35,498 (+22)
32,075 (+45)
76,933 (+23)
77,385 (+68)
2,603 (-22)
47,398 (-23) | **+15.31%**
**+8.33%**
**-0.05%**
**+3.26%**
**-3.27%**
**+0.84%**
**+0.12%**
**+0.04%**
**+0.14%**
**-1.49%**
**+0.69%**
**-0.02%**
**+17.18%**
**+0.06%**
**+0.14%**
**+0.03%**
**+0.09%**
**-0.84%**
**-0.05%** | 88 (+67)
67 (0)
260 (0)
12 (0)
12 (0)
426 (0)
6 (0)
6 (0)
6 (0)
1 (0)
3 (0)
356 (+67)
4 (0)
68 (0)
68 (0)
6 (0)
6 (0)
248 (0)
21 (0) |
codecov[bot] commented 4 days ago

Bundle Report

Changes will decrease total bundle size by 3.83MB (-10.75%) :arrow_down:. This is within the configured threshold :white_check_mark:

Detailed changes | Bundle name | Size | Change | | ----------- | ---- | ------ | | sdk-router-@synapsecns/sdk-router-esm | 255.26kB | 609 bytes (0.24%) :arrow_up: | | sdk-router-@synapsecns/sdk-router-cjs | 117.55kB | 312 bytes (0.27%) :arrow_up: | | explorer-ui-server-cjs | 724.75kB | 141.31kB (-16.32%) :arrow_down: | | explorer-ui-client-array-push | 2.17MB | 146.19kB (-6.32%) :arrow_down: | | synapse-interface-client-array-push | 7.41MB | 132.38kB (1.82%) :arrow_up: | | synapse-interface-server-cjs | 1.65MB | 160.38kB (10.73%) :arrow_up: | | widget-cjs-esm* | 271.27kB | 2.03kB (-0.74%) :arrow_down: | | docs-bridge-client-array-push* | 7.28MB | 619.12kB (-7.83%) :arrow_down: | | docs-bridge-server-cjs* | 11.31MB | 3.57MB (-23.98%) :arrow_down: | | synapse-constants-esm-cjs* | 174.63kB | 174.63kB (100%) :arrow_up: | | synapse-constants-cjs-esm* | 174.18kB | 174.18kB (100%) :arrow_up: |

ℹ️ *Bundle size includes cached data from a previous commit