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

feat(rfq-relayer): regenerate with updated fastbridgev2 and zap terminology [SLT-442] #3393

Closed
wants to merge 102 commits into from

Conversation

dwasse
Copy link
Collaborator

@dwasse dwasse commented Nov 14, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new fastbridgev2 contract version with enhanced functionality.
    • Added mock contracts for testing, including RecipientMock.
    • Implemented new methods for handling bridge transactions and events in the updated contract.
  • Bug Fixes

    • Improved error handling during contract interactions and event parsing.
  • Documentation

    • Updated comments and documentation to reflect changes in contract structures and functionalities.
  • Tests

    • Added new tests for the fastbridgev2 contract and updated existing tests to accommodate changes in the contract interface.

bigboydiamonds and others added 30 commits October 15, 2024 17:26
 - @synapsecns/synapse-interface@0.40.10
* dispute emit relayer not guard. new Claim/Refund transfer & tests [SLT-295]

* var & comment tweaks
 - @synapsecns/contracts-rfq@0.8.3
 - @synapsecns/explorer-ui@0.5.0
* Feat: check amounts with offsets in isProfitable()

* WIP: test adj changes

* Fix: quoter tests

* [goreleaser]

* Cleanup: lint

* Feat: move origin offset calc to getDestAmount()

* Feat: add more test cases for new offset logic

* [goreleaser]

* Fix: offset application

* [goreleaser]
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
* storage refs - readability & gas impv

* rearrange reads on dispute

* read storage to local stack - claim

* docs: make storage writes more explicit

---------

Co-authored-by: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com>
 - @synapsecns/contracts-rfq@0.8.4
…g [SLT-328] [SLT-273] (#3284)

* refactor: isolate encoding into a separate lib

* test: use library encoding in tests

* feat: add new encoding/decoding

* test: prove/claim/refund/relay with invalid request payloads

* feat: use new full struct encoding/decoding

* feat: decode relevant fields only in claim

* feat: decode relevant fields only in relay

* feat: decode relevant fields only in refund

* refactor: improve constants readability a-la Go

* docs: validate/encode/decode V2

* test: rework to remove extra contracts from gas report

* fix: change V2 fields encoding order
* inherit MulticallTarget to FastBridge V1

* test: simple integration tests for multicall in V1

* refactor: make integration test more generic

---------

Co-authored-by: parodime <jordan@protochainresearch.com>
 - @synapsecns/contracts-rfq@0.9.0
 - @synapsecns/synapse-interface@0.40.11
…3304)

* build: add OZ contracts 4.5.0

* build: fix openzeppelin nohoist, yarn

* chore: move legacy router contracts from the old repo

* build: add legacy contracts to fmt, solhint exceptions

* test: add FB RouterV2 integration tests

* test: override edge case scenarios handled by Router

* build: ignore legacy contract in slither

* ci: add optional coverage filter step

* ci: install lcov in Foundry Coverage job

* build: try fixing slither filter paths

* Revert "build: try fixing slither filter paths"

This reverts commit 118103e.

* ci: add slither-config path
 - @synapsecns/contracts-rfq@0.9.1
…Q transaction has been refunded [SLT-350] (#3307)

* Returns bridge refunds with status
* Remove error details that are already contained in logs
* updates docs for fields
* Adds try catch and return null for non-RFQ in-flight txns
* dry graphql construction & queries
 - @synapsecns/rest-api@1.6.0
 - @synapsecns/rest-api@1.6.1
* Chain updates
* re-gen bridge map
* Normalize for USDC.e on RFQ
* Polygon pol/matic routeSymbol adjustment

---------

Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
 - @synapsecns/synapse-interface@0.40.12
* Re-gen bridge map
* Pol updates

---------

Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
 - @synapsecns/rest-api@1.7.0
* Updates bridgeMap
* Pol updates

---------

Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
 - @synapsecns/bridge-docs@0.4.5
 - @synapsecns/explorer-ui@0.5.1
 - @synapsecns/synapse-constants@1.8.0
 - @synapsecns/widget@0.8.0
* uptime metrics

* update

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
…icit docs [SLT-342] (#3316)

* refactor: emit the events before external calls

* docs: storage reads

* docs: more explicit notes about tx status changes

* docs: inheritdoc

* docs: update permisionless claim phrasing

Co-authored-by: parodime <jordan@protochainresearch.com>

---------

Co-authored-by: parodime <jordan@protochainresearch.com>
Copy link
Contributor

coderabbitai bot commented Nov 14, 2024

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

184 files out of 280 files are above the max files limit of 75. Please upgrade to Pro plan to get higher limits.

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

Walkthrough

The pull request introduces significant updates across multiple packages, primarily transitioning from the fastbridge to fastbridgev2 contract. Key changes include the addition of new files for handling bridge statuses, events, and mock implementations, as well as modifications to existing files to accommodate the new contract structure. The updates enhance functionality and testing capabilities, particularly through the introduction of new methods and types for managing Ethereum events and contract interactions.

Changes

File Path Change Summary
packages/contracts-rfq/package.json Updated build:go script to include test/mocks/*.sol for Solidity file processing.
services/rfq/contracts/fastbridge/status.go Added comment and lint suppression in init function; no changes to existing constants or methods.
services/rfq/contracts/fastbridgev2/bridgestatus_string.go New file generated for BridgeStatus type with string representation.
services/rfq/contracts/fastbridgev2/events.go New file defining event topics for bridge operations with error handling.
services/rfq/contracts/fastbridgev2/eventtype_string.go New stringer implementation for EventType with constants and error handling.
services/rfq/contracts/fastbridgev2/export_test.go Added GetAllBridgeStatuses function for testing purposes.
services/rfq/contracts/fastbridgev2/fastbridgev2.metadata.go New file for handling Ethereum smart contract metadata using embedded JSON.
services/rfq/contracts/fastbridgev2/generate.go New package for Fast Bridge V2 contract with //go:generate directive for Go bindings.
services/rfq/contracts/fastbridgev2/helper.go Introduced FastBridgeV2Ref type and constructor for contract references.
services/rfq/contracts/fastbridgev2/parser.go New file for parsing events with a defined Parser interface and event type enumeration.
services/rfq/contracts/fastbridgev2/status.go New BridgeStatus type with constants and initialization logic.
services/rfq/contracts/testcontracts/fastbridgemockv2/fastbridgemockv2.metadata.go New package for mock contract metadata handling.
services/rfq/contracts/testcontracts/recipientmock/generate.go New package for mock recipient contract with //go:generate directive.
services/rfq/e2e/rfq_test.go Updated tests to integrate new contract version and added TestZap function.
services/rfq/relayer/chain/chain.go Updated references from fastbridge to fastbridgev2, modifying the Chain struct and related methods.
services/rfq/relayer/limiter/limiter_test.go Updated import path and transaction type in tests to reflect fastbridgev2.
services/rfq/relayer/quoter/quoter_test.go Updated import path and transaction type in tests to reflect fastbridgev2.
services/rfq/relayer/service/chainindexer.go Updated event handling logic to utilize fastbridgev2 event types.
services/rfq/relayer/service/handlers.go Transitioned methods to use fastbridgev2 types, added getBridgeTxs method.
services/rfq/relayer/service/relayer.go Updated contract reference instantiation to use fastbridgev2.
services/rfq/testutil/contracttype.go Updated mock contract imports and introduced RecipientMockType.
services/rfq/testutil/deployers.go Added new deployer for RecipientMock, updated existing deployers for new contract versions.
services/rfq/testutil/typecast.go Updated contract retrieval functions to return new types from fastbridgev2 and added GetRecipientMock.

Possibly related PRs

Suggested labels

go, size/s, needs-go-generate-services/rfq, needs-go-generate-contrib/promexporter, needs-go-generate-contrib/opbot

Suggested reviewers

  • aureliusbtc
  • trajan0x

Poem

🐰 In the fields where bridges sway,
FastBridgeV2 leads the way.
With mocks and tests, we leap and bound,
New paths in code, together found.
Hopping high, we celebrate,
In our code, we innovate! 🌟


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.

@dwasse dwasse changed the base branch from master to feat/relayer-arb-call November 14, 2024 16:23
@github-actions github-actions bot added M-ci Module: CI javascript Pull requests that update Javascript code go Pull requests that update Go code M-explorer-ui M-synapse-interface Sol Typescript M-deps M-docs M-vscode-settings size/l labels Nov 14, 2024
@dwasse dwasse closed this Nov 14, 2024
@github-actions github-actions bot deleted the feat/relayer-arb-call-zap branch November 14, 2024 16:25
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 49.49495% with 150 lines in your changes missing coverage. Please review.

Project coverage is 31.08355%. Comparing base (978313d) to head (b3faf2b).
Report is 98 commits behind head on feat/relayer-arb-call.

Files with missing lines Patch % Lines
contrib/opbot/botmd/commands.go 0.00000% 93 Missing ⚠️
contrib/opbot/internal/client.go 0.00000% 34 Missing ⚠️
core/metrics/standard.go 44.44444% 8 Missing and 2 partials ⚠️
core/bytes.go 0.00000% 7 Missing ⚠️
contrib/opbot/botmd/botmd.go 0.00000% 5 Missing ⚠️
services/omnirpc/cmd/cmd.go 0.00000% 1 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                       @@
##           feat/relayer-arb-call       #3393         +/-   ##
===============================================================
+ Coverage               24.99061%   31.08355%   +6.09293%     
===============================================================
  Files                        207         560        +353     
  Lines                      13317       38300      +24983     
  Branches                      82          82                 
===============================================================
+ Hits                        3328       11905       +8577     
- Misses                      9701       25362      +15661     
- Partials                     288        1033        +745     
Flag Coverage Δ
cctp-relayer 31.97848% <ø> (?)
core 58.61668% <54.05405%> (?)
ethergo 47.35802% <ø> (?)
git-changes-action 23.48315% <ø> (?)
omnirpc 32.65401% <0.00000%> (?)
opbot 0.18337% <0.00000%> (-0.30533%) ⬇️
packages 90.44834% <ø> (ø)
promexporter 6.81642% <ø> (ø)
restclient 0.98007% <ø> (?)
screener-api 29.45990% <ø> (?)
scribe 18.18182% <ø> (?)
solidity 98.65320% <100.00000%> (?)
tools 30.55118% <ø> (?)

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.

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity ^0.8.4;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity ^0.8.4;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
Comment on lines +227 to +232
function zapNative(bytes calldata encodedTx) internal pure returns (uint256 zapNative_) {
// Load 32 bytes from the offset. No shift is applied, as we need the full 256 bits.
assembly {
zapNative_ := calldataload(add(encodedTx.offset, OFFSET_ZAP_NATIVE))
}
}

Check warning

Code scanning / Slither

Assembly usage Warning

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.

9 participants