Skip to content

Conversation

@hmoragrega
Copy link
Contributor

@hmoragrega hmoragrega commented Jun 11, 2025

Summary by CodeRabbit

  • New Features

    • Introduced Ethereum Virtual Machine (EVM) transaction and log support, including Ethereum transaction message handling, validation, error reporting, event constants, and utility functions.
    • Added generic exchange authorization for message types with spend limits.
    • Improved thread safety for authorized market limits.
    • Enhanced order expiration key management and spot market update validation.
  • Bug Fixes

    • Fixed validation logic for spot and derivative orders, admin addresses, and duplicate order detection.
    • Improved error messages and validation for market and parameter updates.
  • Refactor

    • Significantly simplified and modernized order, position, market, and proposal types by removing redundant methods and legacy code.
    • Consolidated and externalized price, quantity, and notional conversion utilities.
    • Updated configuration and Makefile for better maintainability and expanded EVM module support.
  • Chores

    • Upgraded linting and configuration files for improved code quality.
    • Removed deprecated message types and proposal constructors.
    • Updated comments and naming conventions for clarity and consistency.
  • Documentation

    • Improved code comments and documentation for new and existing features.

aarmoa added 30 commits November 7, 2024 23:43
…core_and_indexer

Fix/synced dev with v1 14 core and indexer
… new CI step to run golangci-lint using the github action
…_commit_repo

Feat/remove deprecated pre commit repo
… example for the new GetEipBaseFee request in txfees module
* (fix) Applied the fixes for EIP712 JSON unmarshalling to the master branch

* fix: update pre-commit/action from v2.0.2 to v3.0.1 to ry to solve the pre-commit validation workflow error

* fix: Added configuration in .golangci.yml file to exclude some dirs

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: Added quantization in the functions that convert notional values to chain format

* fix/fix_manual_tx_generation (#296)

* fix: fixed the manual TX generation and signing to receive the gas price

* fix: solve issues in pre-commit workflow caused by using deprecated components

* fix: solve issues in pre-commit workflow caused by using deprecated components
aarmoa and others added 26 commits May 7, 2025 14:36
… endpoint (the /websocket destination is added internally now)
…w reduce margin ratio for derivative markets
…d examples for the new queries and messages.
…s (with fully qualified name) every time the proto definitions are updated
@coderabbitai
Copy link

coderabbitai bot commented Jun 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces extensive changes across the codebase, including significant refactoring, removals, and new feature additions. The EVM module receives a comprehensive implementation with new types, transaction handling, error management, and utility functions. Exchange types are streamlined by removing legacy code and redundant methods, introducing thread-safe constants, generic authorizations, and improved validation. Several configuration files and build scripts are modernized, and protobuf message extraction is automated. Many previously exported constructors and methods are removed or replaced with simplified or test-only versions.

Changes

File(s) / Area Change Summary
.github/workflows/golangci-lint.yml, .golangci.yml Updated lint workflow and configuration to use newer versions, fixed tool version, and modernized settings.
Makefile Refactored: removed indexer dependency, updated core version, expanded chain types copying, automated message extraction, added new lint target.
auth_vote/authz_vote.go, chain/crypto/ethsecp256k1/ethsecp256k1.go, chain/crypto/hd/algorithm.go Minor refactoring: receiver simplification, comment updates, argument changes.
chain/crypto/hd/hd_path.go New: HD wallet path utilities and iterator for Ethereum.
chain/erc20/types/codec.go New: ERC20 module codec registration and interface setup.
chain/evm/types/ (multiple new files) Major addition: Full EVM module type system, including transaction types, error handling, events, storage, codec, params, logs, and utilities.
chain/exchange/types/authz_common.go, authz_derivative.go, authz_spot.go Refactored: Thread-safe authorized markets limit, validation logic updated to use getter.
chain/exchange/types/authz_exchange_generic.go New: Generic exchange authorization type for message validation and spend limits.
chain/exchange/types/codec.go Refactored: Removed deprecated message registrations, added new authorization registration.
chain/exchange/types/common_order.go Refactored: Function signatures updated, new getters, hash function exported, simplified parameter for margin calculation.
chain/exchange/types/common_utils.go Refactored: Removed order delta structs and methods, added generic duplicate checkers, removed subaccount ID method.
chain/exchange/types/deposit.go Refactored: Removed deposit constructor and display methods.
chain/exchange/types/derivative_orders.go Major refactor: Removed legacy and redundant derivative order logic, consolidated accessors, simplified margin and price utilities, test-only hash/margin functions added.
chain/exchange/types/errors.go Updated: Improved error message, added new error variables, disabled line-length lint.
chain/exchange/types/exchange.go Major refactor: Removed most order methods, added access level validity check, retained only essential field accessors.
chain/exchange/types/fee_discounts.go Refactored: Removed all fee discount schedule methods, only struct/type alias remain.
chain/exchange/types/fee_validation.go Refactored: Reformatted function signatures, added test-only comment.
chain/exchange/types/genesis.go Refactored: Removed GenesisState constructors, validation remains.
chain/exchange/types/key.go Refactored: Deprecated legacy prefixes, added new expiration prefixes and key functions, improved price parsing.
chain/exchange/types/market.go Major refactor: Removed market struct methods, added standalone conversion utilities, simplified MarketType.
chain/exchange/types/market_admin.go Refactored: Removed permission checkers and empty admin info, fixed permission constants, added composite permission.
chain/exchange/types/msgs.go, msgs_validation.go Refactored: Removed deprecated messages, added spot market update interface and validation, centralized address validation, improved duplicate detection.
chain/exchange/types/params.go Refactored: Renamed all validation functions for consistency, removed default/new param functions, exported min margin ratio.
chain/exchange/types/positions.go Refactored: Removed all position methods and logic, left only exported payout struct.
chain/exchange/types/proposal.go Refactored: Removed all proposal constructor functions, cleaned up imports.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CosmosSDK
    participant EVMModule
    participant EthereumTx
    participant MsgEthereumTx
    participant ErrorHandler

    User->>CosmosSDK: Submit Ethereum-compatible transaction
    CosmosSDK->>EVMModule: Route MsgEthereumTx
    EVMModule->>EthereumTx: Parse and validate transaction
    EthereumTx-->>EVMModule: Return transaction data or error
    EVMModule->>ErrorHandler: On error, wrap and format error (VMError, RevertError)
    EVMModule-->>CosmosSDK: Return execution result or error
    CosmosSDK-->>User: Deliver transaction response
Loading

Poem

🐇
In the warren, code is hopping,
Old methods gone, new types popping.
EVM’s here with logs and keys,
Exchange is lighter, changes breeze.
Linting sharper, configs neat—
This codebase now is quite a treat!
—Rabbit 🥕

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hmoragrega hmoragrega closed this Jun 11, 2025
@hmoragrega hmoragrega deleted the f/no-exchange branch June 11, 2025 06:26
@hmoragrega hmoragrega restored the f/no-exchange branch June 11, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants