makerdao / spells-mainnet

Staging repo for MakerDAO weekly executive spells
GNU Affero General Public License v3.0
107 stars 43 forks source link

Fix `diff-deployed-dssspell` script #341

Closed amusingaxl closed 1 year ago

amusingaxl commented 1 year ago

I noticed that sometimes the Etherscan API returns the source code with Windows-style line-breaks (\n\r). This would break the diff in any Unix-based system.

Also, bash has some slightly different implementations across MacOS and Linux, so it's a good idea to avoid the shell trying to be funny with strings. For that reason, I changed the Etherscan source download step to store the output in a file instead of a string in memory.

Since everything is erased at the end with make clean, I believe that wouldn't cause an issue.

The final issue this commit fixes is that sometimes the only difference between the repo and the spell code is a trailing new-line. That would cause diff to exit with a non-zero code, making the script fail.

This would prevent this script to be used in tandem with any other scripts following it, even if the diff is fine.

[Fixes #352]