-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean up redundant code in eth/rlp/writer.nim #755
Conversation
c55169b
to
6a73a9d
Compare
d12fd0d
to
ec25345
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unorthodox but clever.
since you're here, another "discrepancy" is that https://github.com/status-im/nim-eth/blob/master/eth/rlp/options.nim#L12 exists as a helper for We're moving away from |
example in json-serialization: example in json-rpc: |
Someone thought about this before https://github.com/status-im/nim-eth/blob/master/eth/common/base_rlp.nim#L14 |
77fe3b2
to
276e391
Compare
eth/rlp/options.nim
Outdated
|
||
export | ||
options, rlp | ||
export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exports go on top, below the import, not sure why they are here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll change it.
eth/rlp/options.nim
Outdated
std/options, | ||
../rlp | ||
import ../rlp | ||
import results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.nim
is so named after the module it provides support for - this file should thus be renamed to results.nim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah makes sense. I'll change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arnetheduck I have wasted too much time for this simple issue. Having the same name as the package is causing an error "cannot import itself". I tried to look for the rules of qualification and landed on the above issue. Its significantly old so maybe you know a way to qualify the package nim-results
in an import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/results
and ./results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
329eb68
to
6a54710
Compare
Changelog
checkedOptionalFields
tocountOptionalFields
and removed unnecessary abstractions(optionalFieldsNum
) for counting optional fieldshasOptional
in favor ofcountOptionalFields
.macro countFieldsRuntimeImpl
in favor of the nimbus style guide.Rationale
x == True
) is equivalent to that of integers (x > 0
) thereforehasOptional
was redundantop
ofenumerateRlpFields
) all that was required was an additional check for emptiness of optional values. Hence themacro countFieldsRuntimeImpl
was not required.