-
Notifications
You must be signed in to change notification settings - Fork 999
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
bump substreams client to sf.substreams.rpc.v2.Stream/Blocks #4556
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
27f2d3b
bump substreams client to sf.substreams.rpc.v2.Stream/Blocks
sduchesneau 4225c36
Merge branch 'master' into stepd/substreams_undo_rework
Eduard-Voiculescu 10f86d0
Merge remote-tracking branch 'origin/master' into stepd/substreams_un…
sduchesneau 810e494
Merge remote-tracking branch 'origin/master' into stepd/substreams_un…
sduchesneau bc6a519
adjust substreams mapper code branches for clarity
sduchesneau 398648a
add comments to clarify intent when ignoring useless substreams messages
sduchesneau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
syntax = "proto3"; | ||
|
||
package sf.substreams.rpc.v2; | ||
|
||
import "google/protobuf/any.proto"; | ||
import "substreams.proto"; | ||
|
||
service Stream { | ||
rpc Blocks(Request) returns (stream Response); | ||
} | ||
|
||
message Request { | ||
int64 start_block_num = 1; | ||
string start_cursor = 2; | ||
uint64 stop_block_num = 3; | ||
|
||
// With final_block_only, you only receive blocks that are irreversible: | ||
// 'final_block_height' will be equal to current block and no 'undo_signal' will ever be sent | ||
bool final_blocks_only = 4; | ||
|
||
// Substreams has two mode when executing your module(s) either development mode or production | ||
// mode. Development and production modes impact the execution of Substreams, important aspects | ||
// of execution include: | ||
// * The time required to reach the first byte. | ||
// * The speed that large ranges get executed. | ||
// * The module logs and outputs sent back to the client. | ||
// | ||
// By default, the engine runs in developer mode, with richer and deeper output. Differences | ||
// between production and development modes include: | ||
// * Forward parallel execution is enabled in production mode and disabled in development mode | ||
// * The time required to reach the first byte in development mode is faster than in production mode. | ||
// | ||
// Specific attributes of development mode include: | ||
// * The client will receive all of the executed module's logs. | ||
// * It's possible to request specific store snapshots in the execution tree (via `debug_initial_store_snapshot_for_modules`). | ||
// * Multiple module's output is possible. | ||
// | ||
// With production mode`, however, you trade off functionality for high speed enabling forward | ||
// parallel execution of module ahead of time. | ||
bool production_mode = 5; | ||
|
||
string output_module = 6; | ||
|
||
sf.substreams.v1.Modules modules = 7; | ||
|
||
// Available only in developer mode | ||
repeated string debug_initial_store_snapshot_for_modules = 10; | ||
} | ||
|
||
|
||
message Response { | ||
oneof message { | ||
SessionInit session = 1; // Always sent first | ||
ModulesProgress progress = 2; // Progress of data preparation, before sending in the stream of `data` events. | ||
BlockScopedData block_scoped_data = 3; | ||
BlockUndoSignal block_undo_signal = 4; | ||
|
||
// Available only in developer mode, and only if `debug_initial_store_snapshot_for_modules` is set. | ||
InitialSnapshotData debug_snapshot_data = 10; | ||
// Available only in developer mode, and only if `debug_initial_store_snapshot_for_modules` is set. | ||
InitialSnapshotComplete debug_snapshot_complete = 11; | ||
|
||
} | ||
} | ||
|
||
|
||
// BlockUndoSignal informs you that every bit of data | ||
// with a block number above 'last_valid_block' has been reverted | ||
// on-chain. Delete that data and restart from 'last_valid_cursor' | ||
message BlockUndoSignal { | ||
sf.substreams.v1.BlockRef last_valid_block = 1; | ||
string last_valid_cursor = 2; | ||
} | ||
|
||
message BlockScopedData { | ||
MapModuleOutput output = 1; | ||
sf.substreams.v1.Clock clock = 2; | ||
string cursor = 3; | ||
|
||
// Non-deterministic, allows substreams-sink to let go of their undo data. | ||
uint64 final_block_height = 4; | ||
|
||
repeated MapModuleOutput debug_map_outputs = 10; | ||
repeated StoreModuleOutput debug_store_outputs = 11; | ||
} | ||
|
||
message SessionInit { | ||
string trace_id = 1; | ||
} | ||
|
||
message InitialSnapshotComplete { | ||
string cursor = 1; | ||
} | ||
|
||
message InitialSnapshotData { | ||
string module_name = 1; | ||
repeated StoreDelta deltas = 2; | ||
uint64 sent_keys = 4; | ||
uint64 total_keys = 3; | ||
} | ||
|
||
message MapModuleOutput { | ||
string name = 1; | ||
google.protobuf.Any map_output = 2; | ||
// DebugOutputInfo is available in non-production mode only | ||
OutputDebugInfo debug_info = 10; | ||
} | ||
|
||
// StoreModuleOutput are produced for store modules in development mode. | ||
// It is not possible to retrieve store models in production, with parallelization | ||
// enabled. If you need the deltas directly, write a pass through mapper module | ||
// that will get them down to you. | ||
message StoreModuleOutput { | ||
string name = 1; | ||
repeated StoreDelta debug_store_deltas = 2; | ||
OutputDebugInfo debug_info = 10; | ||
} | ||
|
||
message OutputDebugInfo { | ||
repeated string logs = 1; | ||
// LogsTruncated is a flag that tells you if you received all the logs or if they | ||
// were truncated because you logged too much (fixed limit currently is set to 128 KiB). | ||
bool logs_truncated = 2; | ||
bool cached = 3; | ||
} | ||
|
||
message ModulesProgress { | ||
repeated ModuleProgress modules = 1; | ||
} | ||
|
||
message ModuleProgress { | ||
string name = 1; | ||
|
||
oneof type { | ||
ProcessedRanges processed_ranges = 2; | ||
InitialState initial_state = 3; | ||
ProcessedBytes processed_bytes = 4; | ||
Failed failed = 5; | ||
} | ||
|
||
message ProcessedRanges { | ||
repeated BlockRange processed_ranges = 1; | ||
} | ||
message InitialState { | ||
uint64 available_up_to_block = 2; | ||
} | ||
message ProcessedBytes { | ||
uint64 total_bytes_read = 1; | ||
uint64 total_bytes_written = 2; | ||
uint64 bytes_read_delta = 3; | ||
uint64 bytes_written_delta = 4; | ||
uint64 nano_seconds_delta = 5; | ||
} | ||
message Failed { | ||
string reason = 1; | ||
repeated string logs = 2; | ||
// FailureLogsTruncated is a flag that tells you if you received all the logs or if they | ||
// were truncated because you logged too much (fixed limit currently is set to 128 KiB). | ||
bool logs_truncated = 3; | ||
} | ||
} | ||
|
||
message BlockRange { | ||
uint64 start_block = 2; | ||
uint64 end_block = 3; | ||
} | ||
|
||
message StoreDelta { | ||
enum Operation { | ||
UNSET = 0; | ||
CREATE = 1; | ||
UPDATE = 2; | ||
DELETE = 3; | ||
} | ||
Operation operation = 1; | ||
uint64 ordinal = 2; | ||
string key = 3; | ||
bytes old_value = 4; | ||
bytes new_value = 5; | ||
} | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be sf.substreams.rpc.v2 right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the sf.substreams.v1 still exists for the packages, manifests and such. Only, the service layer in it has been deprecated and moved to sf.substreams.rpc.v2 (the v2 to avoid confusion, even if we change namespace)
this extern_path directive informs the rpcv2 tonic handler about where to find the sf.substreams.v1 stuff.