sdk-go
sdk-go copied to clipboard
Feat/add exchange v2 support
- Added support for all queries and messages from the new Exchange V2.
- Applied the required updates for the chain stream
- Deprecated all methods from Exchange V1 in favor of the ones from Exchange V2.
- Updated all example scripts using Exchange V1 elements to use Exchange V2.
- Updated unit tests.
Walkthrough
This update introduces a significant refactor and expansion of the codebase, particularly in the EVM module and exchange types. The EVM module receives a comprehensive implementation of transaction, log, error, parameter, and utility types, enabling robust Ethereum compatibility. The exchange types are streamlined, with many legacy methods and types removed, new concurrency-safe limits, and improved validation and utility functions. Several deprecated message types and proposal constructors are removed, and configuration files are modernized.
Changes
| File(s) / Path(s) | Change Summary |
|---|---|
| .github/workflows/golangci-lint.yml, .golangci.yml, Makefile | Updated workflow and config versions, improved linter settings, updated Makefile targets, added lint-all target. |
| chain/crypto/ethsecp256k1/ethsecp256k1.go, chain/crypto/hd/algorithm.go | Refactored method receiver names for consistency; updated comments. |
| chain/crypto/hd/hd_path.go | New: Introduces HD wallet path constants and utilities for Ethereum. |
| chain/erc20/types/codec.go | New: Adds codec registration for ERC20 module messages and interfaces. |
| chain/evm/types/ (access_list.go, access_list_tx.go, chain_config.go, codec.go, dynamic_fee_tx.go, errors.go, eth.go, events.go, key.go, legacy_tx.go, logs.go, msg.go, params.go, storage.go, tx.go, tx_data.go, utils.go) | New: Implements a full EVM types module: transaction types, codecs, error handling, logs, params, storage, and utilities for Ethereum compatibility. |
| chain/exchange/types/authz_common.go, authz_derivative.go, authz_spot.go | Adds concurrency-safe access for authorized markets limit; updates validation logic to use accessor function. |
| chain/exchange/types/authz_exchange_generic.go | New: Adds generic exchange authorization type with spend limit checks. |
| chain/exchange/types/codec.go | Removes deprecated message types from codec registration; adds new authorization type. |
| chain/exchange/types/common_order.go | Refactors and simplifies order margin logic, adds new public methods, and exports order hash computation. |
| chain/exchange/types/common_utils.go | Removes order delta types and methods; introduces generic duplicate detection functions. |
| chain/exchange/types/deposit.go | Removes Deposit constructors and display methods. |
| chain/exchange/types/derivative_orders.go | Removes extensive business logic for derivative orders; retains only minimal test utilities and basic getters. |
| chain/exchange/types/errors.go | Updates and adds error messages and disables line-length linting. |
| chain/exchange/types/exchange.go | Removes multiple order, market, and reward types/methods; adds minimal getters and a new validation method. |
| chain/exchange/types/fee_discounts.go | Removes all fee discount schedule methods and constructors. |
| chain/exchange/types/fee_validation.go | Reformats function signatures for clarity; adds test code comment. |
| chain/exchange/types/genesis.go | Removes genesis state constructor functions. |
| chain/exchange/types/key.go | Deprecates legacy prefixes, adds new expiration prefixes, and improves price parsing. |
| chain/exchange/types/market.go | Removes all market accessor methods; adds standalone conversion utilities for price, quantity, notional. |
| chain/exchange/types/market_admin.go | Removes permission-checking methods; corrects and adds permission constants. |
| chain/exchange/types/msgs.go | Removes deprecated messages; introduces interface for spot market updates, centralizes address validation, and improves duplicate detection. |
| chain/exchange/types/msgs_validation.go | New: Adds validation function for spot market update messages. |
| chain/exchange/types/params.go | Renames and exports validation functions; removes parameter constructors and defaults. |
| chain/exchange/types/positions.go | Removes all position logic, leaving only an exported payout struct. |
| chain/exchange/types/proposal.go | Removes all proposal constructor functions; tightens margin validation. |
| auth_vote/authz_vote.go | Removes explicit websocket path from Tendermint RPC client initialization. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant ExchangeTypes
participant EVMTypes
participant CosmosSDK
User->>ExchangeTypes: Submit order / message
ExchangeTypes->>ExchangeTypes: Validate input, check limits, deduplicate
ExchangeTypes->>EVMTypes: (if EVM tx) Convert/validate Ethereum tx
EVMTypes->>CosmosSDK: Register codecs, handle tx, log, error types
CosmosSDK-->>User: Respond with tx result or error
sequenceDiagram
participant EVMTypes
participant Ethereum
participant CosmosSDK
EVMTypes->>Ethereum: Convert Cosmos tx to Ethereum tx format
Ethereum-->>EVMTypes: Return tx data, logs, errors
EVMTypes->>CosmosSDK: Register interfaces, pack/unpack Any, handle params
CosmosSDK-->>EVMTypes: Provide context for validation and execution
Poem
🐰
A hop, a skip, a code refactor,
EVM and exchange, both now sharper!
Old types retired, new paths unfurled,
With codecs and keys, a blockchain world.
Linting is modern, configs aligned,
A rabbit’s delight—such progress combined!((\
( -.-)
o_(")(")
[!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
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere 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.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
Is this stale?
Is this stale?
No, it is just work in progress, not stale