Skip to content

Conversation

@letypequividelespoubelles
Copy link
Collaborator

@letypequividelespoubelles letypequividelespoubelles commented Dec 9, 2025

Note

Adds right-padding zkasm utilities for u128/u120 with test integration and vectors; fixes minor comment typos in bit shift utility.

  • Assembly utilities:
    • Add testdata/asm/util/padding.zkasm with rpad_128, rpad_128_120, and rpad_120 functions.
  • Tests:
    • Add Test_AsmUtil_Padding in pkg/test/assembly_util_test.go to run asm/util/padding.
  • Test data:
    • Add generator testdata/asm/util/padding.go and vectors testdata/asm/util/padding.accepts.
  • Minor:
    • Fix comment typos in testdata/asm/util/bit_shr.zkasm ("decompose shift").

Written by Cursor Bugbot for commit fa58f32. This will update automatically on new commits. Configure here.

@letypequividelespoubelles letypequividelespoubelles linked an issue Dec 9, 2025 that may be closed by this pull request
{"rpad_128": { "input": [1329228075013078387168144653824294912], "res": [1329228075013078387168144653824294912] }}
{"rpad_128": { "input": [1329248278194519524574231007531630592], "res": [1329248278194519524574231007531630592] }}
{"rpad_128": { "input": [1334420292643450700532337556609564672], "res": [1334420292643450700532337556609564672] }}
{"rpad_128": { "input": [2658455991569831745807614120560689152], "res": [2658455991569831745807614120560689152] }}
Copy link

Choose a reason for hiding this comment

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

Bug: Intermediate test generation file accidentally committed to repository

The file byte_counts_test.accepts appears to be an intermediate artifact from the test data generation process. According to the comments in padding.go, this file is created as a temporary output (go run ... > byte_counts_test.accepts) before being shuffled into the actual test file at testdata/asm/util/padding.accepts. The test code references "asm/util/padding" which uses the file in testdata, not this root-level file. The mismatched name ("byte_counts" vs "padding") and its location outside the testdata directory further suggest this was unintentionally committed.

Fix in Cursor Fix in Web

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree with cursor bot here. Looks strange the location of the file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I removed the file FYI

Copy link
Collaborator

@DavePearce DavePearce left a comment

Choose a reason for hiding this comment

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

Looks good to me. I remove the misc file, and also removed the label indents. And, should be merged shortly.

{"rpad_128": { "input": [1329228075013078387168144653824294912], "res": [1329228075013078387168144653824294912] }}
{"rpad_128": { "input": [1329248278194519524574231007531630592], "res": [1329248278194519524574231007531630592] }}
{"rpad_128": { "input": [1334420292643450700532337556609564672], "res": [1334420292643450700532337556609564672] }}
{"rpad_128": { "input": [2658455991569831745807614120560689152], "res": [2658455991569831745807614120560689152] }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree with cursor bot here. Looks strange the location of the file.

if leading_zeroes != 0 goto exit_fail
res = rpad_120(remaining)
return
exit_fail:
Copy link
Collaborator

Choose a reason for hiding this comment

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

normally, labels in assembly languages are not indented so they stand out from other instructions. See e.g. here.

{"rpad_128": { "input": [1329228075013078387168144653824294912], "res": [1329228075013078387168144653824294912] }}
{"rpad_128": { "input": [1329248278194519524574231007531630592], "res": [1329248278194519524574231007531630592] }}
{"rpad_128": { "input": [1334420292643450700532337556609564672], "res": [1334420292643450700532337556609564672] }}
{"rpad_128": { "input": [2658455991569831745807614120560689152], "res": [2658455991569831745807614120560689152] }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I removed the file FYI

Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
This removes a misc testing filem, and also removes indents on labels to
be consistent with assembly language style.
@DavePearce DavePearce force-pushed the 1361-feat-add-pad-utils branch from 6337d1b to fa58f32 Compare December 9, 2025 20:19
@DavePearce DavePearce enabled auto-merge (squash) December 9, 2025 20:19
@DavePearce DavePearce merged commit 5ed5c80 into main Dec 9, 2025
26 checks passed
@DavePearce DavePearce deleted the 1361-feat-add-pad-utils branch December 9, 2025 20:57
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.

feat: add PAD utils

3 participants