harmony-one / harmony

The core protocol of harmony
https://harmony.one
GNU Lesser General Public License v3.0
1.47k stars 289 forks source link

SetKey failed when .pass files are present in .hmy/blskeys directory #2954

Open LeoHChen opened 4 years ago

LeoHChen commented 4 years ago

Describe the bug When I was testing the dryrun branch, 10 keys per node. I copied the bls.pass file to the .hmy/blskeys directory together with the corresponding .key file.

However, after restarting the node, we saw errors like below in leader,

{"level":"warn","port":"9000","ip":"3.86.161.62","error":"key not found","caller":"/home/leochen/go/src/github.com/harmony-one/harmony/consensus/consensus_v2.go:139","time":"2020-05-07T22:20:39.335530411Z","message":"[Announce] Leader prepareBitmap SetKey failed"}

And errors like below in validators

{"level":"warn","port":"9000","ip":"18.224.64.164","error":"[BytesToBlsPublicKey] bytes is empty","caller":"/home/leochen/go/src/github.com/harmony-one/harmony/consensus/fbft_log.go:260","time":"2020-05-07T22:43:52.646224388Z","message":"ParseViewChangeMessage failed to parse senderpubkey"}
{"level":"warn","port":"9000","ip":"18.224.64.164","caller":"/home/leochen/go/src/github.com/harmony-one/harmony/consensus/view_change.go:151","time":"2020-05-07T22:43:52.646231518Z","message":"[onViewChange] Unable To Parse Viewchange Message"}
{"level":"info","port":"9000","ip":"18.224.64.164","TotalIn":348008,"RateIn":6873.702155507352,"caller":"/home/leochen/go/src/github.com/harmony-one/harmony/node/node_handler.go:77","time":"2020-05-07T22:43:52.650122631Z","message":"[metrics][p2p] traffic in in bytes"}
{"level":"info","port":"9000","ip":"18.224.64.164","TotalIn":348008,"RateIn":6873.702155507352,"caller":"/home/leochen/go/src/github.com/harmony-one/harmony/node/node_handler.go:77","time":"2020-05-07T22:43:52.652125298Z","message":"[metrics][p2p] traffic in in bytes"}
{"level":"warn","port":"9000","ip":"18.224.64.164","error":"[BytesToBlsPublicKey] bytes is empty","caller":"/home/leochen/go/src/github.com/harmony-one/harmony/consensus/fbft_log.go:260","time":"2020-05-07T22:43:52.652286339Z","message":"ParseViewChangeMessage failed to parse senderpubkey"}
{"level":"warn","port":"9000","ip":"18.224.64.164","caller":"/home/leochen/go/src/github.com/harmony-one/harmony/consensus/view_change.go:151","time":"2020-05-07T22:43:52.652293451Z","message":"[onViewChange] Unable To Parse Viewchange Message"}

To Reproduce Steps to reproduce the behavior:

  1. Check out code from s3 branch
  2. Build
  3. in your node, created bls key files like .hmy/blskeys/1.key, .hmy/blskeys/1.pass, 2.key, 2.pass

Assuming all the pass are the same, I have another pass file in /home/ec2-user/bls.pass

Start the node.sh with multi-key support -M -p /home/ec2-user/bls.pass

gupadhyaya commented 4 years ago

@LeoHChen currently s3 code does not really have the code to read passphrase from .pass file and use it to load the bls key and it simply uses the default passphrase provided in using blspass. For your deployment, if you didn't had same passphrase blspass for all the keys that you wanted to load, and not passed this passphrase, it would have led to empty bls. However it should have printed the error.

LeoHChen commented 4 years ago

we have the same pass phrase for all the blskeys we used. Anyway, we should have failed earlier if any errors encountered during the startup especially related to the key/pass.