This is about the parameters that we need to provide at the time of source code verification on Etherscan. I have a bit idea about it but i am looking for some deep and clear explanation.
So my question is what are these parameters i.e runs and optimization all about. Answer can consist the detail about:
- How they exactly affect the source code verification?
- Why enabling optimization sometimes prevents smart contract verification?
- Why we
usually pass 200 to
runs?
optimizationcan be eithertrueorfalse, and it indicates whether or not the compiler should optimize the code. AFAIK, in our eco-system here (block-chain), 'optimize' translates to 'reduce gas consumption (in opposed to 'increase speed' or 'reduce memory consumption' on traditional eco-systems).optimization-runsindicates the number of iterations that the compiler should perform during the optimization process. – goodvibration Dec 17 '18 at 11:22runswhich yields maximum optimization, by trying different values, until you find a point where the output byte-code remains identical (binary-search would be ideal for that). Alternatively, you can just use a very large value to begin with. – goodvibration Dec 17 '18 at 11:22runs, at a certain point, the output byte-code remains identical. This has led me to understand that the compiler runs a certain number of iterations until reaching maximum optimization. – goodvibration Dec 18 '18 at 06:36