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

feat: add bytecode_address from CallInputs to Contract during construction. #1568

Merged
merged 6 commits into from
Jun 30, 2024

Conversation

vandenbogart
Copy link
Contributor

It's completely possible I am missing something, but I couldn't find a good way to access the address of the account which owns the bytecode being executed while using the Inspector::step hook. It would be really convenient if the contract stored on the interpreter also contained the bytecode address like the CallInputs it is constructed from do.

@vandenbogart vandenbogart changed the title Add bytecode_address from CallInputs to Contract during construction. feat: add bytecode_address from CallInputs to Contract during construction. Jun 26, 2024
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

This seems reasonable to add.

But would make bytecode_address a Option in a similar way as the Contract hash is, and would put it to None if it is a creation call.

@@ -60,6 +65,7 @@ impl Contract {
bytecode,
hash,
contract_address,
None,
Copy link
Member

Choose a reason for hiding this comment

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

This should be added from env.tx.kind if kind is To we should set that address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I get your meaning. I set it to None in the case of create and to the destination address in the case of Call

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

One more nit

@rakita rakita merged commit 5507047 into bluealloy:main Jun 30, 2024
26 checks passed
@github-actions github-actions bot mentioned this pull request Jun 30, 2024
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.

2 participants