Skip to content

types/priv_validator package#1203

Merged
ebuchman merged 23 commits intodevelopfrom
feature/priv_val
Feb 28, 2018
Merged

types/priv_validator package#1203
ebuchman merged 23 commits intodevelopfrom
feature/priv_val

Conversation

@ebuchman
Copy link
Contributor

@ebuchman ebuchman commented Feb 9, 2018

Replaces #1044
closes #673

Note this is just the new code, none of the integration (old priv val is still there).

I didn't feel too good about the integration last time, and now its riddled with conflicts, so maybe we can figure out a simple way to make it work starting a fresh. At least with this we can merge it without affecting anything.

@ebuchman ebuchman requested a review from melekes as a code owner February 9, 2018 22:01
@ebuchman ebuchman changed the title Feature/priv val types/priv_validator package Feb 9, 2018
// or else generates a new one and saves it to the filePath.
func LoadOrGenPrivValidatorJSON(filePath string) *PrivValidatorJSON {
var pvj *PrivValidatorJSON
if _, err := os.Stat(filePath); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

cmn.FileExists(filePath) ?

@melekes
Copy link
Contributor

melekes commented Feb 10, 2018

# github.com/tendermint/tendermint/types/priv_validator
/tmp/go-build532587797/github.com/tendermint/tendermint/types/priv_validator/_test/_obj_test/unencrypted.go:16:6: undefined: "github.com/tendermint/tendermint/types".ValidatorID

xla added 6 commits February 13, 2018 19:08
* break out connect functionality out of OnStart
* introduce max retries
As calls to the private validator can involve side-effects like network
communication it is desirable for all methods returning an error to not
break the control flow of the caller.

* adjust PrivValidator interface
@zramsay zramsay mentioned this pull request Feb 19, 2018
@ebuchman
Copy link
Contributor Author

Merged in the new priv validator socket work, but please see review from that PR: #1204 (review)

@codecov-io
Copy link

codecov-io commented Feb 19, 2018

Codecov Report

Merging #1203 into develop will decrease coverage by 0.14%.
The diff coverage is 59.66%.

@@             Coverage Diff             @@
##           develop    #1203      +/-   ##
===========================================
- Coverage    59.66%   59.52%   -0.15%     
===========================================
  Files          121      126       +5     
  Lines        11050    11527     +477     
===========================================
+ Hits          6593     6861     +268     
- Misses        3851     4012     +161     
- Partials       606      654      +48

xla and others added 2 commits February 23, 2018 13:58
Following ADDR 008 the node will connect to an external
process to handle signing requests. Operation of the external process is
left to the user.

* introduce alias for PrivValidator interface on socket client
* integrate socket client in node
* structure tests
* remove unnecessary flag
@xla
Copy link
Contributor

xla commented Feb 28, 2018

@ebuchman What's the next step here? Should we start with the actual integration by getting rid of the old priv val, flesh out cmd/priv_val_server according to ADR 008, or prepare to merge as is?

Happy to follow-up and tackle any of these.

var (
chainID = flag.String("chain-id", "mychain", "chain id")
listenAddr = flag.String("laddr", ":46659", "Validator listen address (0.0.0.0:0 means any interface, any port")
maxConn = flag.Int("clients", 3, "maximum of concurrent connections")
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we want to limit that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Originally it only accepted a single connection at a time, we had a discussion around it and decided to go with 3 for now. Usually the relation should be one-to-one, between tendermint process and external signer, as far as I know at least.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Thanks

)
)

