Subgraph Uncrashable by Float is a code generation tool that integrates with any subgraph and ensures continuous uptime of your subgraph by making your subgraph uncrashable 🚀
The team behind Float has been building subgraphs for several years. First for wildcards.world, and since then, they have been contracted to build out multiple production critical graphs for clients (as avolabs.io) and most recently for their own protocol, Float.
Through working extensively with subgraphs, the Float team has found strategies to make subgraphs more fool-proof by implementing a variety of helper functions that make many classes of common graph bugs impossible. These helper functions have been greatly inspired by pure-functional programming languages, and have been used with great effect in developing and upgrading Float’s subgraphs.
Some common problems seen repeatedly in subgraphs are that they are prone to issues of loading undefined entities, not setting or initializing all values of entities and race conditions on loading and saving entities. A subgraph crashing due to mishandling of entities (in our experience this is 99% of all subgraph issues) can render your UI or any other service that relies on the subgraph, unavailable or unusable by your end users, and in turn lead to adverse business impacts.
Subgraph Uncrashable completely abstracts the need for subgraph developers to call
Entity.save()functions which are all inherently error prone. Using our helper functions these common pitfalls will become impossible.
Integrating your subgraph with Subgraph Uncrashable ensures your subgraph does not crash. This is achieved by generating a set of helper functions from the graphql schema of the project that ensure all interactions with entities in the graph are completely safe.
In August 2022, the Float team decided that the use of this tool would benefit any subgraph developer and ultimately benefit overall Graph ecosystem, and applied for a grant with The Graph Foundation. After successful application, Float received funding to decouple the tool from its current hard-coded integration, package the code generation tool into a stand-alone application, open-source it, and integrate with the Graph CLI.
“Credits are owed to the amazing team running The Graph Foundation Grants Program. Float is extremely grateful to be contributing to the graph ecosystem and providing builders with more confidence in their subgraph development.” - Jason Smythe, Co-Founder at Float
Mishandled entities cause subgraphs to crash, which can be very disruptive for projects that are dependent on the graph. Set up helper functions to make your subgraphs “uncrashable” and ensure business continuity.
Common problems seen in subgraph development are issues of loading undefined entities, not setting or initializing all values of entities, and race conditions on loading and saving entities. Ensure all interactions with entities are completely atomic.
Set default values and configure the level of security checks that suits your individual project's needs. Warning logs are recorded indicating where there is a breach of subgraph logic to help patch the issue to ensure data accuracy.
The code generation tool accommodates all subgraph types and is configurable for users to set sane defaults on values. The code generation will use this config to generate helper functions that are to the users specification.
The framework also includes a way (via the config file) to create custom but safe setter functions for groups of entity variables. This way it is impossible for the user to load/use a stale graph entity and it is also impossible to forget to save or set a variable that is required by the function.
Warning logs are recorded as logs indicating where there is a breach of subgraph logic to help patch the issue to ensure data accuracy. These logs can be viewed in the The Graph's hosted service under the 'Logs' section.
Subgraph Uncrashable is available as a standalone npm package or using the Graph CLI as an optional flag.
graph codegen [options] [<subgraph-manifest>]
-h, --help Show usage information
-o, --output-dir <path> Output directory for generated types (default: generated/)
--skip-migrations Skip subgraph migrations (default: false)
-w, --watch Regenerate types when subgraph files change (default: false)
-u, --uncrashable Generate Float Subgraph Uncrashable helper file
-uc, --uncrashable-config <path> Directory for uncrashable config (default: ./uncrashable-config.yaml)
Run the graph uncrashable codegen via the Graph CLI:
graph codegen -u
npm install @float-capital/float-subgraph-uncrashable
yarn add @float-capital/float-subgraph-uncrashable
Run the graph uncrashable codegen as a standalone package:
Any project building or upgrading a subgraph can use this tool to make their subgraphs “uncrashable” and ensure continuous uptime 🚀
Watch this video tutorial for a demo on installing and configuring Subgraph Uncrashable against an example subgraph.
If you require any support installing, configuring or using the tool, please feel free to send the Float team a message in the discussions section of the float-subgraph-uncrashable repository on Github.
If you would like to contribute to this project or if you have identified a bug / issue with the tool, please feel free to visit the contribution guidelines in the float-subgraph-uncrashable repository on Github. Pull requests submitted that do not follow the guidelines will not be reviewed and/or merged.
The Graph is the indexing and query layer of web3. Developers build and publish open APIs, called subgraphs, that applications can query using GraphQL. The Graph currently supports indexing data from over 39 different networks
The Graph Foundation oversees The Graph Network. The Graph Foundation is overseen by the Technical Council, Edge & Node, StreamingFast, Figment, Semiotic, The Guild, Messariand GraphOps are seven of the many organizations within The Graph ecosystem.
Float is a novel derivatives protocol for minting leveraged tokens on chain, with no liquidations, no over-collaterization and no margin maintenance. Leveraged returns in one click.
Get live updates, new features, opportunities and shitposts on our Twitter.
Or, meet the team, claim your gem role, and hang out in our Discord.