-
Notifications
You must be signed in to change notification settings - Fork 6
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
Verify Info Server refactoring and testing #2
Conversation
test/models/user_test.rb
Outdated
assert_not user.update(address: address.slice(1)), | ||
'should not fall below 42 characters' | ||
|
||
assert_not user.update(address: 'g' + address.slice(2) + 'G'), |
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.
should be '0xg' + address.slice(4) + 'G'
?
app/models/user.rb
Outdated
validates :address, | ||
presence: true, | ||
uniqueness: true, | ||
format: { with: /\A0x[a-fA-F0-9]{40}\Z/, |
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.
Actually, we should use the checksummed version of the address to store in the database. We can use the gem ethereum
to convert and check checksummed addresses
Specifications: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
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.
Can I use Eth::Utils.valid_address?
instead since it is already installed?
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.
Yup
Pushed the changes but Github is not updating the comments? |
|
||
case result | ||
when :invalid_data, :database_error | ||
render json: { errors: challenge_or_error }, |
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.
error
instead of errors
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.
Done, also created result_response
and error_response
to signify a standard success or failure response.
Main objective:
verify_info_server_request
as a middleware or action filterSecondary objective:
rubocop
for formatting and lintingfactory_bot
for fixturessimple_cov
for code coverageproven
column tochallenges
to prevent re-proving a proven challenge