Skip to content

Coffee actions #245

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

Merged
merged 29 commits into from
Jul 29, 2025
Merged

Conversation

verdigos
Copy link
Collaborator

  • New coffee actions
  • Added workflow with indexer tests
  • Actions reclassification script

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive support for Coffee DEX actions in the indexer, implementing detection and parsing for various Coffee protocol operations including swaps, liquidity management, staking, MEV protection, and pool creation. The implementation includes new action types, database schema changes, test cases, and a GitHub Actions workflow.

Key Changes:

  • Added 7 new Coffee action types with complete parsing logic and database support
  • Implemented comprehensive test coverage with 611 test cases for Coffee protocol operations
  • Added GitHub Actions workflow for automated testing of indexer components

Reviewed Changes

Copilot reviewed 22 out of 43 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ton-index-postgres/src/migrate.cpp Database migration adding Coffee-specific composite types and table columns
ton-index-go/index/*.go Core Go indexer changes adding Coffee action parsing, models, and API support
indexer/indexer/events/blocks/ Python event processing implementation for Coffee protocol messages and matchers
indexer/tests/test_cases/coffee.yaml Comprehensive test cases covering all Coffee DEX operations
indexer/action_updates/01_coffee_actions.py Script for reclassifying existing actions to Coffee types
.github/workflows/tests.yml GitHub Actions workflow for running indexer tests

@@ -43,7 +43,7 @@ var EVAA_ASSET_ID_MAP_TESTNET = map[string]string{
"0xc585bac25948a5feea8f2a9e052eb45995882b15dfb784b37cd271cc163f3aea": "0:5EE20B5240CC4CE51A4C60BAF8C9D358EF617C26463E89C6571B534972C8EEF1",
}

var IsTestnet bool = false
var IsTestnet bool
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

Removing the default initialization value (false) makes the variable's initial state unclear. Consider explicitly initializing to false for clarity.

Suggested change
var IsTestnet bool
var IsTestnet bool = false

Copilot uses AI. Check for mistakes.

@@ -1116,7 +1143,7 @@ async def build_block(self, block: Block, other_blocks: list[Block]) -> list[Blo
pton_transfer = find_call_contract(
excess_transfer.next_blocks, PTonTransfer.opcode
)
if pton_transfer:
if pton_transfer is not None:
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The change from if pton_transfer: to if pton_transfer is not None: is more explicit but may be unnecessary if pton_transfer is always either a valid object or None. The original truthiness check was likely sufficient.

Suggested change
if pton_transfer is not None:
if pton_transfer:

Copilot uses AI. Check for mistakes.

@@ -85,7 +85,7 @@ def test_self(self, block: Block):
else:
return False
except Exception as e:
logger.error(e, exc_info=True)
# logger.error(e, exc_info=True)
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

Commenting out error logging without explanation reduces debugging capability. Consider either removing the line entirely or adding a comment explaining why this logging was disabled.

Suggested change
# logger.error(e, exc_info=True)
# Log exceptions for debugging purposes
logger.error(e, exc_info=True)

Copilot uses AI. Check for mistakes.

@@ -103,7 +103,7 @@ def check_value(actual_value: Any, expected_value: Any, path: str) -> None:
break
except AssertionError:
continue
assert found, f"Item '{exp_item}' not found in actual list at '{path}'"
assert found, f"Item '{exp_item}' not found in actual list at '{path}' in {actual_value}"
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

Adding {actual_value} to the assertion error message could make error messages very long and hard to read when dealing with large data structures. Consider truncating or formatting the output for better readability.

Suggested change
assert found, f"Item '{exp_item}' not found in actual list at '{path}' in {actual_value}"
assert found, f"Item '{exp_item}' not found in actual list at '{path}' in {format_value_for_error(actual_value)}"

Copilot uses AI. Check for mistakes.

@@ -1,11 +1,14 @@
from __future__ import annotations

from ast import Call
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

The import from ast import Call appears to be unused in this file. Consider removing it to reduce clutter.

Suggested change
from ast import Call

Copilot uses AI. Check for mistakes.

@kdimentionaltree kdimentionaltree merged commit 478047a into toncenter:master Jul 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants