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: integrate Protocol Contracts v2 #2594

Merged
merged 37 commits into from
Aug 19, 2024
Merged

feat: integrate Protocol Contracts v2 #2594

merged 37 commits into from
Aug 19, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jul 30, 2024

Description

This PR setup smart contract v2 environment.

We will use this branch as a feature branch for added functionality that breaks compatibility with previous design

Copy link
Contributor

coderabbitai bot commented Jul 30, 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.

52 files out of 167 files are above the max files limit of 100. 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.


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

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 23.57456% with 1394 lines in your changes missing coverage. Please review.

Project coverage is 66.90%. Comparing base (2252e5e) to head (c13c70b).
Report is 4 commits behind head on develop.

Files Patch % Lines
pkg/contracts/erc1967proxy/ERC1967Proxy.go 0.00% 266 Missing ⚠️
zetaclient/chains/evm/observer/v2_inbound.go 0.00% 186 Missing ⚠️
zetaclient/chains/evm/observer/v2_outbound.go 0.00% 175 Missing ⚠️
x/crosschain/keeper/v2_zevm_inbound.go 10.52% 131 Missing and 5 partials ⚠️
pkg/contracts/testdappv2/TestDAppV2.go 0.00% 127 Missing ⚠️
zetaclient/chains/evm/signer/v2_sign.go 0.00% 115 Missing ⚠️
x/fungible/keeper/v2_evm.go 18.51% 85 Missing and 3 partials ⚠️
zetaclient/chains/evm/signer/sign.go 65.69% 41 Missing and 6 partials ⚠️
zetaclient/chains/evm/signer/signer.go 34.84% 40 Missing and 3 partials ⚠️
...hain/keeper/cctx_orchestrator_validate_outbound.go 24.52% 39 Missing and 1 partial ⚠️
... and 17 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2594      +/-   ##
===========================================
- Coverage    71.25%   66.90%   -4.35%     
===========================================
  Files          351      364      +13     
  Lines        18982    20458    +1476     
===========================================
+ Hits         13525    13688     +163     
- Misses        4853     6143    +1290     
- Partials       604      627      +23     
Files Coverage Δ
pkg/coin/coin.go 100.00% <100.00%> (ø)
pkg/crypto/address.go 100.00% <100.00%> (ø)
x/crosschain/keeper/cctx.go 94.44% <ø> (ø)
x/crosschain/types/message_vote_inbound.go 100.00% <100.00%> (ø)
x/fungible/keeper/evm.go 88.38% <100.00%> (+0.14%) ⬆️
x/fungible/keeper/gas_coin_and_pool.go 91.66% <ø> (ø)
x/fungible/keeper/gas_price.go 86.04% <ø> (ø)
...le/keeper/msg_server_deploy_fungible_coin_zrc20.go 96.07% <100.00%> (+0.84%) ⬆️
...ngible/keeper/msg_server_update_system_contract.go 93.06% <ø> (ø)
x/fungible/keeper/system_contract.go 90.37% <ø> (ø)
... and 35 more

... and 4 files with indirect coverage changes

lumtis added 6 commits July 31, 2024 10:37
* add runner for v2

* implement helper function

* add test bodies

* add makefile entry

* import
* add protocol contract version in cctx

* read deposit from ZetaClient

* deposit gas token

* run deposit

* add tests

* add event check

* add workflow for test

* put error handling higher level ObserverGateway

* add named interface
@github-actions github-actions bot added ci Changes to CI pipeline or github actions breaking:proto labels Aug 6, 2024
ws4charlie and others added 7 commits August 6, 2024 12:27
* port Panruo's outbound code and make compile pass

* make SOL withdraw e2e test passing

* make solana outbound tracker goroutine working

* allow solana gateway address to update

* integrate sub methods of SignMsgWithdraw and SignWithdrawTx

* initiate solana outbound tracker reporter

* implemented solana outbound tx verification

* use the amount in tx result for outbound vote

* post Solana priority fee to zetacore

* config Solana fee payer private key

* resolve 1st wave of comments in PR review

* resolve 2nd wave of comments

* refactor IsOutboundProcessed as VoteOutboundIfConfirmed; move outbound tracker iteration logic into ProcessOutboundTrackers sub method

