Interop: "Xelper" Devnet Tooling #12792
Open
+409
−0
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.
Xelper
Xelper is a lightweight python/shell-scripting framework for playing with the
interop-devnet
. The purpose is to allow interaction with deployed chains using composable scripting, while also supporting persisting the outputs in a way that's friendly for manual intervetion.Commands
Each Xelper command can be found in the
commands
directory. Commands are expected to adhere to the followingexecute
and must contain adescription
Context Variables
Xelper uses
context
files, which is just a named JSON format K:V storage that commands can share. For example:This snippet is from the
deploy_emitter
command. The command uses subprocess to run aforge
contract creation, and then saves the result structure, and saves the contract to a separate key.When the command is done, Xelper will save the new version of the Context to the original location. Other commands can access these new values to extend the previous steps, like so:
This snippet is from
emit
, which first locates a previously registered Emitter contract, and then uses string-formatting to include it in a subprocess call tocast
All the existing commands follow the same pattern of leveraging subprocess to execute bash scripts, and then consume the output and persist important parts to the Context.
There are a few reasons for this context system:
Running
To see the full list of commands, run Xelper without specifying a subcommand.
Optional Top Level Arguments
--context specifies a context file, or will default to
context.json
--verbose will print the full
stdout
andstderr
returned from subcommandsExample
For an example of how to use Xelper for complex workflows, check out
example_orchestration.sh
which:The context which is created can be used for further calls to Xelper, or you can manually use the outputs in your own work. You could also put manual pause steps between thee lines, or add branching based on the Context. The point of Xelper is to allow composable scripts to build off one another without making any monolithic scripts
context.json
after runningexample_orchestration.sh
https://gist.github.com/axelKingsley/56327215231e26ce731f3187d11186e1