MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
5.84k stars 11.06k forks source link

[gql] transactions queries uses scan limit approach from benchmarking #18413

Open wlmyng opened 3 days ago

wlmyng commented 3 days ago

Description

The bulk of the changes lie in TransactionBlock::paginate:

  1. validate filter consistency: does some checks on after, at, and before checkpoint, and checks that if SystemTx, sign is empty or 0x0
  2. set checkpoint_viewed_at to cursor if provided, otherwise use from watermark
  3. always set lo_cp to 0, hi_cp to checkpoint_viewed_at first
  4. then adjust per checkpoint filters, and apply a scan_limit as needed
  5. fetch the tx_sequence_number equivalent of the cp bounds
    1. lo_cp maps to network_total_transactions of previous checkpoint
    2. hi_cp maps to network_total_transactions - 1 of current checkpoint
  6. if transaction_ids are specified, we fetch them first, and use it to bound the remaining subqueries
  7. if cursors are provided, we apply them to each subquery

Test plan

WIP


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

vercel[bot] commented 3 days ago

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

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2024 10:10pm
3 Ignored Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **multisig-toolkit** | ⬜️ Ignored ([Inspect](https://vercel.com/mysten-labs/multisig-toolkit/4fKwywJuZVrMPTX89CTUasHRttsc)) | [Visit Preview](https://multisig-toolkit-git-wlmyng-gqlscan-limit-tx-a24c5b-mysten-labs.vercel.app) | | Jun 28, 2024 10:10pm | | **sui-kiosk** | ⬜️ Ignored ([Inspect](https://vercel.com/mysten-labs/sui-kiosk/7SZjdWrTw7hYo8ySXq61o1BmdmxL)) | [Visit Preview](https://sui-kiosk-git-wlmyng-gqlscan-limit-tx-approach-mysten-labs.vercel.app) | | Jun 28, 2024 10:10pm | | **sui-typescript-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/mysten-labs/sui-typescript-docs/BiFXhgAfi3nRFZ3YUwZA4twmhrTU)) | [Visit Preview](https://sui-typescript-docs-git-wlmyng-gqlscan-limit-0adb70-mysten-labs.vercel.app) | | Jun 28, 2024 10:10pm |