Skip to content
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

Use reserved discriminant segments for IndexForAscTypeId #3446

Merged
merged 2 commits into from
Apr 12, 2022

Conversation

tilacog
Copy link
Contributor

@tilacog tilacog commented Apr 8, 2022

This PR changes the organization of IndexForAscTypeId variants for future blockchain implementations.

Motivation:
The incentive for this change is the expected (and desired) growth of supported blockchains in Graph-Node. Each new blockchain implementation also comes with a myriad of new AssemblyScript types defined in Graph-TS that need to be represented in the runtime. We have been appending new type IDs to the end of the IndexForAscTypeId enum, but the addition of new types proved to be convoluted and hard to reason about. We aim to improve the developer experience by removing this kind of friction.

Rationale:
We propose that each blockchain implementation have a fixed and contiguous discriminant space of 1,000 items, starting to be enforced after our latest released implementations: Ethereum and Near.

Our goal is that every new supported blockchain, for instance, Tendermint, will have room to include new AssemblyScript class IDs without interweaving its discriminants with other blockchains.

Merging and Releasing instructions:
Although this PR interferes with memory allocation in the runtime, it should not disrupt previously compiled subgraphs because the currently released AssemblyScript type IDs were not touched.

However, any existing Tendermint prototype subgraphs will face errors due to this changes and needs to be recompiled and re-synced.

TODO: We need to reorganize the variants in graph-ts' TypeId enum to exactly match the variants and their kid rearranged by this PR.

@tilacog tilacog requested review from evaporei and leoyvens April 8, 2022 03:08
@tilacog tilacog self-assigned this Apr 12, 2022
TransactionReceipt = 1000,
Log = 1001,
ArrayH256 = 1002,
ArrayLog = 1003,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these are all not in real use yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Positive.
Those types were created for #3373, which haven't gone live yet.

@tilacog tilacog merged commit 5e8bc88 into master Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants