This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Make the function depth workaround conditional on using solc of version <0.5.1 #1493
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…to the old output.
…rom command line.
…a caret range, and update the tests themselves for the changes here and 0.5.1.
… to the context info, where it does. Also, determine whether to invoke the workaround by looking at the context that will be called, instead of the current context. Finally, fix an oversight where I changed the default function depth from 1 to 0, but only in initialization, not in reset; now it's changed in reset as well.
gnidan
approved these changes
Dec 5, 2018
//call. Note that this won't work if the contract method was previously | ||
//placed in a function variable! Those will continue to screw things up! | ||
//But if a contract call is being made directly, we can detect that. | ||
//because of the problem in solc <5.0.1 where contract method calls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor typo: v0.5.1
context => | ||
context.compiler !== undefined && //would be undefined for e.g. a precompile | ||
context.compiler.name === "solc" && | ||
semver.satisfies(context.compiler.version, "<0.5.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love using the semver
library to compare semver values/constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What, you think I want to make that comparison myself? :P
@@ -25,7 +25,7 @@ export async function prepareContracts(provider, sources = {}, migrations) { | |||
|
|||
config.compilers = { | |||
solc: { | |||
version: "0.5.0" | |||
version: "^0.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request makes the function depth contract call workaround conditional on the contract (or library) being called into having been compiled with a version of
solc
prior to0.5.1
. As of version0.5.1
,solc
now outputs corrected jump markings that no longer exhibit the problem that made the function depth workaround necessary; however, it remains necessary for any old contracts compiled prior to that, so it has been left in conditional on the compiler version.In order to effect this, compiler information from the artifact files is now included in the
context
objects. A newevm
selector has been added to get the context not of the current call, but of the call about to be made (the logic previously inevm.current.context
has been factored out into a function since they both work the same way); and asolidity
selector has been added to get the compiler information and check whether it'ssolc
of version prior to0.5.1
in order to determine whether to invoke the workaround.One little quirk is worth noting -- although this is really due to
solc
0.5.1
and not to the changes here. When calling a function externally, its parameters will now end up indata.proc.assignments
twice -- once in the correct stackframe, and once in an otherwise unused stackframe. Since these ghost parameters shouldn't affect anything and would be difficult to get rid of, I've left them alone.Also, in order to keep the
functionDepth
similar to how it was prior to0.5.1
, I've adjusted the defaultfunctionDepth
from1
to0
. This will introduce an offset when debugging contracts compiled with an older version ofsolc
, butfunctionDepth
is purely an internal thing anyway; this offset has no effect.Finally, this pull requests updates the tests from version
0.5.0
to version^0.5.0
(so, presently, that's0.5.1
). It also adjusts thefunctionDepth
tests to be correct withsolc
's new jump markings. No new tests have been added in this pull request.