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

Fix wallet:transaction decrypting at most 255 notes #3950

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

dguenther
Copy link
Member

@dguenther dguenther commented Jun 6, 2023

Summary

Fixes a bug where calling wallet:transaction or wallet:transactions on a transaction with more than 255 output notes would only display at most the first 255 results.

The decryptNotes task passes in the number of notes to decrypt as a u8, but bufio only bounds-checks if a number is a safe integer when writing numbers, and we don't do any verification that the number of results matches the number of inputs, so it's possible to overflow the value. In the wallet's transaction processing code, we decrypt notes in batches of 20, so this doesn't affect it. But when calling wallet:transaction or wallet:transactions, we attempt to decrypt output notes as a spender in one batch, and since transactions can have several hundred notes, this opens up the possibility for this bug.

The PR's change removes the length field from the serialized output -- since the worker pool is internal to the SDK and nothing external can connect to it, I don't think it's necessary to encode the number of notes as part of the input.

This doesn't affect a user's balance or available notes in their wallet, and transactions don't need to be rescanned or re-decrypted as a result of this change. Also, incoming/received notes are not affected by this, so this bug would only affect display of transactions where the decrypting account sent more than 255 notes.

Testing Plan

  • Added tests for including over 255 notes in a decryptNotes job.

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.

[ ] 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

@dguenther dguenther requested a review from a team as a code owner June 6, 2023 21:14
Copy link
Contributor

@jowparks jowparks left a comment

Choose a reason for hiding this comment

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

TY for fixing this 😅

@dguenther dguenther merged commit febacce into staging Jun 7, 2023
3 checks passed
@dguenther dguenther deleted the fix-transaction-notes branch June 7, 2023 15:12
@lyonsstar
Copy link

how can i update node version? what is the commands?

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.

None yet

3 participants