if err := pvsc.Start(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't find where we stop this ...

Copy link
Contributor

Choose a reason for hiding this comment

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

If we defer pvsc.Stop() here it would be killed as soon as we exit the function scope. If the client is used it's vital to the node and is kind of bound to the lifecycle of the node process itself, maybe I missed a place where we have teardown when the node shuts down, that would be the place to stop it.

Copy link
Contributor

Choose a reason for hiding this comment

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


func (pvj *PrivValidatorJSON) save() {
if pvj.filePath == "" {
cmn.PanicSanity("Cannot save PrivValidator: filePath not set")
Copy link
Contributor

Choose a reason for hiding this comment

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

Panic* methods are deprecated. Use panic instead.

Round int `json:"round"`
Step int8 `json:"step"`
Signature crypto.Signature `json:"signature,omitempty"` // so we dont lose signatures
SignBytes cmn.HexBytes `json:"signbytes,omitempty"` // so we dont lose signatures
Copy link
Contributor

Choose a reason for hiding this comment

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

sign_bytes?

Copy link
Contributor

@xla xla Mar 6, 2018

Choose a reason for hiding this comment

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

This would be inconsistent to other occurences of signbytes:

LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` // so we dont lose signatures

Round int `json:"round"`
Step int8 `json:"step"`
Signature crypto.Signature `json:"signature,omitempty"` // so we dont lose signatures
SignBytes data.Bytes `json:"signbytes,omitempty"` // so we dont lose signatures
Copy link
Contributor

Choose a reason for hiding this comment

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

sign_bytes?

return // Ignore error from listener closing.
}
pvss.Logger.Error(
"accpetConnections",
Copy link
Contributor

Choose a reason for hiding this comment

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

accept

@ebuchman
Copy link
Contributor Author

Merging for the sake of progress, will open new issue for remaining points. Thanks @xla !

@ebuchman ebuchman merged commit dd2d846 into develop Feb 28, 2018
@ebuchman ebuchman deleted the feature/priv_val branch February 28, 2018 14:27
@ebuchman ebuchman mentioned this pull request Feb 28, 2018
7 tasks
@ebuchman
Copy link
Contributor Author

See issue #1255 and new PR #1256 for follow-up

@xla xla mentioned this pull request Mar 6, 2018
firelizzard18 pushed a commit to AccumulateNetwork/tendermint that referenced this pull request Feb 1, 2024
…not match locked block (tendermint#1203)

* consensus: update state to prevote nil when proposal block does not match locked block. (tendermint#6986)

* add failing test

* tweak comments in failing test

* failing test comment

* initial attempt at removing prevote locked block logic

* comment out broken function

* undo reset on prevotes

* fixing TestProposeValidBlock test

* update test for completed POL update

* comment updates

* further unlock testing

* update comments

* Update internal/consensus/state.go

* spacing nit

* comment cleanup

* nil check in addVote

* update unlock description

* update precommit on relock comment

* add ensure new timeout back

* rename IsZero to IsNil and replace uses of block len check with helper

* add testing.T to new assertions

* begin removing unlock condition

* fix TestStateProposerSelection2 to precommit for nil correctly

* remove erroneous sleep

* update TestStatePOL comment

* update relock test to be more clear

* add _ into test names

* rename slashing

* udpate no relock function to be cleaner

* do not relock on old proposal test cleanup

* con state name update

* remove all references to unlock

* update test comments to include new

* add relock test

* add ensureRelock to common_test

* remove all event unlock

* remove unlock checks

* no lint add space

* lint ++

* add test for nil prevote on different proposal

* fix prevote nil condition

* fix defaultDoPrevote

* state_test.go fixes to accomodate prevoting for nil

* add failing test for POL from previous round case

* update prevote logic to prevote POL from previous round

* state.go comment fixes

* update validatePrevotes to correctly look for nil

* update new test name and comment

* update POLFromPreviousRound test

* fixes post merge

* fix spacing

* make the linter happy

* change prevote log message

* update prevote nil debug line

* update enterPrevote comment

* lint

* Update internal/consensus/state.go

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* Update internal/consensus/state.go

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* add english description of alg rules

* Update internal/consensus/state.go

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* comment fixes from review

* fix comment

* fix comment

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>

* Fix UTs

* Addressed comments

* Add changelog

* Update consensus/state.go

Co-authored-by: Hernán Vanzetto <15466498+hvanz@users.noreply.github.com>

---------

Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Hernán Vanzetto <15466498+hvanz@users.noreply.github.com>
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.

4 participants