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

Validator scenario #287

Merged
merged 4 commits into from
Jan 23, 2019
Merged

Validator scenario #287

merged 4 commits into from
Jan 23, 2019

Conversation

alpe
Copy link
Contributor

@alpe alpe commented Jan 22, 2019

  • Add/ Remove validator
  • Prevent empty validator updates crashing tendermint
  • Fixes validator initializer not called

@alpe alpe requested a review from husio January 22, 2019 15:15
@codecov-io
Copy link

codecov-io commented Jan 22, 2019

Codecov Report

Merging #287 into master will increase coverage by 0.1%.
The diff coverage is 88%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #287     +/-   ##
=======================================
+ Coverage    70.8%    71%   +0.1%     
=======================================
  Files         143    144      +1     
  Lines        6281   6307     +26     
=======================================
+ Hits         4451   4482     +31     
+ Misses       1392   1384      -8     
- Partials      438    441      +3
Impacted Files Coverage Δ
x/validators/errors.go 100% <ø> (ø) ⬆️
cmd/bnsd/client/tx.go 85.7% <100%> (+4.7%) ⬆️
cmd/bnsd/app/init.go 85.7% <100%> (+0.2%) ⬆️
cmd/bnsd/client/admin.go 100% <100%> (ø)
x/validators/handler.go 76.4% <76.9%> (-2%) ⬇️
x/validators/msg.go 86.2% <85.7%> (-0.5%) ⬇️
app/store.go 69.6% <0%> (+4%) ⬆️
cmd/bnsd/app/tx.go 50% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c25d96a...a9f0e73. Read the comment docs.

return b.conn.Validators(nil)
}

func (b *BnsClient) GetValidators(height int64) (*ctypes.ResultValidators, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a sentence of an explanation would make this method perfect.

💅 What do you think about using -1 as a height value to get the current validators list (instead of GetCurrentValidators method).

I think it would be much better if this package would not return ctypes structures. Current API leaks out it's dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add docs 👍
The server functionality for this is built into Tendermint. Unlike the other client functions I would need to substitute all the nested ctypes, too. Our use case is very much limited to admin operations with the cluster. I will extract this code into an admin client to separate this from "normal" client operations.

}
`, addr)
`, addr, multiSigContractAddr, addr)
println(appState)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👮‍♂️

@@ -10,13 +10,17 @@ import (
// ABCI Response Codes
// x/update_validators reserves 40 ~ 49.
const (
CodeEmptyDiff uint32 = 40
CodeWrongType = 41
CodeEmptyDiff uint32 = 40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 They are const, so it might be better to leave them without a type. Compiler can do an extra work for us then.

strings.ToLower(m.Pubkey.Type) != "ed25519" {
return errors.WithCode(errInvalidPubKey, CodeInvalidPubKey)
}
// can power be negative?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think it would make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me neither. Added a condition to prevent this

Copy link
Contributor

@husio husio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@alpe alpe merged commit fefebb1 into master Jan 23, 2019
@alpe alpe deleted the validator_scenario branch January 23, 2019 09:53
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.

None yet

3 participants