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: add size check in RandBlobTxsWithAccounts #1235

Merged
merged 2 commits into from
Jan 13, 2023

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Jan 13, 2023

Overview

The parameter size in RandBlobTxsWithAccounts accepts positive values as well as negative.
However, passing a negative value will make the random generator panic, thus making the integration tests fail without any clear error message. An example of this: https://github.com/celestiaorg/celestia-app/actions/runs/3911542927/jobs/6685657620

Thus, adding a check on size would fix this and never allow anyone to pass a negative value.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@rach-id rach-id added the bug Something isn't working label Jan 13, 2023
@rach-id rach-id self-assigned this Jan 13, 2023
@MSevey MSevey requested review from a team and rahulghangas and removed request for a team January 13, 2023 15:28
@MSevey MSevey requested a review from a team January 13, 2023 16:36
@rach-id rach-id changed the title fix: use uint instead of int for size in RandBlobTxsWithAccounts fix: add size check in RandBlobTxsWithAccounts Jan 13, 2023
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

👍

@rach-id rach-id merged commit 4ed8a42 into celestiaorg:main Jan 13, 2023
rach-id added a commit that referenced this pull request Jan 17, 2023
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview
Similar to #1235, the
`blobCount` is used in the `rand` function, thus needs always to be
strictly positive.

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants