harmony-one / harmony-log-analysis

Harmony Log Analysis and Visualization
5 stars 3 forks source link

M5 test output #1

Open JB273 opened 4 years ago

JB273 commented 4 years ago

Running economics test M5 gives following output running on Windows 10, Anaconda Navigator, Jupyter Notebook 6.0.3

median stake is 2.74e+23 lower bond is 2.3290000000000002e+23 upper bond is 3.1510000000000003e+23 validator: one1dcmp24uqgwszcvmm8n6r5dvhqhuukdj86pkg6n bls public key: b2c5958d38748777d6e0548da5c1356a20c3ab33a6261da2977a9e8f0d97559263a64e47a364ebed6c449aef26fc6c04 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1dcmp24uqgwszcvmm8n6r5dvhqhuukdj86pkg6n bls public key: 2a213469b35be4d97be559d8d3d548f5126da9a521690551989ce19723ab56eaac885f7f8a1206681de1ad9691db5380 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1dcmp24uqgwszcvmm8n6r5dvhqhuukdj86pkg6n bls public key: 5e5ccd77a8d7d630f52d9572d8d63694ccfd18e7013729294365df154493cf481b6aa5ae18ba21bba345bfaf1d641e10 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1dcmp24uqgwszcvmm8n6r5dvhqhuukdj86pkg6n bls public key: 42dcad47d66171c95969c6ff1c9dd47a4a911efffd83077d8ab243ab77c54eb0ca8daa430e37fb4a1a94ca0b4cc71418 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: dfca9b0bb41a358023b75136f51882e2b5396806f4287a0200f772c2b7b8a5981730fbc7558b086da8217969518d3498 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: 62937063063c3c8390c86fd406b3155158fe8ecf1e82b0116e1e27cd8fb021c61c39469658d212cb89168ada8ab89a08 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: 778fedb1699a7741eae03dbdcbc376c983b1a23aa9da2548c1706442acc3431747a957cf7aee2ae0fa028bc0c83a1684 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: 356b0732524bdd3a2ac6f2a09aa29da9a71b73167f42c64e5ba2b3322d82f79ade31b56efe61782f25c354c1dec28f88 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: 3d1beab1aadb5ac570dfec12a5fad198503a3de7ce05e343b4f4b4db7a67514e1ab69d189e1ca1055405e5a5f8496195 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: eaf2ca8784b0f15be0de551c863181f2ff9e697dd9bae6a194e5dfa555fbc21c22f0e4997a1005a2245940c27b1b6d99 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: bfadf1857af818d011ae0daae1418e3777d59f065eb83684c4f2d4a787dee17948fff62a3980b810956e8425f321f519 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1u6c4wer2dkm767hmjeehnwu6tqqur62gx9vqsd bls public key: 554203630e40fd64f8199113f6c57f080b802d858e77ae28f27ad63b5868d98154444f4f398986605d4b4f8029b98e05 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1p5hv9qv90dyrag9fj3wzrvvrs273ypcq8mz7zn bls public key: c1862b5b975a69612946d57a0649c9ed266511f6ea5653886af12782f73911f0907be7848d9d28ec69ca97c13f3e9594 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1m6j80t6rhc3ypaumtsfmqwjwp0mrqk9ff50prh bls public key: afc4d81ab636323b04893c23d3404f38e95e9291b3d5299dade3d03822edd3a2b799bd6d64265a9a9cac025d5dbd600c shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1t94xaxcp8glz29mwe6pkksx0zgq9jwmjuljra0 bls public key: 5e6962882b779894b77ef9ceee77e9510c8920cff082b045bfa1d45fd2844d9db31f0ebc4780891401f71903b676c484 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1t94xaxcp8glz29mwe6pkksx0zgq9jwmjuljra0 bls public key: ce8ba722c18faafd34da34831303162bea0ef10aee9d61632d87943659346d2f958a27303e938e31ce19fa8b65655680 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1jm28f73rmg7lnca7duuyuqrhkp4ahfzdvzzdsf bls public key: becd65dfdcb41486187b5e9c4e1b0758ff30c302b0bfb29b57e92278c4c55a869c3d9d176b9b4339787b1e961e306c14 shard: 0 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1zsvnf4nf69rmndakfeslypas5j6zc9zxhg3csf bls public key: 1b39cc60094424b6a79b9f7e12a4357e55da793c7b71f2f573e0217e0b3cb4f81ebd0bb0f8dd606c951d3eb0fd684111 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1awswe9xrx5rcjxvtdd6lwta9py2t09g6cet05h bls public key: 2dd420cd3ca4279ebd5be60c153c6e0cc82cc3d0784ac2eef64fc64e0eec7fb22da3617018f8c91e9ab2aa7cb1ac1091 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one10fjqteq6q75nm62cx8vejqsk7mc8t5hle8ewnl bls public key: 552f8aa65835f04e4bc3a04a4bd1f5c67dcd562513b6728c5b9fd258d9fdb054c10008b14a739818d0c234d37b8f1301 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1y5n7p8a845v96xyx2gh75wn5eyhtw5002lah27 bls public key: e65ce96e41d54d49243e2294fb306768862cccd5be80347f88bafe13aa4d3582c21c613fc26f6908ed1faa0dd0c27381 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1y5n7p8a845v96xyx2gh75wn5eyhtw5002lah27 bls public key: b9626bcf02210e8979b0e661bbdbf2e5a691105761fd8800bd1e96087a57c393285af91dcf3c3d6763a643d874f14599 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1y5n7p8a845v96xyx2gh75wn5eyhtw5002lah27 bls public key: b3815c62affe89560ecabb2f30de46742c927e8a951f37f080264d0b394e16b55ea0786629798d0170c713a9779e4585 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000

validator: one1m0nek70wrtk279c9rgg6sxzaemfvmjejamfjvf bls public key: 3f4325bb2bc8c1eb816fdffc1b301bb721700e2eda85e4e61147125b30b90963bfc646656d123d49ce1172f768393409 shard: 1 effective stake is out of range. The effective stake is 232900000000000000000000.000000000000000000


TypeError Traceback (most recent call last)

in ----> 1 M5_test() in M5_test() 13 elected = getAllElectedValidator() 14 for i in elected: ---> 15 for s in getValidatorInfo(i)['metrics']['by-shard']: 16 if float(s['effective-stake']) > upper or float(s['effective-stake']) < lower: 17 print("validator: " + i + " bls public key: " + str(s['bls-public-key']) +\ TypeError: 'NoneType' object is not subscriptable ​
ivorytowerdds commented 4 years ago

When it's at the last block of an epoch, everyone's currently-in-committee will change to False. At that moment, no metrics. Since I call getValidatorInfo one by one, it's possible that it achieves the last block of epoch when it calls the RPC call and that caused the NoneType issue.

change the script to getAllValidatorInfo at once, and then check whether currently-in-committee is True before check the metrics.

https://github.com/harmony-one/harmony-log-analysis/commit/b3c5658874793621a3b39c25358104f6a380d14e

@JB273

JB273 commented 4 years ago

I now get this error:

median stake is 2.9649975e+23 lower bond is 2.520247875e+23 upper bond is 3.409747125e+23

KeyError Traceback (most recent call last)

in ----> 1 M5_test() in M5_test() 14 for i in validators: 15 if i['currently-in-committee'] == True: ---> 16 for s in i['metrics']['by-shard']: 17 if float(s['effective-stake']) > upper or float(s['effective-stake']) < lower: 18 address = i['validator']['address'] KeyError: 'by-shard' @ivorytowerdds
ivorytowerdds commented 4 years ago

I know why it caused the error. The error means it doesn't have the by-shard key. Now our RPC call changed, there is no longer by-shard, it's now changed to by-bls-key!

But for this one, Ganesha has changed the checking logic.

quoted from Ganesha: "Further debugging found that, comparing the effective stakes of elected validators (collected using validator information) against the median stake obtained using GetMedianRawStakeSnapshot is incorrect, as GetMedianRawStakeSnapshot is more like running median and committee list. Updated https://github.com/harmony-one/harmony/issues/2654"

@JB273

ivorytowerdds commented 4 years ago

And also a lesson for me, when write tests, it's better to first check whether the key exists!!

JB273 commented 4 years ago

So I must change these myself on this tests that are not running correctly? @ivorytowerdds

ivorytowerdds commented 4 years ago

or let me revise them! maybe there are other keys changed, then it may cause new issues. @JB273

ivorytowerdds commented 4 years ago

revise it, but it still has the rounding issue, not pass the test :(

median stake is 709048999999999945211904 lower bond is 602691649999999946719232 upper bond is 815406349999999876595712 validator: one1hwn68w7m5g8daltvrjkmq23qn58nrvr3yz6ryt
bls public key: 48ad00d97fb657f3476b5a8466798f33a23b16615091ebcd3587c14c9aad9e2e28c28fd12a7e9c887e621eb2f7860d00 effective stake is out of range. The effective stake is 815406350000000010813440

@JB273 @gupadhyaya

JB273 commented 4 years ago

After doing several tests it look like this is picking up the correct stuff... @ivorytowerdds image

median stake is 115857142857142852648960 lower bond is 98478571428571420557312 upper bond is 133235714285714284740608 total slots verified: 93 True

ivorytowerdds commented 4 years ago

@JB273 good! Thanks! Today when I run it on the script, it also passed, guess just small rounding issues. also, I update the new script on github: https://github.com/harmony-one/harmony-log-analysis/blob/master/notebooks/economic-test/economic-test.py after merging soph's pull request, it can be worked on windows! But the running time is a little long, around 40-50 min for all the tests. If it also pass for you, we can close the issue.