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

indexer: unique transaction recipient row #12597

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

gegaowp
Copy link
Contributor

@gegaowp gegaowp commented Jun 21, 2023

Description

Before this PR, recipients table had multiple rows for an recipient if the recipient received multiple objects, this PR changed it to one row.

Otherwise, on the reading side, I will have to group by transaction digest to make sure the returned tx page will not have duplicate tx, which is super slow.

Test Plan

  1. cargo run indexer as a writer
  2. cargo run indexer as a reader and verify recipients related endpoints;
curl --location --request POST http://127.0.0.1:3030 \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_queryTransactionBlocks",
    "params": [
        {
            "filter": {
                "FromOrToAddress": "0x3dc7a8a21f5d3bc17337260079688d8aefb76f27978e7ec082a5fb0d06bc8b39"
            }
        },
        null,
        10,
        false
    ]
}'
{"jsonrpc":"2.0","error":{"code":-32602,"message":"invalid type: string \"0x3dc7a8a21f5d3bc17337260079688d8aefb76f27978e7ec082a5fb0d06bc8b39\", expected struct variant TransactionFilter::FromOrToAddress at line 4 column 103"},"id":1}%                                                                                                                                          

curl --location --request POST http://127.0.0.1:3030 \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_queryTransactionBlocks",
    "params": [
        {
            "filter": {
                "FromOrToAddress": {addr: "0x3dc7a8a21f5d3bc17337260079688d8aefb76f27978e7ec082a5fb0d06bc8b39"}
            }
        },
        null,
        10,
        false
    ]
}'
{"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error"},"id":null}%                                                                                                              
curl --location --request POST http://127.0.0.1:3030 \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_queryTransactionBlocks",
    "params": [
        {
            "filter": {
                "FromOrToAddress": {"addr": "0x3dc7a8a21f5d3bc17337260079688d8aefb76f27978e7ec082a5fb0d06bc8b39"}
            }
        },
        null,
        10,
        false
    ]
}'
{"jsonrpc":"2.0","result":{"data":[{"digest":"7CuBm1AnLgkBMB6GiEn5d3RizznF5LbawjJTs8A5dcXF","timestampMs":"1681318800000","checkpoint":"0"}],"nextCursor":"7CuBm1AnLgkBMB6GiEn5d3RizznF5LbawjJTs8A5dcXF","hasNextPage":false},"id":1}%                                                                                                                                              

curl --location --request POST http://127.0.0.1:3030 \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_queryTransactionBlocks",
    "params": [
        {
            "filter": {
                "FromAndToAddress": {"from": "0x0000000000000000000000000000000000000000000000000000000000000000", "to": "0x3dc7a8a21f5d3bc17337260079688d8aefb76f27978e7ec082a5fb0d06bc8b39"}
            }
        },
        null,
        10,
        false
    ]
}'
{"jsonrpc":"2.0","result":{"data":[{"digest":"7CuBm1AnLgkBMB6GiEn5d3RizznF5LbawjJTs8A5dcXF","timestampMs":"1681318800000","checkpoint":"0"}],"nextCursor":"7CuBm1AnLgkBMB6GiEn5d3RizznF5LbawjJTs8A5dcXF","hasNextPage":false},"id":1}%       

If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

@vercel
Copy link

vercel bot commented Jun 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
multisig-toolkit ❌ Failed (Inspect) Jun 21, 2023 3:35pm
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Jun 21, 2023 3:35pm
explorer-storybook ⬜️ Ignored (Inspect) Jun 21, 2023 3:35pm
sui-kiosk ⬜️ Ignored (Inspect) Jun 21, 2023 3:35pm
sui-wallet-kit ⬜️ Ignored (Inspect) Jun 21, 2023 3:35pm
wallet-adapter ⬜️ Ignored (Inspect) Jun 21, 2023 3:35pm

@vercel
Copy link

vercel bot commented Jun 21, 2023

@gegaowp is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

@gegaowp gegaowp merged commit 1d8d500 into MystenLabs:main Jun 21, 2023
@gegaowp gegaowp deleted the idx-unique-to branch June 21, 2023 16:33
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