* resolve 3rd wave of PR feedback

* added description to explain what do we do about the outbound tracker txHash

* add additional error message; add additional method comment

* fix gosec err

* replace contex.TODO() with context.Background()
* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <[email protected]>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <[email protected]>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <[email protected]>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>

* clean up

* format code

---------

Co-authored-by: Dmitry S <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <[email protected]>
* Implement chain registry

* Rewrite test-cases for AppContext

* Drop `supplychecker`

* Refactor app ctx Update worker

* Refactor orchestrator

* Refactor observer&signer; DROP postBlockHeaders

* Fix test cases [1]

* Update changelog

* Allow Zeta Chain in appContext; address PR comments [1]

* Fix app context update

* Check for `chain.IsZeta()`

* Add AppContext.FilterChains

* Fix test cases [2]

* Fix test cases [3]

* Address PR comments [1]

* Address PR comments [2]

* Add tests for `slices`

* Fix e2e tests [1]

* Fix e2e tests [2]

* Resolve conflicts, converge codebase between PRs

* Add lodash; remove slices pkg

* Address PR comments

* Minor logging fix

* Address PR comments
* Update golang cross compile to 1.22.4

* update deprecated --skip-validate --skip-release flags
@lumtis lumtis added UPGRADE_TESTS Run make start-upgrade-tests ADMIN_TESTS Run make start-admin-tests SOLANA_TESTS Run make start-solana-test labels Aug 16, 2024
Copy link

!!!WARNING!!!
nosec detected in the following files: x/crosschain/keeper/cctx_orchestrator_validate_outbound.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Aug 16, 2024
@lumtis lumtis marked this pull request as ready for review August 16, 2024 12:20
@swift1337
Copy link
Contributor

@coderabbitai summarize changes and structure them based on both features and packages

Copy link
Contributor

coderabbitai bot commented Aug 16, 2024

Tip

For best results, initiate chat on the files or code changes.

@swift1337: Here's a structured summary of the changes in the PR, organized by features and packages:

Features

  • Smart Contract Updates:
    • Modifications in TestZRC20 smart contract files (.abi, .bin, .go, .json, .sol), indicating updates or new features in the smart contract functionalities.
    • The TestZRC20.go file has significant additions, suggesting new logic or functions added to the contract.

Packages

  • E2E Contracts:

    • Updates in the e2e/contracts/testzrc20 directory with changes across multiple files, reflecting enhancements or bug fixes in the test contracts.
  • Go Environment:

    • Changes in cmd/zetae2e/local/local.go, which might relate to the local execution environment setup for end-to-end testing.
    • Updates in go.mod and go.sum files, indicating changes in dependencies or version updates for Go modules.

These changes collectively aim to integrate Protocol Contracts v2 and prepare the environment for future enhancements.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# List all changed files in the PR to understand which packages and features are affected.
git diff --name-only origin/main

# Get a summary of changes in each file to understand the features added or modified.
git diff --stat origin/main

Length of output: 448


Script:

#!/bin/bash
# List all changed files in the PR using HEAD^ to ensure we are comparing against the previous commit.
git diff --name-only HEAD^

# Get a summary of changes in each file using HEAD^ to understand the features added or modified.
git diff --stat HEAD^

Length of output: 877

cmd/zetae2e/local/local.go Outdated Show resolved Hide resolved
.github/workflows/e2e.yml Show resolved Hide resolved
@lumtis lumtis added the V2_TESTS Run make start-v2-test label Aug 16, 2024
@lumtis lumtis requested a review from gartnera August 16, 2024 17:55
@lumtis lumtis added this pull request to the merge queue Aug 19, 2024
Merged via the queue into develop with commit 3d1698d Aug 19, 2024
27 of 29 checks passed
@lumtis lumtis deleted the feat/contract-v2-2 branch August 19, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADMIN_TESTS Run make start-admin-tests breaking:cli breaking:proto ci Changes to CI pipeline or github actions nosec SOLANA_TESTS Run make start-solana-test UPGRADE_TESTS Run make start-upgrade-tests V2_TESTS Run make start-v2-test
Projects
None yet
8 participants