From 99e9153c88a3a7e9cdb6a335983ad1bf9c3634dc Mon Sep 17 00:00:00 2001 From: EmelyanenkoK Date: Tue, 9 Feb 2021 17:26:26 +0300 Subject: [PATCH 1/2] Fix non-critical bug in config-code Wins/losses order is messed up --- crypto/smartcont/config-code.fc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/smartcont/config-code.fc b/crypto/smartcont/config-code.fc index eedb0dc56..a638144ef 100644 --- a/crypto/smartcont/config-code.fc +++ b/crypto/smartcont/config-code.fc @@ -601,7 +601,9 @@ _ unpack_proposal(slice pstatus) inline_ref { voters_list = cons(voter_id, voters_list); } } until (~ f); - var (rounds_remaining, losses, wins) = (rest~load_uint(8), rest~load_uint(8), rest~load_uint(8)); + ;; Note there is a bug in config contract currently deployed in testnet2: + ;; wins and losses are messed up + var (rounds_remaining, wins, losses) = (rest~load_uint(8), rest~load_uint(8), rest~load_uint(8)); rest.end_parse(); var (param_id, param_val, param_hash) = parse_config_proposal(proposal); return [expires, critical?, [param_id, param_val, param_hash], vset_id, voters_list, weight_remaining, rounds_remaining, losses, wins]; From ea6fbc579d3f3434ca8205f1783ab63b123a045c Mon Sep 17 00:00:00 2001 From: EmelyanenkoK Date: Wed, 10 Feb 2021 12:49:29 +0300 Subject: [PATCH 2/2] Fix old hash parsing in create-config-proposal.fif --- crypto/smartcont/create-config-proposal.fif | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/smartcont/create-config-proposal.fif b/crypto/smartcont/create-config-proposal.fif index 18036d0d4..8dbfdd27e 100644 --- a/crypto/smartcont/create-config-proposal.fif +++ b/crypto/smartcont/create-config-proposal.fif @@ -16,7 +16,7 @@ begin-options "Creates a critical parameter change proposal" option-help "x" "--expires-in" { parse-int =: expire-in } short-long-option-arg "Sets proposal expiration time in seconds (default " expire-in (.) $+ +")" option-help - "H" "--old-hash" { (hex-number) not abort"256-bit hex number expected as hash" =: old-hash } + "H" "--old-hash" { (hex-number) 1 = not .s abort"256-bit hex number expected as hash" =: old-hash } short-long-option-arg "Sets the required cell hash of existing parameter value (0 means no value)" option-help "h" "--help" { usage } short-long-option