Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Fail early on StateDB functions #410

Closed
fedekunze opened this issue Aug 6, 2021 · 5 comments · Fixed by #566
Closed

Fail early on StateDB functions #410

fedekunze opened this issue Aug 6, 2021 · 5 comments · Fixed by #566
Assignees
Labels
C:x/evm EVM module good first issue Good for newcomers help wanted Extra attention is needed

Comments

@fedekunze
Copy link
Contributor

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.

@fedekunze fedekunze added C:x/evm EVM module good first issue Good for newcomers help wanted Extra attention is needed labels Aug 6, 2021
@yihuang
Copy link
Contributor

yihuang commented Aug 12, 2021

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

@fedekunze
Copy link
Contributor Author

no, it shouldn't panic, just fail early

@yihuang
Copy link
Contributor

yihuang commented Aug 16, 2021

https://github.com/ethereum/go-ethereum/blob/master/core/state/statedb.go#L299
In go-ethereum, the query apis just returns a empty value when things not found.

@tomtau
Copy link
Contributor

tomtau commented Sep 15, 2021

being worked on by @davcrypto

@davcrypto
Copy link
Contributor

@tomtau yup, please help to assign to me first

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C:x/evm EVM module good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants