-
Notifications
You must be signed in to change notification settings - Fork 49
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
boa/util/cached_vvm.py
Outdated
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.
not sure that we need this to be a separate file really
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()
boa/contracts/vvm/vvm_contract.py
Outdated
def __call__(self, *args, **kwargs): | ||
env = self.contract.env | ||
assert isinstance(self.contract, VVMContract) # help mypy | ||
env.set_code(self.contract.address, self._override_bytecode) |
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.
uhh i think this is wrong if there is a callback into the contract's code
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.
the rest of the contract should still behave the same even if we injected one method
What I did
inject_function
,internal
and_storage
contract methods for any contract compiled via the VVMHow I did it
Cute Animal Picture