Skip to content

Update AssemblyScript to 0.19.2 #2571

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

Merged
merged 32 commits into from
Jul 15, 2021
Merged

Conversation

evaporei
Copy link
Contributor

@evaporei evaporei commented Jun 15, 2021

This PR allows subgraph developers to use AssemblyScript on version 0.19.2. To enable the feature, they must change their subgraph.yaml's apiVersion to a version greater than or equal to 0.0.5. The behavior for the current deployed subgraphs shouldn't change at all.

Before this is merged, we need to release a new version of both graph-ts and graph-cli, so we can point to them in the integration-tests, for now they're using these PRs branches:

Important changes:

  • runtime/asc_abi/class now holds mappings for both versions, the ones that needed to change were: ArrayBuffer, TypedArray, AscString and Array;
  • Some runtime if/elses have been added to support both versions (in WasmInstance/WasmInstanceContext for memory alignment and new exported functions);
  • runtime unit tests have been duplicated
  • A new integration-test has been added pointing to the older apiVersion 0.0.4

@evaporei evaporei self-assigned this Jun 15, 2021
@evaporei evaporei force-pushed the otavio/update-assembly-script branch 8 times, most recently from c9d4162 to b02cac8 Compare June 18, 2021 22:06
@evaporei evaporei marked this pull request as ready for review June 18, 2021 23:26
@evaporei evaporei force-pushed the otavio/update-assembly-script branch 5 times, most recently from b8496ce to e13ca01 Compare June 22, 2021 16:51
@evaporei evaporei requested review from leoyvens and removed request for leoyvens June 22, 2021 17:01
@evaporei evaporei force-pushed the otavio/update-assembly-script branch 3 times, most recently from b8440a3 to 207d0f5 Compare June 23, 2021 16:45
@evaporei evaporei requested a review from leoyvens June 23, 2021 16:45
@evaporei evaporei force-pushed the otavio/update-assembly-script branch 5 times, most recently from f100d50 to 9ecb156 Compare July 2, 2021 05:45
@evaporei evaporei requested review from leoyvens and removed request for leoyvens July 2, 2021 05:57
evaporei added 21 commits July 12, 2021 23:54
This had to be done for now because the size_of is being
called on AscPtr::read_ptr using the whole structure containing
both versions, so the size is bigger.
Now we pass a flag (--explicitStart) to `asc` (AssemblyScript compiler)
for it to export the `_start` funcion for us to call it manually.
This is being done so the host-exports work properly.
@evaporei evaporei force-pushed the otavio/update-assembly-script branch from e3bc271 to 7f29b82 Compare July 13, 2021 02:54
@@ -1,7 +1,9 @@
import { Trigger } from "../generated/Contract/Contract";
import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts";

// Test that host exports work in globals.
// TODO: remove this, graph-ts should guarantee this
__alloc(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this TODO be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this should be removed 😅

I'll remove both TODO and __alloc.

The __alloc should be called by my graph-ts branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

@leoyvens
Copy link
Collaborator

Lets just squash the commits when merging

// Sanity check
match &api_version {
api_version if *api_version <= Version::new(0, 0, 4) => {
// This was using an double equal sign before instead of less than.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leoyvens here's the final comment I've talked about

@evaporei evaporei merged commit 8bef4c0 into master Jul 15, 2021
@evaporei evaporei deleted the otavio/update-assembly-script branch August 26, 2021 17:35
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.

3 participants