provable-things / ethereum-api

Provable API for Ethereum smart contracts
https://docs.provable.xyz/#ethereum
MIT License
801 stars 427 forks source link

Update to Solc 0.5 #67

Closed gskapka closed 5 years ago

gskapka commented 5 years ago

Solc 0.5.0 Version of the API

Here it is, the API upgraded to the latest Solidity compiler, and (hopefully) following all the best practices. Rather than simply getting it to compile, many other changes have been made and so hence the need for a thorough review. Amongst those changes:

Notes:

Re which latter bullet point: It turns out that with the new recasting rules we must first cast to types of the same size. So to go from bytes(1) to uint we first need to go via either uint8 or bytes32:

uint256(bytes32(bytes1(...)));
// or
uint256(uint8(bytes1(...)));

The two casts pad differently hence the new explicitness ruling. As such, I broke (and then fixed) the proof verification thusly:

api-break

To Do

@D-Nice & @riccardopersiani please can you go over this PR with a fine tooth comb and make sure I haven't goofed anything? Also tell me if any of the above listed changes are a step too far/pointless/terrible/should be burnt with fire &c., &c.

Also, I have a private repo elsewhere with some (unpolished but passing) tests for some of the parsing helpers we offer in this API, plus all the truffle examples in the ethereum-examples repo have been updated to als use this API and all tests therein are also passing.
So it should be all good w/r/t it working, now it's just a case of arguing over the changes I've made.

D-Nice commented 5 years ago

shall we also decide on a standard as to whether to return anonymous or named variables?

gskapka commented 5 years ago

Easy question for me - named variables everytime (unless we're talking point-free - but that's a different & more fun kettle of fish!). That whole:

naming is hard

thing is dumb. Naming is explicit and useful and enlightening.

gskapka commented 5 years ago

Update:

Okay so I've done anything from the above review that I can & pushed it. I've also compiled anything I couldn't do into this one post to make it easier to see & address.

Done:

:heavy_check_mark: Naming return params (and adding underscores to go along with current practices) :heavy_check_mark: Fixing the license typo. :heavy_check_mark: Removing white space from string [] type declarations.

I can confirm that all tests are passing on all examples that have test-suites per my tool on gitlab using this current iteration of the API.


Stuff that needs discussing/addressing:

:pager: Paging @bertani & @D-Nice, whose relevance to issues at hand are marked after the issues:

gskapka commented 5 years ago

Responses to above from @bertani


Next:

:balance_scale: Just need you to weigh in now @D-Nice please!

D-Nice commented 5 years ago

ok, based on those replies, let's remove coupon. Also, based on our earlier discussion, and me diving into safeMemoryCleaner, I think it's best we still leave it in, because as mentioned, it can be useful for any other assembly that works on memory, but doesn't necessarily zero it out, so the safeMemoryCleaner can be re-used there.

gskapka commented 5 years ago

Done & done.

axic commented 5 years ago

Oh wow, this is great! :)