Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: decouple Node releases from SQS #8886

Merged
merged 13 commits into from
Jan 10, 2025
Merged

chore: decouple Node releases from SQS #8886

merged 13 commits into from
Jan 10, 2025

Conversation

deividaspetraitis
Copy link
Member

@deividaspetraitis deividaspetraitis commented Dec 13, 2024

Closes: BE-658

What is the purpose of the change

Introduced changes decouples SQS deployment from Osmosis by removing sqsdomain module and moving its all relevant data structures to Osmosis repo.

Changes summary:

  • Moved sqsdomain contents to ingest/types
  • Updated import paths
  • Integrated ingest.proto into current code generation form proto files

Testing and Verifying

This change is already covered by existing tests:

  • Re-run existing unit tests on Node
  • Re-run existing unit/integration tests on SQS

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

@github-actions github-actions bot added the Stale label Dec 22, 2024
@github-actions github-actions bot closed this Dec 26, 2024
@deividaspetraitis deividaspetraitis self-assigned this Jan 7, 2025
@deividaspetraitis
Copy link
Member Author

Note: I am aware of failing Lint, Spell Check stages, will fix that other than thtat PR is ready for reviews.

@github-actions github-actions bot removed the Stale label Jan 8, 2025
@PaddyMc PaddyMc added the A:backport/v28.x backport patches to v28.x branch label Jan 9, 2025
Copy link
Collaborator

@PaddyMc PaddyMc left a comment

Choose a reason for hiding this comment

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

gg, one ask, it's kinda big tho

Copy link
Contributor

coderabbitai bot commented Jan 9, 2025

Walkthrough

This pull request introduces a comprehensive refactoring of the Osmosis ingest package, primarily focusing on migrating type definitions and import paths from the sqsdomain package to a new types package within the Osmosis repository. The changes span multiple files across the ingest subsystem, updating type references, method signatures, and import statements to use the new types package. The refactoring involves creating new type definitions, implementing custom JSON marshaling/unmarshaling methods, and establishing interfaces for pool-related functionality.

Changes

File Change Summary
ingest/indexer/service/indexer_streaming_service_test.go Updated import and variable types from sqsdomain to ingesttypes
ingest/sqs/domain/ingester.go Modified method signatures to use ingesttypes.PoolI and ingesttypes.TakerFeeMap
ingest/sqs/domain/mocks/* Updated method signatures and type references in mock implementations
ingest/sqs/pools/transformer/* Replaced sqsdomain imports with ingesttypes, updated method signatures and type references
ingest/types/ Added new package with comprehensive type definitions for pools, taker fees, and related structures
proto/osmosis/ingest/v1beta1/ingest.proto Introduced new protobuf service and message definitions for block processing
CHANGELOG.md Added entry for chore related to decoupling Node releases from SQS

Possibly related PRs

Suggested Labels

C:app-wiring, A:backport/v25.x

Suggested Reviewers

  • p0mvn
  • AlpinYukseloglu
  • PaddyMc

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68d02d3 and 352cfa1.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: go-split-test-files
  • GitHub Check: e2e
  • GitHub Check: check-proto
  • GitHub Check: Run golangci-lint
  • GitHub Check: Summary

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (16)
ingest/types/cosmwasmpool/alloy_transmuter.go (1)

20-20: Fix typo in comment: 'Tranmuter' should be 'Transmuter'

There's a spelling error in the comment on line 20. Correcting this improves code readability and aligns with standard terminology.

Apply this diff to fix the typo:

-// Tranmuter Alloyed Data, since v3.0.0
+// Transmuter Alloyed Data, since v3.0.0
ingest/types/cosmwasmpool/orderbook.go (3)

29-38: Consider using an explicit enum for OrderbookDirection and RoundingDirection

Currently, OrderbookDirection and RoundingDirection are defined as bool, which can be less intuitive and may lead to confusion. Using an explicit iota-based enum improves code clarity and type safety.

Apply this diff to define explicit enums:

 type OrderbookDirection int

 const (
-	BID OrderbookDirection = true
-	ASK OrderbookDirection = false
+	BID OrderbookDirection = iota
+	ASK
 )

 type RoundingDirection int

 const (
-	ROUND_UP   RoundingDirection = true
-	ROUND_DOWN RoundingDirection = false
+	ROUND_UP RoundingDirection = iota
+	ROUND_DOWN
 )

60-66: Simplify IterationStep method by removing redundant error return

The IterationStep method always returns a valid integer and never actually returns an error. Simplifying the method signature enhances readability.

Apply this diff to simplify the method:

-func (d *OrderbookDirection) IterationStep() (int, error) {
+func (d *OrderbookDirection) IterationStep() int {
 	if *d { // BID
-		return -1, nil
+		return -1
 	} else { // ASK
-		return 1, nil
+		return 1
 	}
 }

Update the calling function accordingly:

 func CalcAmountInToExhaustOrderbookLiquidity(directionIn OrderbookDirection, startingIndex int, ticks []OrderbookTick) (osmomath.BigDec, error) {
 	directionOut := directionIn.Opposite()

-	directionOutIterationStep, err := directionOut.IterationStep()
-	if err != nil {
-		return osmomath.ZeroBigDec(), err
-	}
+	directionOutIterationStep := directionOut.IterationStep()

123-130: Simplify GetStartTickIndex method by removing redundant error return

The GetStartTickIndex method does not return an error in any case. Removing the error return simplifies the code.

Apply this diff to update the method:

-func (d *OrderbookData) GetStartTickIndex(direction OrderbookDirection) (int, error) {
+func (d *OrderbookData) GetStartTickIndex(direction OrderbookDirection) int {
 	if direction == ASK {
-		return d.NextAskTickIndex, nil
+		return d.NextAskTickIndex
 	} else { // BID
-		return d.NextBidTickIndex, nil
+		return d.NextBidTickIndex
 	}
 }

Ensure any calls to this method are updated appropriately.

ingest/sqs/domain/mocks/grpc_client_mock.go (1)

5-5: Remove unused import of sqsdomain package

The sqsdomain package is imported but no longer used after the changes. Removing unused imports cleans up the code.

Apply this diff to remove the unused import:

 import (
 	"context"

-	"github.com/osmosis-labs/osmosis/v28/ingest/sqs/domain"
 	"github.com/osmosis-labs/osmosis/v28/ingest/types"
 )
ingest/types/passthroughdomain/passthrough_pools_data.go (1)

4-8: LGTM! Consider adding an interface.

The wrapper types are well-structured with proper JSON tags and clear documentation. The use of embedded structs and omitempty for optional fields is appropriate.

Consider defining an interface that both wrappers implement to enable generic handling of status-wrapped pool data:

type PoolDataStatusWrapper interface {
    IsStaleStatus() bool
    IsErrorStatus() bool
}

Also applies to: 11-15

ingest/types/errors.go (1)

13-19: Enhance error message with valid values.

The error message for invalid direction could be more helpful by explicitly stating the valid values.

Consider updating the error message to be more specific:

-	return fmt.Sprintf("orderbook pool direction (%d) is invalid; must be either -1 or 1", e.Direction)
+	return fmt.Sprintf("orderbook pool direction (%d) is invalid; valid values are: -1 (sell), 1 (buy)", e.Direction)
ingest/types/cosmwasmpool/errors.go (1)

5-13: Add validation for empty denom values.

Consider adding validation in the constructor or Error() method to handle empty denom values gracefully.

Example implementation:

func NewOrderbookUnsupportedDenomError(denom, quoteDenom, baseDenom string) OrderbookUnsupportedDenomError {
    if denom == "" {
        denom = "<empty>"
    }
    if quoteDenom == "" {
        quoteDenom = "<empty>"
    }
    if baseDenom == "" {
        baseDenom = "<empty>"
    }
    return OrderbookUnsupportedDenomError{
        Denom:      denom,
        QuoteDenom: quoteDenom,
        BaseDenom:  baseDenom,
    }
}
ingest/types/json/sqs_json.go (2)

4-4: Remove TODO comment

The TODO comment in the import statement should be removed or replaced with actual documentation.


28-34: Consider wrapping errors for better context

The implementation looks good, but consider wrapping errors with additional context to help with debugging. This is especially important since this is a core JSON package that will be used throughout the application.

 func Marshal(v interface{}) ([]byte, error) {
-	return jsonLib.Marshal(v)
+	b, err := jsonLib.Marshal(v)
+	if err != nil {
+		return nil, fmt.Errorf("json.Marshal: %w", err)
+	}
+	return b, nil
 }

 func Unmarshal(data []byte, v interface{}) error {
-	return jsonLib.Unmarshal(data, v)
+	if err := jsonLib.Unmarshal(data, v); err != nil {
+		return fmt.Errorf("json.Unmarshal: %w", err)
+	}
+	return nil
 }
ingest/types/passthroughdomain/pool_fees.go (1)

18-36: Add validation in UnmarshalJSON

Consider adding validation for required fields and numerical values in the UnmarshalJSON implementation.

 func (p *PoolFee) UnmarshalJSON(data []byte) error {
 	type Alias PoolFee
 	temp := &struct {
 		PoolID string `json:"pool_id"`
 		*Alias
 	}{
 		Alias: (*Alias)(p),
 	}

 	if err := json.Unmarshal(data, temp); err != nil {
 		return err
 	}

+	// Validate required fields
+	if temp.PoolID == "" {
+		return fmt.Errorf("pool_id is required")
+	}
+	
+	// Validate numerical values
+	if temp.Volume24h < 0 || temp.Volume7d < 0 {
+		return fmt.Errorf("volume cannot be negative")
+	}
+	if temp.FeesSpent24h < 0 || temp.FeesSpent7d < 0 {
+		return fmt.Errorf("fees spent cannot be negative")
+	}
+
 	p.PoolID = temp.PoolID

 	return nil
 }
ingest/types/passthroughdomain/pool_apr.go (1)

32-56: Consider enhancing error handling with more context.

While the error handling is good, consider providing more context in the error message:

-    return fmt.Errorf("invalid pool_id: %w", err)
+    return fmt.Errorf("failed to parse pool_id '%s': %w", temp.PoolID, err)
ingest/types/taker_fee.go (1)

58-83: Remove unnecessary newlines.

There are unnecessary leading newlines in several functions.

-func (tfm TakerFeeMap) Has(denom0, denom1 string) bool {
-
+func (tfm TakerFeeMap) Has(denom0, denom1 string) bool {
     _, found := tfm[DenomPair{Denom0: denom0, Denom1: denom1}]
     return found
 }

-func (tfm TakerFeeMap) GetTakerFee(denom0, denom1 string) osmomath.Dec {
-
+func (tfm TakerFeeMap) GetTakerFee(denom0, denom1 string) osmomath.Dec {
     takerFee, found := tfm[DenomPair{Denom0: denom0, Denom1: denom1}]

-func (tfm TakerFeeMap) SetTakerFee(denom0, denom1 string, takerFee osmomath.Dec) {
-
+func (tfm TakerFeeMap) SetTakerFee(denom0, denom1 string, takerFee osmomath.Dec) {
     tfm[DenomPair{Denom0: denom0, Denom1: denom1}] = takerFee
 }
🧰 Tools
🪛 GitHub Check: Run golangci-lint

[failure] 58-58:
unnecessary leading newline (whitespace)


[failure] 67-67:
unnecessary leading newline (whitespace)


[failure] 80-80:
unnecessary leading newline (whitespace)

proto/osmosis/ingest/v1beta1/ingest.proto (3)

7-12: Enhance service documentation

While the service purpose is clear, consider adding more details to the ProcessBlock RPC documentation:

  • Expected behavior on success/failure
  • Any rate limiting or size constraints
  • Whether it's idempotent
 // SQSIngester is a a data ingester from an Osmosis node to
 // the sidecar query server.
 service SQSIngester {
-  // ProcessBlock processes a block from the Osmosis node.
+  // ProcessBlock processes a block from the Osmosis node.
+  // It is idempotent and can be safely retried.
+  // Returns an empty response on success, or a gRPC error on failure.
   rpc ProcessBlock(ProcessBlockRequest) returns (ProcessBlockReply) {}
 }

15-26: Consider schema evolution and validation strategy

The use of bytes fields for all models makes the schema opaque and harder to validate. Consider:

  1. Using specific message types instead of bytes for better schema evolution
  2. Adding version fields to help with future migrations
  3. Adding pool type enum to explicitly check tick_model validity

Also, note that in protobuf, fields are never nil - they're either present or absent. The comment about tick_model being nil should be updated.

 message PoolData {
+  // The version of the pool data format.
+  uint32 version = 1;
+
+  // The type of the pool.
+  enum PoolType {
+    POOL_TYPE_UNSPECIFIED = 0;
+    POOL_TYPE_CONCENTRATED = 1;
+    POOL_TYPE_STANDARD = 2;
+  }
+  PoolType pool_type = 2;
+
   // ChainModel is the chain representation model of the pool.
-  bytes chain_model = 1;
+  bytes chain_model = 3;

   // SqsModel is additional pool data used by the sidecar query server.
-  bytes sqs_model = 2;
+  bytes sqs_model = 4;

   // TickModel is the tick data of a concentrated liquidity pool.
-  // This field is only valid and set for concentrated pools. It is nil
+  // This field is only present for concentrated pools and should be ignored
   // otherwise.
-  bytes tick_model = 3;
+  bytes tick_model = 5;
 }

31-43: Add field constraints and consider structured taker fees

  1. Consider adding field validation:

    • Non-zero block height
    • Maximum size for taker_fees_map
    • Maximum number of pools
  2. Similar to PoolData, consider using a structured message for taker_fees_map instead of bytes.

  3. Consider adding metadata to ProcessBlockReply for monitoring/debugging:

    • Number of pools processed
    • Processing timestamp
    • Status details
 message ProcessBlockRequest {
   // block height is the height of the block being processed.
-  uint64 block_height = 1;
+  uint64 block_height = 1 [(validate.rules).uint64.gt = 0];
   // taker_fees_map is the map of taker fees for the block.
-  bytes taker_fees_map = 2;
+  TakerFeesMap taker_fees_map = 2;
   // pools in the block.
-  repeated PoolData pools = 3;
+  repeated PoolData pools = 3 [(validate.rules).repeated.max_items = 1000];
 }

+// TakerFeesMap represents the taker fees collected in a block
+message TakerFeesMap {
+  message Fee {
+    string denom = 1;
+    string amount = 2 [(validate.rules).string.pattern = "^[0-9]+$"];
+  }
+  map<string, Fee> fees = 1;
+}

 // The response after completing the block processing.
-message ProcessBlockReply {}
+message ProcessBlockReply {
+  // Number of pools successfully processed
+  uint32 processed_pools_count = 1;
+  // Server-side processing timestamp
+  google.protobuf.Timestamp processed_at = 2;
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2beed45 and d4e0297.

⛔ Files ignored due to path filters (3)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • ingest/types/proto/types/ingest.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
📒 Files selected for processing (27)
  • ingest/indexer/service/indexer_streaming_service_test.go (4 hunks)
  • ingest/sqs/domain/ingester.go (3 hunks)
  • ingest/sqs/domain/mocks/grpc_client_mock.go (2 hunks)
  • ingest/sqs/domain/mocks/pool_transformer_mock.go (1 hunks)
  • ingest/sqs/pools/transformer/alloy_transmuter.go (1 hunks)
  • ingest/sqs/pools/transformer/alloy_transmuter_test.go (1 hunks)
  • ingest/sqs/pools/transformer/export_test.go (2 hunks)
  • ingest/sqs/pools/transformer/orderbook.go (1 hunks)
  • ingest/sqs/pools/transformer/orderbook_test.go (1 hunks)
  • ingest/sqs/pools/transformer/pool_transformer.go (5 hunks)
  • ingest/sqs/pools/transformer/pool_transformer_test.go (11 hunks)
  • ingest/sqs/pools/transformer/taker_fee.go (2 hunks)
  • ingest/sqs/pools/transformer/taker_fee_test.go (8 hunks)
  • ingest/sqs/service/grpc_client.go (3 hunks)
  • ingest/sqs/service/sqs_streaming_service_test.go (2 hunks)
  • ingest/types/cosmwasmpool/alloy_transmuter.go (1 hunks)
  • ingest/types/cosmwasmpool/errors.go (1 hunks)
  • ingest/types/cosmwasmpool/model.go (1 hunks)
  • ingest/types/cosmwasmpool/orderbook.go (1 hunks)
  • ingest/types/errors.go (1 hunks)
  • ingest/types/json/sqs_json.go (1 hunks)
  • ingest/types/passthroughdomain/passthrough_pools_data.go (1 hunks)
  • ingest/types/passthroughdomain/pool_apr.go (1 hunks)
  • ingest/types/passthroughdomain/pool_fees.go (1 hunks)
  • ingest/types/pools.go (1 hunks)
  • ingest/types/taker_fee.go (1 hunks)
  • proto/osmosis/ingest/v1beta1/ingest.proto (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • ingest/sqs/pools/transformer/orderbook.go
  • ingest/sqs/pools/transformer/orderbook_test.go
  • ingest/sqs/pools/transformer/alloy_transmuter_test.go
🧰 Additional context used
🪛 GitHub Check: Run golangci-lint
ingest/types/cosmwasmpool/model.go

[failure] 17-17:
const alloyTransmuterMinVersionStr is unused (unused)

ingest/types/taker_fee.go

[failure] 58-58:
unnecessary leading newline (whitespace)


[failure] 67-67:
unnecessary leading newline (whitespace)


[failure] 80-80:
unnecessary leading newline (whitespace)

🪛 GitHub Actions: Lint
ingest/types/cosmwasmpool/model.go

[error] 17-17: const alloyTransmuterMinVersionStr is unused

ingest/types/pools.go

[warning] 5-5: File is not goimports-ed

🪛 GitHub Actions: Spell Check
ingest/types/cosmwasmpool/alloy_transmuter.go

[error] 39-39: Spelling error: 'limitin' should be 'limiting' or 'limit in'

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (34)
ingest/types/errors.go (1)

5-11: LGTM! Clear and informative error message.

The error type and message for concentrated pool tick model is well-structured and informative.

ingest/sqs/domain/mocks/pool_transformer_mock.go (1)

12-13: LGTM! Clean mock implementation.

The mock is well-structured with proper interface implementation and type updates.

Also applies to: 20-22

ingest/types/cosmwasmpool/errors.go (2)

15-21: LGTM! Clear error message.

The error type and message for duplicated denom is well-structured.


23-30: Verify OrderbookDirection.String() implementation.

The error message relies on OrderbookDirection.String() for direction representation.

Let's verify the String() implementation:

✅ Verification successful

OrderbookDirection.String() implementation verified and correct

The String() method properly converts the direction to "BID" or "ASK" strings, which will result in clear and accurate error messages.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for OrderbookDirection type and String() method
ast-grep --pattern 'type OrderbookDirection $_ {
  $$$
}

func (OrderbookDirection) String() string {
  $$$
}'

Length of output: 112


Script:

#!/bin/bash
# Search for OrderbookDirection type definition
echo "=== Searching for OrderbookDirection type ==="
rg "type\s+OrderbookDirection" -A 5

echo -e "\n=== Searching for OrderbookDirection String method ==="
rg "func.*OrderbookDirection.*String\(\)" -A 5

echo -e "\n=== Backup search for any OrderbookDirection references ==="
rg "OrderbookDirection" --type go

Length of output: 2709

ingest/sqs/pools/transformer/taker_fee.go (1)

17-17: LGTM! Clean migration to new types package

The function signature has been properly updated to use the new types package while maintaining the same robust functionality.

ingest/sqs/domain/ingester.go (1)

18-18: LGTM! Clean interface updates

The interface method signatures have been properly updated to use the new types package while maintaining the same contract and behavior.

Also applies to: 30-30

ingest/types/passthroughdomain/pool_apr.go (1)

17-30: Well-structured data model with clear documentation!

The struct definition is clean, with proper documentation for each field and appropriate JSON tags.

ingest/types/cosmwasmpool/model.go (1)

40-58: Well-designed model with clear documentation!

The CosmWasmPoolModel and CosmWasmPoolData structs are well-designed with clear documentation explaining the tagged union pattern.

ingest/types/taker_fee.go (2)

11-19: Well-designed types with clear documentation!

The DenomPair and TakerFeeMap types are well-designed with clear documentation about the bi-directional taker fee support.


24-54: Robust JSON marshaling implementation!

The JSON marshaling and unmarshaling implementation is robust with proper error handling and clear string representation of denom pairs.

ingest/sqs/pools/transformer/export_test.go (1)

29-33: Clean type reference updates!

The changes correctly update the type references from sqsdomain to types, aligning with the PR objective of decoupling from SQS.

ingest/types/pools.go (4)

16-36: Well-designed interface with clear method signatures.

The PoolI interface is well-structured with comprehensive documentation for each method.


40-44: Clean and focused struct definition.

The TickModel struct effectively captures the required fields with appropriate JSON tags.


46-56: Well-documented struct with clear field purposes.

The SQSPool struct includes helpful comments explaining when specific fields are needed.


58-64: Comprehensive wrapper implementation.

The PoolWrapper struct effectively implements the PoolI interface with all necessary fields.

ingest/sqs/service/grpc_client.go (3)

11-12: Clean import path updates.

The import paths have been correctly updated to use the new types package.


43-43: Correctly updated method signature.

The PushData method signature has been properly updated to use types.PoolI and types.TakerFeeMap.


112-112: Correctly updated method signature.

The marshalPools method signature has been properly updated to use []types.PoolI.

ingest/sqs/pools/transformer/taker_fee_test.go (3)

4-4: Clean import update.

The import has been correctly updated to use the new types package.


25-25: Correctly updated type references in struct definitions.

The type references have been properly updated to use types.DenomPair and types.TakerFeeMap.

Also applies to: 33-33, 35-35


40-40: Comprehensive test case updates.

All test cases have been properly updated to use the new type references while maintaining the same test coverage and functionality.

Also applies to: 50-50, 52-52, 66-66, 77-77, 85-85, 103-103, 105-105, 119-119, 129-129, 136-136

ingest/sqs/pools/transformer/alloy_transmuter.go (1)

8-8: Clean import path update.

The import path has been correctly updated to use the new package location for sqscosmwasmpool.

ingest/sqs/service/sqs_streaming_service_test.go (3)

11-11: LGTM! Import path updated correctly.

The import path change from sqsdomain to ingest/types aligns with the PR objective of decoupling from SQS.


106-110: LGTM! Type references updated consistently.

The variable type and function call updates from sqsdomain to types package are consistent with the import changes.


Line range hint 137-140: LGTM! Consistent type updates across test cases.

The type changes from sqsdomain to types are consistently applied across all test cases.

Also applies to: 328-331, 685-688

ingest/sqs/pools/transformer/pool_transformer.go (4)

13-14: LGTM! Import paths updated correctly.

The import paths for both types and sqscosmwasmpool packages are properly updated to use the new module structure.


123-127: LGTM! Function signature updated correctly.

The Transform method signature has been properly updated to use the new types package while maintaining the same interface contract.


134-134: LGTM! Variable type declarations updated consistently.

All variable type declarations have been properly updated to use the new types package.

Also applies to: 187-188, 278-279


303-305: LGTM! Struct field types updated correctly.

The struct field types have been properly updated to use the new types package while maintaining the same structure.

proto/osmosis/ingest/v1beta1/ingest.proto (1)

5-5: Verify Osmosis version number in go_package path

Please confirm that v28 is the correct version for the Osmosis repository. This is important for maintaining consistent versioning across the codebase.

✅ Verification successful

Version number v28 in go_package path is correct

The version number v28 in the go_package path matches the module version in go.mod and is consistent with all other proto files in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the current Osmosis version in go.mod
grep "osmosis-labs/osmosis/v" go.mod

# Check other proto files for version consistency
fd -e proto | xargs grep -l "osmosis-labs/osmosis/v"

Length of output: 5096

ingest/indexer/service/indexer_streaming_service_test.go (1)

137-142: LGTM! Type changes align with decoupling objectives.

The changes correctly update the type references from sqsdomain.PoolI to types.PoolI while maintaining the existing test logic and coverage.

Also applies to: 328-332, 685-689

ingest/sqs/pools/transformer/pool_transformer_test.go (3)

10-11: LGTM! Import changes align with module restructuring.

The imports are correctly updated to use the new types package from the Osmosis repository.


47-47: LGTM! Variable type updates maintain consistency.

All instances of TakerFeeMap type references are correctly updated from sqsdomain to types package while preserving the existing functionality.

Also applies to: 67-67, 175-175, 208-208, 242-242, 277-277, 320-320, 378-378


815-815: LGTM! Function signature update preserves type safety.

The validatePoolConversion function signature is properly updated to use types.PoolI instead of sqsdomain.PoolI.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
ingest/types/cosmwasmpool/alloy_transmuter.go (1)

20-20: ⚠️ Potential issue

Correct spelling error in comment: 'Tranmuter' should be 'Transmuter'

The comment on line 20 contains a misspelling. Correcting this helps maintain code readability and adheres to coding standards.

Apply this diff to correct the spelling:

-// Tranmuter Alloyed Data, since v3.0.0
+// Transmuter Alloyed Data, since v3.0.0
🧹 Nitpick comments (4)
ingest/types/pools.go (1)

17-37: Enhance interface documentation for better clarity.

While the interface is well-structured, consider adding more detailed documentation for the following methods:

  • GetPoolLiquidityCap(): Document the units and any constraints.
  • GetPoolDenoms(): Clarify if the returned slice maintains any specific ordering.
  • GetUnderlyingPool(): Explain the relationship between the wrapper and underlying pool.
ingest/types/cosmwasmpool/alloy_transmuter.go (3)

49-49: Fix malformed link in comment

The link provided in the comment appears to be incorrect or malformed. Updating it ensures that future readers can access the correct documentation.

Apply this diff to fix the URL:

-	// [more info](https://github.com/osmosis-labs/transmuter/tree/v3.0.0?tab=readme-ov-file#normalization-factors)
+	// [more info](https://github.com/osmosis-labs/transmuter/blob/v3.0.0/README.md#normalization-factors)

90-94: Consider using precise numeric types for decimal values

Fields LatestValue and Integral in the Division struct are represented as strings. If these values are intended to be precise decimal numbers, consider using osmomath.Dec or a similar precise numeric type to enhance type safety and reduce potential parsing errors.


100-102: Consider using precise numeric types for decimal values

In the ChangeLimiter struct, the LatestValue and BoundaryOffset fields are of type string representing decimal numbers. Using a precise numeric type like osmomath.Dec can improve type safety and prevent potential conversion errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4e0297 and 68d02d3.

⛔ Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (15)
  • ingest/indexer/service/indexer_streaming_service_test.go (4 hunks)
  • ingest/sqs/domain/ingester.go (3 hunks)
  • ingest/sqs/domain/mocks/grpc_client_mock.go (2 hunks)
  • ingest/sqs/domain/mocks/pool_transformer_mock.go (1 hunks)
  • ingest/sqs/pools/transformer/export_test.go (2 hunks)
  • ingest/sqs/pools/transformer/pool_transformer.go (5 hunks)
  • ingest/sqs/pools/transformer/pool_transformer_test.go (11 hunks)
  • ingest/sqs/pools/transformer/taker_fee.go (2 hunks)
  • ingest/sqs/pools/transformer/taker_fee_test.go (8 hunks)
  • ingest/sqs/service/grpc_client.go (3 hunks)
  • ingest/sqs/service/sqs_streaming_service_test.go (2 hunks)
  • ingest/types/cosmwasmpool/alloy_transmuter.go (1 hunks)
  • ingest/types/cosmwasmpool/model.go (1 hunks)
  • ingest/types/pools.go (1 hunks)
  • ingest/types/taker_fee.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • ingest/sqs/domain/mocks/grpc_client_mock.go
  • ingest/indexer/service/indexer_streaming_service_test.go
  • ingest/sqs/pools/transformer/taker_fee.go
  • ingest/sqs/service/sqs_streaming_service_test.go
  • ingest/types/cosmwasmpool/model.go
  • ingest/sqs/domain/ingester.go
  • ingest/sqs/service/grpc_client.go
  • ingest/sqs/domain/mocks/pool_transformer_mock.go
  • ingest/types/taker_fee.go
  • ingest/sqs/pools/transformer/export_test.go
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: go (02)
  • GitHub Check: e2e
  • GitHub Check: Summary
🔇 Additional comments (6)
ingest/types/pools.go (1)

59-122: Implementation looks good!

The PoolWrapper implementation is clean with proper error handling and consistent denom ordering. The type assertion on line 67 ensures compile-time verification of interface implementation.

ingest/sqs/pools/transformer/taker_fee_test.go (1)

4-4: Type updates look good!

The changes consistently update the types from sqsdomain to ingesttypes across the test file while maintaining the existing test logic.

Also applies to: 25-25, 33-33, 35-35, 40-40, 50-50, 52-52, 66-66, 77-77, 85-85, 103-103, 105-105, 119-119, 129-129, 136-136, 175-175, 208-208, 242-242, 277-277, 320-320, 378-378

ingest/sqs/pools/transformer/pool_transformer.go (2)

123-134: Type updates in Transform method look good!

The changes correctly update the return types and map initialization to use the new ingesttypes package.


187-188: Type updates in ConvertPool method look good!

The changes correctly update:

  • Parameter and return types to use ingesttypes.PoolI
  • TickModel initialization to use ingesttypes.TickModel
  • PoolWrapper construction to use ingesttypes.PoolWrapper and ingesttypes.SQSPool

The logic remains unchanged while transitioning to the new types.

Also applies to: 278-291, 303-313

ingest/sqs/pools/transformer/pool_transformer_test.go (1)

815-815: Type update in validatePoolConversion looks good!

The method signature correctly updates the actualPool parameter type from sqsdomain.PoolI to ingesttypes.PoolI.

ingest/types/cosmwasmpool/alloy_transmuter.go (1)

1-103: Overall code quality is excellent

The code is well-structured, and the implementation aligns with Go best practices. The use of descriptive naming and thorough commenting enhances readability and maintainability.

@deividaspetraitis
Copy link
Member Author

Addressed requested changes including including linting and spelling errors, - ready for another round! 🚀

Copy link
Collaborator

@PaddyMc PaddyMc left a comment

Choose a reason for hiding this comment

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

Can we add a changelog please?

@PaddyMc PaddyMc added the V:state/compatible/backport State machine compatible PR, should be backported label Jan 10, 2025
@deividaspetraitis deividaspetraitis merged commit 8286393 into main Jan 10, 2025
1 check passed
@deividaspetraitis deividaspetraitis deleted the BE-658 branch January 10, 2025 12:02
@deividaspetraitis deividaspetraitis changed the title BE-658 | Decouple Node releases from SQS chore: decouple Node releases from SQS Jan 10, 2025
PaddyMc pushed a commit that referenced this pull request Jan 15, 2025
* chore: decouple Node releases from SQS

* chore: decouple Node releases from SQS

(cherry picked from commit 8286393)

# Conflicts:
#	go.mod

* mergify/bp/v28.x/pr-8886 | Resolve conflicts

---------

Co-authored-by: Deividas Petraitis <hi@deividaspetraitis.lt>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v28.x backport patches to v28.x branch V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants