tokamak-network / plasma-evm

Plasma EVM client
GNU Lesser General Public License v3.0
24 stars 10 forks source link

cmd/geth : Could not set negative commission with `setCommissionRate` sub-command. #117

Closed sifnoc closed 4 years ago

sifnoc commented 4 years ago

System information

Geth version: 1.9.10 OS & Version: MacOS Commit hash : Develop - v0.0.0.rc7.1

Expected behaviour

Set

Actual behaviour

Set negative commission rate like positive one

Steps to reproduce the behaviour

root@981aa7fd1824:/home/ubuntu/plasma-evm# build/bin/geth manage-staking setCommissionRate "-0.01" \
>             --datadir ./.pls.staking/operator1 \
>             --rootchain.url ws://127.0.0.1:8546 \
>             --unlock 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f \
>             --password pwd.pass \
>             --rootchain.sender 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f
Incorrect Usage: flag provided but not defined: -0.01

setCommissionRate [command options] [arguments...]

                                                                                                                                                        geth staking setCommissionRate <rate>

Set commission rate of the root chain (operator only)

NOTE:
rate should be 0 or between 0.01 and 1.00

Figure

build/bin/geth \
>             --datadir ./.pls.staking/operator1 \
>             --rootchain.url ws://127.0.0.1:8546 \
>             --unlock 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f \
>             --password pwd.pass \
>             --rootchain.sender 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f \
>            manage-staking setCommissionRate -- -0.01

Except not checking commitssion rate range with this code line

https://github.com/Onther-Tech/plasma-evm/blob/develop/cmd/geth/stakecmd.go#L1160-L1162

sifnoc commented 4 years ago

Another Way

using string "M" starts with the input argument for setCommissionRate. ex) manage-staking setCommissionRate M0.01

sifnoc commented 4 years ago

Confirmed Well output with negative operator at #118

build/bin/geth  manage-staking setCommissionRate \
    --datadir ./.pls.staking/operator1 \
    --rootchain.url ws://127.0.0.1:8546 \           
    --unlock 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f  \
    --password pwd.pass   \
    --rootchain.sender 0x5e3230019fed7ab462e3ac277e7709b9b2716b4f  \
    -- -0.4

INFO [04-23|08:30:58.131] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-23|08:30:58.137] Set options for submitting a block       mingaspirce=1000000000 maxgasprice=100000000000 resubmit=0s
INFO [04-23|08:30:59.070] Unlocked account                         address=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:30:59.070] Root chain transaction sender found      address=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:30:59.072] Allocated cache and file handles         database=/home/ubuntu/plasma-evm/.pls.staking/operator1/geth/stakingdata cache=16.00MiB handles=16
INFO [04-23|08:30:59.084] Using manager contracts                  TON=0xa4e81d08BC0F707e2FB4b58A0b82b8FfD23b74e3 WTON=0x843622222583fD30Fb3F6Cc9f59255CB8f3DDDf2 DepositManager=0x42bf06bF22d2F84cA0973BE1969b6f83435Bf86e RootChainRegistry=0x9345D86136A5d935d853c4A714c6339797DbD8c2 SeigManager=0xa72e2e22e52fC21A4ca2505a071500C9f2496f6E PowerTON=0x9b0C0A2f9Ed1c4Af28BBD92cECceD2260F5A2abD
INFO [04-23|08:30:59.095] Set commission rate                      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32 commissionRate=-0.400
plasma-evm# build/bin/geth --nousb staking balances 0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F \
  --datadir ./.pls.staking/operator1  \
  --rootchain.url ws://127.0.0.1:8546

INFO [04-23|08:31:03.815] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-23|08:31:03.815] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [04-23|08:31:03.819] Set options for submitting a block       mingaspirce=1000000000 maxgasprice=100000000000 resubmit=0s
INFO [04-23|08:31:03.820] Allocated cache and file handles         database=/home/ubuntu/plasma-evm/.pls.staking/operator1/geth/stakingdata cache=16.00MiB handles=16
INFO [04-23|08:31:03.833] Using manager contracts                  TON=0xa4e81d08BC0F707e2FB4b58A0b82b8FfD23b74e3 WTON=0x843622222583fD30Fb3F6Cc9f59255CB8f3DDDf2 DepositManager=0x42bf06bF22d2F84cA0973BE1969b6f83435Bf86e RootChainRegistry=0x9345D86136A5d935d853c4A714c6339797DbD8c2 SeigManager=0xa72e2e22e52fC21A4ca2505a071500C9f2496f6E PowerTON=0x9b0C0A2f9Ed1c4Af28BBD92cECceD2260F5A2abD
WARN [04-23|08:31:03.864] Failed to read total stake of root chain err="no contract code at given address"
WARN [04-23|08:31:03.870] Failed to read uncomitted stake          err="abi: attempting to unmarshall an empty string while arguments are expected"
WARN [04-23|08:31:03.874] Failed to read stake                     err="abi: attempting to unmarshall an empty string while arguments are expected"
INFO [04-23|08:31:03.882] TON Balance                              amount="9000.0 TON" depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.883] WTON Balance                             amount="1000.0 WTON" depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.883] Deposit                                  amount="0 WTON"      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32 depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.883] Pending withdrawal requests              num=0
INFO [04-23|08:31:03.884] Pending withdrawal WTON                  amount="0 WTON"      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32 depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.884] Total Stake                              amount="0 WTON"
INFO [04-23|08:31:03.884] Total Stake of Root Chain                amount="0 WTON"      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32
INFO [04-23|08:31:03.884] Uncomitted Stake                         amount="0 WTON"      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32 depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.884] Comitted Stake                           amount="0 WTON"      rootchain=0xd6662103d7Ffd6D44792d9866AfAD0Beef5d3c32 depositor=0x5E3230019fEd7aB462e3AC277E7709B9b2716b4F
INFO [04-23|08:31:03.884] Commission Rate                          rate=-0.400