EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

Upgrade system contract failed using cleos with version > 1.1.1 #5714

Closed young-mu closed 6 years ago

young-mu commented 6 years ago

I refer to this doc upgrading-the-system-contract to upgrade system contract.

This can be done using cleos with version v1.1.1 but failed with version v1.2.4, v1.2.5 and latest develop branch (45e609fe7). So may be this is a regression if the related command usages are not changed.


Below are my operations.

  1. build EOS

(I tested in branch v1.2.4, v1.2.5, and latest develop branch (45e609fe7))

  1. boot node with 3 BPs
> ./bios-boot-tutorial.py -a --producer-limit 3 --user-limit 4 --num-voters 3 --num-producers-vote 3 --producer-sync-delay 30
  1. generate transaction file
> cleos -u http://127.0.0.1:8000 set contract -s -j -d eosio.msig ~/Github/eosio.contracts/build/eosio.msig > upgrade_multisig_contract_trx.json
> cp upgrade_multisig_contract_trx.json upgrade_multisig_contract_official_trx.json
> cp upgrade_multisig_contract_trx.json upgrade_multisig_contract_official_trx_signed.json
  1. change expiration field

In upgrade_multisig_contract_official_trx.json and upgrade_multisig_contract_official_trx_signed.json, modify expiration value to a time that is in the future but less than 1 hour. (for example, the original value is 2018-09-18T07:51:18, the changed value is 2018-09-18T08:41:18)

  1. get the signatures of 3 BPs
> cleos -u http://127.0.0.1:8000 sign --chain-id 1c6ae7719a2a3b4ecb19584a30ff510ba1b6ded86e1fd8b8fc22f1179c622a32 --private-key 5KLGj1HGRWbk5xNmoKfrcrQHXvcVJBPdAckoiJgFftXSJjLPp7b upgrade_multisig_contract_official_trx.json
> cleos -u http://127.0.0.1:8000 sign --chain-id 1c6ae7719a2a3b4ecb19584a30ff510ba1b6ded86e1fd8b8fc22f1179c622a32 --private-key 5K6qk1KaCYYWX86UhAfUsbMwhGPUqrqHrZEQDjs9ekP5j6LgHUu upgrade_multisig_contract_official_trx.json
> cleos -u http://127.0.0.1:8000 sign --chain-id 1c6ae7719a2a3b4ecb19584a30ff510ba1b6ded86e1fd8b8fc22f1179c622a32 --private-key 5JCStvbRgUZ6hjyfUiUaxt5iU3HP6zC1kwx3W7SweaEGvs4EPfQ upgrade_multisig_contract_official_trx.json

get the signaures field value of output.

  1. add signatures in upgrade_multisig_contract_official_trx_signed.json

add the three signatures (prefix is "SIG_") in signatures field. Like

  "transaction_extensions": [],
  "signatures": [
    "SIG_K1_KaSqLGqyWnHzoFUc2wdjHFXedLURXE4tBQNYKt6EjpTYmcRmjVtydh7B1N1xAHQQUvzSpRhsqXm2dD6Yd5BmN7f5QjszQX",
    "SIG_K1_JvYWapz4SSU4c7AqjcmRCFWq48g7EU87TXJL82HN37PkTGXPvncFh124XCmjBDKqyHJvH2ebcW8uCjXWgdmnPiDn2uT5ar",
    "SIG_K1_K9GGZbKY7MC9L5j3oNPyxkMcSzV79xZmKGVqYR88dhdtmiWKnTPuWCk6ZUzwvTX8cCxaAj2qxBHhGkspDAgreS3qciwtED"
  ],
  "context_free_data": []
  1. push transaction
> cleos --wallet-url http://127.0.0.1:6666 -u http://127.0.0.1:8000 push transaction upgrade_multisig_contract_official_trx_signed.json

Then error occurs

Error 3090001: Duplicate signature included

But when I change to v1.1.1 cleos binary and execute this flow, it works with the following logs.

{
  "transaction_id": "4af20d4fb27de7f0d3fbb18ca8424257b890c8499536218d7aaf71e478dd1a84",
  "processed": {
    "id": "4af20d4fb27de7f0d3fbb18ca8424257b890c8499536218d7aaf71e478dd1a84",
    "receipt": {
...
taokayan commented 6 years ago

you need to add --skip-sign in "push transaction" otherwise cleos will add extra signatures.

young-mu commented 6 years ago

@taokayan

Oops... okay, after adding this option, it works for higher version cleos.

This is break change for this subcommand, lower version cleos push transaction skips signing as default but higher version don't skip signing as default. So, please update the related reference doc, in case that others make the same mistake.

jgiszczak commented 6 years ago

Documentation update in progress.