Skip to content
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

adds hash to response of wallet/postTransaction #3764

Merged
merged 3 commits into from
Apr 10, 2023

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Apr 7, 2023

Summary

sendTransaction includes the hash in its responses, but postTransaction does not.

a client could hash the output themselves, but this adds an extra step and perhaps an extra dependency for the client.

Testing Plan

  • updates unit tests

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[X] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

sendTransaction includes the hash in its responses, but postTransaction does
not.

a client _could_ hash the output themselves, but this adds an extra step and
perhaps an extra dependency for the client.
@hughy hughy requested a review from a team as a code owner April 7, 2023 18:11
Copy link
Contributor

@EvanJRichard EvanJRichard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple, convenient, and unifies RPCs a little more. One question about tests, but non-blockin g. :shipit:

@@ -27,6 +27,7 @@ describe('Route wallet/postTransaction', () => {

expect(addSpy).toHaveBeenCalledTimes(0)
expect(response.status).toBe(200)
expect(response.content.hash).toBeDefined()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth it to calculate what the hash should be and check equality, do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little tricky to do this: there's randomness involved in posting transactions, so posting the same raw transaction twice will result in two different hashes 😓

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, true. Forget it, then, imo.

@@ -27,6 +27,7 @@ describe('Route wallet/postTransaction', () => {

expect(addSpy).toHaveBeenCalledTimes(0)
expect(response.status).toBe(200)
expect(response.content.hash).toBeDefined()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(response.content.hash).toBeDefined()
expect(response.content.hash).toBe(expect.any(String))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works in Jest with toBe. It seems like CI is failing with this.

@danield9tqh danield9tqh merged commit d97fdef into staging Apr 10, 2023
@danield9tqh danield9tqh deleted the feature/ifl-182/post-transaction-hash branch April 10, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants