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!: add stateful precompiles support #2633

Merged
merged 32 commits into from
Aug 27, 2024

Conversation

fbac
Copy link
Contributor

@fbac fbac commented Aug 5, 2024

Description

Introduce the stateful precompiled contracts support into the ZetaChain node.

Closes #2511
Closes #2512
Closes #2498

Summary

  • Minor cleanups in Makefile and go.mod: not related to the PR directly, but needed in order to cleanup the codebase and introduce subsequent changes.
  • No longer import evmos/ethermint, instead import zeta-chain/ethermint directly.
  • NewEVM now returns an instance of *vm.EVM, which is instantiated from go-ethereum/core/vm and supports stateful precompiled contracts.
  • simapp dependency was removed from zeta-chain/ethermint in zeta-chain/ethermint@a8efba4, hence some parts of the code such as app/encoding.go still using types from simapp were failing. Replaced simapp types for zeta-chain/ethermint/types
  • Introduced the prototype contract, deployed in 0x0000000000000000000000000000000000000065
  • Introduced e2e tests for the prototype contract.
    • Modified localnet.yml and e2e tests to include a new user user_precompile
  • Introduced a new Makefile target make precompile to generate the abi and bindings for each precompile.

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Introduced support for stateful precompiled contracts, enhancing contract management capabilities.
  • Bug Fixes

    • Updated various import paths to reflect the transition from Evmos to Zeta Chain, ensuring correct package resolution across the application.
  • Documentation

    • Updated license URLs in comments to point to the Zeta Chain repository.
    • Improved formatting and readability in several documentation files.
  • Chores

    • Consolidated and reorganized package dependencies in the project’s go.mod file to align with Zeta Chain's libraries.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

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.

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

Walkthrough

Walkthrough

The recent changes primarily involve updating import paths across multiple files to transition from the evmos to the zeta-chain repository. This includes modifications to licensing information and the introduction of new variables in the Makefile. The updates aim to adapt the core node to support stateful precompiled contracts, streamline dependencies, and enhance the organization of code without altering core functionalities.

Changes

Files Change Summary
Makefile Added variables for package name, Go version, and GOPATH. Consolidated test commands and improved readability.
app/... (ante.go, fees.go, ...) Updated import paths to reference the zeta-chain repository instead of evmos, and amended licensing URLs.
cmd/... (zetacored/add_observer_list.go, ...) Changed import paths to zeta-chain for various modules, indicating a shift in dependency management.
rpc/... (backend/*.go) Modified imports and licensing comments to reflect the new source under zeta-chain.
go.mod Added new dependencies from zeta-chain, removed old ones, and updated existing package versions.

Sequence Diagram(s)

sequenceDiagram
    participant Node
    participant Contracts
    participant State
    Node->>Contracts: Request stateful precompiled contract
    Contracts->>State: Validate contract state
    State-->>Contracts: Return validation result
    Contracts-->>Node: Provide contract interaction result
Loading

Assessment against linked issues

Objective Addressed Explanation
Import the zeta-chain/ethermint release supporting stateful precompiles ( #2511 )
Integration with existing node code ( #2511 )
Cleanup go.mod ( #2511 )
No precompiled contracts should be initialized with the app ( #2511 ) The implementation does not specifically address initialization logic.
Import zeta-chain/go-ethereum release supporting stateful precompiles ( #2511 ) Unclear if the relevant code for Ethereum integration has been included.

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.

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.

@fbac fbac changed the title [WIP] feat: add stateful precompiles support feat: add stateful precompiles support Aug 5, 2024
@fbac fbac force-pushed the feat/stateful-precompiled-contracts branch from e799619 to 4ca59cb Compare August 5, 2024 14:04
@fbac fbac changed the title feat: add stateful precompiles support feat!: add stateful precompiles support Aug 5, 2024
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

Don't see particular issue so far

app/app.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 73.97260% with 38 lines in your changes missing coverage. Please review.

Project coverage is 66.83%. Comparing base (42eb4bd) to head (fffd126).
Report is 1 commits behind head on develop.

Files Patch % Lines
precompiles/prototype/prototype.go 69.35% 33 Missing and 5 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2633      +/-   ##
===========================================
+ Coverage    66.78%   66.83%   +0.05%     
===========================================
  Files          364      368       +4     
  Lines        20516    20662     +146     
===========================================
+ Hits         13702    13810     +108     
- Misses        6186     6219      +33     
- Partials       628      633       +5     
Files Coverage Δ
pkg/mempool/senders_with_nonce.go 87.50% <ø> (ø)
precompiles/precompiles.go 100.00% <100.00%> (ø)
precompiles/types/errors.go 100.00% <100.00%> (ø)
precompiles/types/types.go 100.00% <100.00%> (ø)
x/crosschain/keeper/evm_deposit.go 86.95% <ø> (ø)
x/crosschain/keeper/evm_hooks.go 84.42% <ø> (ø)
x/fungible/keeper/deposits.go 95.74% <ø> (ø)
x/fungible/keeper/evm.go 88.38% <ø> (ø)
x/fungible/keeper/evm_hooks.go 100.00% <ø> (ø)
x/fungible/keeper/v2_deposits.go 21.73% <ø> (ø)
... and 6 more

@fbac fbac changed the title feat!: add stateful precompiles support feat: add stateful precompiles support Aug 8, 2024
@fbac fbac marked this pull request as ready for review August 8, 2024 10:58
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.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (9)
readme.md (2)

42-42: Correct verb agreement.

The verb "match" does not agree with the singular subject "version." Consider using "matches."

- Verify that the version of the binaries match the release tag.
+ Verify that the version of the binaries matches the release tag.
Tools
LanguageTool

[uncategorized] ~42-~42: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...Verify that the version of the binaries match the release tag. ``` zetacored version...

(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)


33-33: Specify language for code block.

Consider specifying a language for the code block to improve readability and syntax highlighting.

- ```
+ ```bash
Tools
Markdownlint

33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

x/crosschain/types/expected_keepers.go (1)

11-11: Import Path Issue: Verify or Correct the Import Path for evmtypes

The import path "github.com/zeta-chain/ethermint/x/evm/types" for evmtypes does not exist in the current repository. This discrepancy suggests that the import path may be incorrect or the package is missing. Please review the import path to ensure it is correct and that the necessary package is available in the codebase.

  • Verify the existence and correctness of the import path for evmtypes.
  • Ensure that the package is correctly integrated into the codebase.
Analysis chain

Verify the correctness of the import change.

The import path for evmtypes has been updated. Ensure that this package is compatible and that its usage in the code remains correct.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new import path for `evmtypes` is correct and used appropriately.

# Test: Search for the usage of `evmtypes` in the codebase.
rg --type go --word-regexp --fixed-strings 'evmtypes.'

Length of output: 160


Script:

#!/bin/bash
# Verify the definition of `evmtypes` in the new import path.
ast-grep --lang go --pattern 'package evmtypes' -- 'github.com/zeta-chain/ethermint/x/evm/types'

# Check the usage of `evmtypes` in `rpc/backend/call_tx.go` for compatibility.
rg --type go --context 5 --word-regexp --fixed-strings 'evmtypes.' rpc/backend/call_tx.go

Length of output: 645

testutil/keeper/fungible.go (2)

8-11: Consider organizing imports.

The import statements could be grouped by standard library, third-party, and local packages for better readability.


95-99: Potential Issue with authorityKeeper Initialization

The authoritytypes.StoreKey does not appear to be explicitly initialized in the keys setup within app/app.go. This might lead to improper initialization of the authorityKeeper. Please verify that authoritytypes.StoreKey is correctly configured in the keys and memKeys initializations to ensure proper functionality.

  • Check the initialization of keys in app/app.go to include authoritytypes.StoreKey.
  • Ensure memKeys setup includes necessary configurations for authorityKeeper.
Analysis chain

Ensure proper initialization of authorityKeeper.

The initialization of authorityKeeper with specific keys improves modularity. Ensure that these keys are correctly configured elsewhere in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the configuration of keys for `authorityKeeper`.

# Test: Ensure keys are correctly initialized and used.
rg --type go 'authoritytypes.StoreKey'

Length of output: 297


Script:

#!/bin/bash
# Description: Check the initialization and usage of `keys` and `memKeys` in `app/app.go`.

# Search for the initialization of `keys` in `app/app.go`.
rg --type go 'keys\s*:=\s*' -A 5 app/app.go

# Search for the initialization of `memKeys` in `app/app.go`.
rg --type go 'memKeys\s*:=\s*' -A 5 app/app.go

Length of output: 554

x/crosschain/keeper/evm_hooks.go (1)

Line range hint 56-56: Reminder: Implement unit tests.

The TODO comment indicates that unit tests for ProcessLogs are missing. Implementing these tests is crucial for ensuring the reliability and correctness of the log processing logic.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

rpc/namespaces/ethereum/eth/api.go (1)

26-27: Import Paths Verification: Issues Found

The import paths github.com/zeta-chain/ethermint/types and github.com/zeta-chain/ethermint/x/evm/types are extensively referenced throughout the codebase. However, attempts to locate corresponding directories or files failed, indicating that these paths might not exist within the repository.

  • Potential Issues: The absence of these directories suggests that the import paths could be incorrect or the repository structure might have changed.
  • Affected Files: The paths are used in multiple files, including rpc/namespaces/ethereum/eth/api.go, rpc/backend/chain_info.go, and many others.

Action Required:

  • Verify the existence of these paths in the repository or update the import paths to reflect the correct structure.
  • Ensure that any changes align with the project's objectives and dependencies.
Analysis chain

Verify the correctness of import paths.

The import paths have been updated to point to the zeta-chain repository. Ensure that these paths are correct and align with the project's objectives.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new import paths are valid and exist in the repository.

# Test: Search for the existence of the new import paths in the repository.
rg --files-with-matches "github.com/zeta-chain/ethermint/types" "github.com/zeta-chain/ethermint/x/evm/types"

Length of output: 191


Script:

#!/bin/bash
# Description: Verify the existence of directories corresponding to the import paths in the repository.

# Search for the 'ethermint/types' and 'ethermint/x/evm/types' directories within the repository.
fd 'types' --glob 'ethermint/types' --glob 'ethermint/x/evm/types' --full-path

Length of output: 245


Script:

#!/bin/bash
# Description: Search for any references to the import paths within the repository.

# Search for references to 'github.com/zeta-chain/ethermint/types' and 'github.com/zeta-chain/ethermint/x/evm/types' in the repository.
rg "github.com/zeta-chain/ethermint/types" -A 3
rg "github.com/zeta-chain/ethermint/x/evm/types" -A 3

Length of output: 26129

testutil/keeper/keeper.go (1)

Potential Compatibility Issue with NewContext Function Signature Change

The NewContext function now requires an sdk.MultiStore, but in testutil/keeper/ibccrosschain.go, stateStore is initialized using store.NewCommitMultiStore. This might not be compatible with the updated function signature. Consider reviewing and potentially refactoring this initialization to ensure compatibility with sdk.MultiStore.

  • File to Review: testutil/keeper/ibccrosschain.go
Analysis chain

Line range hint 75-88: Ensure compatibility with function signature changes.

The NewContext function now takes a sdk.MultiStore instead of sdk.CommitMultiStore. Verify that this change is compatible with the rest of the codebase and does not introduce any issues.


To ensure compatibility with the function signature change, I will check the initialization and usage of stateStore in each file where NewContext is used. This will help confirm that sdk.MultiStore is appropriately handled.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the `NewContext` function signature change.

# Test: Search for the usage of `NewContext` function in the repository.
rg --type go --pcre2 'NewContext\('

Length of output: 1667


Script:

#!/bin/bash
# Check how `stateStore` is initialized and used in files where `NewContext` is called.

# Find the initialization of `stateStore` in relevant files.
rg --type go --pcre2 'stateStore\s*:=' testutil/keeper/authority.go testutil/keeper/emissions.go testutil/keeper/lightclient.go testutil/keeper/observer.go testutil/keeper/ibccrosschain.go testutil/keeper/fungible.go

Length of output: 731

app/app.go (1)

563-572: Refactor key management into a sub-function.

Consider refactoring the key management logic into a separate sub-function to improve readability and maintainability.

func gatherAllKeys(keys map[string]storetypes.StoreKey, tkeys map[string]storetypes.StoreKey, memKeys map[string]storetypes.StoreKey) map[string]storetypes.StoreKey {
	allKeys := make(map[string]storetypes.StoreKey, len(keys)+len(tkeys)+len(memKeys))
	for k, v := range keys {
		allKeys[k] = v
	}
	for k, v := range tkeys {
		allKeys[k] = v
	}
	for k, v := range memKeys {
		allKeys[k] = v
	}
	return allKeys
}
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f78ff55 and ac03a5d.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (107)
  • Makefile (7 hunks)
  • app/ante/ante.go (1 hunks)
  • app/ante/fees.go (2 hunks)
  • app/ante/handler_options.go (2 hunks)
  • app/ante/interfaces.go (3 hunks)
  • app/app.go (5 hunks)
  • app/encoding.go (1 hunks)
  • app/init_genesis.go (1 hunks)
  • app/prefix.go (1 hunks)
  • changelog.md (1 hunks)
  • cmd/zetacored/add_observer_list.go (1 hunks)
  • cmd/zetacored/config/config.go (1 hunks)
  • cmd/zetacored/genaccounts.go (1 hunks)
  • cmd/zetacored/parse_genesis.go (1 hunks)
  • cmd/zetacored/root.go (5 hunks)
  • e2e/contracts/contextapp/bindings.go (1 hunks)
  • e2e/txserver/zeta_tx_server.go (1 hunks)
  • go.mod (7 hunks)
  • pkg/mempool/custom_proposal_handler_test.go (1 hunks)
  • pkg/mempool/mempool_test.go (1 hunks)
  • pkg/mempool/senders_with_nonce.go (1 hunks)
  • readme.md (3 hunks)
  • rpc/apis.go (1 hunks)
  • rpc/backend/account_info.go (2 hunks)
  • rpc/backend/account_info_test.go (1 hunks)
  • rpc/backend/backend.go (2 hunks)
  • rpc/backend/backend_suite_test.go (1 hunks)
  • rpc/backend/blocks.go (2 hunks)
  • rpc/backend/blocks_test.go (1 hunks)
  • rpc/backend/call_tx.go (3 hunks)
  • rpc/backend/call_tx_test.go (1 hunks)
  • rpc/backend/chain_info.go (2 hunks)
  • rpc/backend/chain_info_test.go (1 hunks)
  • rpc/backend/client_test.go (1 hunks)
  • rpc/backend/evm_query_client_test.go (1 hunks)
  • rpc/backend/feemarket_query_client_test.go (1 hunks)
  • rpc/backend/filters.go (1 hunks)
  • rpc/backend/filters_test.go (1 hunks)
  • rpc/backend/mocks/evm_query_client.go (1 hunks)
  • rpc/backend/mocks/feemarket_query_client.go (1 hunks)
  • rpc/backend/node_info.go (2 hunks)
  • rpc/backend/node_info_test.go (1 hunks)
  • rpc/backend/sign_tx.go (2 hunks)
  • rpc/backend/sign_tx_test.go (1 hunks)
  • rpc/backend/tracing.go (2 hunks)
  • rpc/backend/tracing_test.go (1 hunks)
  • rpc/backend/tx_info.go (2 hunks)
  • rpc/backend/tx_info_test.go (1 hunks)
  • rpc/backend/utils.go (2 hunks)
  • rpc/ethereum/pubsub/pubsub.go (1 hunks)
  • rpc/namespaces/ethereum/debug/api.go (2 hunks)
  • rpc/namespaces/ethereum/debug/utils.go (1 hunks)
  • rpc/namespaces/ethereum/eth/api.go (2 hunks)
  • rpc/namespaces/ethereum/eth/filters/api.go (2 hunks)
  • rpc/namespaces/ethereum/eth/filters/filter_system.go (2 hunks)
  • rpc/namespaces/ethereum/eth/filters/filters.go (1 hunks)
  • rpc/namespaces/ethereum/eth/filters/subscription.go (1 hunks)
  • rpc/namespaces/ethereum/eth/filters/utils.go (1 hunks)
  • rpc/namespaces/ethereum/miner/api.go (1 hunks)
  • rpc/namespaces/ethereum/miner/unsupported.go (1 hunks)
  • rpc/namespaces/ethereum/net/api.go (2 hunks)
  • rpc/namespaces/ethereum/personal/api.go (2 hunks)
  • rpc/namespaces/ethereum/txpool/api.go (2 hunks)
  • rpc/namespaces/ethereum/web3/api.go (1 hunks)
  • rpc/types/addrlock.go (1 hunks)
  • rpc/types/block.go (2 hunks)
  • rpc/types/events.go (3 hunks)
  • rpc/types/events_test.go (1 hunks)
  • rpc/types/query_client.go (2 hunks)
  • rpc/types/types.go (1 hunks)
  • rpc/types/utils.go (2 hunks)
  • rpc/websockets.go (2 hunks)
  • scripts/protoc-gen-openapi.sh (1 hunks)
  • server/config/config.go (1 hunks)
  • server/config/toml.go (1 hunks)
  • server/flags/flags.go (1 hunks)
  • server/indexer_cmd.go (2 hunks)
  • server/indexer_service.go (2 hunks)
  • server/json_rpc.go (2 hunks)
  • server/start.go (2 hunks)
  • server/util.go (1 hunks)
  • testutil/keeper/authority.go (3 hunks)
  • testutil/keeper/codec.go (2 hunks)
  • testutil/keeper/config.go (2 hunks)
  • testutil/keeper/crosschain.go (5 hunks)
  • testutil/keeper/emissions.go (3 hunks)
  • testutil/keeper/fungible.go (6 hunks)
  • testutil/keeper/ibccrosschain.go (2 hunks)
  • testutil/keeper/keeper.go (7 hunks)
  • testutil/keeper/lightclient.go (3 hunks)
  • testutil/keeper/mocks/crosschain/fungible.go (1 hunks)
  • testutil/keeper/mocks/fungible/evm.go (1 hunks)
  • testutil/keeper/observer.go (4 hunks)
  • testutil/network/genesis_state.go (1 hunks)
  • testutil/network/network_setup.go (2 hunks)
  • x/crosschain/client/querytests/suite.go (2 hunks)
  • x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go (1 hunks)
  • x/crosschain/keeper/evm_deposit.go (1 hunks)
  • x/crosschain/keeper/evm_deposit_test.go (1 hunks)
  • x/crosschain/keeper/evm_hooks.go (1 hunks)
  • x/crosschain/keeper/msg_server_vote_inbound_tx_test.go (1 hunks)
  • x/crosschain/keeper/utils_test.go (1 hunks)
  • x/crosschain/types/expected_keepers.go (1 hunks)
  • x/fungible/keeper/deposits.go (1 hunks)
  • x/fungible/keeper/evm.go (1 hunks)
  • x/fungible/keeper/evm_hooks.go (1 hunks)
  • x/fungible/keeper/evm_test.go (1 hunks)
Files not processed due to max files limit (15)
  • x/fungible/keeper/gas_coin_and_pool_test.go
  • x/fungible/keeper/msg_server_deploy_system_contract_test.go
  • x/fungible/keeper/msg_server_update_contract_bytecode_test.go
  • x/fungible/keeper/msg_server_update_system_contract_test.go
  • x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go
  • x/fungible/keeper/zevm_message_passing_test.go
  • x/fungible/keeper/zevm_msg_passing.go
  • x/fungible/types/evm.go
  • x/fungible/types/evm_test.go
  • x/fungible/types/expected_keepers.go
  • x/observer/client/querytests/suite.go
  • zetaclient/zetacore/broadcast_test.go
  • zetaclient/zetacore/client.go
  • zetaclient/zetacore/client_query_ethermint.go
  • zetaclient/zetacore/client_query_test.go
Files skipped from review due to trivial changes (72)
  • app/ante/ante.go
  • app/ante/fees.go
  • app/ante/handler_options.go
  • app/prefix.go
  • cmd/zetacored/add_observer_list.go
  • cmd/zetacored/config/config.go
  • cmd/zetacored/parse_genesis.go
  • e2e/txserver/zeta_tx_server.go
  • pkg/mempool/custom_proposal_handler_test.go
  • pkg/mempool/mempool_test.go
  • pkg/mempool/senders_with_nonce.go
  • rpc/backend/account_info.go
  • rpc/backend/account_info_test.go
  • rpc/backend/backend.go
  • rpc/backend/blocks.go
  • rpc/backend/call_tx.go
  • rpc/backend/call_tx_test.go
  • rpc/backend/chain_info.go
  • rpc/backend/chain_info_test.go
  • rpc/backend/client_test.go
  • rpc/backend/feemarket_query_client_test.go
  • rpc/backend/filters.go
  • rpc/backend/node_info.go
  • rpc/backend/node_info_test.go
  • rpc/backend/sign_tx.go
  • rpc/backend/sign_tx_test.go
  • rpc/backend/tracing_test.go
  • rpc/backend/tx_info.go
  • rpc/backend/tx_info_test.go
  • rpc/backend/utils.go
  • rpc/ethereum/pubsub/pubsub.go
  • rpc/namespaces/ethereum/debug/api.go
  • rpc/namespaces/ethereum/debug/utils.go
  • rpc/namespaces/ethereum/eth/filters/api.go
  • rpc/namespaces/ethereum/eth/filters/filter_system.go
  • rpc/namespaces/ethereum/eth/filters/filters.go
  • rpc/namespaces/ethereum/eth/filters/subscription.go
  • rpc/namespaces/ethereum/eth/filters/utils.go
  • rpc/namespaces/ethereum/miner/api.go
  • rpc/namespaces/ethereum/miner/unsupported.go
  • rpc/namespaces/ethereum/net/api.go
  • rpc/namespaces/ethereum/personal/api.go
  • rpc/namespaces/ethereum/txpool/api.go
  • rpc/namespaces/ethereum/web3/api.go
  • rpc/types/addrlock.go
  • rpc/types/block.go
  • rpc/types/events.go
  • rpc/types/query_client.go
  • rpc/types/types.go
  • rpc/types/utils.go
  • rpc/websockets.go
  • server/config/config.go
  • server/config/toml.go
  • server/flags/flags.go
  • server/indexer_cmd.go
  • server/indexer_service.go
  • server/json_rpc.go
  • server/start.go
  • server/util.go
  • testutil/keeper/mocks/crosschain/fungible.go
  • testutil/keeper/mocks/fungible/evm.go
  • testutil/network/genesis_state.go
  • testutil/network/network_setup.go
  • x/crosschain/client/querytests/suite.go
  • x/crosschain/keeper/cctx_orchestrator_validate_outbound_test.go
  • x/crosschain/keeper/evm_deposit.go
  • x/crosschain/keeper/evm_deposit_test.go
  • x/crosschain/keeper/msg_server_vote_inbound_tx_test.go
  • x/fungible/keeper/deposits.go
  • x/fungible/keeper/evm.go
  • x/fungible/keeper/evm_hooks.go
  • x/fungible/keeper/evm_test.go
Additional context used
Path-based instructions (31)
app/encoding.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

e2e/contracts/contextapp/bindings.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/codec.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

app/ante/interfaces.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

app/init_genesis.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/filters_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/authority.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

scripts/protoc-gen-openapi.sh (1)

Pattern **/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

testutil/keeper/lightclient.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/mocks/feemarket_query_client.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/emissions.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/config.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/ibccrosschain.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/tracing.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

x/crosschain/keeper/utils_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/apis.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/observer.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

cmd/zetacored/genaccounts.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/backend_suite_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

x/crosschain/types/expected_keepers.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/fungible.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

cmd/zetacored/root.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/types/events_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/mocks/evm_query_client.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

x/crosschain/keeper/evm_hooks.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/evm_query_client_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/crosschain.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/namespaces/ethereum/eth/api.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

testutil/keeper/keeper.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

app/app.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

rpc/backend/blocks_test.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

LanguageTool
readme.md

[uncategorized] ~42-~42: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...Verify that the version of the binaries match the release tag. ``` zetacored version...

(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)

Markdownlint
readme.md

33-33: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Additional comments not posted (100)
app/encoding.go (2)

4-5: Import Path Update Approved.

The import path change to github.com/zeta-chain/ethermint/encoding and github.com/zeta-chain/ethermint/types is consistent with the PR objectives.


9-9: Verify the impact of the return type change.

The change in the return type from params.EncodingConfig to ethermint.EncodingConfig may affect other components expecting the previous type.

e2e/contracts/contextapp/bindings.go (1)

15-15: Import Path Update Approved.

The import path change to github.com/zeta-chain/ethermint/x/evm/types aligns with the transition to the zeta-chain repository.

testutil/keeper/codec.go (2)

16-17: Import Path Update Approved.

The import path change to github.com/zeta-chain/ethermint/types and github.com/zeta-chain/ethermint/x/evm/types aligns with the new dependency structure.


39-39: Interface Registration Update Approved.

The update to use ethermint.RegisterInterfaces(registry) ensures the correct interfaces are registered with the codec.

app/ante/interfaces.go (2)

27-29: Import path updates approved.

The import paths have been correctly updated to reflect the transition to the zeta-chain namespace.


44-44: Verify compatibility of return type change in NewEVM.

The return type of NewEVM has been changed from evm.EVM to *vm.EVM. Ensure that this change is compatible with all usages of NewEVM in the codebase, as it may affect memory management and performance.

app/init_genesis.go (1)

19-20: Import path updates approved.

The import paths for evmtypes and feemarkettypes have been correctly updated to reflect the transition to the zeta-chain namespace.

rpc/backend/filters_test.go (1)

9-9: Import path update approved.

The import path for evmtypes has been correctly updated to reflect the transition to the zeta-chain namespace.

testutil/keeper/authority.go (2)

50-50: LGTM: Use of log.NewNopLogger().

The use of log.NewNopLogger() is appropriate for testing purposes, as it avoids unnecessary logging output.


32-33: Consider implications of using nil for store initialization.

Using nil for the database parameter in MountStoreWithDB allows flexibility but ensure that this aligns with the intended use case and does not introduce unintended side effects.

scripts/protoc-gen-openapi.sh (1)

8-8: LGTM: Update of ETHERMINT repository reference.

The change to point ETHERMINT to github.com/zeta-chain/ethermint aligns with the PR objectives and ensures consistency with the updated project structure.

testutil/keeper/lightclient.go (2)

55-58: LGTM! But verify the impact of using a logger.

The use of rootmulti.NewStore with a logger is a positive change for debugging. Ensure this does not alter the intended functionality of the store.

Verification successful

Impact of Using log.NewNopLogger() with rootmulti.NewStore Verified

The use of log.NewNopLogger() with rootmulti.NewStore across multiple files indicates a consistent approach to disabling logging during tests. This ensures no functional changes are introduced by logging.

  • The change is present in:
    • testutil/keeper/observer.go
    • testutil/keeper/fungible.go
    • testutil/keeper/lightclient.go
    • testutil/keeper/emissions.go
    • testutil/keeper/authority.go

This approach is suitable for maintaining clean test outputs without affecting the core functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of using a logger with `rootmulti.NewStore`.

# Test: Check for any logging-related changes in behavior. Expect: No functional changes.
rg --type go 'rootmulti.NewStore\(.*log.NewNopLogger\(\)\)'

Length of output: 496


39-40: Verify store initialization with nil.

The removal of the db parameter in MountStoreWithDB calls simplifies the code. Ensure that the stores are correctly initialized and can handle nil without issues.

rpc/backend/mocks/feemarket_query_client.go (1)

12-12: Verify the new import path for types.

The import path has been updated to zeta-chain. Ensure that this new path is correct and that all dependencies are compatible.

testutil/keeper/emissions.go (3)

41-41: Verify stateStore initialization with a logger.

The use of rootmulti.NewStore with a logger is beneficial for debugging. Ensure that this change does not affect the intended functionality of stateStore.

Verification successful

No Impact on stateStore Functionality with NopLogger

The initialization of stateStore using rootmulti.NewStore with log.NewNopLogger() across multiple files does not affect its functionality. The use of a no-operation logger is consistent and does not introduce any dependencies or changes in behavior related to logging. The intended functionality remains intact.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of using a logger with `rootmulti.NewStore` for `stateStore`.

# Test: Check for any logging-related changes in behavior. Expect: No functional changes.
rg --type go 'rootmulti.NewStore\(.*log.NewNopLogger\(\)\)'

Length of output: 496


Script:

#!/bin/bash
# Description: Search for references to `stateStore` that might indicate reliance on logging behavior.

# Find all references to `stateStore` in the Go codebase to check for dependencies on logging behavior.
rg --type go 'stateStore'

Length of output: 4845


47-47: Verify the removal of db parameter in initAuthorityKeeper.

Ensure that the removal of the db parameter from initAuthorityKeeper does not affect its functionality.

Verification successful

Verification of db Parameter Removal in initAuthorityKeeper

The initAuthorityKeeper function, as defined in testutil/keeper/authority.go, no longer includes a db parameter. It currently takes cdc and ss as parameters, which aligns with the updated calls across the codebase. The function mounts stores with nil as the third argument, indicating that the db parameter is no longer necessary.

  • Function Definition: testutil/keeper/authority.go
    • Parameters: cdc codec.Codec, ss store.CommitMultiStore

The removal of the db parameter does not appear to affect the functionality, as the necessary store operations are handled with the current parameters.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing the `db` parameter from `initAuthorityKeeper`.

# Test: Check for any issues related to the removal of `db` parameter. Expect: No issues.
rg --type go 'initAuthorityKeeper\(.*stateStore\)'

Length of output: 407


Script:

#!/bin/bash
# Search for the definition of the `initAuthorityKeeper` function to verify its parameters.
ast-grep --lang go --pattern 'func initAuthorityKeeper($_, $_) { $$$ }'

Length of output: 73


Script:

#!/bin/bash
# Use ripgrep to search for the definition of the `initAuthorityKeeper` function in Go files.
rg --type go 'func initAuthorityKeeper'

Length of output: 96


Script:

#!/bin/bash
# Extract more lines around the definition of `initAuthorityKeeper` to verify its parameters and implementation.
rg --type go 'func initAuthorityKeeper' -A 10

Length of output: 720


56-56: Verify the removal of db parameter in initLightclientKeeper.

Ensure that the removal of the db parameter from initLightclientKeeper does not affect its functionality.

Verification successful

Removal of db Parameter in initLightclientKeeper Verified

The initLightclientKeeper function has been successfully refactored to remove the db parameter. The use of nil in ss.MountStoreWithDB indicates that the database parameter was not essential for the function's current operations. The function continues to initialize the keeper correctly without any apparent issues.

  • Function definition and logic are consistent with the removal of the db parameter.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing the `db` parameter from `initLightclientKeeper`.

# Test: Check for any issues related to the removal of `db` parameter. Expect: No issues.
rg --type go 'initLightclientKeeper\(.*stateStore,.*authorityKeeper\)'

Length of output: 271


Script:

#!/bin/bash
# Search for the definition of the `initLightclientKeeper` function to verify its parameters and implementation.
ast-grep --lang go --pattern 'func initLightclientKeeper($_, $_, $_) { $$$ }'

Length of output: 79


Script:

#!/bin/bash
# Search for the definition of the `initLightclientKeeper` function to verify its parameters and implementation.
rg --type go 'func initLightclientKeeper'

Length of output: 102


Script:

#!/bin/bash
# Extract the full definition and implementation of the `initLightclientKeeper` function.
rg --type go -A 20 'func initLightclientKeeper' testutil/keeper/lightclient.go

Length of output: 893

testutil/keeper/config.go (1)

55-102: Ensure StoreKeys function handles all key types correctly.

The StoreKeys function aggregates various store keys into maps. Ensure that all necessary store keys are included and that the function is used correctly within the application. Consider adding comments to clarify the purpose of each key type if not already documented elsewhere.

testutil/keeper/ibccrosschain.go (1)

72-73: Confirm removal of db parameter does not affect functionality.

The db parameter has been removed from several function calls. Verify that these functions no longer require the database parameter and that their functionality remains intact.

Verification successful

Removal of db Parameter is Valid and Maintains Functionality

The initAuthorityKeeper and initLightclientKeeper functions have been successfully refactored to remove the db parameter. They now utilize store.CommitMultiStore, which abstracts the database interactions, ensuring that the functionality remains intact.

  • initAuthorityKeeper is defined in testutil/keeper/authority.go.
  • initLightclientKeeper is defined in testutil/keeper/lightclient.go.

The change is consistent with the intended design and does not impact the maintainability or functionality of the code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization functions to ensure they no longer require the `db` parameter.

# Test: Search for the `initAuthorityKeeper` and `initLightclientKeeper` function definitions to confirm the parameter change.
ast-grep --lang go --pattern 'func initAuthorityKeeper($_, $_) $_'
ast-grep --lang go --pattern 'func initLightclientKeeper($_, $_, $_) $_'

Length of output: 1897

rpc/backend/tracing.go (1)

26-26: Verify the new import path for evmtypes.

The import path for evmtypes has been updated to github.com/zeta-chain/ethermint/x/evm/types. Ensure that this change is intentional and that the new path is correct and compatible with the existing code.

Verification successful

Confirm the import path for evmtypes.

The import path github.com/zeta-chain/ethermint/x/evm/types is used consistently across the codebase, suggesting it is the correct path. Ensure that the repository is accessible and contains the expected package structure.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new import path for `evmtypes`.

# Test: Check if the new import path exists in the repository.
rg --type go 'github.com/zeta-chain/ethermint/x/evm/types'

Length of output: 6077

x/crosschain/keeper/utils_test.go (1)

12-12: Import Path Update Approved.

The import path for evmkeeper has been updated to github.com/zeta-chain/ethermint/x/evm/keeper. This change aligns with the project's migration to the Zeta Chain repository.

rpc/apis.go (1)

25-25: Import Path Update Approved.

The import path for ethermint has been updated to github.com/zeta-chain/ethermint/types. This change is consistent with the migration to the Zeta Chain repository.

testutil/keeper/observer.go (1)

7-10: Initialization Logic Simplification Approved.

The removal of the db parameter and the use of nil in MountStoreWithDB enhance the modularity and simplify the initialization process. The integration of logging capabilities improves observability, making the codebase more maintainable.

Also applies to: 54-55, 79-89

cmd/zetacored/genaccounts.go (1)

19-20: Verify the correctness of the import changes.

The import paths for ethermint and evmtypes have been updated. Ensure that these packages are compatible and that their usage in the code remains correct.

Verification successful

Confirm Usage and Compatibility of Updated Imports

The updated import paths for ethermint and evmtypes are indeed used in the codebase. Here are the relevant usages:

  • ethermint:

    • Found in rpc/namespaces/ethereum/personal/api.go, indicating its use in the context of personal account management.
  • evmtypes:

    • Found in rpc/backend/call_tx.go, used for performing simulated call operations.

These findings suggest that the imports are correctly integrated into the codebase. Ensure that these usages are compatible with any changes in the imported packages' APIs.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new import paths are correct and used appropriately.

# Test: Search for the usage of `ethermint` and `evmtypes` in the codebase.
rg --type go --word-regexp --fixed-strings 'ethermint.' 'evmtypes.'

Length of output: 115


Script:

#!/bin/bash
# Description: Correctly verify the usage of `ethermint` and `evmtypes` in the codebase.

# Test: Search for the usage of `ethermint` and `evmtypes` in the codebase.
rg --type go --word-regexp 'ethermint\.' -A 3
rg --type go --word-regexp 'evmtypes\.' -A 3

Length of output: 849

rpc/backend/backend_suite_test.go (1)

20-26: Verify the correctness of the import changes.

The import paths for various packages have been updated. Ensure that these packages are compatible and that their usage in the code remains correct.

Verification successful

Import Paths and Usage Verified

The new import paths for the packages have been correctly updated and are used appropriately throughout the codebase. The following observations confirm their usage:

  • app: Extensively used in various modules for configuration, encoding, and application setup.
  • ethsecp256k1: Utilized for cryptographic operations, such as key generation and encryption.
  • hd: Applied in keyring options and key generation.
  • encoding: Employed for encoding configurations and codec operations.
  • indexer: Used for creating indexers and indexing operations.
  • tests: Used for generating test addresses and keys.

No discrepancies were found in the import paths or their usage. The codebase reflects the correct integration of these packages.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new import paths are correct and used appropriately.

# Test: Search for the usage of `app`, `ethsecp256k1`, `hd`, `encoding`, `indexer`, and `tests` in the codebase.
rg --type go --word-regexp --fixed-strings 'app.' 'ethsecp256k1.' 'hd.' 'encoding.' 'indexer.' 'tests.'

Length of output: 337


Script:

#!/bin/bash
# Correcting the syntax error and refining the search for import statements and usage.

# Search for the import statements of the specified packages.
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/app"'
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/crypto/ethsecp256k1"'
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/crypto/hd"'
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/encoding"'
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/indexer"'
ast-grep --lang go --pattern 'import $_ "github.com/zeta-chain/ethermint/tests"'

# Search for the usage of these packages in the codebase.
rg --type go 'app\.' -A 3
rg --type go 'ethsecp256k1\.' -A 3
rg --type go 'hd\.' -A 3
rg --type go 'encoding\.' -A 3
rg --type go 'indexer\.' -A 3
rg --type go 'tests\.' -A 3

Length of output: 109891

testutil/keeper/fungible.go (3)

88-88: Use of log.NewNopLogger() is appropriate for testing.

The use of log.NewNopLogger() is a good choice for testing as it avoids cluttering the output with log messages.


131-139: Dynamic store mounting enhances scalability.

The use of loops to dynamically mount stores based on keys improves scalability and maintainability.


64-65: Verify the impact of using nil for DB in MountStoreWithDB.

The change to use nil instead of db in MountStoreWithDB calls should be verified to ensure it doesn't affect the functionality or performance.

cmd/zetacored/root.go (4)

32-34: Updated import paths align with new repository structure.

The changes to import paths reflect a transition to the zeta-chain repository, which is consistent with the PR objectives.


48-48: Update to NewRootCmd signature improves consistency.

The change from appparams.EncodingConfig to types.EncodingConfig is consistent with the refactoring of encoding configuration.


122-122: Refactoring of initRootCmd enhances compatibility.

The function now uses types.EncodingConfig, which aligns with the overall refactoring efforts.


239-239: Update to appCreator struct improves consistency.

The change to use types.EncodingConfig ensures consistency across the codebase.

rpc/types/events_test.go (1)

10-10: Import path update aligns with repository transition.

The change to the import path for evmtypes reflects the shift to the zeta-chain repository and is consistent with the PR objectives.

rpc/backend/mocks/evm_query_client.go (1)

12-12: Import path update approved.

The import path change from github.com/evmos/ethermint/x/evm/types to github.com/zeta-chain/ethermint/x/evm/types is consistent with the PR objectives and does not affect the mock functionality.

x/crosschain/keeper/evm_hooks.go (1)

17-17: Import path update approved.

The import path change from github.com/evmos/ethermint/x/evm/types to github.com/zeta-chain/ethermint/x/evm/types is consistent with the PR objectives.

rpc/backend/evm_query_client_test.go (1)

17-18: Import path updates approved.

The import path changes from github.com/evmos/ethermint/tests to github.com/zeta-chain/ethermint/tests and from github.com/evmos/ethermint/x/evm/types to github.com/zeta-chain/ethermint/x/evm/types are consistent with the PR objectives and ensure alignment with the updated dependencies.

Makefile (6)

3-3: LGTM: Correct package name declaration.

The PACKAGE_NAME is correctly set to github.com/zeta-chain/node.


12-12: LGTM: GOFLAGS initialization.

The GOFLAGS variable is correctly initialized as an empty string.


13-13: LGTM: Golang cross version specification.

The GOLANG_CROSS_VERSION is appropriately set to v1.22.4.


14-14: LGTM: GOPATH configuration.

The GOPATH is correctly set to the user's Go workspace.


29-29: LGTM: Test directory configuration.

The TEST_DIR is correctly set to include all subdirectories.


59-60: LGTM: Test command restructuring.

The restructuring of the test command enhances clarity.

testutil/keeper/crosschain.go (6)

8-8: LGTM: Logging import.

The import of log enhances the ability to monitor and debug operations.


11-11: LGTM: Rootmulti import.

The import of rootmulti supports a more flexible store management approach.


25-25: LGTM: Authority keeper import.

The import of authoritykeeper aligns with the refactored keeper initialization.


31-31: LGTM: Lightclient keeper import.

The import of lightclientkeeper supports modular initialization.


33-33: LGTM: Observer keeper import.

The import of observerkeeper aligns with the modular initialization.


Line range hint 98-224: LGTM: Enhanced keeper initialization and store management.

The modifications improve the flexibility, clarity, and maintainability of the CrosschainKeeperWithMocks function. However, consider addressing the TODO comment regarding the IBC router sealing to ensure completeness.

go.mod (45)

8-8: LGTM: Addition of cosmossdk.io/errors.

The addition of cosmossdk.io/errors enhances error handling capabilities.


9-9: LGTM: Addition of cosmossdk.io/math.

The addition of cosmossdk.io/math provides useful mathematical utilities.


10-10: LGTM: Addition of cosmossdk.io/tools/rosetta.

The addition of cosmossdk.io/tools/rosetta supports Rosetta API integration.


11-11: LGTM: Addition of github.com/99designs/keyring.

The addition of github.com/99designs/keyring enhances secure key storage capabilities.


12-12: LGTM: Addition of github.com/btcsuite/btcd.

The addition of github.com/btcsuite/btcd supports Bitcoin-related functionalities.


13-13: LGTM: Addition of github.com/btcsuite/btcd/btcec/v2.

The addition of github.com/btcsuite/btcd/btcec/v2 provides elliptic curve cryptography utilities.


14-14: LGTM: Addition of github.com/btcsuite/btcd/btcutil.

The addition of github.com/btcsuite/btcd/btcutil provides Bitcoin utility functions.


15-15: LGTM: Addition of github.com/btcsuite/btcd/chaincfg/chainhash.

The addition of github.com/btcsuite/btcd/chaincfg/chainhash provides utilities for Bitcoin chain configurations and hashes.


17-17: LGTM: Addition of github.com/cenkalti/backoff/v4.

The addition of github.com/cenkalti/backoff/v4 provides backoff algorithms for retry logic.


18-18: LGTM: Addition of github.com/cockroachdb/errors.

The addition of github.com/cockroachdb/errors enhances error handling and reporting capabilities.


19-19: LGTM: Addition of github.com/coinbase/rosetta-sdk-go.

The addition of github.com/coinbase/rosetta-sdk-go supports Rosetta API integration for blockchain interoperability.


20-20: LGTM: Addition of github.com/cometbft/cometbft.

The addition of github.com/cometbft/cometbft provides consensus and networking functionalities.


21-21: LGTM: Addition of github.com/cometbft/cometbft-db.

The addition of github.com/cometbft/cometbft-db supports database functionalities for the CometBFT framework.


22-22: LGTM: Addition of github.com/cosmos/btcutil.

The addition of github.com/cosmos/btcutil provides Bitcoin utility functions within the Cosmos ecosystem.


26-26: LGTM: Addition of github.com/davecgh/go-spew.

The addition of github.com/davecgh/go-spew provides utilities for printing Go data structures.


27-27: LGTM: Addition of github.com/emicklei/proto.

The addition of github.com/emicklei/proto supports protocol buffer parsing and manipulation.


29-29: LGTM: Addition of github.com/fatih/color.

The addition of github.com/fatih/color provides utilities for colorizing terminal output.


30-30: LGTM: Addition of github.com/frumioj/crypto11.

The addition of github.com/frumioj/crypto11 provides PKCS#11 cryptographic functionalities.


32-32: LGTM: Addition of github.com/golang/mock.

The addition of github.com/golang/mock provides mocking capabilities for testing.


35-35: LGTM: Addition of github.com/gorilla/websocket.

The addition of github.com/gorilla/websocket provides WebSocket protocol support.


37-37: LGTM: Addition of github.com/hashicorp/go-getter.

The addition of github.com/hashicorp/go-getter provides utilities for downloading files from various sources.


38-38: LGTM: Addition of github.com/huandu/skiplist.

The addition of github.com/huandu/skiplist provides a skip list data structure implementation.


39-39: LGTM: Addition of github.com/improbable-eng/grpc-web.

The addition of github.com/improbable-eng/grpc-web provides support for gRPC-Web protocol.


40-40: LGTM: Addition of github.com/libp2p/go-libp2p.

The addition of github.com/libp2p/go-libp2p provides peer-to-peer networking functionalities.


41-41: LGTM: Addition of github.com/libp2p/go-libp2p-kad-dht.

The addition of github.com/libp2p/go-libp2p-kad-dht provides Kademlia DHT functionalities for peer-to-peer networking.


43-43: LGTM: Addition of github.com/nanmu42/etherscan-api.

The addition of github.com/nanmu42/etherscan-api provides an interface to the Etherscan API.


44-44: LGTM: Addition of github.com/near/borsh-go.

The addition of github.com/near/borsh-go provides Borsh serialization and deserialization functionalities.


45-45: LGTM: Addition of github.com/onrik/ethrpc.

The addition of github.com/onrik/ethrpc provides Ethereum RPC client functionalities.


46-46: LGTM: Addition of github.com/pkg/errors.

The addition of github.com/pkg/errors enhances error handling capabilities.


48-48: LGTM: Addition of github.com/rakyll/statik.

The addition of github.com/rakyll/statik provides utilities for embedding static files into Go binaries.


49-49: LGTM: Addition of github.com/rs/cors.

The addition of github.com/rs/cors provides middleware for handling CORS in Go applications.


50-50: LGTM: Addition of github.com/rs/zerolog.

The addition of github.com/rs/zerolog provides structured logging capabilities.


51-51: LGTM: Addition of github.com/samber/lo.

The addition of github.com/samber/lo provides a collection of utility functions for Go.


52-52: LGTM: Addition of github.com/spf13/afero.

The addition of github.com/spf13/afero provides an abstract filesystem interface.


53-53: LGTM: Addition of github.com/spf13/cast.

The addition of github.com/spf13/cast provides utilities for casting between different data types.


54-54: LGTM: Addition of github.com/spf13/cobra.

The addition of github.com/spf13/cobra provides a library for creating powerful command-line interfaces.


55-55: LGTM: Addition of github.com/spf13/pflag.

The addition of github.com/spf13/pflag provides enhanced flag parsing capabilities for Go applications.


56-56: LGTM: Addition of github.com/spf13/viper.

The addition of github.com/spf13/viper provides configuration management capabilities for Go applications.


57-57: LGTM: Addition of github.com/stretchr/testify.

The addition of github.com/stretchr/testify provides utilities for writing unit tests in Go.


58-58: LGTM: Addition of github.com/zeta-chain/ethermint.

The addition of github.com/zeta-chain/ethermint supports Ethereum-related functionalities within the ZetaChain ecosystem.


59-59: LGTM: Addition of github.com/zeta-chain/keystone/keys.

The addition of github.com/zeta-chain/keystone/keys provides key management functionalities within the ZetaChain ecosystem.


60-60: LGTM: Addition of github.com/zeta-chain/protocol-contracts.

The addition of github.com/zeta-chain/protocol-contracts supports protocol contract functionalities within the ZetaChain ecosystem.


352-352: LGTM: Replace directive for github.com/ethereum/go-ethereum.

The replacement with a ZetaChain maintained fork aligns with specific project requirements for Ethereum functionalities.


353-353: LGTM: Replace directive for github.com/libp2p/go-libp2p.

The replacement with a ZetaChain maintained fork aligns with specific project requirements for peer-to-peer networking.


354-354: LGTM: Replace directive for gitlab.com/thorchain/tss/go-tss.

The replacement with a ZetaChain maintained fork aligns with specific project requirements for threshold signature schemes.

testutil/keeper/keeper.go (2)

396-484: Review the new function NewSDKKeepersWithKeys.

The NewSDKKeepersWithKeys function introduces a new way to instantiate SDK keepers with local storage for testing. Ensure that the function is correctly implemented and aligns with the project's testing framework.


43-48: Verify the correctness of import paths.

The import paths have been updated to point to the zeta-chain repository. Ensure that these paths are correct and align with the project's objectives.

app/app.go (2)

83-90: Verify the correctness of import paths.

The import paths have been updated to point to the zeta-chain repository. Ensure that these paths are correct and align with the project's objectives.


316-316: Ensure compatibility with function signature changes.

The New function now uses ethermint.EncodingConfig instead of appparams.EncodingConfig. Verify that this change is compatible with the rest of the codebase and does not introduce any issues.

Verification successful

No Compatibility Issues Detected with New Function Signature Change

The change in the New function signature from appparams.EncodingConfig to ethermint.EncodingConfig in app/app.go does not appear to introduce any compatibility issues within the codebase. The function is not directly referenced elsewhere in a manner that would be affected by this change.

  • The New function in app/app.go is defined with ethermint.EncodingConfig, and no direct references were found that would be impacted by this change.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of the `New` function signature change.

# Test: Search for the usage of `New` function in the repository.
rg --type go --pcre2 'New\('

Length of output: 36877


Script:

#!/bin/bash
# Locate the definition of the `New` function in `app/app.go` and analyze its usage.
ast-grep --lang go --pattern 'func New($_, $_) {' app/app.go

Length of output: 503


Script:

#!/bin/bash
# Corrected pattern to locate the definition of the `New` function in `app/app.go`.
ast-grep --lang go --pattern 'func New($_) {' app/app.go

Length of output: 495


Script:

#!/bin/bash
# Use ripgrep to search for the definition of the `New` function in `app/app.go`.
rg 'func New\(' app/app.go -A 10

Length of output: 311


Script:

#!/bin/bash
# Search for references to the `New` function throughout the repository to verify compatibility.
rg 'New\(' --type go

Length of output: 36869

changelog.md (1)

60-60: Changelog entry is well-formatted.

The addition of the entry for stateful precompiled contracts is consistent with the existing format.

rpc/backend/blocks_test.go (1)

17-18: Verify the updated import paths.

The import paths have been updated to point to the zeta-chain repository. Ensure these paths are correct and align with the new repository structure.

@fbac fbac changed the title feat: add stateful precompiles support [DO NOT MERGE] feat: add stateful precompiles support Aug 8, 2024
@fbac fbac requested a review from lumtis August 9, 2024 21:23
Copy link
Member

@gartnera gartnera left a comment

Choose a reason for hiding this comment

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

It would be nice to add a simple contract and invoke it on the e2e side to demonstrate that this actually works?

@fbac
Copy link
Contributor Author

fbac commented Aug 10, 2024

It would be nice to add a simple contract and invoke it on the e2e side to demonstrate that this actually works?

Yes, that's going to be a second PR on top of this branch. This is just the base feature.

@fbac fbac added blocked and removed blocked labels Aug 10, 2024
@skosito skosito requested a review from a team as a code owner August 26, 2024 20:49
@github-actions github-actions bot added the ci Changes to CI pipeline or github actions label Aug 26, 2024
@skosito
Copy link
Contributor

skosito commented Aug 26, 2024

Seems we need to run make generate

@lumtis for make generate to work now we need solc and abigen installed for make precompiles to work in ci, which seems like an overhead to me since it adds some time, i added it to workflow action simplest way, will try to find better way if possible, at least to hardcode solc version - do we need to generate bindings for precompiles in this action?

EDIT: i added solc-select to action and some checks to script for solc/solc-select to make it a bit more robust

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gartnera gartnera left a comment

Choose a reason for hiding this comment

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

CI stamp

@skosito skosito enabled auto-merge August 27, 2024 17:41
@skosito skosito disabled auto-merge August 27, 2024 17:43
@skosito skosito enabled auto-merge August 27, 2024 17:45
@skosito skosito added this pull request to the merge queue Aug 27, 2024
Merged via the queue into develop with commit 949cc26 Aug 27, 2024
29 checks passed
@skosito skosito deleted the feat/stateful-precompiled-contracts branch August 27, 2024 18:10
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 ci Changes to CI pipeline or github actions UPGRADE_TESTS Run make start-upgrade-tests V2_TESTS Run make start-v2-test
Projects
None yet
6 participants