Skip to content

test(avm): integration test for alu truncation#22684

Merged
jeanmon merged 1 commit into
merge-train/avmfrom
jean/avm-267-write-integration-test-for-alu-truncation
Apr 23, 2026
Merged

test(avm): integration test for alu truncation#22684
jeanmon merged 1 commit into
merge-train/avmfrom
jean/avm-267-write-integration-test-for-alu-truncation

Conversation

@jeanmon

@jeanmon jeanmon commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Linear issue: AVM-267

@jeanmon jeanmon changed the base branch from next to merge-train/avm April 21, 2026 09:03
@jeanmon jeanmon marked this pull request as ready for review April 21, 2026 09:04
@jeanmon jeanmon force-pushed the jean/avm-267-write-integration-test-for-alu-truncation branch from e3b735a to 47449c2 Compare April 21, 2026 09:44

@IlyasRidhuan IlyasRidhuan 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.

Looks good (modulo us figuring out what to do with tests that rely on TS opcodes folder)

@jeanmon jeanmon force-pushed the jean/avm-267-write-integration-test-for-alu-truncation branch from 47449c2 to aecebcf Compare April 21, 2026 15:41

@dbanks12 dbanks12 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.

LGTM, but just want to better understand exactly what each test is testing.

Comment on lines +211 to +216
// Exercise SET truncation: set values whose widths exceed the target tag and
// rely on `buildFromTagTruncating` to truncate to the low bits of the tag.
// Covers sources larger than 128 bits (via SET_FF) and sources in (32, 128]
// bits (via SET_64) against destination tags U1/U8/U16/U32/U64/U128.
export async function setTruncationTest(tester: PublicTxSimulationTester) {
// 200-bit value: forces truncation for every target tag up to U128.

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.

What exactly is this testing? The AVM? Or buildFromTagTruncating in TS?

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.

The goal is to test the AVM circuit as a whole in the presence of truncation performed by CAST and or SET. The rationale about adding this test is a recent change which removed the possibility to pass larger values than their type in the bulk test. To still keep the same testing coverage, I opened a ticket which resulted into the present PR. I made it a bit more exhaustive by testing more target types and covering both SET and CAST.

@jeanmon jeanmon force-pushed the jean/avm-267-write-integration-test-for-alu-truncation branch from aecebcf to 2f6cf75 Compare April 22, 2026 13:54
@jeanmon jeanmon force-pushed the jean/avm-267-write-integration-test-for-alu-truncation branch from 2f6cf75 to 9344d19 Compare April 23, 2026 09:17
@jeanmon jeanmon merged commit 259a9ec into merge-train/avm Apr 23, 2026
12 checks passed
@jeanmon jeanmon deleted the jean/avm-267-write-integration-test-for-alu-truncation branch April 23, 2026 11:08
@AztecBot AztecBot mentioned this pull request Apr 23, 2026
chrismarino pushed a commit to chrismarino/aztec-packages that referenced this pull request May 5, 2026
BEGIN_COMMIT_OVERRIDE
chore(avm)!: execution internal audit second pass (AztecProtocol#22552)
test(avm): integration test for alu truncation (AztecProtocol#22684)
END_COMMIT_OVERRIDE
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