-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: display tx hash instead of txi when tx_hash=true #789
Conversation
Keyword.get(opts, :expand?, false) -> | ||
Txs.fetch!(state, txi) | ||
|
||
Keyword.get(opts, :tx_hash?, false) -> | ||
Enc.encode(:tx_hash, Txs.txi_to_hash(state, txi)) |
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.
It would be good for the user to get some kind of exception like this otherwise the param gets ignored silently. This would indicate that it should be used one param or the other.
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, added this validation on the PaginationPlug
so we didn't have to on every top module
else | ||
txi | ||
cond do | ||
Keyword.get(opts, :expand?, false) -> |
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.
same as on names.ex
{:ok, _encoded_tx_hash}, | ||
:aeser_api_encoder.safe_decode(:tx_hash, tx_hash) |
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.
It could be checked that besides present the tx_hash
is correct, here on integration or on unit tests.
An integration test for oracle would be missing or if the tx_hash
becomes validated on oracle unit test it would be enough.
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, added oracle test which validates this now
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.
Could it test if the hash is correct for each oracle (having it's own tx_hash
)?
I think it's enough to test that at least one tx hash was converted, testing that the conversion txi->hash is not always the same seems to be too far fetch for values that were chosen randomly (8989-> th_5aUc7Xqk3TkG38XVjCzZPAWc1geGFfjGcgEytcZAFe3FJyn4g) |
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.
For a complete test, it would be to test if the hash belongs to the correct oracle.
refs #764