-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: VVM injection, internal functions and variables #294
base: master
Are you sure you want to change the base?
Conversation
depends on vyperlang/vvm#21
I'm waiting for vyperlang/vvm#21 and vyperlang/vvm#23 before finishing this PR |
return None | ||
|
||
result = vvm.compile_source( | ||
self.source_code, vyper_version=self.vyper_version, output_format="metadata" |
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.
why don't we just get metadata to begin with (when generating VVMDeployer)?
also, note that metadata isn't available in all versions of vyper, and it is not guaranteed to be stable between releases. but this probably works for recent vyper versions (0.3.7-0.3.10)
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.
For what it's worth I would have no objection to restricting the scope of the VVM functionalities to 0.3.7+
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.
why don't we just get metadata to begin with (when generating VVMDeployer)?
Can we do that without calling the compiler twice? I implemented it here so it's only done when necessary (note the cached_property
)
also, note that metadata isn't available in all versions of Vyper
We'll show the error from the compiler, so it should be clear when not supported
not guaranteed to be stable between releases
If you way to get info about private functions that's stable please let me know
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.
why don't we just get metadata to begin with (when generating VVMDeployer)?
Can we do that without calling the compiler twice? I implemented it here so it's only done when necessary (note the
cached_property
)
ah, maybe we should have added the option for multiple output formats in vvm
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.
That doesn't work with combined_json
anyway
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.
yea, we should probably add "stabilize" metadata (which, i think we have mostly stopped making changes to it) and add to combined_json output.
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.
sounds like a good idea, however that won't work for old vyper versions
self.contract = contract | ||
|
||
def get(self, *args): | ||
return self.__call__(*args) |
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.
this doesn't really work the same way as VyperContract.get()
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.
please explain
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.
in vyper_contract.StorageVar.get()
, it takes no arguments, and instead iterates over touched storage slots to reconstruct a dict. the way it's done here, it exposes a getter which the user needs to provide arguments to
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 am mildly ok with not requiring the API to be the same, but in that case we should probably call it something else, like get_value_at()
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.
Ah OK, I thought that's how that worked, I might have mixed it up when implementing zksync plugin.
I don't think we can get all the key values via the ABI
What I did
inject_function
,internal
and_storage
contract methods for any contract compiled via the VVMHow I did it
Cute Animal Picture