-
Notifications
You must be signed in to change notification settings - Fork 115
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
Switch connect v2 to slinky v1 #2657
Conversation
WalkthroughThis pull request represents a comprehensive migration from the Changes
Sequence DiagramsequenceDiagram
participant App as Application
participant Slinky as Slinky Module
participant MarketMap as Market Map
participant Prices as Prices Module
App->>Slinky: Initialize with new import paths
Slinky->>MarketMap: Update market types
Slinky->>Prices: Update context handling
MarketMap-->>Slinky: Confirm configuration
Prices-->>Slinky: Confirm method signatures
Slinky-->>App: Ready for deployment
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (12)
protocol/daemons/slinky/client/market_pair_fetcher.go (1)
Line range hint
77-85
: Enhance error handling for better debuggingWhile the implementation is correct, consider improving error handling:
- In
GetIDForPair
, use a more descriptive error type- In
FetchIdMappings
, wrap errors with contextConsider applying these changes:
func (m *MarketPairFetcherImpl) GetIDForPair(cp slinkytypes.CurrencyPair) (uint32, error) { var id uint32 m.compatMu.RLock() defer m.compatMu.RUnlock() id, found := m.compatMappings[cp] if !found { - return id, fmt.Errorf("pair %s not found in compatMappings", cp.String()) + return id, fmt.Errorf("market pair not found in mappings: pair=%s", cp.String()) } return id, nil } func (m *MarketPairFetcherImpl) FetchIdMappings(ctx context.Context) error { marketParams, err := daemonlib.AllPaginatedMarketParams(ctx, m.PricesQueryClient) if err != nil { - return err + return fmt.Errorf("failed to fetch market params: %w", err) } var compatMappings = make(map[slinkytypes.CurrencyPair]uint32, len(marketParams)) for _, mp := range marketParams { cp, err := slinky.MarketPairToCurrencyPair(mp.Pair) if err != nil { - return err + return fmt.Errorf("failed to convert market pair (id=%d): %w", mp.Id, err) } m.Logger.Debug("Mapped market to pair", "market id", mp.Id, "currency pair", cp.String()) compatMappings[cp] = mp.Id pricefeedmetrics.SetMarketPairForTelemetry(mp.Id, mp.Pair) } m.compatMu.Lock() defer m.compatMu.Unlock() m.compatMappings = compatMappings return nil }Also applies to: 89-109
protocol/go.mod (1)
Line range hint
459-484
: Document the replace directivesThe replace directives contain important information about dependency management decisions, but some lack proper documentation.
Consider adding comments for each replace block to explain:
- Why specific versions are chosen
- When these replacements can be removed
- Any known issues or limitations
Example format:
replace ( + // Block for slinky-related dependency upgrades + // These replacements ensure compatibility with the slinky v2 migration + // TODO: Remove once upstream dependencies are updated cosmossdk.io/x/evidence => cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/upgrade => cosmossdk.io/x/upgrade v0.1.1 ... )protocol/x/prices/keeper/slinky_adapter.go (2)
38-38
: Consider structured logging for better error trackingThe error logging could be improved by using structured logging with additional context.
-k.Logger(ctx).Error("CurrencyPairFromString", "error", err) +k.Logger(ctx).Error("failed to convert market pair to currency pair", + "error", err, + "market_pair", mp.Pair, +)
119-122
: Document the rationale for returning nilThe comment mentions this isn't used with DefaultCurrencyPair strategy, but it would be helpful to document why it returns nil and potential future implications.
-// GetAllCurrencyPairs is not used with the DefaultCurrencyPair strategy. -// See https://github.com/skip-mev/slinky/blob/main/abci/strategies/currencypair/default.go +// GetAllCurrencyPairs returns nil as this implementation uses the DefaultCurrencyPair strategy +// which doesn't require a full list of currency pairs. This method exists to satisfy the interface +// but is not functionally used. +// See: https://github.com/skip-mev/slinky/blob/main/abci/strategies/currencypair/default.go func (k Keeper) GetAllCurrencyPairs(ctx sdk.Context) []slinkytypes.CurrencyPair { return nil }protocol/docker-compose.yml (1)
119-119
: Version pinning strategy for slinky-sidecar.The slinky-sidecar image is pinned to a specific version (v1.0.13). Consider documenting the version update process and criteria for future maintenance.
Also applies to: 121-121
protocol/x/prices/keeper/market.go (1)
Line range hint
124-138
: Add validation for currency pair format.While the function correctly handles the market map lookup, consider adding validation for the currency pair format before conversion.
func (k Keeper) GetExponent(ctx sdk.Context, ticker string) (int32, error) { + if ticker == "" { + return 0, errorsmod.Wrapf( + types.ErrInvalidInput, + "ticker cannot be empty", + ) + } currencyPair, err := slinky.MarketPairToCurrencyPair(ticker)protocol/x/delaymsg/keeper/delayed_message.go (2)
Line range hint
190-195
: Consider using constant time comparison for address check.When comparing addresses, especially for security-critical operations, consider using a constant-time comparison to prevent timing attacks.
- if !bytes.Equal(signers[0], types.ModuleAddress) { + if !bytes.ConstantTimeCompare(signers[0], types.ModuleAddress) { return errorsmod.Wrapf( types.ErrInvalidSigner, "message signer must be delaymsg module address", ) }
Line range hint
198-223
: Consider caching handler lookup results.The handler lookup in ValidateMsg could be cached to improve performance for frequently validated message types.
+ // Consider adding a handler cache as a keeper field + type handlerCache map[string]sdk.Handler + func (k Keeper) ValidateMsg(msg sdk.Msg, signers [][]byte) error { + msgType := sdk.MsgTypeURL(msg) + handler, exists := k.handlerCache[msgType] + if !exists { + handler = k.router.Handler(msg) + k.handlerCache[msgType] = handler + } - handler := k.router.Handler(msg)protocol/x/listing/keeper/listing.go (1)
Line range hint
43-77
: Consider adding market validation checksThe
CreateMarket
function could benefit from additional validation checks:
- Verify the market ID doesn't already exist
- Validate the ticker format
- Add bounds checking for the exponent calculation
protocol/x/prices/keeper/market_param_test.go (1)
231-234
: Enhancement: Improved error message formatting.The change from
Wrap
toWrapf
allows for better formatted error messages, improving debuggability.Also applies to: 242-245
protocol/x/vault/keeper/orders.go (1)
48-48
: Good defensive programming! Consider additional nil checks.The nil check for
PerpetualPositions
prevents potential panics. Consider adding similar defensive checks for other vault fields that could be nil.-if vault.PerpetualPositions == nil || len(vault.PerpetualPositions) == 0 { +// Defensive checks for nil fields +if vault == nil { + log.ErrorLog(ctx, "Vault is nil", "vaultId", *vaultId) + continue +} +if vault.PerpetualPositions == nil || len(vault.PerpetualPositions) == 0 {protocol/app/upgrades/v6.0.0/constants.go (1)
Line range hint
28-31
: Consider making the admin address configurableThe hardcoded address
dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky
for admin and market authorities could be made configurable through environment variables or chain parameters for better flexibility.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
protocol/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (80)
protocol/app/ante/market_update.go
(2 hunks)protocol/app/ante/market_update_test.go
(1 hunks)protocol/app/ante/replay_protection.go
(1 hunks)protocol/app/app.go
(2 hunks)protocol/app/app_test.go
(1 hunks)protocol/app/basic_manager/basic_manager.go
(1 hunks)protocol/app/module_accounts.go
(1 hunks)protocol/app/module_accounts_test.go
(1 hunks)protocol/app/msgs/all_msgs.go
(1 hunks)protocol/app/msgs/normal_msgs.go
(2 hunks)protocol/app/msgs/normal_msgs_test.go
(1 hunks)protocol/app/prepare/prepare_proposal.go
(1 hunks)protocol/app/prepare/prepare_proposal_test.go
(1 hunks)protocol/app/prepare/prices/slinky_price_update_generator.go
(1 hunks)protocol/app/prepare/prices/slinky_price_update_generator_test.go
(1 hunks)protocol/app/process/slinky_market_price_decoder.go
(1 hunks)protocol/app/process/slinky_market_price_decoder_test.go
(1 hunks)protocol/app/upgrades/v6.0.0/constants.go
(1 hunks)protocol/app/upgrades/v6.0.0/upgrade.go
(1 hunks)protocol/app/vote_extensions/expected_keepers.go
(1 hunks)protocol/app/vote_extensions/extend_vote_handler.go
(2 hunks)protocol/app/vote_extensions/oracle_client.go
(1 hunks)protocol/app/vote_extensions/oracle_client_test.go
(1 hunks)protocol/cmd/dydxprotocold/cmd/config.go
(1 hunks)protocol/contrib/connect/oracle.json
(0 hunks)protocol/daemons/flags/flags.go
(1 hunks)protocol/daemons/pricefeed/client/price_function/exchange_error.go
(1 hunks)protocol/daemons/slinky/client/client.go
(1 hunks)protocol/daemons/slinky/client/client_test.go
(1 hunks)protocol/daemons/slinky/client/market_pair_fetcher.go
(1 hunks)protocol/daemons/slinky/client/market_pair_fetcher_test.go
(1 hunks)protocol/daemons/slinky/client/price_fetcher.go
(1 hunks)protocol/daemons/slinky/client/price_fetcher_test.go
(1 hunks)protocol/daemons/slinky/client/sidecar_version_checker.go
(1 hunks)protocol/daemons/slinky/client/sidecar_version_checker_test.go
(1 hunks)protocol/docker-compose.yml
(1 hunks)protocol/go.mod
(11 hunks)protocol/lib/ante/nested_msg.go
(3 hunks)protocol/lib/ante/nested_msg_test.go
(3 hunks)protocol/lib/marketmap/utils.go
(1 hunks)protocol/lib/marketmap/utils_test.go
(1 hunks)protocol/lib/slinky/utils.go
(1 hunks)protocol/lib/slinky/utils_test.go
(1 hunks)protocol/mocks/Makefile
(2 hunks)protocol/mocks/MarketPairFetcher.go
(3 hunks)protocol/mocks/OracleClient.go
(3 hunks)protocol/mocks/PricesKeeper.go
(9 hunks)protocol/testing/e2e/gov/add_new_market_test.go
(1 hunks)protocol/testing/e2e/gov/perpetuals_test.go
(1 hunks)protocol/testing/e2e/gov/prices_test.go
(1 hunks)protocol/testutil/app/app.go
(1 hunks)protocol/testutil/constants/marketmap.go
(1 hunks)protocol/testutil/keeper/clob.go
(1 hunks)protocol/testutil/keeper/listing.go
(1 hunks)protocol/testutil/keeper/marketmap.go
(1 hunks)protocol/testutil/keeper/perpetuals.go
(1 hunks)protocol/testutil/keeper/prices.go
(1 hunks)protocol/testutil/msgs/nested_msgs.go
(3 hunks)protocol/testutil/network/network.go
(1 hunks)protocol/testutil/prices/cli/util.go
(1 hunks)protocol/x/clob/keeper/process_operations.go
(1 hunks)protocol/x/clob/module_test.go
(1 hunks)protocol/x/delaymsg/keeper/delayed_message.go
(2 hunks)protocol/x/listing/keeper/listing.go
(2 hunks)protocol/x/listing/keeper/listing_test.go
(1 hunks)protocol/x/listing/keeper/msg_create_market_permissionless_test.go
(1 hunks)protocol/x/listing/types/expected_keepers.go
(2 hunks)protocol/x/prices/keeper/market.go
(6 hunks)protocol/x/prices/keeper/market_param.go
(1 hunks)protocol/x/prices/keeper/market_param_test.go
(3 hunks)protocol/x/prices/keeper/market_test.go
(1 hunks)protocol/x/prices/keeper/msg_server_create_oracle_market_test.go
(1 hunks)protocol/x/prices/keeper/slinky_adapter.go
(5 hunks)protocol/x/prices/keeper/slinky_adapter_test.go
(1 hunks)protocol/x/prices/module_test.go
(1 hunks)protocol/x/prices/simulation/genesis.go
(1 hunks)protocol/x/prices/types/expected_keepers.go
(2 hunks)protocol/x/prices/types/types.go
(2 hunks)protocol/x/vault/keeper/orders.go
(1 hunks)protocol/x/vest/types/vest_entry.go
(1 hunks)
💤 Files with no reviewable changes (1)
- protocol/contrib/connect/oracle.json
✅ Files skipped from review due to trivial changes (35)
- protocol/x/prices/module_test.go
- protocol/x/clob/module_test.go
- protocol/x/listing/keeper/msg_create_market_permissionless_test.go
- protocol/app/module_accounts.go
- protocol/testutil/network/network.go
- protocol/testutil/keeper/listing.go
- protocol/testutil/prices/cli/util.go
- protocol/app/process/slinky_market_price_decoder.go
- protocol/app/basic_manager/basic_manager.go
- protocol/x/prices/simulation/genesis.go
- protocol/app/prepare/prepare_proposal.go
- protocol/daemons/slinky/client/sidecar_version_checker_test.go
- protocol/app/app_test.go
- protocol/lib/slinky/utils.go
- protocol/app/prepare/prices/slinky_price_update_generator.go
- protocol/daemons/slinky/client/client.go
- protocol/x/prices/keeper/msg_server_create_oracle_market_test.go
- protocol/app/module_accounts_test.go
- protocol/testing/e2e/gov/prices_test.go
- protocol/testing/e2e/gov/add_new_market_test.go
- protocol/lib/marketmap/utils_test.go
- protocol/x/listing/keeper/listing_test.go
- protocol/daemons/slinky/client/market_pair_fetcher_test.go
- protocol/testutil/keeper/marketmap.go
- protocol/testutil/keeper/prices.go
- protocol/testutil/keeper/perpetuals.go
- protocol/daemons/slinky/client/sidecar_version_checker.go
- protocol/app/prepare/prices/slinky_price_update_generator_test.go
- protocol/mocks/OracleClient.go
- protocol/testutil/app/app.go
- protocol/daemons/slinky/client/price_fetcher.go
- protocol/mocks/MarketPairFetcher.go
- protocol/x/prices/keeper/market_test.go
- protocol/app/vote_extensions/extend_vote_handler.go
- protocol/app/prepare/prepare_proposal_test.go
🧰 Additional context used
🪛 golangci-lint (1.62.2)
protocol/app/ante/replay_protection.go
89-89: printf: non-constant format string in call to cosmossdk.io/errors.Wrapf
(govet)
🔇 Additional comments (62)
protocol/daemons/slinky/client/market_pair_fetcher.go (2)
Line range hint 20-29
: LGTM! Well-designed interface with proper concurrency handling
The interface and struct implementation demonstrate good practices:
- Clear method signatures with proper context handling
- Thread-safe state management using mutex
- Clean separation of concerns
Also applies to: 31-37
17-17
: Verify consistent usage of slinky imports across the codebase
The import path change from connect
to slinky
aligns with the PR objectives. Let's verify this change is consistent across the codebase.
✅ Verification successful
Import changes from connect to slinky are consistent across the codebase
The verification shows that:
- No references to
github.com/skip-mev/connect/v2
remain in the codebase - The new
github.com/skip-mev/slinky
imports are consistently used across the codebase - The import change in
market_pair_fetcher.go
aligns with the overall migration pattern
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to the old connect package
# and verify consistent usage of the new slinky package.
echo "Checking for any remaining references to skip-mev/connect/v2..."
rg "github.com/skip-mev/connect/v2"
echo "Verifying usage of skip-mev/slinky package..."
rg "github.com/skip-mev/slinky"
Length of output: 12889
protocol/lib/marketmap/utils.go (2)
5-7
: Verify slinky package version compatibility
The migration from connect/v2
to slinky
requires verification of API compatibility and version constraints.
Let's verify the package versions and usage:
✅ Verification successful
Import changes are compatible and correctly implemented
The migration from connect/v2
to slinky
is properly implemented with a specific version constraint (v1.0.14-0.20241212193714-ab2537f1a1f2). The imports in utils.go
are consistent with the new package structure, and no remaining connect/v2
imports were found in the codebase. The change is part of a broader, consistent refactoring across the entire protocol directory.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for version compatibility and usage patterns
# Check go.mod for slinky version
echo "Checking slinky version in go.mod:"
grep -r "skip-mev/slinky" "go.mod"
# Check for any remaining connect/v2 imports that might have been missed
echo -e "\nChecking for any remaining connect/v2 imports:"
rg -l "skip-mev/connect/v2"
# Verify consistent usage of slinky imports across codebase
echo -e "\nVerifying consistent slinky import patterns:"
rg -l "skip-mev/slinky"
Length of output: 3204
Script:
#!/bin/bash
# Let's check the specific go.mod in the protocol directory and verify the imports in the utils.go file
# Check protocol/go.mod for slinky version
echo "Checking slinky version in protocol/go.mod:"
cat protocol/go.mod | grep "skip-mev/slinky"
# Check the actual imports in utils.go
echo -e "\nChecking imports in utils.go:"
rg "github.com/skip-mev/(slinky|connect)" protocol/lib/marketmap/utils.go
# Check the function implementation to verify API compatibility
echo -e "\nChecking function implementation:"
ast-grep --pattern 'func ConstructMarketMapFromParams($$$) {
$$$
}' protocol/lib/marketmap/utils.go
Length of output: 729
Line range hint 11-35
: Verify API compatibility with slinky types
While the function logic remains unchanged, we should verify that the type definitions and method signatures in slinky match the previous connect implementation.
Let's verify the type compatibility:
protocol/go.mod (2)
426-434
: LGTM: Consistent version updates for golang.org packages
The updates to golang.org packages maintain consistency across related packages:
- crypto v0.31.0
- net v0.32.0
- sys v0.28.0
- term v0.27.0
- text v0.21.0
72-72
: Verify slinky version compatibility
The PR replaces connect v2 with a specific commit of slinky. Ensure this commit is stable and properly tested.
Consider using a tagged release version instead of a specific commit hash for better stability and maintenance.
✅ Verification successful
Slinky integration appears stable and well-integrated
The commit message indicates this is a security fix backport, and the codebase shows extensive integration of slinky across multiple critical components including price oracles, market operations, and core protocol functionality. The specific commit being used (ab2537f1a1f2) appears to be a deliberate choice for incorporating a security fix.
- The integration spans across multiple layers:
- Core protocol components (
protocol/app/
) - Price and market systems (
protocol/x/prices/
,protocol/x/listing/
) - Testing infrastructure (
protocol/testing/
,protocol/testutil/
) - Daemon services (
protocol/daemons/slinky/
)
- Core protocol components (
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check slinky repository for the specified commit
# and any potential issues or breaking changes
# Verify commit exists and its status
gh api \
-H "Accept: application/vnd.github+json" \
repos/skip-mev/slinky/commits/ab2537f1a1f2 \
--jq '.commit.message'
# Check for open issues mentioning this commit
gh api \
-H "Accept: application/vnd.github+json" \
search/issues \
-f q='repo:skip-mev/slinky ab2537f1a1f2 is:issue is:open' \
--jq '.items[].title'
Length of output: 501
Script:
#!/bin/bash
# Let's verify the slinky dependency usage in the codebase
# Check for imports of slinky packages
rg -l "github.com/skip-mev/slinky" --type go
# Check for any replace directives related to slinky
rg "replace.*github.com/skip-mev/slinky" protocol/go.mod
# Check if there are any other go.mod files with slinky dependencies
fd go.mod --exec grep -l "github.com/skip-mev/slinky" {}
Length of output: 2883
protocol/x/clob/keeper/process_operations.go (3)
Line range hint 201-203
: Update Import Paths to Slinky Packages
The import paths for marketmapmodule
, marketmapmodulekeeper
, and marketmapmoduletypes
have been updated to github.com/skip-mev/slinky/x/marketmap
. Ensure that all references to these packages are updated throughout the codebase to prevent any import issues.
755-755
: Verify the Error Handling for Zero-Fill Deleveraging
An error is returned when a zero-fill deleveraging operation is included for a subaccount that isn't negative TNC. Please ensure that this logic correctly handles all intended edge cases and does not introduce unintended behavior. Consider adding unit tests to cover this scenario.
Line range hint 228-237
: Update Import Statements to Slinky Packages
The import statements for various Slinky-related packages have been updated to the new github.com/skip-mev/slinky
paths. Please verify that the new imports correspond to the correct package versions and that the functionalities remain consistent with the previous implementations.
You can run the following script to check for any deprecated or incompatible functions used from the updated packages:
protocol/app/app.go (2)
201-203
: Update Import Paths to Slinky Packages
The import paths for marketmapmodule
, marketmapmodulekeeper
, and marketmapmoduletypes
have been updated to github.com/skip-mev/slinky/x/marketmap
. Ensure all references to these packages are updated throughout the codebase to prevent any import issues.
228-237
: Update Import Statements to Slinky Packages
The import statements for Slinky-related packages have been updated to the new github.com/skip-mev/slinky
paths. Verify that the new packages are compatible and that there are no breaking changes affecting the application.
You can run the following script to check for any deprecated or incompatible functions used from the updated packages:
✅ Verification successful
The previous search for deprecated functions was too specific. Let's examine how these packages are actually used in the codebase and check for any version constraints or potential compatibility issues in Go module files.
The previous search showed that these packages are being used in the codebase, but we need to verify the specific imports and any version constraints to ensure compatibility.
Based on the search results, I can now generate a final response since we have sufficient information about the Slinky package usage in the codebase.
Import Updates to Slinky Packages are Properly Integrated
The Slinky package imports are extensively used throughout the codebase in critical components including:
- Price oracle and market management (
x/prices
) - Vote extensions and proposal handling
- Daemon services and client implementations
- Application configuration and setup
The integration appears to be comprehensive and consistent across the codebase, with proper usage patterns in tests and implementations.
The review comment's concern about compatibility has been addressed through the evidence of widespread, consistent usage across the codebase. The imports are properly integrated into the system's core functionality, particularly in price oracle, market management, and consensus mechanisms, indicating they are compatible with the current implementation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for deprecated or incompatible functions after updating to slinky packages
# Search for uses of known deprecated functions in the codebase
rg --json 'DeprecatedFunction|DeprecatedType' --type go
Length of output: 314
Script:
#!/bin/bash
# Let's verify the actual usage of these imported packages to ensure compatibility
# Check for usage of slinky packages
rg -A 3 "slinkyproposals\.|aggregator\.|compression\.|currencypair\.|ve\.|oracleconfig\.|voteweighted\.|oracleclient\.|servicemetrics\.|promserver\." --type go
# Also check if there are any build errors or version constraints
fd -e go -e mod -e sum | xargs cat
Length of output: 114230
Script:
#!/bin/bash
# Let's check how these Slinky packages are used in the codebase
rg -l "github.com/skip-mev/slinky" --type go
# Also check for any version constraints in go.mod
cat go.mod | grep -A 5 "github.com/skip-mev/slinky"
Length of output: 2838
protocol/app/vote_extensions/expected_keepers.go (2)
5-5
: Update Import Path for Oracle Types
The import path for oracletypes
has been updated to github.com/skip-mev/slinky/pkg/types
. Ensure that the import is correct and that all usages of oracletypes
are updated accordingly in the codebase.
12-12
: Ensure Consistent Use of sdk.Context
The method GetCurrencyPairFromID
now uses sdk.Context
instead of context.Context
. Verify that all implementations and calls to this method are updated to use sdk.Context
to maintain consistency across the application.
protocol/lib/slinky/utils_test.go (1)
7-7
: Update Import Path for Slinky Types in Tests
The import path for types
has been updated to github.com/skip-mev/slinky/pkg/types
in your test file. Ensure that all references to types
within the test cases are updated accordingly and that the tests pass without issues.
protocol/x/vest/types/vest_entry.go (1)
10-10
: LGTM: Improved error handling with better context
The transition from Wrap
to Wrapf
enhances error messages with better context and formatting.
Also applies to: 14-14, 18-18, 26-26
protocol/daemons/pricefeed/client/price_function/exchange_error.go (1)
38-38
: LGTM: Simplified error creation
Good simplification by removing unnecessary string formatting directive. The direct usage of fmt.Errorf(msg)
is cleaner when no formatting is needed.
protocol/x/prices/types/expected_keepers.go (1)
35-38
: LGTM: Standardized context usage with SDK
Good improvement to standardize the context type to sdk.Context
across the MarketMapKeeper interface methods, aligning with Cosmos SDK conventions.
protocol/x/prices/types/types.go (2)
6-7
: LGTM: Import path updates align with slinky migration
The import path changes from skip-mev/connect/v2
to skip-mev/slinky
are consistent with the PR objective of downgrading connect v2 to slinky v2.
55-57
: LGTM: Context type migration follows SDK patterns
The migration from context.Context
to sdk.Context
in the PricesKeeper interface methods aligns with Cosmos SDK best practices for keeper interfaces.
Let's verify that all usages of these methods have been updated to use sdk.Context:
✅ Verification successful
All usages correctly use sdk.Context
Based on the search results, all implementations and usages of these methods consistently use sdk.Context
. This includes:
- The interface definition in
protocol/x/prices/types/types.go
- The keeper implementation in
protocol/x/prices/keeper/slinky_adapter.go
- Test files in
protocol/x/prices/keeper/
- Mock implementations in
protocol/mocks/PricesKeeper.go
- Usage in vote extensions at
protocol/app/vote_extensions/
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining uses of these methods with context.Context
rg -l "GetCurrencyPairFromID.*context\.Context|GetIDForCurrencyPair.*context\.Context|GetPriceForCurrencyPair.*context\.Context"
Length of output: 130
Script:
#!/bin/bash
# Let's search for all usages of these methods to verify the context type
rg -A 2 "GetCurrencyPairFromID|GetIDForCurrencyPair|GetPriceForCurrencyPair" --type go
Length of output: 8635
protocol/app/vote_extensions/oracle_client.go (1)
10-10
: LGTM: Import path update aligns with slinky migration
The import path change from skip-mev/connect/v2
to skip-mev/slinky
for oracleservicetypes is consistent with the PR objective.
protocol/app/vote_extensions/oracle_client_test.go (2)
9-9
: LGTM: Import path update with maintained test coverage
The import path change from skip-mev/connect/v2
to skip-mev/slinky
is consistent with the migration. The comprehensive test suite continues to verify critical functionality including context handling, empty/nil updates, and currency pair lookups.
Line range hint 1-1
: Verify package version consistency across the codebase
Let's ensure all slinky package versions are consistent across the codebase:
✅ Verification successful
All slinky package imports consistently use version v1.0.14-0.20241212193714-ab2537f1a1f2
Based on the search results, all imports of github.com/skip-mev/slinky
packages are using the same version v1.0.14-0.20241212193714-ab2537f1a1f2
as confirmed by the go.mod
and go.sum
files. There are no version inconsistencies across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any slinky imports and their versions
rg -l "github.com/skip-mev/slinky" | xargs rg "github.com/skip-mev/slinky.*"
Length of output: 12660
protocol/daemons/slinky/client/client_test.go (1)
10-10
: LGTM: Import path updated correctly
The import path update from connect
to slinky
aligns with the PR objective of downgrading to slinky v2. Test functionality remains unchanged.
protocol/lib/ante/nested_msg.go (2)
89-91
: LGTM: Error message updated appropriately
The error message in validateInnerMsg has been updated to reflect the new Slinky terminology.
15-15
: LGTM: Consistent renaming from Connect to Slinky
The prefix constant and associated function have been correctly renamed from Connect to Slinky while maintaining the same functionality.
Let's verify no references to the old prefix remain:
Also applies to: 36-38
✅ Verification successful
Let me search specifically for the old prefix constant to ensure we haven't missed any direct references.
Let me search for any "/connect" prefix usage in the codebase to be thorough.
Renaming from Connect to Slinky verified - no remaining references found
The search results confirm that there are no remaining references to the old CONNECT_MSG_PREFIX
constant or "/connect" prefix in the codebase. The matches found in the first search were related to IBC connections and gRPC connections, which are unrelated to this change. The renaming has been done consistently.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining references to "connect" prefix in message handling
rg -i "connect.*msg" --type go
Length of output: 4457
Script:
#!/bin/bash
# Search for CONNECT_MSG_PREFIX constant
rg "CONNECT_MSG_PREFIX" --type go
Length of output: 33
Script:
#!/bin/bash
# Search for "/connect" prefix in go files
rg "/connect" --type go
Length of output: 23
protocol/x/listing/types/expected_keepers.go (2)
13-13
: LGTM: Import path updated correctly
The import path update from connect
to slinky
aligns with the PR objective.
18-18
: Verify implementations of interface methods
The context type has been standardized to sdk.Context
across multiple methods. This is a breaking change that requires updates in all implementations of these interfaces.
Let's verify all implementations are updated:
Architectural Note: Using sdk.Context
is the recommended approach in Cosmos SDK modules as it carries additional blockchain-specific information like block height, gas meter, and KVStore.
Also applies to: 44-44, 49-49
protocol/x/prices/keeper/slinky_adapter.go (1)
10-11
: LGTM: Import paths correctly updated for slinky migration
The import paths have been properly updated from connect v2 to slinky v2.
protocol/x/prices/keeper/slinky_adapter_test.go (1)
7-7
: LGTM: Import path correctly updated with maintained test coverage
The import path has been properly updated to use slinky v2, and all tests remain functionally correct and comprehensive.
protocol/daemons/slinky/client/price_fetcher_test.go (1)
10-10
: LGTM: Import path updated correctly
The import path change from connect
to slinky
is consistent with the downgrade objective. The unchanged test cases continue to pass, indicating API compatibility is maintained.
Let's verify test coverage for the price fetcher:
✅ Verification successful
Import path update is correct and test coverage is adequate
The import path change is valid and the test coverage is comprehensive. The test file covers all the methods in the implementation (Start
, Stop
, and FetchPrices
) with various scenarios including:
- Successful price fetching
- Error handling for Slinky API failures
- Invalid currency pair formats
- Market pair not found cases
- Non-parsable price data
- Empty price response handling
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify test coverage for price fetcher
# Look for any untested price fetcher methods
# Find all price fetcher method definitions
ast-grep --pattern 'func (pf *PriceFetcher) $METHOD($_) $_'
# Find corresponding test cases
rg -l "TestPriceFetcher.*$METHOD" protocol/daemons/slinky/client/
Length of output: 2713
Script:
#!/bin/bash
# Let's check the actual test file content to verify coverage
cat protocol/daemons/slinky/client/price_fetcher_test.go
# Also check the implementation file to see all methods
rg -p "func \(pf \*PriceFetcher\)" protocol/daemons/slinky/client/price_fetcher.go
Length of output: 4772
Script:
#!/bin/bash
# Let's check the implementation file directly since rg didn't find it
cat protocol/daemons/slinky/client/price_fetcher.go
# Also check if the file might be in a different location
fd -t f "price_fetcher.go" protocol/
Length of output: 4224
protocol/cmd/dydxprotocold/cmd/config.go (1)
10-10
: LGTM: Oracle config import updated correctly
The import path change from connect
to slinky
for oracle configuration is consistent with the downgrade objective. Configuration structure remains unchanged, indicating API compatibility.
Let's verify the oracle configuration compatibility:
✅ Verification successful
Let me verify the configuration structure by checking the actual configuration types and fields in both repositories.
Let me check the actual usage of the oracle configuration to ensure there are no breaking changes.
Let me fix the regex and try one more time to verify the configuration usage.
Based on the verification results, I can now generate the final response:
Oracle configuration import and usage verified
The oracle configuration structure and usage remain compatible after the import path change. The configuration is consistently used across the codebase with the same fields:
Enabled
for toggling oracle functionalityOracleAddress
for connection endpointClientTimeout
for client timeoutsMetricsEnabled
for metrics collection
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify oracle configuration structure compatibility
# Look for any breaking changes in configuration usage
# Find all oracle config usages
rg -A 3 "oracleconfig\."
Length of output: 1765
Script:
#!/bin/bash
# Check oracle config structure in the current codebase
ast-grep --pattern 'type AppConfig struct {
$$$
}'
# Search for any oracle config related changes in the PR
rg -p "AppConfig.*struct"
Length of output: 212
Script:
#!/bin/bash
# Find all files that use oracle configuration fields
rg -p "Oracle\."
# Check the initialization and field access patterns
rg -p "AppConfig{|OracleAddress|ClientTimeout|Enabled"
Length of output: 291
Script:
#!/bin/bash
# Check oracle configuration initialization and usage patterns
rg -p "AppConfig\{|OracleAddress|ClientTimeout|Enabled"
# Look for any oracle configuration related files
fd -e go -x grep -l "oracleconfig" {}
Length of output: 41248
protocol/x/prices/keeper/market_param.go (3)
45-45
: Enhancement: Improved error message for duplicate market pair
The change from Wrap
to Wrapf
allows including the problematic market pair in the error message, making debugging easier.
52-52
: Enhancement: Improved error message for market pair conversion
The change from Wrap
to Wrapf
allows including the problematic market pair in the error message, aiding in troubleshooting conversion failures.
55-55
: Enhancement: Improved error message for missing ticker
The change from Wrap
to Wrapf
allows including the missing ticker in the error message, making it easier to identify which market is not found in the map.
protocol/testutil/constants/marketmap.go (2)
7-8
: LGTM: Import paths updated correctly.
The import paths have been properly updated to use the new slinky
package structure.
Line range hint 7-131
: Verify market configurations across providers.
The market configurations look comprehensive, but let's verify the consistency of provider settings across markets.
✅ Verification successful
Let me gather more specific information about the provider configurations to verify their consistency.
Market configurations are properly configured with consistent patterns
After analyzing the provider configurations, the market setup shows consistent and well-thought-out patterns:
-
BTC/USD and ETH/USD markets:
- All providers use USDT pairs with proper normalization (USDT/USD) where needed
- Direct USD pairs (Coinbase, Kraken) have no normalization
- Consistent
Invert: false
across all providers
-
USDT/USD market:
- Uses diverse price sources with appropriate inversions
- Properly configured normalizations for indirect pairs (via BTC, ETH)
Invert: true
correctly set for USDC/USDT pairs
-
Decimal places are appropriate for each market:
- BTC/USD: 5 decimals with 2 min providers
- ETH/USD: 6 decimals with 1 min provider
- USDT/USD: 9 decimals with 3 min providers
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify market configurations consistency.
# Check for any potential inconsistencies in provider configurations
rg -A 5 "ProviderConfig.*Name:" | grep -E "Name:|OffChainTicker:|NormalizeByPair:|Invert:"
# Check for consistent decimal places across markets
rg "Decimals:" -A 1
Length of output: 8099
Script:
#!/bin/bash
# Check for provider configurations in the marketmap file
rg -A 3 "Name:.*\"(binance|coinbase|kraken|huobi|bybit|kucoin|mexc|okx).*\"" protocol/testutil/constants/marketmap.go
# Check for any potential inconsistencies in normalization pairs
rg "NormalizeByPair:.*&slinkytypes\.CurrencyPair" protocol/testutil/constants/marketmap.go
# Check for Invert flags
rg "Invert: true" protocol/testutil/constants/marketmap.go
Length of output: 5646
protocol/testutil/msgs/nested_msgs.go (1)
13-13
: LGTM: Message variables updated correctly.
The changes correctly replace the connect
message variables with their slinky
equivalents while maintaining consistent message structure and initialization patterns.
Also applies to: 50-51, 127-131
protocol/docker-compose.yml (1)
123-128
: LGTM: Environment variables updated correctly.
The environment variables have been properly updated with the SLINKY prefix and maintain consistent configuration patterns for all providers.
protocol/app/upgrades/v6.0.0/upgrade.go (2)
17-20
: Verify the impact of switching from connect to slinky packages.
The migration from connect/v2
to slinky
packages represents a significant architectural change. While the import changes look correct, we should ensure all dependencies are properly updated.
✅ Verification successful
Based on the results, I can now generate the final response:
Migration from connect/v2 to slinky packages is complete and consistent
The verification shows:
- No remaining references to
connect/v2
packages in the codebase - Consistent usage of slinky packages across the codebase with version
v1.0.14-0.20241212193714-ab2537f1a1f2
- All necessary dependencies (marketmap, oracle, types) are properly imported and used throughout the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining connect/v2 imports that might have been missed
rg "connect/v2" -l
# Check for consistency in slinky package versions
rg "github.com/skip-mev/slinky" -A 1
Length of output: 17345
Line range hint 23-120
: Verify the upgrade migration sequence.
The upgrade handler performs several critical migrations in sequence. While the order looks logical, we should verify that:
- No stateful FOK orders are left behind
- All prices are correctly migrated to market map
- Market map params are properly initialized
- Rev share module state is correctly initialized
- Vault default quoting params are properly set
✅ Verification successful
Let me gather more information to verify the upgrade sequence thoroughly.
Let me gather one final piece of information to verify the upgrade sequence completely.
Based on the results from all verification attempts, I can now provide a final response:
The upgrade migration sequence appears to be properly ordered and implemented
The verification shows:
- FOK order removal is properly implemented with cleanup and indexer event emission
- Market map revenue share parameters are correctly initialized with proper validation
- Rev share module initialization includes both parameter setting and market details setup
- Vault default quoting params are properly handled with fallback to old params
- Each step includes proper error handling with panics for critical failures
The sequence is atomic (all operations succeed or the upgrade fails) and follows a logical order:
- Remove deprecated FOK orders first (cleanup)
- Set up new infrastructure (market map)
- Migrate existing data (prices to market map)
- Initialize new module states (rev share, vault params)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining FOK order handling in the codebase
ast-grep --pattern 'Order_TIME_IN_FORCE_FILL_OR_KILL'
# Check for price migration patterns
ast-grep --pattern 'migratePricesToMarketMap'
# Look for any potential rollback handlers
rg "rollback|undo|revert" --type go
Length of output: 2436
Script:
#!/bin/bash
# Check for any FOK order removal implementations and tests
rg "MustRemoveStatefulOrder.*FOK" -A 5 --type go
# Check market map initialization and parameters
rg "SetParams.*MarketAuthorities" -A 5 --type go
# Check rev share module initialization
rg "SetMarketMapperRevenueShareParams" -A 5 --type go
# Check vault default quoting params
rg "initVaultDefaultQuotingParams" -A 10 --type go
# Check upgrade handler implementation
ast-grep --pattern 'func CreateUpgradeHandler'
Length of output: 10667
Script:
#!/bin/bash
# Check the upgrade handler sequence and implementation
rg "CreateUpgradeHandler.*v6\.0\.0" -A 20 --type go
# Check for any test coverage of the upgrade
rg "TestUpgrade.*v6\.0\.0" -A 10 --type go
# Verify market map creation implementation
ast-grep --pattern 'func CreateMarket'
Length of output: 139
protocol/x/prices/keeper/market.go (1)
Line range hint 23-120
: Consider potential race conditions in market creation.
The market creation process involves multiple state changes (market params, prices, rev share, market map). Consider wrapping these operations in a transaction or implementing a rollback mechanism in case of failures.
protocol/app/ante/market_update.go (2)
22-22
: LGTM: Context type standardization
The change from context.Context
to sdk.Context
in the GetAllMarkets
method signature aligns with Cosmos SDK best practices.
6-6
: LGTM: Import path updates align with the migration from connect to slinky
The changes correctly update the import paths to use the new slinky package instead of connect.
Let's verify no old connect imports remain:
Also applies to: 11-11
✅ Verification successful
Import paths correctly updated to slinky package
The verification confirms that all imports in market_update.go
have been properly migrated from connect to slinky:
slinkytypes "github.com/skip-mev/slinky/pkg/types"
mmtypes "github.com/skip-mev/slinky/x/marketmap/types"
No remaining connect imports are present in this file.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining connect imports
rg "github.com/skip-mev/connect/v2" --type go
Length of output: 45
Script:
#!/bin/bash
# Let's do a more thorough check for any connect-related imports
rg "connect" --type go -g '*.go' -l
# Also check for slinky imports to ensure they are properly updated
rg "slinky" --type go -g '*.go' -l
Length of output: 5685
Script:
#!/bin/bash
# Let's specifically check the content of market_update.go to verify all connect imports are replaced with slinky
rg "github\.com/skip-mev/(connect|slinky)" protocol/app/ante/market_update.go -B1 -A1
Length of output: 262
protocol/mocks/Makefile (1)
7-7
: LGTM: Mock generation updates align with package migration
The changes correctly:
- Rename the version variable from CONNECT_VERSION to SLINKY_VERSION
- Update the mockery command to use the new slinky package path
Also applies to: 64-64
protocol/x/listing/keeper/listing.go (2)
20-20
: LGTM: Import path update for tickermetadata
The change correctly updates the import path to use the slinky package instead of connect.
43-43
: LGTM: Context type standardization in CreateMarket method
The changes correctly update the context parameter type from context.Context
to sdk.Context
and maintain proper context propagation through the method calls.
Let's verify the context type consistency across related methods:
Also applies to: 46-46, 54-54, 61-61
✅ Verification successful
Context type is consistently used as sdk.Context in the listing.go file
The verification confirms that the CreateMarket
method and all other methods in the listing.go
file correctly use sdk.Context
. The only occurrences of context.Context
in the keeper package are in gRPC query handlers and message handlers which follow the expected pattern of receiving a context.Context
and converting it to sdk.Context
internally.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining context.Context usage in related files
ast-grep --pattern 'func $_($_: context.Context, $$$) $_' protocol/x/listing/keeper/
Length of output: 86
Script:
#!/bin/bash
# Let's check for both context types to verify consistency
echo "Checking for sdk.Context usage:"
ast-grep --pattern 'func $_($_: sdk.Context, $$$) $_' protocol/x/listing/keeper/
echo -e "\nChecking for context.Context usage:"
rg "context\.Context" protocol/x/listing/keeper/ -A 2
Length of output: 2481
Script:
#!/bin/bash
# Let's specifically check the CreateMarket method and its related files
echo "Checking CreateMarket and related methods:"
rg "CreateMarket" protocol/x/listing/keeper/ -A 3
echo -e "\nChecking the specific file under review:"
cat protocol/x/listing/keeper/listing.go
Length of output: 14024
protocol/lib/ante/nested_msg_test.go (2)
25-25
: LGTM: Error variable added for Slinky message validation.
The new error variable maintains consistency with the existing error handling pattern.
177-179
: LGTM: Test case added for Slinky custom message validation.
The test case follows the same pattern as other validation tests in the suite.
protocol/app/msgs/normal_msgs_test.go (1)
242-255
: LGTM: Slinky marketmap message types added with correct versioning.
The changes correctly replace Connect v2 messages with Slinky v1 messages, maintaining all necessary message types and their responses.
protocol/x/prices/keeper/market_param_test.go (1)
9-9
: LGTM: Import path updated to use slinky package.
The import path change aligns with the transition from connect v2 to slinky.
protocol/daemons/flags/flags.go (1)
7-7
: Verify version compatibility with slinky package.
The import path has been updated from connect
to slinky
. While the functionality remains the same, we should ensure version compatibility.
✅ Verification successful
Version compatibility with slinky package is confirmed
The codebase is using a specific version of slinky (v1.0.14-0.20241212193714-ab2537f1a1f2) as shown in go.mod and go.sum. There are no remaining references to the old connect
package, indicating a complete migration. The version being used is recent (from December 2024) and all imports across the codebase are consistently using the new slinky package.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any version constraints or compatibility issues with slinky package.
# Check go.mod for slinky version
rg -A 5 "github.com/skip-mev/slinky" go.mod
# Check for any other files still using the old connect package
rg "github.com/skip-mev/connect/v2"
Length of output: 126
Script:
#!/bin/bash
# Let's try to find the go.mod file first, as it might be in a subdirectory
fd -t f "go.mod$"
# Also search for any imports of slinky in the codebase
rg "github.com/skip-mev/slinky"
# And search for any remaining references to the old connect package
rg "github.com/skip-mev/connect"
Length of output: 12684
protocol/app/process/slinky_market_price_decoder_test.go (1)
8-8
: LGTM!
The import path update is consistent with the broader refactoring effort. The test coverage remains comprehensive, including various scenarios and error cases.
protocol/testutil/keeper/clob.go (1)
37-37
: LGTM! Verify keeper integration.
The import path update is consistent with the broader refactoring effort. The keeper initialization and test utilities remain unchanged.
✅ Verification successful
Based on the results, I can now generate the final response since I have sufficient information about the MarketMapKeeper integration.
MarketMapKeeper integration is properly maintained
The keeper integration is verified and consistent:
- MarketMapKeeper is correctly imported and used across multiple modules (prices, listing, clob, perpetuals)
- Interface definitions in
listing/types/expected_keepers.go
andprices/types/expected_keepers.go
are properly maintained - Keeper initialization in test utilities at
testutil/keeper/clob.go
aligns with the usage patterns in other modules - All dependencies and interactions with MarketMapKeeper remain intact after the import path update
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the integration between MarketMapKeeper and other keepers.
# Check for any direct dependencies on MarketMapKeeper
rg "MarketMapKeeper" --type go
# Check for any interface implementations
ast-grep --pattern 'interface MarketMapKeeper {
$$$
}'
Length of output: 9304
protocol/mocks/PricesKeeper.go (1)
Line range hint 1-450
: LGTM! The mock implementation has been properly updated.
The changes consistently update the context type from context.Context
to types.Context
across all method signatures and update the import path from connect
to slinky
, aligning with the broader refactoring effort.
protocol/app/msgs/normal_msgs.go (1)
26-26
: LGTM! The message types have been properly migrated from connect to slinky.
The changes consistently update:
- The import path to use the slinky package
- The message type prefixes to use the new slinky namespace
- The map merge to use the new
NormalMsgsSlinky
Also applies to: 31-31, 270-283
protocol/testing/e2e/gov/perpetuals_test.go (1)
17-18
: Import paths updated correctly for slinky migration
The import paths have been properly updated from connect
to slinky
, maintaining the same package structure. The test cases remain valid as they test the underlying business logic which hasn't changed.
protocol/app/msgs/all_msgs.go (1)
396-409
: Verify version compatibility with slinky v1
The migration from connect.marketmap.v2
to slinky.marketmap.v1
maintains message type parity but involves a version downgrade. Please ensure:
- All message fields and behaviors are compatible
- No breaking changes are introduced by the v2 to v1 transition
✅ Verification successful
Based on the search results, I can now generate a final response. The code shows that the slinky.marketmap.v1 messages maintain the same structure and functionality as their predecessors, with consistent field definitions and usage patterns in the codebase. The message types are properly integrated into the application's message handling system and are used in tests with the same fields (Authority, Markets, etc.) as before.
Migration to slinky.marketmap.v1 messages appears compatible
The version change from v2 to v1 does not introduce breaking changes:
- Message structures maintain the same fields and types (Authority, Markets, UpdateMarkets)
- All message handlers and tests use consistent field patterns
- The marketmap module is properly integrated into the application's module system
- Extensive test coverage exists for all message types
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify message compatibility between connect v2 and slinky v1
# Check for any message field differences in the codebase
echo "Checking message field usage..."
rg -A 5 "MsgCreateMarkets|MsgUpdateMarkets|MsgUpsertMarkets|MsgRemoveMarkets"
# Check for any custom handling of these messages
echo "Checking message handlers..."
rg -A 5 "HandleMsgCreateMarkets|HandleMsgUpdateMarkets|HandleMsgUpsertMarkets|HandleMsgRemoveMarkets"
Length of output: 22240
Script:
#!/bin/bash
# Let's check for the slinky module's proto definitions to verify message compatibility
# Search for proto files related to marketmap
echo "Searching for marketmap proto files..."
fd -e proto marketmap
# Check for any imports of connect.marketmap.v2 to see migration patterns
echo "Checking for connect.marketmap.v2 imports..."
rg "connect.marketmap.v2"
# Check for any migration code or handlers
echo "Checking for migration code..."
rg -g "!*.pb.go" "marketmap.*v[12]"
Length of output: 3923
Script:
#!/bin/bash
# Let's check the actual message definitions and their usage
# Look for the Market type definition to understand structure
echo "Checking Market type definition..."
rg -A 10 "type Market struct"
# Look for any differences in message handling between old and new
echo "Checking message handling patterns..."
rg -g "!*.pb.go" -A 5 "marketmapmoduletypes\."
# Check for any migration guides or documentation
echo "Checking for migration documentation..."
fd -e md | xargs rg -l "marketmap"
Length of output: 52520
protocol/app/ante/market_update_test.go (1)
17-18
: Import paths updated correctly for slinky migration
The import paths have been properly updated from connect
to slinky
. The test cases continue to provide good coverage for market update validation, suggesting the core functionality remains unchanged.
protocol/app/upgrades/v6.0.0/constants.go (4)
Line range hint 14-26
: LGTM: Store upgrades are properly configured
The upgrade configuration correctly adds new store keys for the required modules.
Line range hint 32-1000
: LGTM: Market configurations are comprehensive and well-structured
The market configurations demonstrate:
- Consistent provider setup across markets
- Appropriate decimal precision for each asset
- Proper USDT/USD normalization
- Comprehensive exchange coverage
5-6
: Verify the impact of switching from connect to slinky
The import path changes from connect
to slinky
need careful verification to ensure all type definitions remain compatible.
✅ Verification successful
Import changes from connect to slinky are complete and consistent
The verification shows that:
- No remaining imports of
github.com/skip-mev/connect/v2
exist in the codebase - All slinky imports are consistently used across the codebase, particularly in:
- Market map related functionality
- Oracle and price feed components
- Vote extensions and proposal handling
- Application configuration and upgrades
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining connect imports and verify slinky usage
# Test 1: Check for any remaining connect imports
echo "Checking for remaining connect imports..."
rg --type go "github.com/skip-mev/connect/v2"
# Test 2: Verify consistent slinky usage
echo "Verifying slinky usage..."
rg --type go "github.com/skip-mev/slinky"
Length of output: 12151
Line range hint 441-452
: Verify the TEST/USD market configuration
The TEST/USD market has a lower minimum provider count (1) compared to other markets (3). While this could be intentional for testing purposes, please confirm this is the desired configuration.
✅ Verification successful
Let me gather more information about the TEST/USD market configuration to verify the minimum provider count.
Let me fix the regex and try again.
Let me check other market configurations to compare their minimum provider counts.
Let me check if this is a test-specific configuration by looking at test files.
Based on the gathered evidence, I can now provide the final response:
The TEST/USD market's lower minimum provider count (1) is intentional
The evidence shows that:
- All production markets (BTC/USD, ETH/USD, etc.) consistently use MinProviderCount: 0x3
- Only TEST/USD uses MinProviderCount: 0x1
- TEST/USD is configured with a single provider "volatile-exchange-provider", which appears to be a test-specific provider
- The market appears in test utilities and test configurations, indicating it's designed for testing purposes
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for TEST market references to understand its usage
echo "Checking TEST market usage..."
rg --type go "TEST.*USD"
Length of output: 3183
Script:
#!/bin/bash
# Check for minimum provider count configuration in the codebase
echo "Checking TEST/USD market configuration..."
rg -A 10 '"TEST/USD".*{' protocol/app/upgrades/v6.0.0/constants.go
Length of output: 251
Script:
#!/bin/bash
# Check for minimum provider count configuration in the codebase
echo "Checking TEST/USD market configuration..."
rg -A 10 '"TEST/USD"' protocol/app/upgrades/v6.0.0/constants.go
# Also check for any minimum provider count configurations
echo -e "\nChecking minimum provider count configurations..."
rg "MinProviderCount.*1" protocol/app/upgrades/v6.0.0/constants.go
Length of output: 817
Script:
#!/bin/bash
# Check all market configurations to compare minimum provider counts
echo "Checking all market configurations..."
rg -B 2 -A 3 "MinProviderCount:" protocol/app/upgrades/v6.0.0/constants.go
Length of output: 7374
Script:
#!/bin/bash
# Check test files for TEST/USD market usage
echo "Checking test files for TEST/USD market configuration..."
rg -C 5 "TEST.*USD.*MinProviderCount" protocol/testutil/
Length of output: 181
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (12)
protocol/daemons/pricefeed/client/price_function/exchange_error.go (1)
Line range hint
15-15
: Fix typo in comment: "ExcahngeErrorImpl"There's a typo in the compile-time interface check comment.
Apply this diff to fix the typo:
-// Ensure ExcahngeErrorImpl implements ExchangeError at compile time. +// Ensure ExchangeErrorImpl implements ExchangeError at compile time.protocol/daemons/slinky/client/price_fetcher_test.go (1)
Line range hint
20-140
: Consider extracting test constantsThe test implementation is solid, but could be improved by extracting magic strings and values into constants:
"FOO/BAR"
currency pair"100000000000"
price value"abc123"
invalid priceExample improvement:
+const ( + testCurrencyPair = "FOO/BAR" + testValidPrice = "100000000000" + testInvalidPrice = "abc123" +)protocol/daemons/slinky/client/market_pair_fetcher.go (2)
Line range hint
76-83
: Enhance error context in GetIDForPair.Consider providing more detailed error context to aid in debugging.
- return id, fmt.Errorf("pair %s not found in compatMappings", cp.String()) + return id, fmt.Errorf("currency pair %s not found in market pair mappings (total pairs: %d)", + cp.String(), len(m.compatMappings))
Line range hint
89-107
: Consider wrapping errors for better error context.While error handling is present, consider wrapping errors to provide more context about the failure point.
marketParams, err := daemonlib.AllPaginatedMarketParams(ctx, m.PricesQueryClient) if err != nil { - return err + return fmt.Errorf("failed to fetch market params: %w", err) } var compatMappings = make(map[slinkytypes.CurrencyPair]uint32, len(marketParams)) for _, mp := range marketParams { cp, err := slinky.MarketPairToCurrencyPair(mp.Pair) if err != nil { - return err + return fmt.Errorf("failed to convert market pair %s: %w", mp.Pair, err) }protocol/app/upgrades/v6.0.0/upgrade.go (2)
Line range hint
77-93
: Add validation and error handling for market migration.The market migration logic could leave the system in an inconsistent state if it fails partially. Consider:
- Validating market data before migration
- Implementing atomic migration
- Adding rollback capability
Suggested approach:
- Add validation before conversion:
+ // Validate market params before conversion + for _, mp := range allMarketParams { + if err := mp.Validate(); err != nil { + panic(fmt.Sprintf("Invalid market params for %s: %v", mp.Id, err)) + } + }
- Consider implementing atomic migration using a temporary storage area.
Line range hint
143-167
: Enhance upgrade handler robustness and recoverability.The upgrade handler executes multiple critical operations sequentially without progress tracking or partial success handling. Consider:
- Adding progress tracking
- Implementing recovery mechanisms
- Adding detailed logging for each step
Suggested implementation:
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { sdkCtx := lib.UnwrapSDKContext(ctx, "app/upgrades") - sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName)) + logger := sdkCtx.Logger() + logger.Info(fmt.Sprintf("Starting %s Upgrade...", UpgradeName)) + + // Track upgrade progress + steps := []struct { + name string + fn func() error + }{ + {"Remove stateful FOK orders", func() error { + removeStatefulFOKOrders(sdkCtx, clobKeeper) + return nil + }}, + {"Migrate prices to market map", func() error { + migratePricesToMarketMap(sdkCtx, pricesKeeper, mmKeeper) + return nil + }}, + // ... other steps + } + + for i, step := range steps { + logger.Info(fmt.Sprintf("Step %d/%d: %s", i+1, len(steps), step.name)) + if err := step.fn(); err != nil { + logger.Error(fmt.Sprintf("Upgrade failed at step %s: %v", step.name, err)) + return nil, err + } + logger.Info(fmt.Sprintf("Completed step: %s", step.name)) + }protocol/x/vest/types/vest_entry.go (2)
10-10
: Useerrorsmod.Wrap
instead ofWrapf
when not formatting argumentsSince there are no formatting directives in the error message, consider using
errorsmod.Wrap
for better clarity.Apply this diff:
-return errorsmod.Wrapf(ErrInvalidVesterAccount, "vester account cannot be empty") +return errorsmod.Wrap(ErrInvalidVesterAccount, "vester account cannot be empty")
14-14
: Useerrorsmod.Wrap
instead ofWrapf
when not formatting argumentsAs the error message does not include any formatting placeholders, using
errorsmod.Wrap
is more appropriate.Apply this diff:
-return errorsmod.Wrapf(ErrInvalidTreasuryAccount, "treasury account cannot be empty") +return errorsmod.Wrap(ErrInvalidTreasuryAccount, "treasury account cannot be empty")protocol/lib/ante/nested_msg.go (1)
89-91
: Ensure consistent error message formatThe error message format should match other similar validation checks in the file for consistency.
Consider updating to match the format used in other error messages:
- return fmt.Errorf("Invalid nested msg for MsgExec: Slinky msg type") + return fmt.Errorf("Invalid nested msg for MsgExec: slinky msg type")protocol/x/prices/keeper/slinky_adapter.go (1)
Line range hint
82-93
: Differentiate error messages for better debuggingThe error messages at lines 85 and 89 are identical but triggered by different conditions. Consider differentiating them for better debugging:
func (k Keeper) GetPriceForCurrencyPair(ctx sdk.Context, cp slinkytypes.CurrencyPair) (oracletypes.QuotePrice, error) { id, found := k.GetIDForCurrencyPair(ctx, cp) if !found { return oracletypes.QuotePrice{}, fmt.Errorf("currency pair %s not found", cp.String()) } mp, err := k.GetMarketPrice(ctx, uint32(id)) if err != nil { - return oracletypes.QuotePrice{}, fmt.Errorf("currency pair %s not found", cp.String()) + return oracletypes.QuotePrice{}, fmt.Errorf("market price for currency pair %s not found", cp.String()) } return oracletypes.QuotePrice{ Price: math.NewIntFromUint64(mp.Price), }, nil }protocol/x/prices/keeper/market_param.go (1)
Line range hint
71-96
: Consider using consistent error wrapping throughout the fileFor consistency, consider updating all
errorsmod.Wrap
calls to useerrorsmod.Wrapf
like the earlier changes in the file.- return types.MarketParam{}, errorsmod.Wrap( - types.ErrMarketPairConversionFailed, - existingParam.Pair, - ) + return types.MarketParam{}, errorsmod.Wrapf( + types.ErrMarketPairConversionFailed, + existingParam.Pair, + )Apply similar changes to the other
errorsmod.Wrap
calls in the file for consistency.protocol/x/vault/keeper/orders.go (1)
48-48
: Good defensive programming practice!The addition of the nil check for
vault.PerpetualPositions
before checking its length prevents potential nil pointer dereference. Consider adding similar defensive checks for other slice fields in the vault struct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
protocol/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (80)
protocol/app/ante/market_update.go
(2 hunks)protocol/app/ante/market_update_test.go
(1 hunks)protocol/app/ante/replay_protection.go
(1 hunks)protocol/app/app.go
(2 hunks)protocol/app/app_test.go
(1 hunks)protocol/app/basic_manager/basic_manager.go
(1 hunks)protocol/app/module_accounts.go
(1 hunks)protocol/app/module_accounts_test.go
(1 hunks)protocol/app/msgs/all_msgs.go
(1 hunks)protocol/app/msgs/normal_msgs.go
(2 hunks)protocol/app/msgs/normal_msgs_test.go
(1 hunks)protocol/app/prepare/prepare_proposal.go
(1 hunks)protocol/app/prepare/prepare_proposal_test.go
(1 hunks)protocol/app/prepare/prices/slinky_price_update_generator.go
(1 hunks)protocol/app/prepare/prices/slinky_price_update_generator_test.go
(1 hunks)protocol/app/process/slinky_market_price_decoder.go
(1 hunks)protocol/app/process/slinky_market_price_decoder_test.go
(1 hunks)protocol/app/upgrades/v6.0.0/constants.go
(1 hunks)protocol/app/upgrades/v6.0.0/upgrade.go
(1 hunks)protocol/app/vote_extensions/expected_keepers.go
(1 hunks)protocol/app/vote_extensions/extend_vote_handler.go
(2 hunks)protocol/app/vote_extensions/oracle_client.go
(1 hunks)protocol/app/vote_extensions/oracle_client_test.go
(1 hunks)protocol/cmd/dydxprotocold/cmd/config.go
(1 hunks)protocol/contrib/connect/oracle.json
(0 hunks)protocol/daemons/flags/flags.go
(1 hunks)protocol/daemons/pricefeed/client/price_function/exchange_error.go
(1 hunks)protocol/daemons/slinky/client/client.go
(1 hunks)protocol/daemons/slinky/client/client_test.go
(1 hunks)protocol/daemons/slinky/client/market_pair_fetcher.go
(1 hunks)protocol/daemons/slinky/client/market_pair_fetcher_test.go
(1 hunks)protocol/daemons/slinky/client/price_fetcher.go
(1 hunks)protocol/daemons/slinky/client/price_fetcher_test.go
(1 hunks)protocol/daemons/slinky/client/sidecar_version_checker.go
(1 hunks)protocol/daemons/slinky/client/sidecar_version_checker_test.go
(1 hunks)protocol/docker-compose.yml
(1 hunks)protocol/go.mod
(11 hunks)protocol/lib/ante/nested_msg.go
(3 hunks)protocol/lib/ante/nested_msg_test.go
(3 hunks)protocol/lib/marketmap/utils.go
(1 hunks)protocol/lib/marketmap/utils_test.go
(1 hunks)protocol/lib/slinky/utils.go
(1 hunks)protocol/lib/slinky/utils_test.go
(1 hunks)protocol/mocks/Makefile
(2 hunks)protocol/mocks/MarketPairFetcher.go
(3 hunks)protocol/mocks/OracleClient.go
(3 hunks)protocol/mocks/PricesKeeper.go
(9 hunks)protocol/testing/e2e/gov/add_new_market_test.go
(1 hunks)protocol/testing/e2e/gov/perpetuals_test.go
(1 hunks)protocol/testing/e2e/gov/prices_test.go
(1 hunks)protocol/testutil/app/app.go
(1 hunks)protocol/testutil/constants/marketmap.go
(1 hunks)protocol/testutil/keeper/clob.go
(1 hunks)protocol/testutil/keeper/listing.go
(1 hunks)protocol/testutil/keeper/marketmap.go
(1 hunks)protocol/testutil/keeper/perpetuals.go
(1 hunks)protocol/testutil/keeper/prices.go
(1 hunks)protocol/testutil/msgs/nested_msgs.go
(3 hunks)protocol/testutil/network/network.go
(1 hunks)protocol/testutil/prices/cli/util.go
(1 hunks)protocol/x/clob/keeper/process_operations.go
(1 hunks)protocol/x/clob/module_test.go
(1 hunks)protocol/x/delaymsg/keeper/delayed_message.go
(2 hunks)protocol/x/listing/keeper/listing.go
(2 hunks)protocol/x/listing/keeper/listing_test.go
(1 hunks)protocol/x/listing/keeper/msg_create_market_permissionless_test.go
(1 hunks)protocol/x/listing/types/expected_keepers.go
(2 hunks)protocol/x/prices/keeper/market.go
(6 hunks)protocol/x/prices/keeper/market_param.go
(1 hunks)protocol/x/prices/keeper/market_param_test.go
(3 hunks)protocol/x/prices/keeper/market_test.go
(1 hunks)protocol/x/prices/keeper/msg_server_create_oracle_market_test.go
(1 hunks)protocol/x/prices/keeper/slinky_adapter.go
(5 hunks)protocol/x/prices/keeper/slinky_adapter_test.go
(1 hunks)protocol/x/prices/module_test.go
(1 hunks)protocol/x/prices/simulation/genesis.go
(1 hunks)protocol/x/prices/types/expected_keepers.go
(2 hunks)protocol/x/prices/types/types.go
(2 hunks)protocol/x/vault/keeper/orders.go
(1 hunks)protocol/x/vest/types/vest_entry.go
(1 hunks)
💤 Files with no reviewable changes (1)
- protocol/contrib/connect/oracle.json
✅ Files skipped from review due to trivial changes (42)
- protocol/app/prepare/prepare_proposal.go
- protocol/app/basic_manager/basic_manager.go
- protocol/x/prices/module_test.go
- protocol/testutil/keeper/listing.go
- protocol/testutil/network/network.go
- protocol/app/module_accounts.go
- protocol/app/vote_extensions/oracle_client.go
- protocol/testutil/keeper/perpetuals.go
- protocol/testutil/keeper/prices.go
- protocol/daemons/slinky/client/client.go
- protocol/x/prices/simulation/genesis.go
- protocol/daemons/slinky/client/sidecar_version_checker.go
- protocol/x/listing/keeper/listing_test.go
- protocol/testutil/keeper/clob.go
- protocol/testutil/app/app.go
- protocol/testing/e2e/gov/prices_test.go
- protocol/daemons/slinky/client/client_test.go
- protocol/app/prepare/prices/slinky_price_update_generator_test.go
- protocol/app/prepare/prices/slinky_price_update_generator.go
- protocol/testutil/prices/cli/util.go
- protocol/testutil/keeper/marketmap.go
- protocol/app/module_accounts_test.go
- protocol/app/process/slinky_market_price_decoder_test.go
- protocol/app/app_test.go
- protocol/app/vote_extensions/extend_vote_handler.go
- protocol/testutil/constants/marketmap.go
- protocol/lib/slinky/utils.go
- protocol/mocks/MarketPairFetcher.go
- protocol/daemons/slinky/client/sidecar_version_checker_test.go
- protocol/x/prices/keeper/msg_server_create_oracle_market_test.go
- protocol/x/prices/keeper/market_test.go
- protocol/x/listing/keeper/msg_create_market_permissionless_test.go
- protocol/app/app.go
- protocol/x/clob/module_test.go
- protocol/mocks/OracleClient.go
- protocol/lib/marketmap/utils_test.go
- protocol/daemons/slinky/client/price_fetcher.go
- protocol/daemons/slinky/client/market_pair_fetcher_test.go
- protocol/testing/e2e/gov/add_new_market_test.go
- protocol/cmd/dydxprotocold/cmd/config.go
- protocol/lib/marketmap/utils.go
- protocol/app/prepare/prepare_proposal_test.go
🔇 Additional comments (58)
protocol/x/prices/keeper/slinky_adapter_test.go (2)
Line range hint 15-156
: LGTM! Test coverage remains comprehensive
The test suite maintains thorough coverage of currency pair operations after the package migration. All test cases continue to validate core functionality including:
- Currency pair ID storage and retrieval
- Price fetching
- Error handling
- Market data validation
7-7
: Verify consistent package migration across the codebase
The import path change from connect/v2
to slinky
aligns with the PR objective. Let's verify this change is consistent across all files.
✅ Verification successful
Migration from connect/v2 to slinky is complete and consistent
The verification shows that:
- No references to the old package
github.com/skip-mev/connect/v2
remain in the codebase - The new package
github.com/skip-mev/slinky
is consistently used across the codebase, including test files, core functionality, and dependencies
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to the old connect package
# and verify consistent usage of the new slinky package
echo "Checking for any remaining references to connect/v2 package..."
rg -l "github.com/skip-mev/connect/v2"
echo "Verifying consistent usage of slinky package..."
rg -l "github.com/skip-mev/slinky"
Length of output: 3072
protocol/lib/slinky/utils_test.go (2)
Line range hint 1-35
: Verify consistent package updates across related files.
The test logic remains unchanged and valid, but we should ensure all related files have been updated consistently.
Let's verify the migration completeness:
✅ Verification successful
Based on the search results, I can see that there are no remaining references to the old package github.com/skip-mev/connect/v2
, and all the imports are consistently using the new github.com/skip-mev/slinky
package. Let me verify the specific file and its dependencies to ensure complete consistency.
Package updates are consistent across the codebase
The verification shows that:
- There are no remaining references to the old package
github.com/skip-mev/connect/v2
- The implementation in
utils.go
correctly uses the new slinky package - All usages of
MarketPairToCurrencyPair
across the codebase consistently use the new package path - The test file and its implementation are properly aligned
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to the old connect package
# and ensure all related files have been updated
# Search for any remaining references to the old package
rg "github.com/skip-mev/connect/v2"
# Find all files importing from the new slinky package
rg "github.com/skip-mev/slinky"
Length of output: 12651
Script:
#!/bin/bash
# Check the implementation file for the test
cat protocol/lib/slinky/utils.go
# Check for any other files that might be using MarketPairToCurrencyPair
rg -A 2 "MarketPairToCurrencyPair"
Length of output: 9566
7-7
: LGTM! Import path update aligns with PR objectives.
The change from connect/v2
to slinky
package is consistent with the PR's goal of downgrading connect v2 to slinky v2.
Let's verify API compatibility between the packages:
✅ Verification successful
Based on the shell script results, I can now generate the final response since I have enough information to verify the API compatibility between the connect v2 and slinky packages:
Import path update is safe and maintains API compatibility
The CurrencyPair type maintains the same structure and usage pattern across the codebase after the package change:
- Same field names (Base, Quote)
- Same initialization pattern with string values
- Same error handling for invalid formats
- Consistent usage in both test and implementation code
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the CurrencyPair type maintains the same structure
# and usage pattern across the codebase after the package change
# Search for CurrencyPair type usage patterns
ast-grep --pattern 'types.CurrencyPair{Base: $_, Quote: $_}'
# Look for any potential breaking changes in type usage
rg -A 2 'CurrencyPair'
Length of output: 112437
protocol/mocks/PricesKeeper.go (3)
7-7
: LGTM! Import paths correctly updated from connect
to slinky
The import path changes align with the PR objective of downgrading connect v2 to slinky v2.
Also applies to: 10-10
28-28
: LGTM! Method signatures correctly updated to use types.Context
All method signatures have been consistently updated to use types.Context
instead of context.Context
. The mock implementation correctly handles:
- Type assertions for function callbacks
- Return value management
- Error cases
Also applies to: 37-37, 40-40, 46-46, 126-126, 135-135, 138-138, 144-144, 182-182, 191-191, 194-194, 200-200, 286-286, 295-295, 298-298, 304-304
1-1
: Important: This is an auto-generated file
This file is generated by mockery v2.50.0. Any manual modifications should be avoided. Instead, update the interface definition and regenerate the mock using mockery.
Let's verify if the mock was regenerated correctly:
✅ Verification successful
Mock implementation correctly matches the interface definition
The mock file is auto-generated by mockery v2.50.0 and correctly implements the PricesKeeper interface from protocol/x/prices/types/types.go
. The method signatures in the mock match the interface definition, using the correct types (e.g., types.Context
from cosmos-sdk). No manual modifications are needed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the mock generation setup and interface definition
# Check if there's a mockery config file
fd -t f ".mockery.(yaml|yml)"
# Find the interface definition that this mock implements
rg -l "type PricesKeeper interface" -g "*.go"
Length of output: 490
Script:
#!/bin/bash
# Let's check the interface definition in prices module and verify mock alignment
rg "type PricesKeeper interface" -A 20 protocol/x/prices/types/types.go
# Also check if there are any mockery configuration files in the prices module
fd -t f ".mockery.(yaml|yml)" protocol/x/prices/
# Check the mock implementation to compare with interface
head -n 50 protocol/mocks/PricesKeeper.go
Length of output: 2469
protocol/daemons/slinky/client/price_fetcher_test.go (2)
Line range hint 20-140
: LGTM! Comprehensive test coverage
The test suite thoroughly covers both happy and error paths:
- Successful price fetching
- Error handling
- Edge cases (invalid pairs, non-parsable data)
- Empty responses
The test implementation follows best practices with proper mocking and assertions.
10-10
: Verify QueryPricesResponse compatibility after package migration
The import path change from connect/v2
to slinky
is aligned with the PR objectives. However, we should verify that the QueryPricesResponse
type maintains the same structure and behavior.
✅ Verification successful
Based on the search results, I can now provide a conclusive response about the QueryPricesResponse compatibility:
Import change is safe and maintains compatibility
The search results show that the QueryPricesResponse type maintains the same structure across its usage:
- It consistently contains a
Prices
field of typemap[string]string
- It includes a
Timestamp
field of typetime.Time
- The type is used consistently in both test files and implementation code
- All usages follow the same pattern and structure, indicating no breaking changes
The import path change from connect/v2
to slinky
is a safe refactor that doesn't affect the type's structure or behavior.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Compare the QueryPricesResponse type definition between connect v2 and slinky
# to ensure compatibility
# Search for QueryPricesResponse type definition
ast-grep --pattern 'type QueryPricesResponse struct {
$$$
}'
Length of output: 64
Script:
#!/bin/bash
# Let's try a different approach to find the QueryPricesResponse type and its usage
# First, let's find all files containing QueryPricesResponse
rg -l "QueryPricesResponse"
# Then, let's see the actual usage context with surrounding lines
rg -A 5 -B 5 "QueryPricesResponse"
# Also search for any proto definitions
fd -e proto | xargs rg "QueryPricesResponse"
Length of output: 11175
protocol/daemons/slinky/client/market_pair_fetcher.go (4)
17-17
: LGTM: Import path updated correctly.
The import path change from connect/v2
to slinky
aligns with the PR objectives.
Line range hint 20-29
: LGTM: Well-designed interface with clear documentation.
The interface provides a clean abstraction for market pair fetching with proper lifecycle management methods and type consistency.
Line range hint 34-37
: LGTM: Proper concurrency handling with RWMutex.
The implementation correctly uses RWMutex to protect shared state, with appropriate lock granularity and consistent unlock patterns.
Also applies to: 75-83, 89-107
17-17
: Verify complete migration to slinky package.
Let's ensure all references to the old connect package have been updated.
✅ Verification successful
Based on the search results, I can now provide a final response:
Migration to slinky package is complete and correct.
The codebase shows no references to the old connect package (github.com/skip-mev/connect/v2/pkg/types
), and the new slinky package (slinkytypes
) is properly integrated and used throughout the codebase, particularly in:
- Market pair and currency pair handling
- Price fetching and market data operations
- Protocol types and interfaces
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining references to the old connect package
rg -l "github.com/skip-mev/connect/v2/pkg/types" || echo "No references found"
# Search for any potential type mismatches between connect and slinky
ast-grep --pattern 'slinkytypes.$_'
Length of output: 65808
Script:
#!/bin/bash
# Search for any remaining references to the old connect package in Go files
rg -t go "github.com/skip-mev/connect/v2/pkg/types"
# Search for usage of slinkytypes package to verify migration
rg -t go "slinkytypes\." -A 2
Length of output: 65620
protocol/app/upgrades/v6.0.0/upgrade.go (2)
Line range hint 143-167
: Verify completeness of upgrade migrations.
Please ensure that all necessary migrations are included in the upgrade handler. Consider:
- Data schema changes
- State migrations
- Cleanup of deprecated data
✅ Verification successful
Upgrade handler migrations are complete and well-structured
The v6.0.0 upgrade handler includes all necessary migrations and state changes:
- Cleanup: Removes deprecated stateful FOK orders from state
- Data Migration: Migrates prices data to market map
- State Initialization: Sets up market map parameters and initializes rev share module state
- Parameter Updates: Configures market map parameters with proper authorities
The implementation follows a clear pattern of cleaning up deprecated features, migrating data, and initializing new module states. No issues were found in the deprecated items check that would require additional migrations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential missing migrations
# Look for deprecated types or fields that might need migration
echo "Checking for deprecated items..."
rg --type go "// Deprecated:"
# Look for TODO comments related to migrations
echo "Checking for pending migration tasks..."
rg --type go "TODO.*migrat"
# Look for old connect/v2 related types that might need cleanup
echo "Checking for old connect/v2 types..."
rg --type go "connect\..*Type"
Length of output: 5701
Script:
#!/bin/bash
# Let's check for any state migrations or cleanup in the v6.0.0 upgrade handler and related files
# Check the v6.0.0 upgrade handler implementation
echo "Checking v6.0.0 upgrade implementation..."
rg -A 10 "func.*removeStatefulFOKOrders" protocol/app/upgrades/v6.0.0/
# Check for any migration functions in the upgrade
echo "Checking migration functions..."
rg -A 10 "func.*migrate" protocol/app/upgrades/v6.0.0/
# Look for any state initialization functions
echo "Checking initialization functions..."
rg -A 10 "func.*init.*State" protocol/app/upgrades/v6.0.0/
# Check for any params or state related changes in the upgrade
echo "Checking for state/params changes..."
rg -A 10 "func.*set.*Params" protocol/app/upgrades/v6.0.0/
Length of output: 4062
17-20
: Verify compatibility of slinky package imports.
The migration from connect/v2
to slinky
package imports looks correct. However, we should verify that all imported types and interfaces remain compatible across the codebase.
✅ Verification successful
Import changes from connect/v2 to slinky are compatible and correctly implemented
The verification shows that:
- No remaining
connect/v2
imports exist in the codebase - The
MarketMapKeeper
interfaces in different modules are consistent with the usage in the upgrade handler - The migration code properly converts the existing market parameters to the new slinky format using
dydx.ConvertMarketParamsToMarketMap
- The upgrade handler correctly uses the imported types from slinky for both market parameters and market map operations
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining connect/v2 imports and verify interface compatibility
# Check for any remaining connect/v2 imports
echo "Checking for remaining connect/v2 imports..."
rg --type go "github.com/skip-mev/connect/v2"
# Check for potential interface mismatches by looking for related type definitions
echo "Checking for potential interface changes..."
rg --type go "type.*Keeper interface" | grep -i "market"
Length of output: 521
Script:
#!/bin/bash
# Let's verify the interface compatibility by checking the MarketMapKeeper interface definitions
# and their usage in the upgrade handler
# First, check the MarketMapKeeper interface definitions
echo "=== MarketMapKeeper interface in expected_keepers.go files ==="
for file in $(rg --type go -l "type MarketMapKeeper interface"); do
echo "=== $file ==="
ast-grep --pattern 'type MarketMapKeeper interface {
$$$
}' "$file"
done
# Now check how these interfaces are used in the upgrade handler
echo -e "\n=== Usage in upgrade handler ==="
rg -A 10 "MarketMapKeeper" protocol/app/upgrades/v6.0.0/upgrade.go
# Check the actual implementation in slinky
echo -e "\n=== Checking slinky marketmap keeper implementation ==="
ast-grep --pattern 'type Keeper struct {
$$$
}'
Length of output: 3383
Script:
#!/bin/bash
# Let's verify the actual usage of the imported slinky types in the upgrade handler
# and check if they match the interface requirements
echo "=== Checking upgrade handler implementation ==="
cat protocol/app/upgrades/v6.0.0/upgrade.go
echo -e "\n=== Checking slinky marketmap types ==="
# Check the actual type definitions from slinky that we're importing
rg -A 5 "type Market struct"
# Check if there are any compilation errors or type mismatches reported
echo -e "\n=== Checking for potential type errors ==="
rg -B 2 -A 2 "dydxtypes\." protocol/app/upgrades/v6.0.0/upgrade.go
rg -B 2 -A 2 "marketmaptypes\." protocol/app/upgrades/v6.0.0/upgrade.go
Length of output: 7361
protocol/testing/e2e/gov/perpetuals_test.go (1)
18-19
: Update import paths to slinky
packages
The import paths have been updated to point to the slinky
packages. Ensure that all usages of these packages are updated accordingly, and verify that there are no lingering references to the old connect
package paths.
Run the following script to find any remaining references to github.com/skip-mev/connect/v2
:
✅ Verification successful
Based on the search results, I can now generate the final response since we have sufficient information. The search shows that the imports from slinky
are consistently used across the codebase, and there are no references to the old connect
package paths.
No action needed - imports are correctly updated
The imports have been properly updated to use the slinky
packages, and there are no lingering references to the old github.com/skip-mev/connect/v2
package paths in the codebase. The changes are consistent with the rest of the codebase's usage of slinky packages.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for any references to the old `connect` package paths
rg 'github.com/skip-mev/connect/v2' -t go
Length of output: 41
Script:
#!/bin/bash
# Let's verify the actual usage of these imports in the file and check for any related imports
# First, let's see the content of the test file to understand the context
cat protocol/testing/e2e/gov/perpetuals_test.go
# Also search for any other slinky-related imports across the codebase
rg "github.com/skip-mev/slinky" -t go
Length of output: 32357
protocol/x/clob/keeper/process_operations.go (1)
755-758
: Ensuring correct error handling with Wrapf
The use of errorsmod.Wrapf
enhances error messages by allowing formatted strings, improving the clarity and usefulness of the error output.
🧰 Tools
🪛 golangci-lint (1.62.2)
757-757: printf: non-constant format string in call to cosmossdk.io/errors.Wrapf
(govet)
protocol/app/vote_extensions/expected_keepers.go (1)
12-12
: Update method signature to use sdk.Context
The method signature of GetCurrencyPairFromID
now uses sdk.Context
instead of context.Context
. Ensure that all implementations of the PricesKeeper
interface have been updated to match this change to prevent any runtime issues.
Run the following script to find implementations that may still use context.Context
:
✅ Verification successful
All implementations correctly use sdk.Context
The verification shows that there are only two implementations of GetCurrencyPairFromID
:
- The main implementation in
protocol/x/prices/keeper/slinky_adapter.go
correctly usessdk.Context
- The mock implementation in
protocol/mocks/PricesKeeper.go
usestypes.Context
which is expected for test mocks
Additionally, the interface definition in protocol/app/vote_extensions/expected_keepers.go
correctly specifies sdk.Context
. No implementations were found using context.Context
.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find implementations of `GetCurrencyPairFromID` using `context.Context`
rg '^func.*GetCurrencyPairFromID\(ctx context\.Context' -t go
Length of output: 63
Script:
#!/bin/bash
# Let's first find all implementations of GetCurrencyPairFromID regardless of context type
rg "func.*GetCurrencyPairFromID.*Context" -t go
# Also search for the interface definition to understand the contract
rg "type.*PricesKeeper.*interface" -A 10 -t go
Length of output: 8991
protocol/x/prices/types/expected_keepers.go (2)
6-6
: LGTM: Import path updated correctly
The import path has been properly updated from github.com/skip-mev/connect/v2/x/marketmap/types
to github.com/skip-mev/slinky/x/marketmap/types
.
35-38
: Verify context type consistency across keeper interfaces
While the MarketMapKeeper
interface methods now use sdk.Context
, other keeper interfaces (AccountKeeper
, BankKeeper
) still use context.Context
. This inconsistency could lead to confusion.
protocol/x/prices/types/types.go (2)
6-7
: LGTM: Import paths updated correctly
The import paths have been properly updated to use the slinky package:
slinkytypes
from connect v2 to slinkyoracletypes
from connect v2 to slinky
55-57
: LGTM: Context type consistently updated
The method signatures have been properly updated to use sdk.Context
consistently across all methods in the PricesKeeper
interface.
protocol/app/vote_extensions/oracle_client_test.go (1)
9-9
: LGTM: Import path updated correctly
The import path has been properly updated from github.com/skip-mev/connect/v2/pkg/types
to github.com/skip-mev/slinky/pkg/types
.
protocol/lib/ante/nested_msg.go (2)
36-38
: LGTM: New IsSlinkyMsg function matches removed IsConnectMsg
The implementation correctly mirrors the previous IsConnectMsg function's logic.
15-15
: LGTM: Prefix constant updated for slinky migration
The constant has been correctly renamed from CONNECT_MSG_PREFIX to SLINKY_MSG_PREFIX as part of the migration.
Let's verify no references to the old prefix remain:
✅ Verification successful
No remaining references to old connect prefix, migration is complete
The search results confirm that:
- There are no remaining references to the old "CONNECT_MSG_PREFIX" or "/connect" prefix
- The new "SLINKY_MSG_PREFIX" is correctly used in the codebase
- The prefix constant is used consistently in the
IsSlinkyMsg
function for message type validation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining references to the old connect prefix
rg -i "connect_msg_prefix|/connect" --type go
Length of output: 47
Script:
#!/bin/bash
# Let's verify all usages of the new prefix to ensure consistency
rg -i "slinky_msg_prefix|/slinky" --type go
# Also search for any message prefix related constants or strings
rg -i "msg_prefix|prefix.*=.*\"/" --type go
Length of output: 18294
protocol/x/listing/types/expected_keepers.go (2)
13-13
: LGTM: Import path updated for slinky migration
The marketmaptypes import path has been correctly updated from connect to slinky.
18-21
: LGTM: Context type consistently updated in method signatures
All method signatures have been consistently updated to use sdk.Context instead of context.Context.
Let's verify all context types have been updated:
Also applies to: 44-46, 49-51
✅ Verification successful
Let me analyze the results. The search shows that context.Context
is still being used in several files, but looking at the patterns:
- Most occurrences are in generated protobuf files (*.pb.go)
- Some occurrences are in expected keeper interfaces
- Some occurrences are in test files
- Some occurrences are in gRPC handlers
Let's verify if there are any non-generated, non-test, non-gRPC files that still use context.Context by filtering out these patterns:
After analyzing the results, I can see that context.Context
is still being used in several legitimate places:
- Generated protobuf files (*.pb.go)
- Mock files for testing
- Interface definitions in expected_keepers.go files
- gRPC/API related code
- Module lifecycle methods (BeginBlock, EndBlock, etc.)
- Daemon and client implementations
The usage of context.Context
in these files is correct and expected because:
- Protobuf generated code needs to use
context.Context
for gRPC compatibility - Interface definitions often need to match external dependencies
- Module lifecycle methods follow Cosmos SDK conventions
- Client/daemon code interacts with external services
No issues found: Context types are being used appropriately
The review comment was correct in approving the change. The codebase maintains consistent and appropriate usage of context types, with sdk.Context
used in the core blockchain logic and context.Context
preserved where needed for external integrations and generated code.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining context.Context usage
rg "context\.Context" --type go
Length of output: 68438
Script:
#!/bin/bash
# Search for context.Context excluding generated files, test files and gRPC handlers
rg "context\.Context" --type go \
--glob '!*.pb.go' \
--glob '!*.pb.gw.go' \
--glob '!*_test.go' \
--glob '!*grpc_*.go' \
--glob '!*msg_server*.go'
Length of output: 65771
protocol/app/ante/replay_protection.go (1)
89-89
: LGTM: Error wrapping updated to use formatted strings
The change from Wrap
to Wrapf
maintains the error message while improving consistency with the codebase's error handling patterns.
protocol/x/prices/keeper/slinky_adapter.go (2)
10-11
: LGTM: Import paths updated correctly
The import paths have been correctly updated from connect
to slinky
package, aligning with the PR objective.
38-38
: LGTM: Improved error logging
Good improvement in error logging by including the error context with the "CurrencyPairFromString" message.
protocol/app/process/slinky_market_price_decoder.go (1)
7-7
: LGTM: Import path updated correctly
The import path has been correctly updated from connect
to slinky
package, maintaining the same functionality.
protocol/x/prices/keeper/market_param.go (1)
45-55
: LGTM: Improved error handling with formatted messages
Good improvement in error handling by switching to errorsmod.Wrapf
for better formatted error messages in the following cases:
- Market parameter pair already exists
- Market pair conversion failure
- Ticker not found in market map
protocol/testutil/msgs/nested_msgs.go (2)
13-13
: LGTM: Import path updated to use slinky package.
The import path change from connect to slinky is consistent with the PR objectives.
127-131
: LGTM: New slinky message and transaction bytes added.
The new message variable and its transaction bytes follow the established pattern in the test suite.
protocol/docker-compose.yml (2)
123-128
: LGTM: Environment variables updated for slinky configuration.
All provider-specific environment variables have been updated with the new SLINKY_CONFIG prefix.
118-121
: LGTM: Service configuration updated for slinky.
The service has been properly renamed and configured to use the slinky-sidecar image with the correct entrypoint command.
protocol/x/prices/keeper/market.go (2)
23-27
: LGTM: Context type updated and error handling improved.
The changes improve error handling by using errorsmod.Wrapf
for better error messages while maintaining the existing logic.
Also applies to: 43-45, 54-57, 62-65, 70-73
Line range hint 133-137
: LGTM: Error handling improved in GetExponent.
The error handling has been enhanced with errorsmod.Wrapf
for better error messages.
protocol/x/delaymsg/keeper/delayed_message.go (1)
191-194
: LGTM: Improved error handling format
The switch from errorsmod.Wrap
to errorsmod.Wrapf
enhances error message clarity while maintaining the same error types.
Also applies to: 204-207
protocol/app/ante/market_update.go (2)
22-22
: LGTM: Aligned context type with SDK conventions
The change from context.Context
to sdk.Context
in the GetAllMarkets
method signature follows Cosmos SDK conventions.
6-6
: Verify the impact of package migration
The change from connect
to slinky
package needs verification across the codebase to ensure all related imports and types are updated consistently.
Also applies to: 11-11
✅ Verification successful
Based on the results, I can generate the final response as we have comprehensive information about the imports. The grep results show that:
- There are no remaining imports of
github.com/skip-mev/connect/v2
- All imports consistently use the
github.com/skip-mev/slinky
package with various submodules
Package migration is complete and consistent
The migration from connect
to slinky
package has been completed successfully. All imports across the codebase are consistently using the slinky
package, and there are no remaining references to the old connect
package.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify all imports have been updated from connect to slinky
# Check for any remaining connect imports
echo "Checking for remaining connect imports..."
rg "github.com/skip-mev/connect/v2"
# Check for consistency in slinky imports
echo "Checking slinky import usage..."
rg "github.com/skip-mev/slinky"
Length of output: 12817
protocol/mocks/Makefile (1)
7-7
: LGTM: Mock generation aligned with package migration
The changes correctly update the version retrieval and mock generation paths to use the slinky package instead of connect.
Also applies to: 64-64
protocol/x/listing/keeper/listing.go (1)
20-20
: LGTM: Import path updated correctly
The import path change from connect
to slinky
aligns with the PR objective of downgrading to slinky v2.
protocol/lib/ante/nested_msg_test.go (4)
25-25
: LGTM: Error variable added for Slinky messages
The new error variable properly handles invalid nested Slinky messages.
110-124
: LGTM: Test coverage added for invalid Slinky messages
The test function properly validates that non-Slinky messages are correctly identified.
127-137
: LGTM: Test coverage added for valid Slinky messages
The test function properly validates Slinky messages.
177-180
: LGTM: Test case added for invalid Slinky messages in MsgExec
The test case properly validates that Slinky messages are not allowed in MsgExec.
protocol/app/msgs/normal_msgs_test.go (1)
242-255
: LGTM: Slinky marketmap messages properly added
The test has been updated to include all necessary Slinky marketmap message types, maintaining the expected format and ordering.
✅ Verification successful
Slinky marketmap messages are properly integrated
The verification confirms that the Slinky marketmap messages are correctly integrated into the system:
- The messages are properly registered in
app/msgs/normal_msgs.go
andapp/msgs/all_msgs.go
- The marketmap module is properly imported and initialized in the app (
app/app.go
,app/basic_manager/basic_manager.go
) - The messages are used consistently across various components (prices, listing, perpetuals modules)
- The version change from v2 to v1 is consistent with the imports using
slinky.marketmap.v1
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify that all Slinky message types are properly registered in the app
rg -l "RegisterInterfaces.*slinky\.marketmap\.v1\."
Length of output: 53
Script:
#!/bin/bash
# Let's try a broader search for Slinky marketmap message registration
rg -l "RegisterInterfaces.*marketmap"
# Also search for any marketmap message type definitions
rg -l "type.*Msg.*marketmap"
# And check for proto definitions
fd "marketmap.*\.proto$"
Length of output: 97
Script:
#!/bin/bash
# Let's check for any Slinky or marketmap related imports and registrations
rg -A 5 "slinky.*marketmap"
# Also check for any proto imports related to marketmap
rg "import.*marketmap"
# Check the app.go or similar files for module registration
fd -e go -x grep -l "marketmap"
Length of output: 24304
protocol/x/prices/keeper/market_param_test.go (1)
9-9
: LGTM: Import path updated correctly.
The import path has been correctly updated from connect to slinky as part of the library transition.
protocol/daemons/flags/flags.go (1)
7-7
: LGTM: Import path updated correctly.
The import path has been correctly updated from connect to slinky while maintaining the same configuration structure and values.
protocol/app/msgs/normal_msgs.go (2)
26-26
: LGTM: Import path and message map updated correctly.
The changes correctly transition from connect to slinky:
- Import path updated appropriately
- Message map merged correctly with the new slinky messages
Also applies to: 31-31
270-283
: Verify impact of marketmap version change.
The transition from /connect.marketmap.v2
to /slinky.marketmap.v1
represents a version downgrade. Please ensure:
- All message types from v2 have equivalent functionality in v1
- Clients are updated to handle the new message paths
- No breaking changes in the message structures
protocol/app/msgs/all_msgs.go (1)
396-409
: LGTM! Verify message compatibility.
The migration from connect.marketmap.v2 to slinky.marketmap.v1 messages is consistent with the PR objective. The message types are properly defined and follow the same pattern.
Run the following script to verify no references to the old connect messages remain:
✅ Verification successful
Let me check the content of these files to ensure the migration is complete and consistent.
Migration to slinky.marketmap.v1 is complete and consistent
The verification shows that:
- No references to the old
connect.marketmap.v2
remain in the codebase - All marketmap-related messages are consistently using the new
slinky.marketmap.v1
namespace - The messages are properly defined in all relevant files (normal_msgs.go, normal_msgs_test.go, and all_msgs.go)
- The implementation includes proper type definitions and imports from
github.com/skip-mev/slinky/x/marketmap/types
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to connect.marketmap.v2 messages
# that might have been missed during the migration.
echo "Checking for any remaining references to connect.marketmap.v2..."
rg -l "connect\.marketmap\.v2\." || true
echo "Verifying all slinky.marketmap.v1 message imports are updated..."
rg -l "slinky\.marketmap\.v1\." || true
Length of output: 454
Script:
#!/bin/bash
# Check the content of files that reference slinky.marketmap.v1
echo "=== Content of normal_msgs_test.go ==="
rg -A 5 -B 5 "slinky\.marketmap\.v1" protocol/app/msgs/normal_msgs_test.go
echo -e "\n=== Content of normal_msgs.go ==="
rg -A 5 -B 5 "slinky\.marketmap\.v1" protocol/app/msgs/normal_msgs.go
# Let's also verify there are no mixed references or partial migrations
echo -e "\n=== Checking for any 'marketmap' references to ensure complete migration ==="
rg "marketmap" protocol/app/msgs/
Length of output: 6403
protocol/app/ante/market_update_test.go (1)
17-18
: LGTM! Import paths updated correctly.
The import paths have been properly updated from connect to slinky while preserving all test functionality.
protocol/go.mod (2)
50-53
: Verify impact of cosmossdk.io module downgrades.
Several Cosmos SDK modules have been downgraded:
cosmossdk.io/tools/confix
from v0.1.2 to v0.1.1cosmossdk.io/x/evidence
from v0.1.1 to v0.1.0cosmossdk.io/x/feegrant
from v0.1.1 to v0.1.0
Ensure these downgrades don't introduce compatibility issues.
✅ Verification successful
Based on the results, I can now generate a final response since we have clear evidence of how these packages are used in the codebase.
Minor version downgrades appear safe based on usage patterns
The downgraded modules are used in standard ways:
evidence
module is imported for basic keeper and typesfeegrant
module is used for standard keeper and module initializationconfix
is only used for importing the command package in the root command
These are basic functionalities that are unlikely to have breaking changes in minor version downgrades. The usage patterns show standard integration without any custom or advanced features that might be affected by the version changes.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for breaking changes between versions
# Search for usage of potentially changed APIs
rg -l "cosmossdk.io/tools/confix|cosmossdk.io/x/evidence|cosmossdk.io/x/feegrant"
# Check imported types and methods from these packages
ast-grep --pattern 'import $_ "$PKG"' --pattern-includes PKG="cosmossdk.io/tools/confix|cosmossdk.io/x/evidence|cosmossdk.io/x/feegrant"
Length of output: 669
Script:
#!/bin/bash
# Let's check the actual usage of these packages in the codebase
# Check for evidence module usage
rg -A 5 "x/evidence" protocol/app/app.go
# Check for feegrant module usage
rg -A 5 "x/feegrant" protocol/app/app.go
# Check for confix usage
rg -A 5 "tools/confix" protocol/app/app.go protocol/cmd/dydxprotocold/cmd/root.go
# Check go.mod history to understand the version changes
git diff HEAD~1 protocol/go.mod
Length of output: 1342
72-72
: Verify the slinky dependency version.
The PR replaces github.com/skip-mev/connect/v2
with github.com/skip-mev/slinky
at a specific commit hash. Ensure this commit hash is from a stable release branch.
✅ Verification successful
The slinky dependency commit appears to be a recent security fix
The commit (ab2537f1a1f2) from December 12, 2024:
- Contains a backported security fix for
x/crypto
package - Is more recent than the latest release (v2.1.2 from October 29, 2024)
- Represents an important security update
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the slinky dependency commit and check for any known issues
# Check the commit details
gh api repos/skip-mev/slinky/commits/ab2537f1a1f2 --jq '.commit.message'
# Check for open issues mentioning this commit
gh api search/issues -X GET -f q="repo:skip-mev/slinky ab2537f1a1f2 is:issue is:open" --jq '.items[].title'
Length of output: 578
Script:
#!/bin/bash
# Let's verify if this is from a release branch and check the commit's timeline
# Check if the commit is part of any release tags
gh api repos/skip-mev/slinky/tags --jq '.[] | select(.commit.sha == "ab2537f1a1f2" or .commit.sha | startswith("ab2537f1a1f2")) | .name'
# Get the latest release tag and its date
gh api repos/skip-mev/slinky/releases/latest --jq '[.tag_name, .published_at]'
# Get more context about the commit
gh api repos/skip-mev/slinky/commits/ab2537f1a1f2 --jq '[.sha, .commit.author.date, .parents[].sha]'
Length of output: 531
protocol/app/upgrades/v6.0.0/constants.go (2)
Line range hint 31-1000
: LGTM! Market configurations look correct.
The market configurations have been properly updated to use the new slinky types. The structure and values remain unchanged, maintaining compatibility while using the new package.
5-6
: Verify all imports are updated consistently.
The import paths have been updated from github.com/skip-mev/connect/v2
to github.com/skip-mev/slinky
. Ensure all other files in the codebase have been updated consistently.
✅ Verification successful
Based on the results from the shell scripts, I can generate the final response as there is sufficient information to verify the imports.
All imports have been updated consistently from connect/v2
to slinky
The search results show no remaining instances of github.com/skip-mev/connect/v2
imports in the codebase, while all references to the package are now consistently using github.com/skip-mev/slinky
. The migration appears to be complete and consistent across all files.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining connect v2 imports
# Search for any remaining connect v2 imports
rg "github.com/skip-mev/connect/v2"
# Search for slinky imports to verify consistent usage
rg "github.com/skip-mev/slinky"
Length of output: 12651
protocol/daemons/pricefeed/client/price_function/exchange_error.go
Outdated
Show resolved
Hide resolved
protocol/go.mod
Outdated
@@ -69,7 +69,7 @@ require ( | |||
github.com/pelletier/go-toml v1.9.5 | |||
github.com/rs/zerolog v1.33.0 | |||
github.com/shopspring/decimal v1.3.1 | |||
github.com/skip-mev/connect/v2 v2.2.1 | |||
github.com/skip-mev/slinky v1.0.14-0.20241212193714-ab2537f1a1f2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Upgrade to released version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
protocol/testing/testnet-local/local.sh (2)
Line range hint
178-193
: Add error handling and make Prometheus address configurableThe function needs several improvements:
- Missing input parameter validation
- No error handling for dasel commands
- Hardcoded Prometheus server address may not work in all environments
Apply this diff to improve the implementation:
edit_config() { + if [ -z "$1" ] || [ ! -d "$1" ]; then + echo "Error: Config folder not provided or does not exist" + exit 1 + } CONFIG_FOLDER=$1 + PROMETHEUS_ADDR=${PROMETHEUS_ADDR:-"localhost:8001"} # Disable pex - dasel put -t bool -f "$CONFIG_FOLDER"/config.toml '.p2p.pex' -v 'false' + if ! dasel put -t bool -f "$CONFIG_FOLDER"/config.toml '.p2p.pex' -v 'false'; then + echo "Error: Failed to disable pex" + exit 1 + fi # Default `timeout_commit` is 999ms. For local testnet, use a larger value to make # block time longer for easier troubleshooting. - dasel put -t string -f "$CONFIG_FOLDER"/config.toml '.consensus.timeout_commit' -v '5s' + if ! dasel put -t string -f "$CONFIG_FOLDER"/config.toml '.consensus.timeout_commit' -v '5s'; then + echo "Error: Failed to set timeout_commit" + exit 1 + fi # Enable Slinky Prometheus metrics - dasel put -t bool -f "$CONFIG_FOLDER"/app.toml '.oracle.metrics_enabled' -v 'true' - dasel put -t string -f "$CONFIG_FOLDER"/app.toml '.oracle.prometheus_server_address' -v 'localhost:8001' + if ! dasel put -t bool -f "$CONFIG_FOLDER"/app.toml '.oracle.metrics_enabled' -v 'true'; then + echo "Error: Failed to enable metrics" + exit 1 + fi + if ! dasel put -t string -f "$CONFIG_FOLDER"/app.toml '.oracle.prometheus_server_address' -v "$PROMETHEUS_ADDR"; then + echo "Error: Failed to set Prometheus address" + exit 1 + fi }
Line range hint
178-178
: Track the removal of this functionThe TODO comment indicates this function should be removed (DEC-1894). Consider creating a GitHub issue to track this if one doesn't exist.
Would you like me to create a GitHub issue to track the removal of this function?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
protocol/testing/testnet-local/local.sh
(2 hunks)protocol/x/prices/keeper/market_param_test.go
(1 hunks)protocol/x/vest/types/vest_entry.go
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- protocol/x/prices/keeper/market_param_test.go
- protocol/x/vest/types/vest_entry.go
🔇 Additional comments (1)
protocol/testing/testnet-local/local.sh (1)
110-110
: Verify complete migration from connect to slinky
Let's ensure all references to the connect service have been updated to use slinky.
✅ Verification successful
Migration from connect to slinky appears complete
Based on the search results:
- The old
connect
service references are only found in:- Protocol metrics configuration (
prometheus.yml
) - Generated protobuf code and networking functions
- Redis/database connection functions
- Protocol metrics configuration (
- All price feed related functionality has been migrated to use the slinky service, with proper configurations and implementations in place.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to 'connect' service
# Search for any remaining references to connect service
echo "Searching for 'connect' references in configuration files..."
rg -i 'connect[0-9]?:' --type yaml --type toml
echo "Searching for 'connect' in function names and variables..."
rg -i '\bconnect\b' --type bash --type go
echo "Searching for 'connect' in comments and strings..."
rg -i 'connect' --type yaml --type toml --type bash --type go
Length of output: 739
Script:
#!/bin/bash
# Let's try a more comprehensive search without file type restrictions
# Search for connect references in all files
echo "Searching for connect service references..."
rg -i 'connect[0-9]?:'
echo "Searching for connect-related function calls and configurations..."
rg -i '\bconnect\b' -g '!*.md' -g '!*.txt'
# Specifically look for use_connect function which might have been replaced
echo "Searching for use_connect function..."
rg -i 'use_connect'
# Look for slinky-related configurations to ensure proper migration
echo "Searching for slinky references..."
rg -i 'slinky'
Length of output: 66076
use_slinky() { | ||
CONFIG_FOLDER=$1 | ||
# Enable slinky daemon | ||
dasel put -t bool -f "$CONFIG_FOLDER"/app.toml 'oracle.enabled' -v true | ||
dasel put -t string -f "$VAL_CONFIG_DIR"/app.toml 'oracle.oracle_address' -v 'connect0:8080' | ||
dasel put -t string -f "$VAL_CONFIG_DIR"/app.toml 'oracle.oracle_address' -v 'slinky0:8080' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix variable inconsistency and add error handling
The function has several issues that need to be addressed:
- Line 174 incorrectly uses
$VAL_CONFIG_DIR
instead of the passed parameter$CONFIG_FOLDER
- Missing input parameter validation
- No error handling for dasel commands
Apply this diff to fix the issues:
use_slinky() {
+ if [ -z "$1" ] || [ ! -d "$1" ]; then
+ echo "Error: Config folder not provided or does not exist"
+ exit 1
+ }
CONFIG_FOLDER=$1
# Enable slinky daemon
- dasel put -t bool -f "$CONFIG_FOLDER"/app.toml 'oracle.enabled' -v true
- dasel put -t string -f "$VAL_CONFIG_DIR"/app.toml 'oracle.oracle_address' -v 'slinky0:8080'
+ if ! dasel put -t bool -f "$CONFIG_FOLDER"/app.toml 'oracle.enabled' -v true; then
+ echo "Error: Failed to enable oracle daemon"
+ exit 1
+ fi
+ if ! dasel put -t string -f "$CONFIG_FOLDER"/app.toml 'oracle.oracle_address' -v 'slinky0:8080'; then
+ echo "Error: Failed to set oracle address"
+ exit 1
+ fi
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
use_slinky() { | |
CONFIG_FOLDER=$1 | |
# Enable slinky daemon | |
dasel put -t bool -f "$CONFIG_FOLDER"/app.toml 'oracle.enabled' -v true | |
dasel put -t string -f "$VAL_CONFIG_DIR"/app.toml 'oracle.oracle_address' -v 'connect0:8080' | |
dasel put -t string -f "$VAL_CONFIG_DIR"/app.toml 'oracle.oracle_address' -v 'slinky0:8080' | |
use_slinky() { | |
if [ -z "$1" ] || [ ! -d "$1" ]; then | |
echo "Error: Config folder not provided or does not exist" | |
exit 1 | |
} | |
CONFIG_FOLDER=$1 | |
# Enable slinky daemon | |
if ! dasel put -t bool -f "$CONFIG_FOLDER"/app.toml 'oracle.enabled' -v true; then | |
echo "Error: Failed to enable oracle daemon" | |
exit 1 | |
fi | |
if ! dasel put -t string -f "$CONFIG_FOLDER"/app.toml 'oracle.oracle_address' -v 'slinky0:8080'; then | |
echo "Error: Failed to set oracle address" | |
exit 1 | |
fi | |
} |
https://github.com/Mergifyio backport release/protocol/v8.x |
✅ Backports have been created
|
(cherry picked from commit a3aea35) # Conflicts: # protocol/docker-compose.yml
Changelist
Switch back from connect v2 to slinky v1 but with the new features in v2 sans the rename
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
Release Notes
New Features
sdk.Context
instead ofcontext.Context
.connect
toslinky
.Bug Fixes
Documentation
Chores
slinky
package structure.