-
Notifications
You must be signed in to change notification settings - Fork 107
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
chore(state-transition): improving applyDeposit
error handling
#2062
base: storage-cleanup-err-not-found
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## storage-cleanup-err-not-found #2062 +/- ##
=================================================================
- Coverage 22.09% 22.07% -0.02%
=================================================================
Files 357 357
Lines 16192 16205 +13
Branches 12 12
=================================================================
Hits 3578 3578
- Misses 12463 12476 +13
Partials 151 151
|
mod/state-transition/go.sum
Outdated
@@ -1,3 +1,11 @@ | |||
cosmossdk.io/api v0.7.0 h1:QsEMIWuv9xWDbF2HZnW4Lpu1/SejCztPu0LQx7t6MN4= | |||
cosmossdk.io/api v0.7.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introducing cosmos deps to state-transition is bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but I believe we have to properly handle the errors from state, however unlikely they are. Will work on finding a different way for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebasing this PR on top of a couple of others, I managed to ditch the direct cosmos sdk dependency and have state-transition depend on storage instead
stateProcessor.applyDeposit
assumed that the only possible error when querying for a validator was that the validator did not exist, in which case it creates it.This is brittle. This PR handles errors differently. A validator is created only if
ErrNotFound
is returned, otherwiseapplyDeposit
returns the error to the client and does not go ahead creating a new validator.