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

Fix the volatileGet to not revert with OutOfGas Error when key does not exist #16

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MoeMahhouk
Copy link
Contributor

In this PR:
We fixed the issue with volatileGet precompile function upon calling it with key that doesnt exist.
It returns an err, however, it also reverts the whole execution with OutOfGas (gas_used =18158513697557840303)
To avoid such an issue and still be able to handle a non-existing key from the smart contract side:
1- Instead of reverting with an error, we return a status and a value. The status would mark if the key exists or not.
If the key exists, the value will be set accordingly. If not, it will return 0 bytes array with a failure status (false)
2- Added unit tests for existing and non-existing keys

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