Skip to content

Conversation

@sergiupopescu199
Copy link
Contributor

@sergiupopescu199 sergiupopescu199 commented Sep 30, 2025

Description of change

This PR adds the feature to add subscription support for events and transactions for GraphQL.

For filtering capabilities it leverages the @oneOf directive which does not allow more than one filter at a time for the input filter object.

Links to any relevant issues

fixes #8561

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)

  • Patch-specific tests (correctness, functionality coverage)

  • ran graphql tests

cargo nextest run -p iota-graphql-rpc --features pg_integration --no-fail-fast --test-threads 1
  • used the iota binary to spin up an indexer and graphql instance and test the subscription queries
cargo r --features indexer -- start --force-regenesis   --with-indexer --with-graphql
  • used the integrated graphiQL ui to issue subscription queries
  • used a third party graphql client (Postman) to issue the same queries

Note

At approximately 1k subscribers, the local machine reached its operational limit. The sheer intensity and concurrent demand of managing the network, indexer, GraphQL server, and a high volume of WebSocket connections prevented reliable testing.

In future iteration we could add Prometheus metrics to track the total amount of active subscribers, how many subscribers experience lags, ect...

Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure)

  • Synchronization of the indexer from genesis for a network including migration objects.
  • Restart of indexer synchronization locally without resetting the database.
  • Restart of indexer synchronization on a production-like database.
  • Deployment of services using Docker.
  • Verification of API backward compatibility.

Note

The following patch does not affect the normal operation of the indexer, thus tests were skipped.

Release Notes

  • GraphQL: Add Subscription support for Event and TransactionBlock.

@sergiupopescu199 sergiupopescu199 requested a review from a team as a code owner September 30, 2025 10:10
@vercel
Copy link

vercel bot commented Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
apps-backend Ignored Ignored Preview Oct 7, 2025 8:25am
apps-ui-kit Ignored Ignored Preview Oct 7, 2025 8:25am
iota-evm-bridge Ignored Ignored Preview Oct 7, 2025 8:25am
iota-multisig-toolkit Ignored Ignored Preview Oct 7, 2025 8:25am
rebased-explorer Ignored Ignored Preview Oct 7, 2025 8:25am
wallet-dashboard Ignored Ignored Preview Oct 7, 2025 8:25am

@iota-ci iota-ci added infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group. labels Sep 30, 2025
Copy link
Contributor

@tomxey tomxey left a comment

Choose a reason for hiding this comment

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

looks good!
do we also plan to add some automated tests for this?

@sergiupopescu199
Copy link
Contributor Author

sergiupopescu199 commented Oct 2, 2025

@tomxey

During implementation, I did consider adding tests, but our current GraphQL client used for testing setup only supports HTTP requests. Since subscriptions operate over WebSockets, we'd need to:

  1. Add a new client to the framework that supports WebSocket connections
  2. Update the code to accommodate this new client
  3. refactor the test infrastructure to handle the subscription testing

This would significantly increase the scope of changes and require additional time. We can create a new issue ti tackle this.

@sergiupopescu199 sergiupopescu199 requested a review from a team October 2, 2025 11:47
@kodemartin kodemartin linked an issue Oct 3, 2025 that may be closed by this pull request
Copy link
Contributor

@kodemartin kodemartin left a comment

Choose a reason for hiding this comment

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

Looks splendid! Left a few minor comments and nits

@sergiupopescu199 sergiupopescu199 merged commit 66810b3 into sc-platform/feat/streaming-support Oct 7, 2025
38 of 39 checks passed
@sergiupopescu199 sergiupopescu199 deleted the sc-platform/issue-8561 branch October 7, 2025 10:39
sergiupopescu199 added a commit that referenced this pull request Nov 11, 2025
…8698)

# Description of change

This PR adds the feature to add subscription support for `events` and
`transactions` for GraphQL.

For filtering capabilities it leverages the
[`@oneOf`](https://graphql.org/blog/2025-09-04-multioption-inputs-with-oneof/)
directive which does not allow more than one filter at a time for the
input filter object.

## Links to any relevant issues

fixes #8561

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)

- ran graphql tests
```shell
cargo nextest run -p iota-graphql-rpc --features pg_integration --no-fail-fast --test-threads 1
```
- used the iota binary to spin up an indexer and graphql instance and
test the subscription queries
```
cargo r --features indexer -- start --force-regenesis   --with-indexer --with-graphql
```
- used the integrated graphiQL ui to issue subscription queries
- used a third party graphql client (Postman) to issue the same queries

> [!NOTE]
> At approximately 1k subscribers, the local machine reached its
operational limit. The sheer intensity and concurrent demand of managing
the network, indexer, GraphQL server, and a high volume of WebSocket
connections prevented reliable testing.

In future iteration we could add **Prometheus** metrics to track the
total amount of active subscribers, how many subscribers experience
lags, ect...

### Infrastructure QA (only required for crates that are maintained by
@iotaledger/infrastructure)

- [ ] Synchronization of the indexer from genesis for a network
including migration objects.
- [ ] Restart of indexer synchronization locally without resetting the
database.
- [ ] Restart of indexer synchronization on a production-like database.
- [ ] Deployment of services using Docker.
- [ ] Verification of API backward compatibility.

> [!NOTE]
> The following patch does not affect the normal operation of the
indexer, thus tests were skipped.

### Release Notes
- [x] GraphQL: Add `Subscription` support for `Event` and
`TransactionBlock`.
sergiupopescu199 added a commit that referenced this pull request Nov 13, 2025
…8698)

# Description of change

This PR adds the feature to add subscription support for `events` and
`transactions` for GraphQL.

For filtering capabilities it leverages the
[`@oneOf`](https://graphql.org/blog/2025-09-04-multioption-inputs-with-oneof/)
directive which does not allow more than one filter at a time for the
input filter object.

## Links to any relevant issues

fixes #8561

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)

- ran graphql tests
```shell
cargo nextest run -p iota-graphql-rpc --features pg_integration --no-fail-fast --test-threads 1
```
- used the iota binary to spin up an indexer and graphql instance and
test the subscription queries
```
cargo r --features indexer -- start --force-regenesis   --with-indexer --with-graphql
```
- used the integrated graphiQL ui to issue subscription queries
- used a third party graphql client (Postman) to issue the same queries

> [!NOTE]
> At approximately 1k subscribers, the local machine reached its
operational limit. The sheer intensity and concurrent demand of managing
the network, indexer, GraphQL server, and a high volume of WebSocket
connections prevented reliable testing.

In future iteration we could add **Prometheus** metrics to track the
total amount of active subscribers, how many subscribers experience
lags, ect...

### Infrastructure QA (only required for crates that are maintained by
@iotaledger/infrastructure)

- [ ] Synchronization of the indexer from genesis for a network
including migration objects.
- [ ] Restart of indexer synchronization locally without resetting the
database.
- [ ] Restart of indexer synchronization on a production-like database.
- [ ] Deployment of services using Docker.
- [ ] Verification of API backward compatibility.

> [!NOTE]
> The following patch does not affect the normal operation of the
indexer, thus tests were skipped.

### Release Notes
- [x] GraphQL: Add `Subscription` support for `Event` and
`TransactionBlock`.
sergiupopescu199 added a commit that referenced this pull request Nov 20, 2025
…8698)

# Description of change

This PR adds the feature to add subscription support for `events` and
`transactions` for GraphQL.

For filtering capabilities it leverages the
[`@oneOf`](https://graphql.org/blog/2025-09-04-multioption-inputs-with-oneof/)
directive which does not allow more than one filter at a time for the
input filter object.

## Links to any relevant issues

fixes #8561

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)

- ran graphql tests
```shell
cargo nextest run -p iota-graphql-rpc --features pg_integration --no-fail-fast --test-threads 1
```
- used the iota binary to spin up an indexer and graphql instance and
test the subscription queries
```
cargo r --features indexer -- start --force-regenesis   --with-indexer --with-graphql
```
- used the integrated graphiQL ui to issue subscription queries
- used a third party graphql client (Postman) to issue the same queries

> [!NOTE]
> At approximately 1k subscribers, the local machine reached its
operational limit. The sheer intensity and concurrent demand of managing
the network, indexer, GraphQL server, and a high volume of WebSocket
connections prevented reliable testing.

In future iteration we could add **Prometheus** metrics to track the
total amount of active subscribers, how many subscribers experience
lags, ect...

### Infrastructure QA (only required for crates that are maintained by
@iotaledger/infrastructure)

- [ ] Synchronization of the indexer from genesis for a network
including migration objects.
- [ ] Restart of indexer synchronization locally without resetting the
database.
- [ ] Restart of indexer synchronization on a production-like database.
- [ ] Deployment of services using Docker.
- [ ] Verification of API backward compatibility.

> [!NOTE]
> The following patch does not affect the normal operation of the
indexer, thus tests were skipped.

### Release Notes
- [x] GraphQL: Add `Subscription` support for `Event` and
`TransactionBlock`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[graphql]: stream transactions and events

5 participants