Skip to content

fix(air): fix inconsistent assertion#408

Open
YichiZhang0613 wants to merge 1 commit intofacebook:mainfrom
YichiZhang0613:fix_inconsistency
Open

fix(air): fix inconsistent assertion#408
YichiZhang0613 wants to merge 1 commit intofacebook:mainfrom
YichiZhang0613:fix_inconsistency

Conversation

@YichiZhang0613
Copy link

In winterfell/air/src/proof/table.rs, the comment and assertion's message requires num_rows and num_cols <= 255(MAX_ROWS and MAX_COLS = 255), while the code check is num_rows < MAX_ROWS and num_cols < MAX_ROWS, which should be fixed into num_rows <= MAX_ROWS and num_rows <= MAX_COLS.

const MAX_ROWS: usize = 255;
const MAX_COLS: usize = 255;
...
    /// Panics if:
    /// * Specified number of rows is 0 or greater than 255.
    /// * Specified number of columns is 0 or greater than 255.
    /// * Provided bytes do not encode valid field elements required to fill the table.
    pub fn from_bytes(
        bytes: &[u8],
        num_rows: usize,
        num_cols: usize,
    ) -> Result<Self, DeserializationError> {
        assert!(num_rows > 0, "number of rows must be greater than 0");
        assert!(
            num_rows < MAX_ROWS,
            "number of rows cannot exceed {MAX_ROWS}, but was {num_rows}"
        );
        assert!(num_cols > 0, "number of columns must be greater than 0");
        assert!(
            num_cols < MAX_ROWS,
            "number of columns cannot exceed {MAX_COLS}, but was {num_cols}"
        );

        let mut reader = SliceReader::new(bytes);
        let num_elements = num_rows * num_cols;
        Ok(Self {
            data: reader.read_many(num_elements)?,
            row_width: num_cols,
        })
    }

@meta-cla
Copy link

meta-cla bot commented Mar 7, 2026

Hi @YichiZhang0613!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link

meta-cla bot commented Mar 7, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the cla signed label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant