Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces "SDK 1.2", a major refactoring that migrates the Solana and EVM data streaming architecture from the old Gateway/Archive + RPC approach to a unified SQD Network Portal-based system. The changes include new packages for EVM streams/objects, a new shared data source abstraction, updates to the batch processor to support hot/unfinalized blocks, and comprehensive updates to example code.
Changes:
- Introduces new packages:
@subsquid/util-internal-data-source,@subsquid/evm-stream, and@subsquid/evm-objects - Refactors
@subsquid/solana-streamto use Portal client instead of Gateway + RPC - Updates
@subsquid/batch-processorto support hot blocks and fork handling - Renames
slot/heightfields to standardizednumberfield across Solana packages
Reviewed changes
Copilot reviewed 63 out of 64 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| util/util-internal-data-source/* | New package defining shared DataSource abstraction with BlockRef, fork handling, and stream interfaces |
| solana/solana-stream/src/source.ts | Major refactor from Gateway+RPC to Portal-only architecture with simplified API |
| solana/solana-stream/src/portal/* | New Portal-based data source implementation replacing old archive/RPC sources |
| evm/evm-stream/* | New package for EVM data streaming using Portal client |
| evm/evm-objects/* | New package providing augmented EVM data model with relationships |
| processor/batch-processor/src/run.ts | Enhanced to support hot blocks, fork navigation, and finalized/unfinalized streams |
| processor/batch-processor/src/database.ts | Updated interface to support hot block databases with fork management |
| test/erc20-transfers/src/processor.ts | Updated example to use new EVM stream API |
| test/solana-example/src/main.ts | Updated example to use new Portal-based API |
| solana/solana-normalization/src/* | Renamed slot to number for consistency |
| solana/solana-objects/src/* | Updated to use number instead of height |
Files not reviewed (1)
- common/config/rush/pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)
solana/solana-stream/src/portal/schema.ts:134
- Unnecessary parentheses around the
array()calls. These can be removed for cleaner code:transactions: array(Transaction), etc.
evm/evm-stream/src/data/model.ts:1 - The
heightfield is marked as deprecated in favor ofnumber, but both fields have the same value (line 145:height: number,). This creates confusion as users might not understand which to use. Consider adding a JSDoc comment explaining thatheightis maintained for backwards compatibility and equalsnumber.
import type {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * | ||
| * @example | ||
| * source.setGateway('https://v2.archive.subsquid.io/network/solana-mainnet') | ||
| * source.setGateway('https://portal.sqd.dev/datasets/solana-mainnet') |
There was a problem hiding this comment.
The JSDoc example still references the old method name setGateway but the method has been renamed to setPortal. Update the example to use source.setPortal('https://portal.sqd.dev/datasets/solana-mainnet').
| // FIXME: maybe it's better to pass it ias an option to `getStream` | ||
| getFinalizedStream(req: DataSourceStreamOptions): AsyncIterable<BlockBatch<B>> |
There was a problem hiding this comment.
Corrected spelling of 'ias' to 'as'.
| @@ -0,0 +1,91 @@ | |||
| import {Bytes, FieldSelection} from '@subsquid/evm-stream' | |||
There was a problem hiding this comment.
Unused import Bytes.
| import {Bytes, FieldSelection} from '@subsquid/evm-stream' | |
| import {FieldSelection} from '@subsquid/evm-stream' |
| @@ -0,0 +1,400 @@ | |||
| import {Bytes, Bytes20, Bytes32, Bytes8} from '@subsquid/evm-stream' | |||
There was a problem hiding this comment.
Unused import Bytes8.
| import {Bytes, Bytes20, Bytes32, Bytes8} from '@subsquid/evm-stream' | |
| import {Bytes, Bytes20, Bytes32} from '@subsquid/evm-stream' |
| import { | ||
| EIP7702Authorization, | ||
| EvmTraceCallAction, | ||
| EvmTraceCallResult, | ||
| EvmTraceCreateAction, | ||
| EvmTraceCreateResult, | ||
| EvmTraceRewardAction, | ||
| EvmTraceSuicideAction | ||
| } from '@subsquid/evm-stream/lib/data/evm' |
There was a problem hiding this comment.
Unused import EIP7702Authorization.
| import {DEFAULT_FIELDS, FieldSelection} from './model' | ||
| import {Selector} from './type-util' | ||
|
|
||
|
|
||
| function merge<Keys extends string>(def: Selector<Keys>, requested: Selector<Keys> = {}): Selector<Keys> { | ||
| let fields: Selector<Keys> = {} | ||
|
|
There was a problem hiding this comment.
Unused imports DEFAULT_FIELDS, FieldSelection.
| import {DEFAULT_FIELDS, FieldSelection} from './model' | |
| import {Selector} from './type-util' | |
| function merge<Keys extends string>(def: Selector<Keys>, requested: Selector<Keys> = {}): Selector<Keys> { | |
| let fields: Selector<Keys> = {} | |
| import {Selector} from './type-util' | |
| function merge<Keys extends string>(def: Selector<Keys>, requested: Selector<Keys> = {}): Selector<Keys> { | |
| let fields: Selector<Keys> = {} |
|
|
||
| function merge<Keys extends string>(def: Selector<Keys>, requested: Selector<Keys> = {}): Selector<Keys> { | ||
| let fields: Selector<Keys> = {} | ||
|
|
||
| for (let key in def) { | ||
| if (requested[key] !== false) { | ||
| fields[key] = def[key] | ||
| } | ||
| } | ||
|
|
||
| for (let key in requested) { | ||
| if (requested[key]) { | ||
| fields[key] = true | ||
| } | ||
| } | ||
|
|
||
| return fields | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Unused function merge.
| function merge<Keys extends string>(def: Selector<Keys>, requested: Selector<Keys> = {}): Selector<Keys> { | |
| let fields: Selector<Keys> = {} | |
| for (let key in def) { | |
| if (requested[key] !== false) { | |
| fields[key] = def[key] | |
| } | |
| } | |
| for (let key in requested) { | |
| if (requested[key]) { | |
| fields[key] = true | |
| } | |
| } | |
| return fields | |
| } |
| import { | ||
| ANY, | ||
| array, | ||
| ANY_INT, | ||
| BOOLEAN, | ||
| BYTES, | ||
| constant, | ||
| NAT, | ||
| object, | ||
| oneOf, | ||
| option, | ||
| STRING | ||
| } from '@subsquid/util-internal-validation' |
There was a problem hiding this comment.
Unused imports ANY, BOOLEAN.
| import * as prom from 'prom-client' | ||
| import {Database, HashAndHeight} from './database' | ||
| import {DataSource} from './datasource' | ||
| import {HashAndHeight, Database, HotDatabaseState} from './database' |
There was a problem hiding this comment.
Unused import HotDatabaseState.
| @@ -0,0 +1,77 @@ | |||
| import assert from 'assert' | |||
| import {Range} from '@subsquid/util-internal-range' | |||
There was a problem hiding this comment.
Unused import Range.
- Improved stream handling by breaking the loop upon successful completion. - Simplified metrics update calculations. - Enhanced data continuity validation by removing unnecessary checks. - Updated transaction handling to use state defaults when necessary.
No description provided.