The Wayback Machine - https://web.archive.org/web/20210815142741/https://github.com/tharsis/ethermint/issues/410
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

Fail early on StateDB functions #410

Open
fedekunze opened this issue Aug 6, 2021 · 2 comments
Open

Fail early on StateDB functions #410

fedekunze opened this issue Aug 6, 2021 · 2 comments

Comments

@fedekunze
Copy link
Contributor

@fedekunze fedekunze commented Aug 6, 2021

Most of the functions from statedb.go perform a no-operation (no-op) when an error is encountered. The problem is, that these functions don't have any context of whether previous calls failed or not. For example, both GetCodeHash and GetNonce require the account to exist before returning the value.

Solution:

Introduce a stateErr error field on the Keeper and return early on every StateDB method if there is a previous error registered.

@yihuang
Copy link
Collaborator

@yihuang yihuang commented Aug 12, 2021

Just panic should be good? since the cosmos-sdk call will recover the panic.

@fedekunze
Copy link
Contributor Author

@fedekunze fedekunze commented Aug 12, 2021

no, it shouldn't panic, just fail early

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment