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

Enable transactions look-up by signatures #117

Merged

Conversation

catalyst17
Copy link
Contributor

@catalyst17 catalyst17 commented Oct 28, 2024

TL;DR

Implemented signature lookup for transactions and improved query filtering.

What changed?

  • Activated signature lookup in GetTransactionsByContractAndSignature function
  • Exported ExtractFunctionSelector function
  • Updated ClickHouse queries to include function selector for transactions
  • Generalised signature clause handling for both logs and transactions in ClickHouse queries

How to test?

  1. Make a GET request to /{chainId}/transactions/{to}/{signature} endpoint with a valid contract address and function signature
curl --location 'http://localhost:3000/660279/transactions/0x6e55472109e6abe4054a8e8b8d9edffcb31032c5/setMinDstGas(uint16,uint16,uint256)?limit=1' \
--header 'Authorization: Basic ...'
  1. Verify that the returned transactions are filtered correctly based on the provided signature
{
    "meta": {
        "chain_id": 660279,
        "address": "0x6e55472109e6abe4054a8e8b8d9edffcb31032c5",
        "signature": "0xdf2a5b3b87f900bae4c01587a04a2d9f5990f0066e443e87fe88cf2ce9974ff0",
        "page": 0,
        "limit": 5,
        "total_items": 5,
        "total_pages": 0
    },
    "data": [
        {
            ...
            "to_address": "0x6e55472109e6abe4054a8e8b8d9edffcb31032c5",
            "value": 0,
            "gas": 52119,
            "gas_price": 1600000000,
            "data": "0xdf2a5b3b00000000000000000000000000000000000000000000000000000000000000af00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000030d40",
            "function_selector": "0xdf2a5b3b",
            ...
        }
    ]
}

Why make this change?

This change enables more precise filtering of transactions based on function signatures, improving the ability to query specific contract interactions. It also aligns the transaction querying capabilities with those already available for logs, providing a more consistent and powerful API for data retrieval.

Copy link

linear bot commented Oct 28, 2024

@catalyst17 catalyst17 requested a review from iuwqyir October 28, 2024 14:47
@catalyst17 catalyst17 changed the title feat: enable transactions look-up by signatures Enable transactions look-up by signatures Oct 28, 2024
Copy link
Contributor Author

catalyst17 commented Oct 28, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @catalyst17 and the rest of your teammates on Graphite Graphite

@catalyst17 catalyst17 marked this pull request as ready for review October 28, 2024 14:51
@catalyst17 catalyst17 force-pushed the arsenii/block-316/transactions_function_selector_filter branch from aa4eac3 to 6989cb8 Compare October 28, 2024 14:58
@catalyst17 catalyst17 force-pushed the arsenii/block-316/transactions_function_selector_filter branch from 6989cb8 to 2bdd298 Compare October 28, 2024 15:00
Copy link
Contributor Author

catalyst17 commented Oct 28, 2024

Merge activity

  • Oct 28, 1:35 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 28, 1:35 PM EDT: A user merged this pull request with Graphite.

@catalyst17 catalyst17 merged commit 22b7991 into main Oct 28, 2024
5 checks passed
@catalyst17 catalyst17 deleted the arsenii/block-316/transactions_function_selector_filter branch October 28, 2024 17:35
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.

2 participants