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

Fix/rfq event regen #1800

Merged
merged 3 commits into from
Jan 9, 2024
Merged

Fix/rfq event regen #1800

merged 3 commits into from
Jan 9, 2024

Conversation

trajan0x
Copy link
Contributor

@trajan0x trajan0x commented Jan 9, 2024

Description

Regenerate #1650 events for #1778

Summary by CodeRabbit

  • New Features

    • Expanded event parameters in BridgeRequested and BridgeRelayed to include additional transaction details.
  • Refactor

    • Updated Solidity version to 0.8.20 for consistent compiler targeting.
    • Modified contract functions to align with new event parameter structures.
  • Tests

    • Updated tests to reflect changes in event and function parameters.
  • Documentation

    • Enhanced inline comments in tests for better clarity of arguments.

Copy link
Contributor

coderabbitai bot commented Jan 9, 2024

Important

Auto Review Skipped

Auto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings.

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.

Walkthrough

The updates across the contracts and tests indicate a standardization of the Solidity version used, moving from a flexible version to a fixed one. Additionally, there's an expansion of event parameters within the FastBridge contract to provide more detailed information about bridge requests and relays. Test contracts and mocks have been adjusted to accommodate these new event parameters, ensuring consistency with the updated contract specifications.

Changes

File Path Change Summary
.../Admin.sol, .../FastBridge.sol Updated Solidity pragma from ^0.8.20 to 0.8.20.
.../interfaces/IAdmin.sol, .../interfaces/IFastBridge.sol Changed Solidity pragma from ^0.8.20 to ^0.8.0. Expanded event parameters.
.../test/FastBridge.t.sol, .../test/FastBridgeMock.sol Adjusted to new BridgeRequested and BridgeRelayed event parameters. Updated function signatures and emit statements.
services/rfq/relayer/listener/listener_test.go Added comments for clarity in test function arguments.

🐇✨
To version fixed, we hop and bound,
With events enriched, our data's sound.
In code we trust, with changes small,
A rabbit's touch, improves it all. 🌟🥕

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added go Pull requests that update Go code size/l labels Jan 9, 2024
@trajan0x trajan0x changed the base branch from master to fix/rfq-events January 9, 2024 17:33
@trajan0x trajan0x requested a review from nautsimon as a code owner January 9, 2024 17:33
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (fix/rfq-events@0f3f5cb). Click here to learn what that means.

❗ Current head bbf4d43 differs from pull request most recent head 9aae71f. Consider uploading reports for the commit 9aae71f to get more accurate results

Additional details and impacted files
@@                 Coverage Diff                  @@
##             fix/rfq-events       #1800   +/-   ##
====================================================
  Coverage                  ?   52.09276%           
====================================================
  Files                     ?         367           
  Lines                     ?       24752           
  Branches                  ?         296           
====================================================
  Hits                      ?       12894           
  Misses                    ?       10620           
  Partials                  ?        1238           
Flag Coverage Δ
packages 93.01015% <0.00000%> (?)
solidity 93.63708% <0.00000%> (?)

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
Contributor

@mikeyrf mikeyrf left a comment

Choose a reason for hiding this comment

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

lgtm!

@trajan0x trajan0x merged commit 4199fa0 into fix/rfq-events Jan 9, 2024
25 of 26 checks passed
@trajan0x trajan0x deleted the fix/rfq-event-regen branch January 9, 2024 17:40
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between eecb5d8 and bbf4d43.
Files ignored due to filter (2)
  • services/rfq/contracts/fastbridge/fastbridge.contractinfo.json
  • services/rfq/contracts/testcontracts/fastbridgemock/fastbridgemock.contractinfo.json
Files selected for processing (7)
  • packages/contracts-rfq/contracts/Admin.sol (1 hunks)
  • packages/contracts-rfq/contracts/FastBridge.sol (3 hunks)
  • packages/contracts-rfq/contracts/interfaces/IAdmin.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IFastBridge.sol (2 hunks)
  • packages/contracts-rfq/test/FastBridge.t.sol (15 hunks)
  • packages/contracts-rfq/test/FastBridgeMock.sol (2 hunks)
  • services/rfq/relayer/listener/listener_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • packages/contracts-rfq/contracts/Admin.sol
  • services/rfq/relayer/listener/listener_test.go
Additional comments: 18
packages/contracts-rfq/contracts/interfaces/IAdmin.sol (1)
  • 2-2: The pragma directive has been changed to ^0.8.0, which allows the contract to be compiled with any version of the Solidity compiler greater than or equal to 0.8.0. Please ensure that all compiler versions in this range have been tested and are known to be safe for this contract.
packages/contracts-rfq/contracts/interfaces/IFastBridge.sol (2)
  • 2-2: The pragma directive has been changed to ^0.8.0, which allows the contract to be compiled with any version of the Solidity compiler greater than or equal to 0.8.0. Please ensure that all compiler versions in this range have been tested and are known to be safe for this contract.

  • 27-51: The additional parameters in the BridgeRequested and BridgeRelayed events provide more granularity and are consistent with the PR objectives to enhance the RFQ event generation process. These changes appear to be correctly implemented.

packages/contracts-rfq/test/FastBridgeMock.sol (3)
  • 56-103: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [46-69]

