near-daos / sputnik-dao-contract

Smart contracts for https://app.astrodao.com
https://astrodao.com/
MIT License
108 stars 81 forks source link

Find out backward compatibility issue #114

Closed ctindogarus4f closed 2 years ago

ctindogarus4f commented 2 years ago

Problem: There was a backward compatibility error introduced at some point in the sputnik contracts and we need to find out the exact commit which introduced it.

How to find it? Basically by picking random commits from https://github.com/near-daos/sputnik-dao-contract/commits/main and see where the error was introduced.

How to do it? You need to follow the instructions below.

Instructions:

  1. Follow all the 10 instructions under https://github.com/near-daos/sputnik-dao-contract/blob/4f46375db940847be5962f99c0d38c1437f87176/release_process.md#1-1-using-personal-account-on-testnet but replace ctindogaru.testnet with your own testnet account.
  2. Next, pick a commit from https://github.com/near-daos/sputnik-dao-contract/commits/main. (we assume the commit is xsda21da)
  3. Go to the terminal and move to that snapshot in time: git checkout xsda21da
  4. Type cargo clean and wait for completion.
  5. Type cargo update and wait for completion.
  6. Type ./build and wait for completion.
  7. Follow the 7 steps under https://github.com/near-daos/sputnik-dao-contract/blob/4f46375db940847be5962f99c0d38c1437f87176/release_process.md#3-1-using-personal-account-on-testnet
  8. After completion, try again to type near view ctindogaru-dao.sputnik-factory.ctindogaru.testnet get_proposal '{"id": 0}’. Please make sure to replace ctindogaru.testnet with your own testnet account.
  9. If you get Cannot deserialize value with Borsh error, it means that commit id contains a backward compatible issue. Please create a new DAO by following these instructions, but make sure to replace ctindogaru-dao with another name and ctindogaru.testnet with your own testnet account.:
    export COUNCIL='["ctindogaru.testnet"]'
    export ARGS=`echo '{"config": {"name": "ctindogaru-dao", "purpose": "ctindogaru DAO", "metadata":""}, "policy": '$COUNCIL'}' | base64`
    near call sputnik-factory.ctindogaru.testnet create "{\"name\": \"ctindogaru-dao\", \"args\": \"$ARGS\"}" --accountId sputnik-factory.ctindogaru.testnet --gas 150000000000000 --amount 10

    Repeat instructions 2-8 until the errror does not show up anymore and you find the exact commit which introduced this backward compatible issue.

  10. If you run out of funds in your wallet, please create a new account by typing near login and repeat instructions 1-9.
ctindogarus4f commented 2 years ago

The guys from SQA will take care of this issue.

GentBinakuSQA commented 2 years ago

The command

near call sputnik-factory.gentbinaku.testnet store $(eval "$BYTES") --base64 --accountId sputnik-factory.gentbinaku.testnet --gas 100000000000000 --amount 10

Fails and talking to @ctindogarus4f it has been suggested it can be only run on mac-os, unfortunately most of our teams runs on Ubuntu Linux

TrevorJTClarke commented 2 years ago

teams runs on Ubuntu Linux

@GentBinakuSQA I had the same issue, created a PR https://github.com/near/near-cli/pull/938 - hopefully it gets merged or you can use

TrevorJTClarke commented 2 years ago

@ctindogarus4f using the scripts i created in PR #111 - I was able to test the recently merged #115 and confirm that backward compat is now working. Doing the final test of checking proposals does not have Borsh deserialize issues. I believe we can close this, however there are yet a couple more backward compat issues to take care of that are different.