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

Return bool from get_storage and set_storage #146

Closed
chfast opened this issue Sep 6, 2018 · 5 comments
Closed

Return bool from get_storage and set_storage #146

chfast opened this issue Sep 6, 2018 · 5 comments
Assignees

Comments

@chfast
Copy link
Member

chfast commented Sep 6, 2018

Continuation of #117

get_storage

For get_storage we can do similarly to get_code_hash and return false when an account does not exist, but this is very artificial case, because the get_storage is only used for the currently executed account. Any VM should not expect get_storage to fail.

set_storage

Similar story as for get_storage but worse. The set_storage returns evmc_storage_status. This one would need to be extended with EVMC_STORAGE_NO_SUCH_ACCOUNT.

@axic
Copy link
Member

axic commented Sep 6, 2018

I think this still makes sense because the function still has an address parameter. What to do if a VM uses an another address? Not clear.

@chfast
Copy link
Member Author

chfast commented Sep 6, 2018

Well it would return a null hash in this case (as it does currently).

@axic
Copy link
Member

axic commented Sep 6, 2018

Well it would return a null hash in this case (as it does currently).

This is not documented.

@chfast
Copy link
Member Author

chfast commented Sep 6, 2018

Is the documentation enough then?

@axic
Copy link
Member

axic commented Sep 6, 2018

set_storage should have that NO_SUCH_ACCOUNT case.

I guess we can go with that for the moment, but if we do have NO_SUCH_ACCOUNT, we may just want to have the bool in get_storage and the design pattern is that we use bool where appropriate, but if the function needs more cases than true/false, then use an enum such as set_storage is doing.

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

No branches or pull requests

2 participants