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

App abstraction (go changes) #2349

Merged

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Mar 21, 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

  • Refactor
    • Enhanced contract bytecode for improved performance and reliability.
    • Optimized code generation paths for solidity files to maintain consistency.
    • Renamed structures and functions for better clarity and usability within interchain applications.
  • Tests
    • Updated an end-to-end test to include a new argument, enhancing test coverage comprehensiveness.
  • Chores
    • Aligned contract references and deployment methods with updated solidity files for smoother development and deployment workflows.

Copy link
Contributor

coderabbitai bot commented Mar 21, 2024

Walkthrough

The recent updates encompass modifications across various components of the SIN executor, focusing on bytecode updates in contract metadata, renaming and path adjustments in mock contracts and generator files, and functional changes in test utilities and executor tests. These changes streamline contract deployment, enhance testing capabilities, and refine the project's structure for better clarity and efficiency.

Changes

Files Change Summary
.../executionservice/executionservice.abigen.go, .../executionfeesmock/executionfeesmock.abigen.go Updated Bin field values in contract metadata.
.../executionfeesmock/generate.go, .../interchainapp/generate.go Updated file paths in go:generate commands.
.../interchainapp/helpers.go Renamed struct and function names from InterchainAppExample to ExampleAppV1.
executor/executor_test.go Modified SendMessage function call to include an additional argument.
testutil/contracttype.go, testutil/deployers.go Updated contract references and deployment methods, including adjusted parameters for interchain app setup.

🐇✨
In the realm of code, where changes are bold,
A rabbit hopped in, with updates untold.
Bytecode refreshed, paths finely tread,
From contract to test, the changes spread.
With every hop, a better flow,
In this digital garden, where progress does grow.
🌱🚀

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.
    • 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 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 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 Mar 21, 2024
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: 2

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between f697db0 and 7eb800e.
Files selected for processing (10)
  • sin-executor/contracts/executionservice/executionservice.abigen.go (2 hunks)
  • sin-executor/contracts/interchainclient/interchainclient.abigen.go (7 hunks)
  • sin-executor/contracts/mocks/executionfeesmock/executionfeesmock.abigen.go (1 hunks)
  • sin-executor/contracts/mocks/executionfeesmock/executionfeesmock.contractinfo.json (1 hunks)
  • sin-executor/contracts/mocks/executionfeesmock/generate.go (1 hunks)
  • sin-executor/contracts/mocks/interchainapp/generate.go (1 hunks)
  • sin-executor/contracts/mocks/interchainapp/helpers.go (2 hunks)
  • sin-executor/executor/executor_test.go (1 hunks)
  • sin-executor/testutil/contracttype.go (1 hunks)
  • sin-executor/testutil/deployers.go (1 hunks)
Files not summarized due to errors (2)
  • sin-executor/contracts/interchainclient/interchainclient.abigen.go: Error: Message exceeds token limit
  • sin-executor/contracts/mocks/executionfeesmock/executionfeesmock.contractinfo.json: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • sin-executor/contracts/mocks/executionfeesmock/generate.go
Additional comments: 16
sin-executor/executor/executor_test.go (1)
  • 38-38: The addition of big.NewInt(0) as an argument to SendMessage aligns with the PR objectives. Ensure that all calls to SendMessage across the codebase have been updated to match the new signature.
sin-executor/testutil/contracttype.go (2)
  • 101-101: The update to the contract reference for InterchainApp to point to ExampleAppV1.sol:ExampleAppV1 aligns with the PR's renaming and rebranding efforts.
  • 107-107: Ensure the updated reference for ExecutionFeesMock aligns with the changes in contract structures or functionalities.
sin-executor/testutil/deployers.go (2)
  • 88-88: The method for deploying the interchain app has been updated to use DeployExampleAppV1, aligning with the PR's objectives.
  • 94-94: The method for setting the interchain client has been updated, ensuring it aligns with the updated functionalities.
sin-executor/contracts/mocks/executionfeesmock/executionfeesmock.contractinfo.json (1)
  • 1-1: The JSON structure appears well-formed and includes detailed information about the ExecutionFeesMock contract and the IExecutionFees interface. It's important to ensure that the compilerVersion, compilerOptions, and evmVersion specified in the info section align with the project's standards and the Solidity version used in other contracts within the project. Additionally, verify that the metadata section's bytecodeHash setting ("ipfs") is consistent with how bytecode hashes are managed across the project. If the project uses a different platform or protocol for bytecode verification, this setting should be adjusted accordingly.
sin-executor/contracts/mocks/executionfeesmock/executionfeesmock.abigen.go (2)
  • 44-44: The Bin field in ExecutionFeesMockMetaData has been updated. While the bytecode itself cannot be directly reviewed for correctness, it's important to ensure that this update corresponds to the intended version of the contract. Please verify the update process was correctly followed and consider updating any related documentation to reflect this change.
  • 44-44: The generated code for the ExecutionFeesMock contract binding follows best practices for Ethereum contract bindings in Go. Note the use of deprecated fields (ExecutionFeesMockABI, ExecutionFeesMockFuncSigs, ExecutionFeesMockBin) is common in generated bindings to maintain backward compatibility.
sin-executor/contracts/executionservice/executionservice.abigen.go (1)
  • 199-199: The Bin field for ExecutionServiceMetaData is updated. Ensure that the new bytecode corresponds to the latest compiled version of the smart contract. This is crucial for the correctness and security of interactions with the blockchain.
sin-executor/contracts/interchainclient/interchainclient.abigen.go (7)
  • 76-76: The Bin field for AppConfigLibMetaData has been updated. Ensure that the new bytecode corresponds to the latest compiled version of the AppConfigLib contract and that it has been thoroughly tested, especially if the contract's logic has changed.
  • 2279-2279: The Bin field for InterchainBatchLibMetaData has been updated. Similar to the previous comment, verify that this bytecode update reflects the latest changes and optimizations in the InterchainBatchLib contract and that comprehensive testing has been conducted.
  • 2473-2473: Updates to the Bin field for a contract are noted without specifying the contract's name. Ensure that this bytecode update is correctly associated with the intended contract and that the contract's functionality aligns with these changes.
  • 4995-4995: The Bin field for InterchainEntryLibMetaData has been updated. As with the other contracts, confirm that this update accurately represents the latest compiled bytecode and that the contract has been adequately tested post-update.
  • 5168-5168: The Bin field for InterchainTransactionLibMetaData has been updated. It's crucial to ensure that this bytecode is the result of the latest contract compilation and that the contract's functionality has been validated through testing.
  • 5341-5341: The Bin field for OptionsLibMetaData has been updated. Verify that this update is reflective of the most recent changes to the OptionsLib contract and that the contract has undergone thorough testing to ensure its functionality.
  • 5900-5900: The Bin field for TypeCastsMetaData has been updated. Ensure that this bytecode corresponds to the latest version of the TypeCasts contract and that the contract has been tested extensively to confirm its functionality.

@@ -9,8 +9,8 @@
)

// InterchainAppMockRef is a reference to an interchain db.
type InterchainAppMockRef struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming InterchainAppMockRef to MockRef to avoid stuttering in the package name usage, as suggested by Go conventions.

- type InterchainAppMockRef struct {
+ type MockRef struct {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
type InterchainAppMockRef struct {
type MockRef struct {

Comment on lines 85 to 97
clientContract := helpers.Registry().Get(ctx, InterchainClient)
sendingModule := helpers.Registry().Get(ctx, InterchainModuleMock)

appAddress, appTx, appMock, err := interchainapp.DeployInterchainAppExample(transactOps, backend, transactOps.From)
appAddress, appTx, appMock, err := interchainapp.DeployExampleAppV1(transactOps, backend, transactOps.From)
if err != nil {
return common.Address{}, nil, nil, fmt.Errorf("could not deploy interchain app mock: %w", err)
}
helpers.Backend().WaitForConfirmation(ctx, appTx)

tx, err := appMock.SetInterchainClient(transactOps, clientContract.Address())
tx, err := appMock.AddInterchainClient(transactOps, clientContract.Address(), true)
if err != nil {
return common.Address{}, nil, nil, fmt.Errorf("could not set interchain client: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [78-78]

Consider removing or renaming unused parameters in functions to _ to adhere to Go best practices.

- func(ctx context.Context, helpers deployer.IFunctionalDeployer, transactOps *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, interface{}, error) {
+ func(_ context.Context, helpers deployer.IFunctionalDeployer, transactOps *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, interface{}, error) {

Also applies to: 111-111, 141-141

Copy link

cloudflare-workers-and-pages bot commented Mar 21, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a14231
Status: ✅  Deploy successful!
Preview URL: https://0fd729d3.sanguine-fe.pages.dev
Branch Preview URL: https://feat-interchain-app-abstract-kqxl.sanguine-fe.pages.dev

View logs

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.yaml

Commits Files that changed from the base of the PR and between 7eb800e and c5cd43d.
Files selected for processing (1)
  • sin-executor/executor/suite_test.go (1 hunks)
Additional comments: 1
sin-executor/executor/suite_test.go (1)
  • 121-121: Changing the OptimisticPeriod from 0 to 1 in the setClientConfigs method affects the configuration setup for the application. This change likely impacts how optimistic operations are simulated or tested within this suite. Ensure that this adjustment aligns with the intended behavior of the tests and consider if any related documentation or other test configurations need to be updated to reflect this change.

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.86729%. Comparing base (f697db0) to head (4a14231).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           feat/interchain-app-abstraction       #2349         +/-   ##
=========================================================================
+ Coverage                         46.85358%   46.86729%   +0.01370%     
=========================================================================
  Files                                  383         383                 
  Lines                                29176       29176                 
  Branches                                83          83                 
=========================================================================
+ Hits                                 13670       13674          +4     
+ Misses                               14048       14044          -4     
  Partials                              1458        1458                 
Flag Coverage Δ
sin-executor 61.90476% <100.00000%> (+1.00250%) ⬆️

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

@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.yaml

Commits Files that changed from the base of the PR and between c5cd43d and 4a14231.
Files selected for processing (1)
  • sin-executor/executor/executor_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • sin-executor/executor/executor_test.go

@ChiTimesChi ChiTimesChi merged commit 2f21dcb into feat/interchain-app-abstraction Mar 22, 2024
28 of 29 checks passed
@ChiTimesChi ChiTimesChi deleted the feat/interchain-app-abstraction-go branch March 22, 2024 12:02
ChiTimesChi added a commit that referenced this pull request Mar 27, 2024
* Update `generate.go`

* Regenerate `sin-executor`

* Update Example App references

* Use non-zero period in tests

* Use `GetMessageFee` for setting the message value

* Use non-zero gas airdrop amount in tests
ChiTimesChi added a commit that referenced this pull request Mar 27, 2024
* Abstraction for receiving messages

* Abstraction for sending messages

* Fully implement IInterchainApp

* Abstraction for managing clients

* Scaffold ICAppV1

* ICAppV1: implement storage

* ICAppV1: implement permissioned management

* Add management views

* Add thin wrapper for "send message to linked app"

* Add more custom errors

* Add App harness and client mock

* Add ICAppV1 management tests

* Add extra checks for the new custom errors

* Chore: move stuff around in tests

* Fix: IInterchainAppV1 should implement IInterchainApp

* Add ICAppV1 messaging tests

* Add `_getMessageFee` thin wrapper and tests around it

* Update PingPongApp to use the `ICAppV1` base

* Update ExampleApp

* Move example apps into a separate folder

* Update scripts and tests

* Chore: cleanup

* Update flattened files set [**.sol glob not working]

* Add fee getter for `ExampleAppV1`

* App abstraction (go changes) (#2349)

* Update `generate.go`

* Regenerate `sin-executor`

* Update Example App references

* Use non-zero period in tests

* Use `GetMessageFee` for setting the message value

* Use non-zero gas airdrop amount in tests

* Regenerate `sin-executor`

* Fix: incorrect fuzzing "not IC client" test
golangisfun123 pushed a commit that referenced this pull request Jun 19, 2024
* Update `generate.go`

* Regenerate `sin-executor`

* Update Example App references

* Use non-zero period in tests

* Use `GetMessageFee` for setting the message value

* Use non-zero gas airdrop amount in tests
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.

1 participant