The changes in the mockBridgeRequest function correctly reflect the updated BridgeRequested event structure and are consistent with the PR objectives.

  • 73-84: The mockBridgeRequestRaw function has been updated to use the getBridgeTransaction method and the emit statement has been modified accordingly. This change is consistent with the updated event structure.

  • 91-100: The mockBridgeRelayer function's signature has been modified to include more detailed parameters, which aligns with the changes in the actual FastBridge contract. The emit statement has been updated accordingly.

packages/contracts-rfq/contracts/FastBridge.sol (3)
  • 2-2: The pragma directive has been updated to a fixed version 0.8.20. This is inconsistent with the other updated files which use ^0.8.0. Please clarify the rationale for this fixed version and ensure consistency across all contracts.

  • 110-120: The additional parameters in the BridgeRequested event provide more granularity and are consistent with the PR objectives to enhance the RFQ event generation process. These changes appear to be correctly implemented.

  • 152-162: The additional parameters in the BridgeRelayed event provide more granularity and are consistent with the PR objectives to enhance the RFQ event generation process. These changes appear to be correctly implemented.

packages/contracts-rfq/test/FastBridge.t.sol (9)
  • 363-372: The BridgeRequested event has been updated with new parameters. Ensure that all parts of the codebase that listen to this event are updated to handle the new parameters.
Verification successful


The verification process has been completed, and the findings are as follows:

  1. The Go service handlers that process the BridgeRequested event have been identified, and they appear to be updated to handle the new parameters.
  2. The Go contract bindings and TypeScript typechain files define the structure of the BridgeRequested event, including the new parameters as per the PR changes.

Based on the information gathered, it can be concluded that the necessary parts of the codebase that interact with the BridgeRequested event have been updated to accommodate the new event parameters.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for the BridgeRequested event usage in the codebase to ensure compatibility with the new parameters.
rg --type solidity "BridgeRequested" --files-with-matches

Length of output: 90



Script:

#!/bin/bash
# Search for the BridgeRequested event usage in the codebase to ensure compatibility with the new parameters.
rg "BridgeRequested" --files-with-matches

Length of output: 1042



Script:

#!/bin/bash
# Check the usage of the BridgeRequested event in Solidity files.
rg "BridgeRequested" --type sol

Length of output: 59


Script:

#!/bin/bash
# Check the usage of the BridgeRequested event in Go files.
rg "BridgeRequested" --type go

Length of output: 95135


Script:

#!/bin/bash
# Check the usage of the BridgeRequested event in TypeScript files.
rg "BridgeRequested" --type ts

Length of output: 1379



Script:

#!/bin/bash
# Check the usage of the BridgeRequested event in Go files in more detail.
rg "BridgeRequested" --type go -C 10

Length of output: 190447


Script:

#!/bin/bash
# Check the usage of the BridgeRequested event in TypeScript files in more detail.
rg "BridgeRequested" --type ts -C 10

Length of output: 15165

* 387-397: The test `test_successfulBridge` correctly emits the updated `BridgeRequested` event with the new parameters. This change is consistent with the updated event signature.
  • 899-907: The BridgeRelayed event has been updated with new parameters. Ensure that all parts of the codebase that listen to this event are updated to handle the new parameters.

  • 937-939: The test test_successfulRelayDestination correctly emits the updated BridgeRelayed event with the new parameters. This change is consistent with the updated event signature.

  • 1183-1183: The BridgeProofProvided event is used in the test_successfulRelayProof function. Ensure that the logic for proof provision is correctly implemented and that the event is emitted as expected.

  • 1314-1316: The BridgeDepositClaimed event is used in the test_successfulClaimOriginTokens function. Verify that the event emission is correct and that the test logic accurately reflects the expected behavior when a deposit is claimed.

  • 1551-1551: The BridgeProofDisputed event is used in the test_successfulDisputeProof function. Confirm that the dispute logic is correctly tested and that the event is emitted appropriately.

  • 1648-1648: The BridgeDepositRefunded event is used in the test_successfulRefund function. Ensure that the refund logic is correctly tested and that the event is emitted appropriately.

  • 360-376: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-1648]

Overall, the test file has been updated to reflect the changes in the BridgeRequested and BridgeRelayed events. Ensure that all tests are passing and that they cover all scenarios, including edge cases and failure modes.

trajan0x added a commit that referenced this pull request Jan 10, 2024
* index event topics

* relax interface pragmas, set contract pragmas to 0.8.20

* bridge params attrs in bridge requested event

* update BridgeRelayed event for extra attrs

* regen (#1800)

Co-authored-by: Trajan0x <[email protected]>

* disable depguard

* refund to originSender only (#1802)

* regen events (#1803)

Co-authored-by: Trajan0x <[email protected]>

* deploy w event updates

* deploy to l1

* regen [goreleaser]

* fix recording [goreleaser]

* Change addresses to be checksummed. Update tests to pass with new set of contracts

* end span [goreleaser]

* use multiplier [goreleaser]

* use multiplier [goreleaser]

---------

Co-authored-by: Trajan0x <[email protected]>
Co-authored-by: trajan0x <[email protected]>
Co-authored-by: aureliusbtc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants