"Instantiate contract failed". Contract uploaded to testnet but not initialized on command

Hi. What am I doing wrong?

  1. I compile this contract without changes: GitHub - scrtlabs/snip20-reference-impl: This is a reference implementation of the SNIP-20 standard.
  2. Compilation:
cd /home/user/snip20-reference-impl-master

docker run --rm -v "$(pwd)":/contract \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  enigmampc/secret-contract-optimizer:1.0.5
  1. I upload contract.wasm.gz to the test network:
    secretcli tx compute store /home/user/snip20-reference-impl-master/contract.wasm.gz --from Promelec --gas 6000000 --gas-prices=1.0uscrt
  2. Stored contract: https://secretnodes.com/pulsar/transactions/A108DA7BF609EAE92F285DA7C0CF2CE6F63EDFB29BBDBBFF414F0ADE2287A9CA
  3. I initiate the contract:
    secretcli tx compute instantiate 12680 '{"name":"secret-secret","symbol":"sSCRT","decimals":6,"prng_seed":"c2VjcmV0","config":{"public_total_supply":true,"enable_deposit":false,"enable_redeem":false,"enable_mint":true,"enable_burn":true}}' --label mycustomtoken1234567 --from Promelec -- gas 6000000
  4. Constantly the same error during different initialization attempts:
"raw_log": 
"failed to execute message; message index: 0: encrypted: 983wGiMQWjxVzFgNFQY4rNneTTls8kdOgXFnxWyYglqQbBOTyri8HAZadnvX04/QQdObazQeEa44l6jik2E+jmgewATg0ri8e879E6W/3Z1TDYl81Ts5oqr1d+I=: instantiate contract failed"

Who managed to initialize this contract after compiling and uploading to the test network, please write a step-by-step algorithm of actions with commands that have values filled in.

For the next person to have a look, I also took a stab and got the same error.

The logs point to this line of code , it’s the only place in the source where this warning is printed…

“WARN [enclave_contract_engine::contract_validation] Got message with malformed contract hash”

I also tried checking out the last 2 tags after master branch, as well as a newer optimizer image, same results.

@Ds444 Not sure if that was you in Discord facing the same issue, but I was also using an outdated secretcli version on my local machine.
After updating secretcli I couldn’t reproduce the issue.

Here’s a contract I instantiated with your uploaded code id

And here’s the command to init, but I’m hopeful that your own command will work after updating.

secretcli tx compute instantiate 12680 '{"name":"acme","symbol":"ACX","decimals":6,"prng_seed":"c2VjcmV0","config":{"public_total_supply":true,"enable_deposit":false,"enable_redeem":false,"enable_mint":true,"enable_burn":true}}' --label anothercustomtoken2 --from discord1_test --gas 6000000