Eos: Update Smart Contract

Created on 5 Apr 2018  ยท  10Comments  ยท  Source: EOSIO/eos

On lastest code brand master, I use cmd to update contract
cleos set contract [OPTIONS] account contract-dir [wast-file] [abi-file]
but when I only change the file .abi I get the error

Error 3030000: transaction validation exception
Ensure that your transaction satisfy the contract's constraint!
Error Details:
account.code_version != code_id: contract is already running this version of code

Can I only change the file .abi and update the smart contract ? ๐Ÿ™‡

Most helpful comment

@PaulCalabrese

Currently, the code and abi are done in separate operations, but the abi
will not be set if the code is not set. If you only want to set an abi, all
you can do now is make a minor change to your contract (something that will
change the hash of the wast) and recompile. Your subsequent "set contract"
should update both.

Thank you very much. I got it. But i think why can not we just check abi changes then we can upgrade smart contract ! ๐Ÿ™‡

All 10 comments

that means you have no change at this contract.

@pokerchain I change the .abi file but I can not update !

I'm having the same issue. I've update both the contract ABI, and the WAST, but the error code is telling me that the latest version is already running
account.code_version != code_id: contract is already running this version of code

The wiki/docs make no reference as to how to update already deployed contract, either.

Currently, the code and abi are done in separate operations, but the abi
will not be set if the code is not set. If you only want to set an abi, all
you can do now is make a minor change to your contract (something that will
change the hash of the wast) and recompile. Your subsequent "set contract"
should update both.

Paul Calabrese

On Thu, Apr 12, 2018 at 1:58 PM, Tyler J. Kuhn notifications@github.com
wrote:

I'm having the same issue. I've update both the contract ABI, and the
WAST, but the error code is telling me that the latest version is already
running
account.code_version != code_id: contract is already running this version
of code

The wiki/docs make no reference as to how to update already deployed
contract, either.

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/EOSIO/eos/issues/2130#issuecomment-380910075, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AJsuzuE6OgvkcNDqK6CVH-Px8cPj2Ig9ks5tn6PTgaJpZM4TINW_
.

Thanks @PaulCalabrese for the info. However, in my case, the .wast has definitely changed. I'm using the tic tac toe example, and changed the namespace to 'tic', which produced a different .wast. After deploying the contract, and running cleos get code tic, i'm getting the same hash.

@PaulCalabrese How can get more information to debug this? Perhaps the deployed contract code, and not just the hash?

This will retrieve the wast code currently in the contract:
cleos get code -c code.wast currency

On Thu, Apr 12, 2018 at 4:09 PM, Tyler J. Kuhn notifications@github.com
wrote:

@PaulCalabrese https://github.com/PaulCalabrese How can get more
information to debug this? Perhaps the deployed contract code, and not just
the hash?

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/EOSIO/eos/issues/2130#issuecomment-380945118, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AJsuzl7yHhLr_kMFtuHANUe3nawXKBqlks5tn8KVgaJpZM4TINW_
.

Thanks @PaulCalabrese. Not sure what I did wrong. But all is well, now. Thanks for the tip.

@PaulCalabrese

Currently, the code and abi are done in separate operations, but the abi
will not be set if the code is not set. If you only want to set an abi, all
you can do now is make a minor change to your contract (something that will
change the hash of the wast) and recompile. Your subsequent "set contract"
should update both.

Thank you very much. I got it. But i think why can not we just check abi changes then we can upgrade smart contract ! ๐Ÿ™‡

mark

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Npizza picture Npizza  ยท  3Comments

hoopslb picture hoopslb  ยท  3Comments

hsejin314 picture hsejin314  ยท  3Comments

zxf969175364 picture zxf969175364  ยท  3Comments

toonsevrin picture toonsevrin  ยท  3Comments