Closed gskapka closed 5 years ago
shall we also decide on a standard as to whether to return anonymous or named variables?
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.
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.
: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.
:pager: Paging @bertani & @D-Nice, whose relevance to issues at hand are marked after the issues:
getPrice
become view
? (@bertani, @D-Nice)
coupon
function? (@bertani)
safeMemoryCleaner
function? (@bertani)
revert
with a message on finding an unexpectedly high price in a query? (@bertani)
view
, pure
&c., even where it results in a lot more compiler warnings? (@bertani, @D-Nice)
getPrice
becoming view
: Whatever keeps compatability with the current connector.
coupon
: Can be removed.
safeMemoryCleaner
: Since @D-Nice implemented it, if it's no longer patching whatever it patched it can be dropped.
revert
, if we didn't throw in the first place, the return value was probably there for a reason so it's probably best to keep the current behaviour.
:balance_scale: Just need you to weigh in now @D-Nice please!
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.
Done & done.
Oh wow, this is great! :)
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:
memory
keywords &c.)parseInt()
(original remains incase anyone using its behaviour)/* ... */
for multilines instead of multiple//
's)snake_case
are nowcamelCased
)if/while/for
conditionals{
sNotes:
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)
touint
we first need to go via eitheruint8
orbytes32
:The two casts pad differently hence the new explicitness ruling. As such, I broke (and then fixed) the proof verification thusly:
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 theethereum-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.