synapsecns / sanguine

Synapse Monorepo
MIT License
38 stars 29 forks source link

RFQ Relayer: pause quoting on pending transactions #2839

Closed dwasse closed 1 month ago

dwasse commented 3 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 3 months ago

Walkthrough

The changes primarily enhance the transaction submitter functionality within the submitter package by adding new metrics recording, a mock transaction submitter for testing, and pending transaction limits. Integration with the quoter component of the relayer service along with updates to relevant tests and configurations has been completed to ensure better handling and monitoring of pending transactions.

Changes

File Path Change Summary
ethergo/submitter/chain_queue.go Reordered imports, split a function call into two for metrics recording, added new metric recording operation.
ethergo/submitter/mocks/transaction_submitter.go Added autogenerated mock TransactionSubmitter with mock functions for testing various scenarios.
ethergo/submitter/queue.go Added a method call numPendingTxes.Set to set pending transactions for a specific chain ID.
ethergo/submitter/submitter.go Introduced hashmap, added a method GetNumPendingTxes to the TransactionSubmitter interface and its implementation.
services/rfq/relayer/quoter/quoter.go Added txSubmitter field to the Manager struct, modified NewQuoterManager, and added isNumPendingExceeded method to manage pending transactions.
services/rfq/relayer/quoter_test.go Added functions setNumPendingTxes and setQuoter for testing, and included a new import for submitterMocks.
services/rfq/relayer/suite_test.go Renamed import from fetcherMocks to submitterMocks, added txSubmitter in test setup.
services/rfq/relayer/relconfig/config.go Introduced a new field MaxPendingTxes to the ChainConfig struct.
services/rfq/relayer/relconfig/config_test.go Added MaxPendingTxes field in test configurations for ChainConfig.
services/rfq/relayer/relconfig/getters.go Added the MaxPendingTxes field and a method GetMaxPendingTxes to retrieve the value.
services/rfq/relayer/service/relayer.go Added a new parameter sm to the NewQuoterManager function call in NewRelayer.

Sequence Diagram(s)

sequenceDiagram
    participant Manager
    participant txSubmitter
    participant Quoter

    Manager->>txSubmitter: Check GetNumPendingTxes
    txSubmitter-->>Manager: Return number of pending tx
    Manager->>Manager: Evaluate if pending tx exceed MaxPendingTxes
    alt If exceeded
        Manager--x Quoter: Do not generate quote
    else If not exceeded
        Manager->>Quoter: Proceed with quote generation
    end

Poem

In the code, where metrics bloom,
Transaction counts dispel the gloom.
Pending tallies rise and fall,
Quoters heed the submitter's call.
Now our tests mock and play,
Limits keep delays at bay.
For in this realm of gears and bytes,
Precision reigns, and all's in sight.

🐇✨


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 .` - `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 generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@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 as 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. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
cloudflare-workers-and-pages[bot] commented 3 months ago

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1cc152a
Status: ✅  Deploy successful!
Preview URL: https://6803e375.sanguine-fe.pages.dev
Branch Preview URL: https://feat-pending-quoting.sanguine-fe.pages.dev

View logs

codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 25.57974%. Comparing base (a362a16) to head (1cc152a). Report is 114 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2839 +/- ## =================================================== - Coverage 25.76884% 25.57974% -0.18910% =================================================== Files 766 724 -42 Lines 55148 53472 -1676 Branches 80 80 =================================================== - Hits 14211 13678 -533 + Misses 39481 38405 -1076 + Partials 1456 1389 -67 ``` | [Flag](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | Coverage Δ | | |---|---|---| | [cctp-relayer](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `?` | | | [omnirpc](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `33.08129% <ø> (+0.04726%)` | :arrow_up: | | [opbot](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `0.21082% <ø> (ø)` | | | [packages](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `90.47619% <ø> (ø)` | | | [promexporter](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `8.50242% <ø> (ø)` | | | [scribe](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `18.17597% <ø> (+0.06437%)` | :arrow_up: | | [tools](https://app.codecov.io/gh/synapsecns/sanguine/pull/2839/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `30.55118% <ø> (ø)` | | 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.

github-actions[bot] commented 2 months ago

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

trajan0x commented 2 months ago

unrelated - think we want to merge?

trajan0x commented 2 months ago

can we resolve conflicts

github-actions[bot] commented 2 months ago

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.