create account

"Delegator had no such ruleset" — historia pewnego błędu w WISE by jblew

View this thread on: hive.blogpeakd.comecency.com
· @jblew ·
$4.97
"Delegator had no such ruleset" — historia pewnego błędu w WISE
![bugarticle.jpg](https://cdn.steemitimages.com/DQmY9pUd7pifnncaefVV5VuyCGXoxpLffuN1SjAnGRLBLHj/bugarticle.jpg)

# "Delegator had no such ruleset" — historia pewnego błędu w WISE

> TLDR: Delegatorzy powinni zaaktualizować wise do wersji 0.19.5.

Nic tak nie denerwuje jak błąd, który uniemożliwia korzystanie z ulubionego programu. Szczególnie, jeżeli nic z nim nie możemy zrobić. Zwykle błędy są trywialne i udaje się je rozwiązać w ciągu kilku godzin. W przypadku tego błędu było jednak inaczej.

"Delegator had no such ruleset", opisany w https://github.com/noisy-witness/steem-wise-cli/issues/9 od początku stwarzał nam kłopoty. Problem występował niestale. Można by rzec — z rzadka. Pojawiał się raz na kilkadziesiąd voteorderów. Został zgłoszony przez  @noisy 29 czerwca. Nie wydawał się wtedy dużym kłopotem, jako że nie występował często. 

Niestety — w pierwszych dniach sierpnia sprawy nabrały rozpędu. Po dosyć dużej zmianie w kodzie przetwarzającym transakcje z blockchainu, która była konieczna do zaimplementowania reguły weight_for_period, błąd zaczął się pojawiać w praktycznie każdym przypadku. Zaczęliśmy intensywną diagnostykę. Napisałem specjalne automatyczne testy, które miały weryfikować błąd, próbowaliśmy odtworzyć sytuacje, które występowały na koncie @noisy. Cała sytuacja była o tyle ciekawa, że ani razu nie udało mi się odwtorzyć tych błędów na moim komputerze. Natomiast błąd na koncie @noisy szalał. Zaczęło dochodzić do sytuacji, w której użytkownicy byli walidowani według cudzych reguł.

Muszę przyznać, że kolejne dni przepełnione były frustracją. Postanowiliśmy stworzyć specjalny system raportowania wydarzeń (zdalne udostępnianie logów). Uruchomienie tego systemu diagnostycznego przyniosło zupełnie niespodziewany rezultat. Na serwerze Krzysztofa błędy przestały się pojawiać, synchronizacja przebiegała gładko. Jak to mówią programiści: **działa! — dziwne**.

W tym momencie skończyły nam się pomysły. Z braku lepszego zajęcia zacząłem przeglądać historię zmian w kodzie biblioteki. Wtedy natrafiłem na tę poprawkę: 

```
https://github.com/noisy-witness/steem-wise-core/commit/0f32bb72c53de75053cdb004c4074b5b587fcf7f#diff-f0e55e336caf39ba655940f5ace4148eR149 
```

którą sam napisałem parę dni wcześniej. Po zastanowieniu, doszedłem do wniosku, że kod, który w niej został poprawiony, wygląda na taki, który mógł spowodować wybór błędnego zestawu reguł do walidacji.

W tym momencie uruchomiłem tzw. test regresyjny. Tzn. usunąłem tę poprawkę i skompilowałem program na serwerze. Po uruchomieniu okazało się, że błąd znowu występuje. To potwierdziło nam, że problem od początku leżał w tym miejscu. Zatem został rozwiązany już kilka dni wcześniej, a my nie zdawaliśmy sobie z tego sprawy! Przez "cichą naprawę" u mnie — w zaaktualizowanej wersji daemona błędu nie było, natomiast u Krzysztofa — w starszej wersji, błąd hulał w najlepsze.

Morał z tej historii jest taki: nigdy nie naprawiać błędów bez uprzedniego napisania testów. Gdybym nie naprawił tego błędu "po cichu" — dużo szybciej zorientowalibyśmy się gdzie leży problem.

W związku z tym na przyszłość planujemy wprowadzić dokładniejsze testy jednostkowe, a przede wszystkim stworzyć środowisko testów scenariuszowych, tj. stworzyć takiego naszego "udawanego" użytkownika, który będzie korzystał z wise wg ustalonego scenariusza — i raportował nam wszelkie błędy i problemy :)

Jak widzicie, rozwiązanie tego problemu nie było łatwe. Wszystkich, którzy nie mogli z jego powodu korzystać z Wise serdecznie przepraszam. 

Zapraszam do zaaktualizowania WISE do wersji 0.19.5 :)

```bash
$ npm install -g steem-wise-cli
```
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorjblew
permlinkdelegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise
categorypolish
json_metadata{"tags":["polish","pl-wise"],"users":["noisy"],"image":["https://cdn.steemitimages.com/DQmY9pUd7pifnncaefVV5VuyCGXoxpLffuN1SjAnGRLBLHj/bugarticle.jpg"],"links":["https://github.com/noisy-witness/steem-wise-cli/issues/9"],"app":"steemit/0.1","format":"markdown"}
created2018-08-09 20:00:42
last_update2018-08-09 20:00:42
depth0
children12
last_payout2018-08-16 20:00:42
cashout_time1969-12-31 23:59:59
total_payout_value3.868 HBD
curator_payout_value1.097 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,624
author_reputation235,650,801,538
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,677,849
net_rshares3,850,538,440,248
author_curate_reward""
vote details (46)
@jacekw · (edited)
$0.03
Warto jakbyś jeszcze zrobił jakieś ELI5 na czym polegał błąd, bo dla dużej części osób to ciągle może być czarna magia :)
👍  
properties (23)
authorjacekw
permlinkre-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180809t203924793z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-09 20:39:36
last_update2018-08-09 20:39:51
depth1
children2
last_payout2018-08-16 20:39:36
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length121
author_reputation101,268,395,445,622
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,680,701
net_rshares21,218,077,127
author_curate_reward""
vote details (1)
@jblew ·
$0.08
Cóż. Sam błąd był prosty. Trudne było jego znalezienie. Niełatwo wyjaśnić działanie błędu bez wyjaśniania wewnętrznego mechanizmu działania wise ;) W skrócie: w momencie zmiany przetwarzania z operacji na transakcje — wyrażenie warunkowe _if_ w miejscu odpowiedzialnym za wybór rulesetu do walidacji voteorderu powinno zostać zmienione, aby przystawało, ale nie zostało zmienione do końca, co spowodowało powstanie błędnego zlepka kodu, który zawsze zwracał prawdę. Ale nie to jest tutaj nauczką dla nas. Kod WISE jest pisany razem z ogromną ilością testów jednostkowych (ok 400). Staram się, aby cały kod był nimi pokryty. W tym miejscu jednak była luka. Nauczki są dwie: 1) dokładniejesze testy jednostkowe, 2) testy scenariuszowe. Im więcej testów, tym mniej potencjalnych błędów. Działają jak sito. Teraz trzeba tylko zmniejszyć oczka ;)
👍  ,
properties (23)
authorjblew
permlinkre-jacekw-re-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180810t075950035z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-10 07:59:51
last_update2018-08-10 07:59:51
depth2
children1
last_payout2018-08-17 07:59:51
cashout_time1969-12-31 23:59:59
total_payout_value0.068 HBD
curator_payout_value0.013 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length841
author_reputation235,650,801,538
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,730,072
net_rshares64,369,624,593
author_curate_reward""
vote details (2)
@nicniezgrublem ·
Wyciągnięty wniosek powinien być inny raczej: na nic zdają się testy jednostkowe bez testów integracyjnych :P
properties (22)
authornicniezgrublem
permlinkre-jblew-re-jacekw-re-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180810t095526025z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-10 09:55:24
last_update2018-08-10 09:55:24
depth3
children0
last_payout2018-08-17 09:55:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length109
author_reputation4,519,349,152,668
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,738,880
net_rshares0
@jblew ·
Zapomniałem jeszcze podziękować @nicniezgrublem i @noisy za ich dużą pomoc przy rozwiązywaniu tego problemu! :)
properties (22)
authorjblew
permlinkre-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180809t202829857z
categorypolish
json_metadata{"tags":["polish"],"users":["nicniezgrublem","noisy"],"app":"steemit/0.1"}
created2018-08-09 20:28:30
last_update2018-08-09 20:28:30
depth1
children0
last_payout2018-08-16 20:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length111
author_reputation235,650,801,538
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,679,863
net_rshares0
@perduta ·
Po raz kolejny STEEM został uratowany.
Dziękuję Jędrzeju.
👍  
properties (23)
authorperduta
permlinkre-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180809t201701469z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-09 20:17:00
last_update2018-08-09 20:17:00
depth1
children0
last_payout2018-08-16 20:17:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length57
author_reputation318,975,007,033
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,679,006
net_rshares761,700,740
author_curate_reward""
vote details (1)
@saunter ·
Czyli już można kurować? :P
👍  ,
properties (23)
authorsaunter
permlinkre-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180810t003509946z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-10 00:35:12
last_update2018-08-10 00:35:12
depth1
children1
last_payout2018-08-17 00:35:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length27
author_reputation9,888,200,003,831
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,696,411
net_rshares2,190,577,289
author_curate_reward""
vote details (2)
@jblew ·
Można! :)
properties (22)
authorjblew
permlinkre-saunter-re-jblew-delegator-had-no-such-ruleset-historia-pewnego-bledu-w-wise-20180810t075415166z
categorypolish
json_metadata{"tags":["polish"],"app":"steemit/0.1"}
created2018-08-10 07:54:15
last_update2018-08-10 07:54:15
depth2
children0
last_payout2018-08-17 07:54:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9
author_reputation235,650,801,538
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,729,702
net_rshares0
@steemitboard ·
Congratulations @jblew! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/comments.png)](http://steemitboard.com/@jblew) Award for the number of comments

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-jblew-20180810t135444000z
categorypolish
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-08-10 13:54:45
last_update2018-08-10 13:54:45
depth1
children0
last_payout2018-08-17 13:54:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length717
author_reputation38,975,615,169,260
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,757,930
net_rshares0
@steemitboard ·
Congratulations @jblew! You have received a personal award!

[![](https://steemitimages.com/70x70/http://steemitboard.com/@jblew/birthday2.png)](http://steemitboard.com/@jblew)  2 Years on Steemit
<sub>_Click on the badge to view your Board of Honor._</sub>


> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-jblew-20180811t221546000z
categorypolish
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-08-11 22:15:45
last_update2018-08-11 22:15:45
depth1
children0
last_payout2018-08-18 22:15:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length480
author_reputation38,975,615,169,260
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id67,895,751
net_rshares0
@steemitboard ·
Congratulations @jblew! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/votes.png)](http://steemitboard.com/@jblew) Award for the number of upvotes

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-ranking-update-steem-power-followers-and-following-added"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmfRVpHQhLDhnjDtqck8GPv9NPvNKPfMsDaAFDE1D9Er2Z/header_ranking.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/steemitboard-ranking-update-steem-power-followers-and-following-added">SteemitBoard Ranking update - Steem Power, Followers and Following added</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-jblew-20181018t064456000z
categorypolish
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-10-18 06:44:57
last_update2018-10-18 06:44:57
depth1
children0
last_payout2018-10-25 06:44:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,237
author_reputation38,975,615,169,260
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id73,532,261
net_rshares0
@steemitboard ·
Congratulations @jblew! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@jblew/msc2018.png</td><td>Thank you for your participation in the "Meet The Steemians" contest in Kraków. We hope you enjoyed it and made lots of new friends. See you at SteemFest4!</td></tr></table>

<sub>_[Click here to view your Board of Honor](https://steemitboard.com/@jblew)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-the-results-the-winners-and-the-prizes"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmeLukvNFRsa7RURqsFpiLGEZZD49MiU52JtWmjS5S2wtW/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-the-results-the-winners-and-the-prizes">Meet the Steemians Contest - The results, the winners and the prizes</a></td></tr><tr><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-special-attendees-revealed"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmeLukvNFRsa7RURqsFpiLGEZZD49MiU52JtWmjS5S2wtW/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-special-attendees-revealed">Meet the Steemians Contest - Special attendees revealed</a></td></tr><tr><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-intermediate-results"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmeLukvNFRsa7RURqsFpiLGEZZD49MiU52JtWmjS5S2wtW/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/meet-the-steemians-contest-intermediate-results">Meet the Steemians Contest - Intermediate results</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-jblew-20181119t143353000z
categorypolish
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-11-19 14:33:54
last_update2018-11-19 14:33:54
depth1
children0
last_payout2018-11-26 14:33:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,029
author_reputation38,975,615,169,260
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id75,558,320
net_rshares0
@steemitboard ·
Congratulations @jblew! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@jblew/birthday3.png</td><td>Happy Birthday! - You are on the Steem blockchain for 3 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@jblew) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=jblew)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-jblew-20190811t210401000z
categorypolish
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-08-11 21:04:00
last_update2019-08-11 21:04:00
depth1
children0
last_payout2019-08-18 21:04:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length608
author_reputation38,975,615,169,260
root_title""Delegator had no such ruleset" — historia pewnego błędu w WISE"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id89,415,994
net_rshares0