Skip to content

chore(avm): migrate to BB asserts#19395

Merged
fcarreiro merged 2 commits into
merge-train/avmfrom
fc/migrate-asserts
Jan 7, 2026
Merged

chore(avm): migrate to BB asserts#19395
fcarreiro merged 2 commits into
merge-train/avmfrom
fc/migrate-asserts

Conversation

@fcarreiro

@fcarreiro fcarreiro commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

BB_ASSERT or BB_ASSERT_DEBUG was used depending on whether the code was in the hot path.

The biggest semantic change is that assert crashes, and BB_ASSERT* throws.

I made a change in the assertion macros because the previous implementation was potentially making copies of the input objects. The original implementation was (probably) chosen so that when the inputs where expressions (e.g., obj + 7) they were only evaluated once. This is reasonable. But... when the input is not an expression a copy might be made. The chosen solution was to use const auto&, which would in general be dangerous but it works for temporary values (like the expression) thanks to the C++ feature called "lifetime extension" for this very particular case (const&). The change was discussed with Adam.

Fixes AVM-171.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fcarreiro fcarreiro requested review from dbanks12 and removed request for IlyasRidhuan and jeanmon January 7, 2026 16:55

@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

fcarreiro commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jan 7, 5:56 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 7, 5:56 PM UTC: @fcarreiro merged this pull request with Graphite.

@fcarreiro fcarreiro merged commit 2a8791e into merge-train/avm Jan 7, 2026
9 checks passed
@fcarreiro fcarreiro deleted the fc/migrate-asserts branch January 7, 2026 17:56
@AztecBot AztecBot mentioned this pull request Jan 7, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Jan 8, 2026
BEGIN_COMMIT_OVERRIDE
feat(avm)!: optionally use TS logger in C++ simulation (#19305)
chore(avm): bytecode caching comments
chore(avm): disable VK hash checking in tests
fix(avm)!: instr_fetching soundness bug (#19381)
fix(avm): dont catch wide exceptions (#19388)
refactor(avm): Refactor get contract instance fuzzer backfill (#19387)
feat(avm): mutate enqueued calls (#19315)
chore(avm): migrate to BB asserts (#19395)
fix!: more missing boolean constraints in calldata, calldata hashing,
sha256 mem PILs (#19367)
feat(avm): defensively assert cd hashes (#19346)
chore: annotate booleans in PIL, and add some missing boolean
constraints (#19371)
fix!: missing boolean constraints on zero checks targets (#19401)
fix!: context did not constrain returndata size to 0 at start, and had a
misnamed relation (#19404)
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.

2 participants