Let's say we have a SmartContract that require a huge amount of iterations to reach a certain state, when something interesting happens. Creating a test for proving the contract behave correctly will require a lot of time and a lot of simulated addresses. So an idea could be having that threshold to a smaller value just in test environment: I think a function callable just in test to lower that threshold value, that cannot be called in production, because otherwise could be interpreted as a potential fraud method. Is this possible? Any alternatives?

  • You have the truebit protocol for off-chain computations. – Ismael May 27 '18 at 0:31

An alternative would be to have the number of iterations passed to the contract during deployment (as a parameter in the constructor), and deploy the contract twice, being one the real contract (deployed on the mainnet), and the other (with lower number of needed iterations) the test/verifiable contract (deployed on the ropsten network).

Since both contracts would have the same bytecode, they would be comparable even using etherscan, and one could run the verification code on the contract deployed on the ropsten network for free, and then use the real contract in the mainnet with total confidence.

  • Seems a reasonable solution, or, at east the only option I received till now :) – Felice Pollano May 25 '18 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.