Skip to content

chore: field_t pow changes#14680

Merged
iakovenkos merged 15 commits into
nextfrom
si/pow-for-integer-exponents
Jun 17, 2025
Merged

chore: field_t pow changes#14680
iakovenkos merged 15 commits into
nextfrom
si/pow-for-integer-exponents

Conversation

@iakovenkos

@iakovenkos iakovenkos commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Made sure that the current impl of field_t pow() matches the audited (and deprecated) implementation of bigfield pow().

The pow method taking const integers as an argument is taken from #14610

@iakovenkos iakovenkos requested a review from Rumata888 June 2, 2025 14:36
accumulator *= running_power;
}
}
if (shifted_exponent != 0) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no need to check this in a while loop

@iakovenkos iakovenkos marked this pull request as ready for review June 2, 2025 14:39
@iakovenkos iakovenkos changed the title chore: field_t pow impl for uint32_t matches the bigfield pow chore: field_t pow impl for witness_t matches the bigfield pow Jun 2, 2025
@iakovenkos iakovenkos self-assigned this Jun 3, 2025
@iakovenkos iakovenkos marked this pull request as draft June 11, 2025 15:13
@iakovenkos iakovenkos marked this pull request as ready for review June 11, 2025 16:31
@iakovenkos iakovenkos changed the title chore: field_t pow impl for witness_t matches the bigfield pow chore: field_t pow changes Jun 12, 2025

@Rumata888 Rumata888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add an assert

}
// Use the constant version that perfoms only the necessary multiplications if the exponent is constant
if (exponent.is_constant()) {
return pow(static_cast<uint32_t>(exponent_value));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're missing an assert that the value is at most 32 bits

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! done

@Rumata888 Rumata888 self-requested a review June 12, 2025 13:20
@iakovenkos iakovenkos added this pull request to the merge queue Jun 17, 2025
Merged via the queue into next with commit a48851a Jun 17, 2025
4 checks passed
@iakovenkos iakovenkos deleted the si/pow-for-integer-exponents branch June 17, 2025 11:49
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jul 16, 2025
Made sure that the current impl of `field_t` `pow()` matches the audited
(and
[deprecated](AztecProtocol#14563))
implementation of `bigfield` `pow()`.

The `pow` method taking const integers as an argument is taken from
AztecProtocol#14610
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.

3 participants