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

Basic support for viaIR #3205

Closed
wants to merge 18 commits into from
Closed

Basic support for viaIR #3205

wants to merge 18 commits into from

Conversation

fvictorio
Copy link
Member

@fvictorio fvictorio commented Sep 22, 2022

Closes #2724.

@vercel
Copy link

vercel bot commented Sep 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hardhat ✅ Ready (Inspect) Visit Preview Dec 10, 2022 at 3:02PM (UTC)
hardhat-storybook ✅ Ready (Inspect) Visit Preview Dec 10, 2022 at 3:02PM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2022

🦋 Changeset detected

Latest commit: 92ac52b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@feuGeneA feuGeneA left a comment

Choose a reason for hiding this comment

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

One of my comments is about something confusing, though maybe it's just me. The other 3 are small improvements you could consider.

}

return latestInstructionRevertFrame;
Copy link
Contributor

Choose a reason for hiding this comment

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

So now this function just falls off and returns undefined? i had to look up and confirm that that's what js does. Maybe use an explicit return undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's what's happening. We could add an explicit return or return undefined, but I think the idiomatic thing (or at least what we normally do in the rest of the codebase) is to not do anything.


if (sourceReference !== undefined) {
return sourceReference;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not following what the change here is. What am I missing? sourceLocationToSourceReference() can return undefined, and we were passing that along before, and now we're making sure not to return its undefined return value from this function, right? but before, it was just falling through to the return undefined; 2 lines later, right? so does this commit have any "functional" change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the previous version of the code was making this assumption: if a step has a location, then we can get a source reference from that location. viaIR seems to break that assumption. What this change is saying is "if you can't get a source reference from this location, then keep looking at the rest of the steps".

For the record 1: this did fix a failing test in OZ, so I'm pretty sure it has a functional change.

For the record 2: this was a very instinctive change, I don't understand in depth why that assumption broke with viaIR.

return this._getCallMessageStackTrace(maybeDecodedMessageTrace);
}

log("Trace is not decoded");
Copy link
Contributor

Choose a reason for hiding this comment

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

should this message not also convey "trace is not a precompile" and "trace does not have an error object"? why not log("Trace message not recognized") like the function name?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a strong preference. "Decoded" in this context has (at least to me) a clear meaning, about the trace not having extra information added by Hardhat. I don't mind changing it though, maybe to "Trace is not a precompile nor decoded" if you think that's better.

@feuGeneA
Copy link
Contributor

Actually, I did have a question about testing this. How did you? I didn't notice anything in here. Do any of our fixture projects already enable viaIR?

@fvictorio
Copy link
Member Author

Closing in favor of #3415.

@fvictorio fvictorio closed this Dec 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2023
@fvictorio fvictorio deleted the via-ir branch August 7, 2023 10:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strack traces not compatible with viaIR
2 participants