-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
graphql: filter transactions by affected object #19474
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amnn
requested review from
wlmyng,
stefan-mysten,
emmazzz and
suiwombat
as code owners
September 21, 2024 00:15
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
## Description Add support for filtering transactions by the objects they touch, which will supersede filtering by a transaction's input and output objects. This feature will exist only in staging mode until the underlying data has been fully backfilled. ## Test plan New staging-only tests: ``` sui$ cargo nextest run -p sui-graphql-e2e-tests --features staging -- affected_object ```
amnn
force-pushed
the
amnn/tx-affected-obj-gql
branch
from
September 30, 2024 10:31
19973c7
to
aa117e3
Compare
This was referenced Sep 30, 2024
bmwill
approved these changes
Sep 30, 2024
amnn
added a commit
that referenced
this pull request
Sep 30, 2024
## Description Add an `AffectedObject` filter on `TransactionFilter` and implement it in `IndexerReader` and in the subscription system. This filter is not implemented on fullnode indices, and in a follow-up PR, support for `InputObject` and `ChangedObject` will be removed from the PG-backed implementation of JSON-RPC. It was difficult to replace `InputObject`/`ChangedObject` support on fullnode with `AffectedObject` because we don't have (and don't want to add) the necessary indices, and the current filters are referred to in certain tests. ## Test plan Manually tested with a local network: ``` sui$ cargo run --bin sui -- start --with-indexer --force-regenesis ``` ``` sui$ curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryTransactionBlocks", "params": [ { "filter": { "AffectedObject":"0x2" } }, null, 50, true ] }' | jq '.result.data.[].digest' ``` ## Stack - #19474 --- ## 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. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [x] Indexer: Adds support for filtering transactions by their affected object - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
amnn
added a commit
that referenced
this pull request
Sep 30, 2024
## Description Deprecate `InputObject` and `OutputObject` as filters in IndexerReader, to be replaced by `AffectedObject`. ## Test plan Tested manually: ``` sui$ cargo run --bin sui -- start --with-indexer --force-regenesis ``` ``` curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryTransactionBlocks", "params": [ { "filter": { "ChangedObject":"0x2" } }, null, 50, true ] ' | jq . { "jsonrpc": "2.0", "error": { "code": -32000, "message": "Indexer does not support the feature with error: `InputObject and OutputObject filters are not supported, please use AffectedObject instead.`" }, "id": 1 } ``` ## Stack - #19474 - #19614 --- ## 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. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [x] Indexer: Remove support for `InputObject` and `OutputObject` transaction filters (replaced by `AffectedObject`). - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
amnn
added a commit
that referenced
this pull request
Sep 30, 2024
## Description Remove support for filtering by `ToAddress` in PG-backed JSON-RPC. At the same time, change implementations for `FromAndToAddress` and `FromOrToAddress` to use the new `tx_affected_addresses` table, which should be more efficient. ## Test plan Manually tested: ``` sui$ cargo run --bin sui -- --force-regenesis \ --with-faucet --with-indexer ``` ``` sui$ $SUI client faucet sui$ $SUI client ptb --transfer-objects [gas] @0x42 sui$ curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryTransactionBlocks", "params": [ { "filter": { "FromOrToAddress": { "addr": "'($SUI client active-address)'" } } }, null, 50, true ] }' | jq .result.data.[].digest "4NDjddQA8Q158EuskHm73AVoo4Gmr6SknuTv1nzghVd1" "5EECPcG6ZbUaH6nXCZWazpg6vcsC33nfnEw6qVkAnN9W" sui$ curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryTransactionBlocks", "params": [ { "filter": { "FromOrToAddress": { "addr": "0x0000000000000000000000000000000000000000000000000000000000000042" } } }, null, 50, true ] }' | jq .result.data.[].digest "4NDjddQA8Q158EuskHm73AVoo4Gmr6SknuTv1nzghVd1" sui$ curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryTransactionBlocks", "params": [ { "filter": { "FromAndToAddress": { "from": "'($SUI client active-address)'", "to": "0x0000000000000000000000000000000000000000000000000000000000000042" } } }, null, 50, true ] }' | jq .result.data.[].digest "4NDjddQA8Q158EuskHm73AVoo4Gmr6SknuTv1nzghVd1" ``` ## Stack - #19474 - #19614 - #19615 --- ## 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. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [x] Indexer: Remove support for filtering transactions by `ToAddress`, (instead of `FromOrToAddress`). - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
amnn
added a commit
that referenced
this pull request
Sep 30, 2024
## Description This PR removes EventFilters from JSON-RPC that aren't supported already by fullnode-backed JSON-RPC: - Combination filters (`All`, `Any`, `Not`, `And`, `Or`) - `Package` - `EventField` These filters were, however, supported by the now-deprecated subscription system, so a question remains whether they are safe to remove. ## Test plan Manually tested, in particular `All: []` support, which we do still need to keep as a way to get all filters (this was also added to the `IndexerReader` implementation): ``` sui$ cargo run --bin sui -- --force-regenesis \ --with-indexer --with-faucet ``` ...run for some time, so that some system events accumulate, then test that we get them from both the fullnode-backed JSONRPC and indexer-backed: Fullnode: ``` curl -LX POST "http://localhost:9000" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryEvents", "params": [ { "All": [] }, null, 50, true ] }' | jq . ``` Indexer: ``` curl -LX POST "http://localhost:9124" \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "suix_queryEvents", "params": [ { "All": [] }, null, 50, true ] }' | jq . ``` ## Stack - #19474 - #19614 - #19615 - #19616 --- ## 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. - [ ] Protocol: - [x] Nodes (Validators and Full nodes): Remove unsupported compound filters for querying events from the JSON-RPC schema to avoid confusion. Remove support for compound filters from the deprecated events subscription system. - [x] Indexer: Remove compound filters for querying events. - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
amnn
added a commit
that referenced
this pull request
Sep 30, 2024
…19618) ## Description Broaden the definition of "affected object" to include objects that a transaction creates and then immediately wraps, or objects that it unwraps and then immediately deletes. This ensures that a transaction will show up in the response to an `affectedObject` query if and only if the Object's ID shows up in its `objectChanges` response. ## Test plan Updated GraphQL E2E test: ``` sui$ cargo nextest run -p sui-graphql-e2e-tests \ --features staging -- affected_object ``` ## Stack - #19474 - #19614 - #19615 - #19616 - #19617 --- ## 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. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [x] Indexer: A transaction's "affected objects" include objects that it created and wrapped, or unwrapped. - [x] JSON-RPC: A transaction's "affected objects" include objects that it created and wrapped, or unwrapped. - [x] GraphQL: A transaction's "affected objects" include objects that it created and wrapped, or unwrapped. - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add support for filtering transactions by the objects they touch, which will supersede filtering by a transaction's input and output objects.
This feature will exist only in staging mode until the underlying data has been fully backfilled.
Test plan
New staging-only tests:
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.