-
Notifications
You must be signed in to change notification settings - Fork 46
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
Support multiple network definitions inside a Package #351
Comments
One could think that the |
This would be great. |
Ok, we refined and updated the thing, @YaroShkvorets please re-read. |
After more discussions:
This is because:
This leads to the following decisions.
|
Eventually, we could remove the client-side burden of computing all this and send the packed spkg in the request, along with the parameters like 'network' and 'params'. Maybe... |
#358 reviews welcome! |
This is great and needed for a long time for us! I think one last touch is to update the schema.json file to reflect these changes. I can make a PR to update but it may be a couple days before I get back around to it https://github.com/streamingfast/substreams/blob/develop/schemas/manifest-schema.json |
Rationale
It is very cumbersome right now to specify the configuration, initial blocks and parameterization for each networks. They need to be in separate files, and we get into a combinatorial problem when we also try to do sink configurations, for each network.
With the current model, we are also forced to ship a new
spkg
for each network configuration, making substreams.dev's interface a bit more ugly. Ideally, we would select anspkg
, which is known to work for multiple networks, and through a dropdown, for a given version, we could select which network to use dynamically.This puts the onus on the client sending the request to pick up the configs for a given network (taken from
network
or as a command-line argument to override it), and apply them to the right modules. The next-level overrides will come from the command-linep
flags.Proposition
Support this syntax in the manifest:
The
deriveFrom
directive would allow one to either OVERWRITE or APPEND a network configuration. Or to replace the functionality ofderiveFrom
, one could now usesubstreams (re?)pack --network polygon ./substreams.yaml
which would write a new .spkg, preconfigured (with network = polygon, and all parameters and initial block in place in their Module definition), with the filename appended with-polygon.spkg
(before the version? after the version?). This ought NOT TO CHANGE thepackage.name
to be able to deduplicate once on substreams.dev ...deriveFrom
just goes away, as it serves no other purpose.The
run
andgui
commands would now support--network
and apply the network configs to theModules
before sending the request over. It would also do some checks to make sure the overrides of params and initialBlocks are consistent between networks (no keys are missing for instance).The
imports
manifest declaration needs to also import thenetworks
definitions, and remap themodule_name
toimported_name:module_name
.. so it cascades when someone selects a network from a child spkg (one that imports multiple spkgs for instance).network
application, will then apply the changes for all of its parents.Validation for
substreams.yaml
'snetworks
:initialBlock
or originalparams
value for a module, unless it uses thisnetworks
override mechanism.In the above example, if
goerli
was not defined within thesrc
import, the algorithm above would halt with the error:missing initialBlock for network "goerli", on module "src:map_pair_created".
spkg
for individual networks. substreams.dev can cross-check my comparing module count, and module hash for each network in equality, + version and package.name.spkg
per network, which complexifies and makes substreams.dev ugly and unintuitive.Q: Rename
network
todefaultNetwork
orselectedNetwork
? Keep it as is?preconfiguredNetwork
The text was updated successfully, but these errors were encountered: