eos icon indicating copy to clipboard operation
eos copied to clipboard

Update Smart Contract

Open navcsdev opened this issue 8 years ago • 10 comments

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 ? 🙇

navcsdev avatar Apr 05 '18 10:04 navcsdev

that means you have no change at this contract.

brain-hu avatar Apr 11 '18 06:04 brain-hu

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

navcsdev avatar Apr 11 '18 06:04 navcsdev

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.

blackwatertepes avatar Apr 12 '18 18:04 blackwatertepes

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 [email protected] 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_ .

PaulCalabrese avatar Apr 12 '18 20:04 PaulCalabrese

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.

blackwatertepes avatar Apr 12 '18 21:04 blackwatertepes

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

blackwatertepes avatar Apr 12 '18 21:04 blackwatertepes

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 [email protected] 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_ .

PaulCalabrese avatar Apr 12 '18 21:04 PaulCalabrese

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

blackwatertepes avatar Apr 12 '18 21:04 blackwatertepes

@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 ! 🙇

navcsdev avatar Apr 13 '18 01:04 navcsdev

mark

OuterSpaceTears avatar Apr 27 '18 03:04 OuterSpaceTears